Examples of JaspiraAction


Examples of org.openbp.jaspira.action.JaspiraAction

     */
    public JaspiraEventHandlerCode toolbar(InteractionEvent ie)
    {
      if (ie.getSourcePlugin() instanceof Modeler)
      {
        JaspiraAction group;

        group = new JaspiraAction("breakpoint", null, null, null, null, 2, JaspiraAction.TYPE_GROUP);
        if (toggleBreakpointsAction != null)
        {
          group.addToolbarChild(toggleBreakpointsAction);
        }
        if (clearBreakpointsAction != null)
        {
          group.addToolbarChild(clearBreakpointsAction);
        }
        ie.add(group);

        group = new JaspiraAction("step", null, null, null, null, 3, JaspiraAction.TYPE_GROUP);
        if (stepIntoAction != null)
        {
          group.addToolbarChild(stepIntoAction);
        }
        if (stepOverAction != null)
        {
          group.addToolbarChild(stepOverAction);
        }
        if (stepOutAction != null)
        {
          group.addToolbarChild(stepOutAction);
        }
        if (stepNextAction != null)
        {
          group.addToolbarChild(stepNextAction);
        }
        if (resumeAction != null)
        {
          group.addToolbarChild(resumeAction);
        }
        if (stopAction != null)
        {
          group.addToolbarChild(stopAction);
        }
        ie.add(group);

        return EVENT_HANDLED;
      }
View Full Code Here

Examples of org.openbp.jaspira.action.JaspiraAction

   * @param socketFigure The referred socket figure
   */
  public static void addParamMenu(InteractionEvent ie, final Modeler modeler, final SocketFigure socketFigure)
  {
    // Popup menu item group
    JaspiraAction group = null;

    NodeSocket socket = socketFigure.getNodeSocket();
    for (Iterator it = socket.getParams(); it.hasNext();)
    {
      final NodeParam param = (NodeParam) it.next();

      // Create an action that toggles the parameter visibility
      JaspiraAction action = new JaspiraAction(modeler, "modeler.edit.paramvisibility.prototype")
      {
        public void actionPerformed(ActionEvent e)
        {
          // Reinitialize the socket contents
          modeler.startUndo("Show/hide Parameter");

          modeler.getDrawingView().clearSelection();

          // Toggle the parameter visibility
          param.setVisible(!param.isVisible());

          // Rebuild the parmeter list, displaying the visible parameters only
          socketFigure.reinitParams(false);

          modeler.endUndo();

          modeler.getDrawingView().redraw();
        }
      };

      // Provide the parameter name or display name as action title
      String name;
      if (DisplayObjectPlugin.getInstance().isTitleModeText())
        name = param.getDisplayText();
      else
        name = param.getName();
      action.setDisplayName(name);

      // Enable the action only if we may hide the parameter
      boolean canHide = !param.isVisible() || canHideParam(param);
      action.setEnabled(canHide);

      // The action selection state reflects the parameter visiblity
      action.setSelected(param.isVisible());

      // Add the action to the 'Parameters' group
      if (group == null)
      {
        // TODO Feature 5 Add the 'show/hide all' menu items

        // Create the 'Parameters' menu group
        group = new JaspiraAction(modeler, "modeler.edit.paramvisibility");
      }
      group.addMenuChild(action);
    }

    if (group != null)
View Full Code Here

Examples of org.openbp.jaspira.action.JaspiraAction

     * @param ie Interaction event to add the menus to
     * @param socket Socket the context menu should refer to
     */
    private void setupSocketContextMenu(InteractionEvent ie, final NodeSocket socket)
    {
      JaspiraAction group = new JaspiraAction("popupbreakpoint", null, null, null, null, 1, JaspiraAction.TYPE_GROUP);

      // Menu item: Toggle breakpoint
      group.addMenuChild(new JaspiraAction(DebuggerPlugin.this, "debugger.client.togglebreakpoint")
      {
        public void actionPerformed(ActionEvent e)
        {
          fireEvent(new QualifierEvent(DebuggerPlugin.this, "debugger.client.togglebreakpoint", socket.getQualifier()));
        }
      });

      ie.add(group);

      if (haltedPosition != null)
      {
        // Menu item: Step until; add this only if we have a halted process
        group = new JaspiraAction("popupstep", null, null, null, null, 3, JaspiraAction.TYPE_GROUP);

        group.addMenuChild(new JaspiraAction(DebuggerPlugin.this, "debugger.client.stepuntil")
        {
          public void actionPerformed(ActionEvent e)
          {
            fireEvent(new QualifierEvent(DebuggerPlugin.this, "debugger.client.stepuntil", socket.getQualifier()));
          }
View Full Code Here

Examples of org.openbp.jaspira.action.JaspiraAction

        // Log as warning
        LogUtil.error(getClass(), "Error instantiating custom model object configurator $0.", className, e);
      }
    }

    templateAction = new JaspiraAction(modeler, "modeler.popup.custom");
  }
View Full Code Here

Examples of org.openbp.jaspira.action.JaspiraAction

    {
      CustomModelObjectConfiguratorDescriptor desc = configurator.checkAppliance(mo);
      if (desc != null)
      {
        final CustomModelObjectConfigurator foundConfigurator = configurator;
        JaspiraAction action = new JaspiraAction(desc.getName(), desc.getDisplayName(), desc.getDescription(), null, null, desc.getPriority(), JaspiraAction.TYPE_ACTION)
        {
          public void actionPerformed(ActionEvent e)
          {
            if (foundConfigurator.displayActivityConfigurationDialog(mo))
            {
              modeler.getDrawing().setModified();
            }
          }
        };
        action.setIcon(templateAction.getIcon());
        group.addMenuChild(action);
      }
    }
  }
View Full Code Here

Examples of org.openbp.jaspira.action.JaspiraAction

    if (ie.getSourcePlugin() == modeler)
    {
      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(ClientFlavors.MODEL_OBJECT))
        {
          ModelObject mo = (ModelObject) ie.getSafeTransferData(flavor [i]);
          configuratorSupport.addConfiguratorMenuOptions(mo, group);
        }

        if (flavor [i].equals(ModelerFlavors.FIGURE))
        {
          Figure figure = (Figure) ie.getSafeTransferData(flavor [i]);
          workspaceView.singleSelect(figure);
        }

        if (flavor [i].equals(ModelerFlavors.PARAM_FIGURE))
        {
          final ParamFigure paramFigure = (ParamFigure) ie.getSafeTransferData(flavor [i]);
          final NodeParam nodeParam = paramFigure.getNodeParam();
          SocketFigure socketFigure = (SocketFigure) paramFigure.getParent();

          // Add the 'Parameter visibility' sub menu for all parameters of the socket if appropriate
          ParamVisibilityHelper.addParamMenu(ie, modeler, socketFigure);

          // 'Parameter Value Wizard' popup
          final NodeFigure nodeFigure = (NodeFigure) socketFigure.getParent();
          if (ParamValueWizard.isParameterValueWizardApplyable(modeler, nodeFigure, nodeParam.getSocket().getName()))
          {
            JaspiraAction wizardGroup = new JaspiraAction("popupwizard", null, null, null, null, 2, JaspiraAction.TYPE_GROUP);

            wizardGroup.addMenuChild(new JaspiraAction(modeler, "modeler.edit.paramvaluewizard")
            {
              public void actionPerformed(ActionEvent e)
              {
                // Display parameter value wizard if appropriate
                ParamValueWizard.displayParameterValueWizard(modeler, nodeFigure, nodeParam.getSocket().getName(), nodeParam.getName());
              }
            });

            ie.add(wizardGroup);
          }

          // 'Create identical process variable' popup
          String paramName = nodeParam.getName();
          if (nodeParam.getProcess().getProcessVariableByName(paramName) == null)
          {
            JaspiraAction wizardGroup = new JaspiraAction("processvargroup", null, null, null, null, 2, JaspiraAction.TYPE_GROUP);

            wizardGroup.addMenuChild(new JaspiraAction(modeler, "modeler.edit.createprocessvarfromparam")
            {
              public void actionPerformed(ActionEvent e)
              {
                // Forward to the process variables plugin
                modeler.fireEvent("variables.createprocessvarfromparam", nodeParam);
              }
            });

            ie.add(wizardGroup);
          }
        }

        if (flavor [i].equals(ModelerFlavors.SOCKET_FIGURE))
        {
          final SocketFigure socketFigure = (SocketFigure) ie.getSafeTransferData(flavor [i]);
          final NodeSocket socket = socketFigure.getNodeSocket();

          // Add the 'Parameter visibility' sub menu if appropriate
          ParamVisibilityHelper.addParamMenu(ie, modeler, socketFigure);

          // 'Parameter Value Wizard' popup
          final NodeFigure nodeFigure = (NodeFigure) socketFigure.getParent();
          if (ParamValueWizard.isParameterValueWizardApplyable(modeler, nodeFigure, socket.getName()))
          {
            JaspiraAction wizardGroup = new JaspiraAction("popupwizard", null, null, null, null, 2, JaspiraAction.TYPE_GROUP);

            wizardGroup.addMenuChild(new JaspiraAction(modeler, "modeler.edit.paramvaluewizard")
            {
              public void actionPerformed(ActionEvent e)
              {
                // Display parameter value wizard if appropriate
                ParamValueWizard.displayParameterValueWizard(modeler, nodeFigure, socket.getName(), null);
              }
            });

            ie.add(wizardGroup);
          }

          /* Currently unused, rathr leads to confusion
          JaspiraAction socketToNodeGroup = new JaspiraAction("popupsockettonode", null, null, null, null, 2, JaspiraAction.TYPE_GROUP);

          // 'Create initial node' popup
          socketToNodeGroup.addMenuChild(new JaspiraAction(modeler, "modeler.edit.createentryfromsocket")
          {
            public void actionPerformed(ActionEvent e)
            {
              modeler.startUndo("Create Initial Node");

              if (drawing.getProcess().getNodeByName(socket.getName()) != null)
              {
                // A node with this name already exists; issue a warning.
                // The createFinalNodeFromSocket method will ensure that the new node
                // has a unique name.
                String msg = modeler.getPluginResourceCollection().getRequiredString("messages.nodealreadyexists");
                JMsgBox.show(null, msg, JMsgBox.ICON_INFO);
              }

              // Create a node from the socket and add it to the process
              NodeFigure nodeFigure = ModelerUtil.createInitialNodeFromSocket(socketFigure);

              modeler.endUndo();
            }
          });

          if (socket.isExitSocket())
          {
            // 'Create final node' popup
            socketToNodeGroup.addMenuChild(new JaspiraAction(modeler, "modeler.edit.createexitfromsocket")
            {
              public void actionPerformed(ActionEvent e)
              {
                modeler.startUndo("Create Final Node");

                if (drawing.getProcess().getNodeByName(socket.getName()) != null)
                {
                  // A node with this name already exists; issue a warning.
                  // The createFinalNodeFromSocket method will ensure that the new node
                  // has a unique name.
                  String msg = modeler.getPluginResourceCollection().getRequiredString("messages.nodealreadyexists");
                  JMsgBox.show(null, msg, JMsgBox.ICON_INFO);
                }

                // Create a node from the socket and add it to the process
                NodeFigure nodeFigure = ModelerUtil.createFinalNodeFromSocket(socketFigure);

                modeler.endUndo();
              }
            });
          }

          ie.add(socketToNodeGroup);
           */
        }

        if (flavor [i].equals(ModelerFlavors.NODE_FIGURE))
        {
          final NodeFigure nodeFigure = (NodeFigure) ie.getSafeTransferData(flavor [i]);

          group.addMenuChild(new JaspiraAction(modeler, "modeler.edit.mirrororientation")
          {
            public void actionPerformed(ActionEvent e)
            {
              modeler.startUndo("Flip Orientation");

              nodeFigure.flipOrientation();
              workspaceView.checkDamage();

              modeler.endUndo();
            }
          });

          group.addMenuChild(new JaspiraAction(modeler, "modeler.edit.rotateorientationcw")
          {
            public void actionPerformed(ActionEvent e)
            {
              modeler.startUndo("Rotate Orientation");

              nodeFigure.changeOrientation(NodeFigure.ROTATE_CW);
              workspaceView.checkDamage();

              modeler.endUndo();
            }
          });

          group.addMenuChild(new JaspiraAction(modeler, "modeler.edit.rotateorientationccw")
          {
            public void actionPerformed(ActionEvent e)
            {
              modeler.startUndo("Rotate Orientation");

              nodeFigure.changeOrientation(NodeFigure.ROTATE_CCW);
              workspaceView.checkDamage();

              modeler.endUndo();
            }
          });
        }

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

          // 'Reset color' popup
          if (col.getFillColor() != null && !col.getFillColor().equals(col.getDefaultFillColor()))
          {
            group.addMenuChild(new JaspiraAction(modeler, "modeler.edit.resetcolor")
            {
              public void actionPerformed(ActionEvent e)
              {
                modeler.startUndo("Reset Color");

                // TODO Feature 6: Reset subordinate element color, too
                col.setFillColor(col.getDefaultFillColor());
                workspaceView.checkDamage();

                modeler.endUndo();
              }
            });
          }
        }

        if (flavor [i].equals(ModelerFlavors.PARAM_CONNECTION_FIGURE))
        {
          final ParamConnection connection = (ParamConnection) ie.getSafeTransferData(flavor [i]);

          // 'Lock/unlock orientation' popup
          JaspiraAction lockAction = new JaspiraAction(modeler, "modeler.edit.lockorientation")
          {
            public void actionPerformed(ActionEvent e)
            {
              modeler.startUndo("Lock Orientation");

              connection.toggleOrientationLock();

              modeler.endUndo();
            }
          };
          lockAction.setSelected(connection.isOrientationLocked());
          group.addMenuChild(lockAction);

          // 'Flip orientation' popup
          group.addMenuChild(new JaspiraAction(modeler, "modeler.edit.fliporientation")
          {
            public void actionPerformed(ActionEvent e)
            {
              modeler.startUndo("Flip Orientation");

              connection.flipOrientation();

              modeler.endUndo();
            }
          });
        }
      }

      ie.add(group);

      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)
          {
            // Forward to the clipboard plugin
            modeler.fireEvent(new JaspiraActionEvent(modeler, "global.clipboard.copy", Plugin.LEVEL_APPLICATION));
          }
        };
        ja.setEnabled(copyEnabled);
        copyPasteGroup.addMenuChild(ja);

        ja = new JaspiraAction(modeler, "modeler.edit.cut")
        {
          public void actionPerformed(ActionEvent e)
          {
            // Forward to the clipboard plugin
            modeler.fireEvent(new JaspiraActionEvent(modeler, "global.clipboard.cut", Plugin.LEVEL_APPLICATION));
          }
        };
        ja.setEnabled(cutEnabled);
        copyPasteGroup.addMenuChild(ja);

        ja = new JaspiraAction(modeler, "modeler.edit.paste")
        {
          public void actionPerformed(ActionEvent e)
          {
            // Forward to the clipboard plugin
            modeler.fireEvent(new JaspiraActionEvent(modeler, "global.clipboard.paste", Plugin.LEVEL_APPLICATION));
          }
        };
        ja.setEnabled(pasteEnabled);
        copyPasteGroup.addMenuChild(ja);

        ie.add(copyPasteGroup);

        ja = new JaspiraAction(modeler, "modeler.edit.delete")
        {
          public void actionPerformed(ActionEvent e)
          {
            // Forward to the clipboard plugin
            modeler.fireEvent(new JaspiraActionEvent(modeler, "global.clipboard.delete", Plugin.LEVEL_APPLICATION));
          }
        };
        ja.setEnabled(deleteEnabled);
        ie.add(ja);
      }
    }

    return EVENT_HANDLED;
View Full Code Here

Examples of org.openbp.jaspira.action.JaspiraAction

   *
   * @param skin Skin or null
   */
  protected void updateSkinSelectionBox(Skin skin)
  {
    JaspiraAction action = getAction("plugin.skin.selectskin");
    if (action != null)
    {
      String text = skin != null ? skin.getDisplayText() : null;
      action.putValue(JaspiraToolbarCombo.PROPERTY_TEXT, text);
      action.setEnabled(text != null);
    }
  }
View Full Code Here

Examples of org.openbp.jaspira.action.JaspiraAction

  /**
   * Fills the skin selection box with the available skins.
   */
  protected void fillSkinSelectionBox()
  {
    JaspiraAction action = getAction("plugin.skin.selectskin");
    if (action != null)
    {
      action.clearValues();

      List skins = SkinMgr.getInstance().getSkinList();
      int n = skins.size();
      for (int i = 0; i < n; ++i)
      {
        Skin skin = (Skin) skins.get(i);
        String text = skin.getDisplayText();

        // Save the skin display name and the skin itself as selection text/selection value
        // in the property map of the action.
        // The toolbar combo will initialize itself from this.
        action.putValue(JaspiraToolbarCombo.PROPERTY_SELECTION_VALUE + i, skin);
        action.putValue(JaspiraToolbarCombo.PROPERTY_SELECTION_TEXT + i, text);
      }

      action.putValue(JaspiraToolbarCombo.PROPERTY_TEXT, null);
      action.setEnabled(false);
    }
  }
View Full Code Here

Examples of org.openbp.jaspira.action.JaspiraAction

     * @param je Event
     * @return The event status code
     */
    public JaspiraEventHandlerCode displayskin(JaspiraEvent je)
    {
      JaspiraAction action = getAction("plugin.skin.selectskin");
      if (action != null)
      {
        Skin skin = (Skin) je.getObject();
        String text = skin != null ? skin.getDisplayText() : null;
        action.putValue(JaspiraToolbarCombo.PROPERTY_TEXT, text);
        action.setEnabled(text != null);
      }

      return EVENT_CONSUMED;
    }
View Full Code Here

Examples of org.openbp.jaspira.action.JaspiraAction

              flipableSelected = true;
            }
          }
        }

        JaspiraAction action = ActionMgr.getInstance().getAction("modeler.edit.fliporientation");
        if (action != null)
        {
          action.setEnabled(flipableSelected);
        }
      }

      return EVENT_HANDLED;
    }
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.