Package org.openbp.core.model.item.process

Examples of org.openbp.core.model.item.process.NodeParam


    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
View Full Code Here


        }

        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")
            {
View Full Code Here

  boolean hasExpression(Object o)
  {
    if (o instanceof ParamFigure)
    {
      ParamFigure paramFigure = (ParamFigure) o;
      NodeParam param = paramFigure.getNodeParam();
      String expression = param.getExpression();

      // We consider the object to have an expression if the expression contains something of interest (i. e. a non-stanard value)
      if (expression != null && !expression.equals("null") && !expression.equals("\"\"") && !expression.equals("false") && !expression.equals("0"))
      {
        return true;
View Full Code Here

    NodeSocket socket = node.getSocket();

    // Copy the parameters of the given socket to the socket of the node
    for (Iterator it = patternSocket.getParams(); it.hasNext();)
    {
      NodeParam param = (NodeParam) it.next();

      try
      {
        param = (NodeParam) param.clone();
      }
      catch (CloneNotSupportedException e)
      {
        param = null;
      }
View Full Code Here

   * @param socket Socket
   * @return The new parameter
   */
  private NodeParam createNodeParam(String name, String displayName, String description, String systemTypeName, boolean visible, boolean optional, NodeSocket socket)
  {
    NodeParam param = new NodeParamImpl();

    param.setName(name);
    param.setDisplayName(displayName);
    param.setDescription(description);

    ModelQualifier typeQualifier = new ModelQualifier(CoreConstants.SYSTEM_MODEL_NAME, systemTypeName, ItemTypes.TYPE, null);
    DataTypeItem dataType = null;
    try
    {
      dataType = (DataTypeItem) ModelConnector.getInstance().getItemByQualifier(typeQualifier, true);
    }
    catch (ModelException e)
    {
      ExceptionUtil.printTrace(e);
      return null;
    }
    param.setDataType(dataType);
    param.setTypeName(systemTypeName);

    param.setVisible(visible);
    param.setOptional(optional);

    if (socket != null)
    {
      socket.addParam(param);
    }
View Full Code Here

      return false;

    // Check if there are parameters we might assign a value
    for (Iterator it = socket.getParams(); it.hasNext();)
    {
      NodeParam param = (NodeParam) it.next();

      if (param.getParamValueWizard() != null)
        return true;
    }

    // Check if there is a configuration bean associated with this type of node
    if (node instanceof MultiSocketNode)
View Full Code Here

    if (socket != null)
    {
      for (Iterator it = socket.getParams(); it.hasNext();)
      {
        NodeParam param = (NodeParam) it.next();

        if (param.getParamValueWizard() != null)
        {
          if (valueParams == null)
            valueParams = new ArrayList();
          valueParams.add(param);
        }
View Full Code Here

    {
      // Traverse backwards to display the param pages in the right order
      int n = valueParams.size();
      for (int i = n - 1; i >= 0; --i)
      {
        NodeParam param = (NodeParam) valueParams.get(i);

        WizardPage page = null;
        String type = param.getParamValueWizard();

        // Create the page according to the wizard type specified by the parameter
        if (type.equals("string"))
        {
          page = new ParamValueStringPage(this, param);
        }
        else if (type.equals("integer"))
        {
          page = new ParamValueIntegerPage(this, param);
        }
        else if (type.equals("boolean"))
        {
          page = new ParamValueBooleanPage(this, param);
        }
        else if (type.equals("datatype"))
        {
          page = new ParamValueDataTypePage(this, param);
        }
        else
        {
          LogUtil.error(getClass(), "Unknown parameter value wizard type $0 for parameter $1", type, param.getQualifier());
        }

        if (page != null)
        {
          // Add the new page to the wizard
          addAndLinkPage(param.getName(), page);
        }
      }
    }

    if (configurationBean != null)
View Full Code Here

    boolean showAllParams = socket.getProcess().getName().equals(NodeItemEditor.NODEEDITOR_PROCESS_NAME);

    // Add all visible parameters of the socket to the parameter list and the tag content
    for (Iterator it = socket.getParams(); it.hasNext();)
    {
      NodeParam param = (NodeParam) it.next();

      // Add the parameter if we display all parameters or if it is a parameter that is currently visible
      if (showAllParams || param.isVisible())
      {
        ParamFigure paramFigure = new ParamFigure(this, param, new Point(0, 0));
        if (paramList == null)
          paramList = new ArrayList();
        paramList.add(paramFigure);
View Full Code Here

    // Add invisible parameters
    int paramFigureIndex = 0;
    for (Iterator it = socket.getParams(); it.hasNext();)
    {
      NodeParam param = (NodeParam) it.next();

      if (param.isVisible() || showAllParams)
      {
        // Display this parameter
        if (param.getRepresentation() == null)
        {
          // Parameter not present as figure, add it
          addParam(param, paramFigureIndex + 1);
        }
        ++paramFigureIndex;
      }
    }

    if (! showAllParams)
    {
      // Remove invisible parameters
      for (Iterator it = content.iterator(); it.hasNext();)
      {
        TagContent content = (TagContent) it.next();
        if (content.getFigure() instanceof ParamFigure)
        {
          ParamFigure paramFigure = (ParamFigure) content.getFigure();
          NodeParam param = paramFigure.getNodeParam();
          if (! param.isVisible())
          {
            // Remove the invisible parameter from the content list
            it.remove();

            // Remove the parameter figure from the parameter figure list
            paramList.remove(paramFigure);

            // Remove the link from the parameter to the representation
            param.setRepresentation(null);
          }
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.openbp.core.model.item.process.NodeParam

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.