Package org.openbp.jaspira.action

Examples of org.openbp.jaspira.action.JaspiraPopupMenu


      return null;
    }

    // we are a menu with subentries - create the menu and return it

    JaspiraPopupMenu menu = new JaspiraPopupMenu();

    SortedSet menuchildren = virtualRoot.getMenuchildren();
    if (menuchildren == null)
      return null;

    for (Iterator it = menuchildren.iterator(); it.hasNext();)
    {
      JaspiraAction next = (JaspiraAction) it.next();

      if (next.getType().equals(JaspiraAction.TYPE_GROUP))
      {
        if (next.getMenuchildren() == null)
        {
          // The group is empty, ignore it.
          continue;
        }

        for (Iterator it2 = next.getMenuchildren().iterator(); it2.hasNext();)
        {
          menu.add((JaspiraAction) it2.next());
        }
      }
      else
      {
        menu.add(next);
      }

      if (it.hasNext())
      {
        menu.addSeparator();
      }
    }

    Component focusOwner = FocusManager.getCurrentManager().getFocusOwner();
    menu.setInvoker(focusOwner);

    return menu;
  }
View Full Code Here


      // Fire the event to the other plugins
      modeler.fireEvent(iae);

      // Create a popup menu from what the Jaspira actions the other plugins have added
      JaspiraPopupMenu menu = iae.createPopupMenu();

      if (menu != null)
      {
        // Position and display the menu
        Point location = null;
        if (me != null)
        {
          location = new Point(me.getX(), me.getY());
        }
        else if (figure != null)
        {
          location = figure.center();
          location = applyScale(location, false);
        }

        adjustOffsets(getParent(), location);

        menu.setLocation(location);
        menu.setInvoker(this);
        menu.setVisible(true);

        if (me != null && figure != null)
        {
          figure.invalidate();
        }
View Full Code Here

    // New item group
    itemBrowser.addNewItemActions(iae);

    // Create the popup
    JaspiraPopupMenu menu = iae.createPopupMenu();
    if (menu == null)
      return EVENT_IGNORED;

    // Show the menu below the main toolbar
    JaspiraPage page = itemBrowser.getPage();
    JaspiraPageContainer pagecontainer = (JaspiraPageContainer) page.getParentContainer();
    JaspiraToolbar toolbar = pagecontainer.getToolbar();

    int height = toolbar.getHeight();
    menu.show(toolbar, 0, height);

    return EVENT_CONSUMED;
  }
View Full Code Here

      // Reset the wait cursor
      ApplicationUtil.waitCursorOff();
    }

    // Create and display the menu
    JaspiraPopupMenu menu = iae.createPopupMenu();

    // When showing the menu directly from here, the portion of the menu that overlaps the current
    // tree row gets painted, but the remainder of the menu will be painted after the tree view
    // was refreshed. In order to prevent this, we dealy the menu display until the update events
    // have been processed.
    if (menu != null)
    {
      menu.show(tree, pos.x, pos.y);
    }
  }
View Full Code Here

    {
      if (e.isPopupTrigger() && !(toolbox instanceof StandardToolBoxPlugin))
      {
        InteractionEvent iae = new InteractionEvent(toolbox, InteractionEvent.POPUP, transferable);
        toolbox.fireEvent(iae);
        JaspiraPopupMenu menu = iae.createPopupMenu();

        if (toolbox.acceptDrop())
        {
          // Add the 'Remove entry' action
          if (menu == null)
          {
            menu = new JaspiraPopupMenu(title);
          }
          else
          {
            menu.addSeparator();
          }

          menu.add(new JaspiraAction(toolbox, "toolbox.remove")
          {
            public void actionPerformed(ActionEvent ae)
            {
              toolbox.removeToolBoxItem(ToolBoxItem.this);
              toolbox.refreshContent();
            }
          });
        }

        menu.show(ToolBoxItem.this, e.getPoint().x, e.getPoint().y);
      }
    }
View Full Code Here

    }

    if (!actionEnabled)
      return null;

    JaspiraPopupMenu menu = new JaspiraPopupMenu();
    boolean needSeparator = false;

    for (int i = 0; i < actions.length; ++i)
    {
      if (actions [i].isEnabled())
      {
        if (needSeparator)
        {
          menu.add(new JSeparator());
          needSeparator = false;
        }

        menu.add(actions [i].toMenuItem());
      }

      if (i == ACTION_INDEX_ADD || i == ACTION_INDEX_PASTE || i == ACTION_INDEX_REMOVE)
      {
        needSeparator = true;
View Full Code Here

TOP

Related Classes of org.openbp.jaspira.action.JaspiraPopupMenu

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.