示例#1
0
  @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();
      }
    }
  }
示例#2
0
  public TabControl(
      GUIService gui, JTabbedPane parent, Container myPanel, String boundServiceName, String txt) {
    super(txt);
    this.parent = parent;
    this.myPanel = myPanel;
    this.boundServiceName = boundServiceName;
    this.myService = gui;

    // build menu
    JMenuItem menuItem =
        new JMenuItem(
            "<html><style type=\"text/css\">a { color: #000000;text-decoration: none}</style><a href=\"http://myrobotlab.org/\">info</a></html>");
    menuItem.setActionCommand("info");
    menuItem.setIcon(Util.getImageIcon("help.png"));
    menuItem.addActionListener(this);
    popup.add(menuItem);

    JMenuItem detachMenuItem = new JMenuItem("detach");
    detachMenuItem.addActionListener(this);
    detachMenuItem.setIcon(Util.getImageIcon("detach.png"));
    popup.add(detachMenuItem);

    JMenuItem releaseMenuItem = new JMenuItem("release");
    releaseMenuItem.addActionListener(this);
    releaseMenuItem.setIcon(Util.getImageIcon("release.png"));
    popup.add(releaseMenuItem);

    allowExportMenuItem = new JMenuItem("prevent export");
    allowExportMenuItem.setActionCommand("prevent export");
    allowExportMenuItem.addActionListener(this);
    allowExportMenuItem.setIcon(Util.getImageIcon("preventExport.png"));
    popup.add(allowExportMenuItem);

    addMouseListener(this);
    addMouseMotionListener(this);
  }
 public void addErrorInfo(String error) {
   hasError = true;
   spinner.setIcon(Util.getImageIcon("error.png"));
   addInfo(error);
 }