Beispiel #1
0
private void MenuPopup (MouseEvent ev, CGNode node)
    {
	if (!node.IsConcept())
	    return;

	String menuname = (String)menumap.get (node.GetType(true));
	if (menuname == null)
	    return;
	Hashtable templates = (Hashtable)menus.get (menuname);
	if (templates == null)
	    return;

	if( popup != null )
	  remove( popup );

	popup = new PopupMenu( menuname );
	
        Enumeration e = templates.keys();
        while (e.hasMoreElements()) {
            String key = (String)e.nextElement();
	    MenuItem mi = new MenuItem( key );
	    mi.setActionCommand( key );
	    mi.addActionListener( this );
	    popup.add( mi );
        }
        curnode = node;

	this.add( popup );

	popup.show( this, ev.getX(), ev.getY() );
    }
Beispiel #2
0
 public void actionPerformed(ActionEvent e) {
   String command = e.getActionCommand();
   if (command == null) return;
   if (command.equals(moreLabel)) {
     Point bloc = moreButton.getLocation();
     pm.show(this, bloc.x, bloc.y);
   } else if (command.equals("Convert to RGB")) IJ.doCommand("Stack to RGB");
   else IJ.doCommand(command);
 }
Beispiel #3
0
  /** Executes the specified command */
  public void run() {
    if (popup != null) {
      popup.show(popupComponent, popupX, popupY);
      popup = null;
      return;
    }

    if (cmd == null) return;

    switch (cmd.commandType) {
        // Open an UrlConnection
      case CommandInfo.COMMAND_TYPE_GET:
        try {
          cmd.commandURL.openConnection();

          BufferedReader in =
              new BufferedReader(new InputStreamReader(cmd.commandURL.openStream()));
          String strLine;
          Debug.println("Server responded:");
          while ((strLine = in.readLine()) != null) {
            Debug.println(strLine);
          }
          in.close();
        } catch (IOException e) {
        }
        break;
        // Open a port
      case CommandInfo.COMMAND_TYPE_OPEN:
        try {
          Socket sockServerConnection = new Socket(cmd.commandHost, (int) cmd.commandPort);
          BufferedReader in =
              new BufferedReader(new InputStreamReader(sockServerConnection.getInputStream()));
          String strLine;
          Debug.println("Server responded:");
          while ((strLine = in.readLine()) != null) {
            Debug.println(strLine);
          }
          in.close();
          sockServerConnection.close();
        } catch (IOException e) {
        }
        break;
    }
    cmd = null;
    Debug.println("Action terminated");
  }
 protected void handlePopupMenu(MouseEvent e) {
   if (disablePopupMenu) return;
   if (IJ.debugMode) IJ.log("show popup: " + (e.isPopupTrigger() ? "true" : "false"));
   int x = e.getX();
   int y = e.getY();
   Roi roi = imp.getRoi();
   if (roi != null
       && (roi.getType() == Roi.POLYGON
           || roi.getType() == Roi.POLYLINE
           || roi.getType() == Roi.ANGLE)
       && roi.getState() == roi.CONSTRUCTING) {
     roi.handleMouseUp(x, y); // simulate double-click to finalize
     roi.handleMouseUp(x, y); // polygon or polyline selection
     return;
   }
   PopupMenu popup = Menus.getPopupMenu();
   if (popup != null) {
     add(popup);
     if (IJ.isMacOSX()) IJ.wait(10);
     popup.show(this, x, y);
   }
 }
 /** Shows the popup menu */
 protected void showMenu(Component comp, int x, int y) {
   if (activeEditor) popupMenu.show(comp, x, y);
 }