コード例 #1
0
ファイル: TabControl.java プロジェクト: JIoJIaJIu/myrobotlab
  @Override
  public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();
    // parent.getSelectedComponent()
    if (boundServiceName.equals(getText())) {
      // Service Frame
      ServiceInterface sw = Runtime.getService(getText());
      if ("info".equals(cmd)) {
        BareBonesBrowserLaunch.openURL("http://myrobotlab.org/service/" + sw.getSimpleName());

      } else if ("detach".equals(cmd)) {
        undockPanel();
      } else if ("release".equals(cmd)) {
        myService.send(Runtime.getInstance().getName(), "releaseService", boundServiceName);
      } else if ("prevent export".equals(cmd)) {
        myService.send(boundServiceName, "allowExport", false);
        allowExportMenuItem.setIcon(Util.getImageIcon("allowExport.png"));
        allowExportMenuItem.setActionCommand("allow export");
        allowExportMenuItem.setText("allow export");
      } else if ("allow export".equals(cmd)) {
        myService.send(boundServiceName, "allowExport", true);
        allowExportMenuItem.setIcon(Util.getImageIcon("preventExport.png"));
        allowExportMenuItem.setActionCommand("prevent export");
        allowExportMenuItem.setText("prevent export");
      }
    } else {
      // Sub Tabbed sub pane
      ServiceInterface sw = Runtime.getService(boundServiceName);
      if ("info".equals(cmd)) {
        BareBonesBrowserLaunch.openURL(
            "http://myrobotlab.org/service/" + sw.getSimpleName() + "#" + getText());

      } else if ("detach".equals(cmd)) {
        undockPanel();
      }
    }
  }