コード例 #1
0
ファイル: Engine.java プロジェクト: conpinion/openmetix
  /**
   * Retrieve the gui factory.
   *
   * @return The gui factory.
   */
  public IGUIFactory getGUIFactory() {
    if (guiFactory == null) {
      Log.logError("system", "Engine.getGUIFactory", "No gui factory set");
    }

    return guiFactory;
  }
コード例 #2
0
ファイル: Engine.java プロジェクト: conpinion/openmetix
  /** Initialize the logging subsystem. */
  private void initLoggingEngine() {
    LoggerRegistry loggerRegistry = new LoggerRegistry();

    if (commandLine.hasOption("l")) {
      try {
        File logFile = new File(commandLine.getOptionValue("l"));

        logFile.createNewFile();
        loggerRegistry.addLogger(new OutputStreamLogger(new FileOutputStream(logFile)));
        loggerRegistry.addLogger("system", "OutputStream");
        loggerRegistry.addLogger("resource", "OutputStream");
        loggerRegistry.addLogger("thread", "OutputStream");
        loggerRegistry.addLogger("network", "OutputStream");
        loggerRegistry.addLogger("plugin", "OutputStream");
        loggerRegistry.addLogger("client", "OutputStream");
        loggerRegistry.addLogger("server", "OutputStream");
        loggerRegistry.addLogger("persist", "OutputStream");
      } catch (IOException x) {
        System.err.println(
            "Unable to create log file '" + commandLine.getOptionValue("l") + "': " + x.toString());
      }
    } else {
      loggerRegistry.addLogger(new ConsoleLogger());
      loggerRegistry.addLogger("system", "Console");
      loggerRegistry.addLogger("resource", "Console");
      loggerRegistry.addLogger("thread", "Console");
      loggerRegistry.addLogger("network", "Console");
      loggerRegistry.addLogger("plugin", "Console");
      loggerRegistry.addLogger("client", "Console");
      loggerRegistry.addLogger("server", "Console");
      loggerRegistry.addLogger("persist", "Console");
    }

    Log.logInfo("system", "Engine.initLoggingEngine", "Logging subsystem initialized");
  }
コード例 #3
0
  /**
   * Create the editor panel.
   *
   * @return The editor panel.
   */
  protected JPanel createEditorPanel() {
    try {
      SwingEngine swingEngine = new SwingEngine(this);

      swingEngine.setClassLoader(InterfacingPlugin.class.getClassLoader());

      JPanel panel =
          (JPanel) swingEngine.render(getClass().getResource("/swixml/NullDriverDialog.xml"));

      return panel;
    } catch (Exception x) {
      Log.logError("client", "NullDriverDialog", x.toString());

      return new JPanel();
    }
  }
コード例 #4
0
ファイル: Engine.java プロジェクト: conpinion/openmetix
 /** Initialize the threading subsystem. */
 private void initThreadPooling() {
   threadService = new ThreadService();
   threadService.addThreadSlot();
   threadService.addThreadSlot();
   Log.logInfo("system", "Engine.initThreadPooling", "Threading subsystem initialized");
 }
コード例 #5
0
ファイル: Engine.java プロジェクト: conpinion/openmetix
 /** Initialize the resource subsystem. */
 private void initResourceEngine() {
   resourceService = new ResourceService(new ResourceNode("resource.engine.root", "root"));
   Log.logInfo("system", "Engine.initResourceEngine", "Resource subsystem initialized");
 }
コード例 #6
0
  /** Initialize the gui. Subclasses should override this method to create a custom gui. */
  public void initGUI() {
    try {
      SwingEngine swingEngine = new SwingEngine(this);

      swingEngine.setClassLoader(AppPlugin.class.getClassLoader());

      JPanel panel =
          (JPanel) swingEngine.render(getClass().getResource("/swixml/GagingSystemListEditor.xml"));

      content.add(panel, createConstraints(0, 0, 1, 1, GridBagConstraints.BOTH, 100, 100, null));

      gagingSystemTableModel =
          new IObjectTableModel() {
            private String[] columnNames =
                new String[] {
                  Engine.instance().getResourceService().getStringWithoutException("metix.name"),
                  Engine.instance().getResourceService().getStringWithoutException("metix.active")
                };
            private Class[] columnClasses = new Class[] {String.class, Boolean.class};

            public int getColumnCount() {
              return columnNames.length;
            }

            public String getColumnName(int col) {
              return columnNames[col];
            }

            public Class getColumnClass(int col) {
              return columnClasses[col];
            }

            public int getRowCount() {
              InterfaceRegistry registry = (InterfaceRegistry) iobject;

              if (registry == null) {
                return 0;
              }

              return registry.getGagingSystemCount();
            }

            public Object getValueAt(int row, int col) {
              InterfaceRegistry registry = (InterfaceRegistry) iobject;
              GagingSystem station = (GagingSystem) registry.getGagingSystem(row);

              switch (col) {
                case 0:
                  return station.getName();

                case 1:
                  return new Boolean(station.getActive());

                default:
                  return null;
              }
            }
          };

      gagingSystemTableModel.addTableModelListener(this);
      gagingSystemTable.setModel(gagingSystemTableModel);

      gagingSystemTable.addMouseListener(
          new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
              if (e.getClickCount() == 2) {
                editGagingStationAction.actionPerformed(null);
              }
            }
          });
    } catch (Exception x) {
      Log.logError("client", "GagingSystemListEditor.initGUI", x.toString());
    }
  }