Examples of JaspiraAction


Examples of org.openbp.jaspira.action.JaspiraAction

        }
      }

      ActionMgr am = ActionMgr.getInstance();

      JaspiraAction copyAction = am.getAction("global.clipboard.copy");
      if (copyAction != null)
        copyAction.setEnabled(canCopy);

      JaspiraAction cutAction = am.getAction("global.clipboard.cut");
      if (cutAction != null)
        cutAction.setEnabled(canCut);

      JaspiraAction deleteAction = am.getAction("global.clipboard.delete");
      if (deleteAction != null)
        deleteAction.setEnabled(canDelete);

      JaspiraAction pasteAction = am.getAction("global.clipboard.paste");
      if (pasteAction != null)
        pasteAction.setEnabled(canPaste);

      return EVENT_IGNORED;
    }
View Full Code Here

Examples of org.openbp.jaspira.action.JaspiraAction

      if (ie.getSourcePlugin() != NodeItemEditorPlugin.this)
        return EVENT_IGNORED;

      DataFlavor [] flavor = ie.getTransferDataFlavors();

      JaspiraAction group = new JaspiraAction("popup", null, null, null, null, 100, JaspiraAction.TYPE_GROUP);

      for (int i = 0; i < flavor.length; i++)
      {
        if (flavor [i].equals(ModelerFlavors.FIGURE))
        {
          Figure figure = (Figure) ie.getSafeTransferData(flavor [i]);
          workspaceView.singleSelect(figure);
        }

        if (flavor [i].equals(ModelerFlavors.COLORIZABLE))
        {
          final Colorizable col = (Colorizable) ie.getSafeTransferData(flavor [i]);

          if (col.getFillColor() != null && !col.getFillColor().equals(col.getDefaultFillColor()))
          {
            group.addMenuChild(new JaspiraAction(NodeItemEditorPlugin.this, "modeler.edit.resetcolor")
            {
              public void actionPerformed(ActionEvent e)
              {
                col.setFillColor(col.getDefaultFillColor());
                col.invalidate();
              }
            });
          }
        }

        final NodeItemEditorPlugin modeler = NodeItemEditorPlugin.this;
        boolean copyEnabled = modeler.canCopy();
        boolean cutEnabled = modeler.canCut();
        boolean deleteEnabled = modeler.canDelete();
        boolean pasteEnabled = modeler.canPaste(ClipboardMgr.getInstance().getCurrentEntry());
        if (copyEnabled || deleteEnabled || cutEnabled || pasteEnabled)
        {
          JaspiraAction copyPasteGroup = new JaspiraAction("copypaste", null, null, null, null, 2, JaspiraAction.TYPE_GROUP);

          JaspiraAction ja;

          ja = new JaspiraAction(modeler, "modeler.edit.copy")
          {
            public void actionPerformed(ActionEvent e)
            {
              copy();
            }
          };
          ja.setEnabled(copyEnabled);
          copyPasteGroup.addMenuChild(ja);

          ja = new JaspiraAction(modeler, "modeler.edit.cut")
          {
            public void actionPerformed(ActionEvent e)
            {
              cut();
            }
          };
          ja.setEnabled(cutEnabled);
          copyPasteGroup.addMenuChild(ja);

          ja = new JaspiraAction(modeler, "modeler.edit.paste")
          {
            public void actionPerformed(ActionEvent e)
            {
              Transferable transferable = ClipboardMgr.getInstance().getCurrentEntry();
              paste(transferable);
            }
          };
          ja.setEnabled(pasteEnabled);
          copyPasteGroup.addMenuChild(ja);

          ie.add(copyPasteGroup);

          ja = new JaspiraAction(modeler, "modeler.edit.delete")
          {
            public void actionPerformed(ActionEvent e)
            {
              delete();
            }
          };
          ja.setEnabled(deleteEnabled);
          ie.add(ja);

        }
      }
View Full Code Here

Examples of org.openbp.jaspira.action.JaspiraAction

      ModelObject mo = (ModelObject) ie.getSafeTransferData(ClientFlavors.MODEL_OBJECT);

      List associations = mo.getAssociations();
      if (associations != null)
      {
        JaspiraAction group = new JaspiraAction(AssociationPlugin.this, "submenu.open");

        int n = associations.size();
        for (int iAssoc = 0; iAssoc < n; ++iAssoc)
        {
          Association association = (Association) associations.get(iAssoc);

          String hintMsg = null;
          OpenEventInfo [] openEventInfo = null;

          if (association.getAssociatedObject() == null)
          {
            // Association present, but no associated object.
            // The association contains a hint message, e. g. "Object has not yet been generated"
            hintMsg = association.getHintMsg();
          }
          else
          {
            // Check the mime types supported by this object
            String [] types = association.getAssociationTypes();
            if (types == null || types.length == 0)
            {
              hintMsg = getPluginResourceCollection().getRequiredString("messages.hints.noassociation");
            }
            else
            {
              // Now check if any plugin is able to open this kind of MIME type
              // The association manager will broadcast the plugin.association.supports event in order
              // to determine the open event name that can be used to open the object of the association
              openEventInfo = determineOpenEvents(types, AssociationPlugin.this);

              if (openEventInfo == null)
              {
                hintMsg = getPluginResourceCollection().getRequiredString("messages.hints.wrongassociation");
              }
            }
          }

          if (openEventInfo != null)
          {
            // We are able to open this object.
            // Create an open action for each open event information
            for (int iEvent = 0; iEvent < openEventInfo.length; ++iEvent)
            {
              OpenAction openAction = new OpenAction(association, openEventInfo [iEvent], !mo.isModifiable());
              openAction.setPriority(iAssoc * 10 + iEvent);
              group.addMenuChild(openAction);
            }
          }
          else
          {
            // Open not possible.
            // Create a dummy action for the association that displays a hint message
            JaspiraAction emptyAction = new JaspiraAction(association);
            emptyAction.setDescription(hintMsg);
            emptyAction.setEnabled(false);
            emptyAction.setPriority(iAssoc * 10);
            group.addMenuChild(emptyAction);
          }
        }

        ie.add(group);
 
View Full Code Here

Examples of org.openbp.jaspira.action.JaspiraAction

        final Item item = (Item) ie.getSafeTransferData(ClientFlavors.ITEM);

        if (!(item instanceof Model))
        {
          // Add the 'Add to toolbox' action
          JaspiraAction action = new JaspiraAction(UserToolBoxPlugin.this, "toolbox.add")
          {
            public void actionPerformed(ActionEvent ae)
            {
              addToolBoxItem(new ToolBoxItem(item.getDisplayText(), ItemIconMgr.getInstance().getIcon(item, FlexibleSize.MEDIUM), item.getDescriptionText(), new ItemTransferable(item)));
              refreshContent();

              // Bring the toolbox to the front, but don't switch pages
              showPlugin(false);
            }
          };

          String s = action.getDisplayName();
          String tt = getToolBoxTitle();
          if (tt != null)
          {
            // Append the name of the toolbox to the action title
            s = s + ": " + tt;
          }
          action.setDisplayName(s);

          ie.add(action);
        }
      }
View Full Code Here

Examples of org.openbp.jaspira.action.JaspiraAction

      if (!ie.isDataFlavorSupported(StandardFlavors.JASPIRA_PAGE))
      {
        return EVENT_IGNORED;
      }

      JaspiraAction group = new JaspiraAction("popup.page", null, null, null, null, 1, JaspiraAction.TYPE_GROUP);

      // 'Open page in new frame' popup menu
      group.addMenuChild(new JaspiraAction(ApplicationBase.this, "frame.openinframe")
      {
        public void actionPerformed(ActionEvent e)
        {
          JaspiraPage page = (JaspiraPage) ie.getSafeTransferData(StandardFlavors.JASPIRA_PAGE);
          if (page != null)
View Full Code Here

Examples of org.openbp.jaspira.action.JaspiraAction

            else
            {
              pop.addSeparator();
            }

            pop.add(new JaspiraMenuItem(new JaspiraAction(ToolBoxPlugin.this, "toolbox.changename")
            {
              public void actionPerformed(ActionEvent e)
              {
                String msg = getActionResource().getRequiredString("toolbox.dialog.changename.text");
                String s = JOptionPane.showInputDialog(null, msg);
View Full Code Here

Examples of org.openbp.jaspira.action.JaspiraAction

    SettingUtil.setBooleanSetting("editor.view.controlanchorvisibility", controlAnchorVisible);
    SettingUtil.saveSettings(null);

    // The selection state of the button should be on if the control links are hidden
    JaspiraAction action = ActionMgr.getInstance().getAction("modelerpage.view.controlanchor");
    if (action != null)
    {
      action.setSelected(!controlAnchorVisible);
    }

    // Notify modelers of status change
    JaspiraEventMgr.fireGlobalEvent("modeler.view.modechange");
  }
View Full Code Here

Examples of org.openbp.jaspira.action.JaspiraAction

    SettingUtil.setBooleanSetting("editor.view.controllinkvisibility", controlLinkVisible);
    SettingUtil.saveSettings(null);

    // The selection state of the button should be on if the control links are hidden
    JaspiraAction action = ActionMgr.getInstance().getAction("modelerpage.view.controltoggle");
    if (action != null)
    {
      action.setSelected(!controlLinkVisible);
    }

    // Notify modelers of status change
    JaspiraEventMgr.fireGlobalEvent("modeler.view.modechange");
  }
View Full Code Here

Examples of org.openbp.jaspira.action.JaspiraAction

    SettingUtil.setBooleanSetting("editor.view.datalinkvisibility", dataLinkVisible);
    SettingUtil.saveSettings(null);

    // The selection state of the button should be on if the data links are hidden
    JaspiraAction action = ActionMgr.getInstance().getAction("modelerpage.view.datatoggle");
    if (action != null)
    {
      action.setSelected(!dataLinkVisible);
    }

    // Notify modelers of status change
    JaspiraEventMgr.fireGlobalEvent("modeler.view.modechange");
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.