Package org.cishell.reference.gui.workflow.model

Examples of org.cishell.reference.gui.workflow.model.AlgorithmWorkflowItem


          (WorkflowGUI) rootItem, 0, brandPluginID);
      rootItem.addChild(wfnew);
      LinkedHashMap<Long, WorkflowItem> itemMap = wf.getMap();
      WorkflowTreeItem parent = wfnew;
      for (Map.Entry<Long, WorkflowItem> itemEntry : itemMap.entrySet()) {
        AlgorithmWorkflowItem algoItem = (AlgorithmWorkflowItem) itemEntry
            .getValue();
        final AlgorithmItemGUI dataItem = new AlgorithmItemGUI(
            algoItem, parent, brandPluginID);
        parent.addChild(dataItem);
        parent = dataItem;

        Dictionary<String, Object> params = algoItem.getParameters();
        if (params == null || params.isEmpty())
          continue;
        final GeneralTreeItem paramLabel = new GeneralTreeItem(
            "Parameters", Constant.Label, dataItem, Utils.getImage(
                PARAMETER_IMAGE_NAME, brandPluginID));
View Full Code Here


    rootItem.addChild(wfnew);
    LinkedHashMap<Long, WorkflowItem> itemMap = wf.getMap();
    WorkflowTreeItem parent = wfnew;
    for (Map.Entry<Long, WorkflowItem> itemEntry : itemMap.entrySet()) {

      AlgorithmWorkflowItem algoItem = (AlgorithmWorkflowItem) itemEntry
          .getValue();
      final AlgorithmItemGUI dataItem = new AlgorithmItemGUI(algoItem,
          parent, brandPluginID);
      parent.addChild(dataItem);
      parent = dataItem;

      Dictionary<String, Object> params = algoItem.getParameters();
      Dictionary<String, String> nameToId = algoItem.getNameToId();

      if (params == null || params.isEmpty())
        continue;
      final GeneralTreeItem paramLabel = new GeneralTreeItem(
          "Parameters", Constant.Label, dataItem, Utils.getImage(
              PARAMETER_IMAGE_NAME, brandPluginID));
      dataItem.addChild(paramLabel);

      for (Enumeration e = nameToId.keys(); e.hasMoreElements();) {
        String key = (String) e.nextElement();
        String strvalue = "";
        Object value = algoItem.getParameterValue(key);
        if (value != null) {
          strvalue = value.toString();
        }
        GeneralTreeItem paramName = new GeneralTreeItem(key,
            Constant.ParameterName, paramLabel, Utils.getImage(
View Full Code Here

        .getService(serviceReference);

    String pid = (String) serviceReference
        .getProperty(Constants.SERVICE_PID);

    AlgorithmWorkflowItem wfi = new AlgorithmWorkflowItem(algorithmLabel,
        ((NormalWorkflow) currentWorkFlowItem.getWorkflow())
            .getUniqueInternalId(), pid);
    wfi.setParameters(parameters);
    wfi.setWorkflow(currentWorkFlowItem.getWorkflow());
    currentWorkFlowItem.getWorkflow().add(wfi);

    final AlgorithmItemGUI dataItem = new AlgorithmItemGUI(wfi,
        this.currentParentItem, this.brandPluginID);
    this.currentParentItem.addChild(dataItem);
    this.currentParentItem = dataItem;
    refresh(dataItem);
    // Create algorithm parameters.
    String metatypePID = getMetaTypeID(serviceReference);
    // get the input parameters
    MetaTypeProvider provider = null;

    try {
      provider = getPossiblyMutatedMetaTypeProvider(metatypePID, pid,
          factory, serviceReference);
    } catch (AlgorithmCreationFailedException e) {
      String format = "An error occurred when creating the algorithm \"%s\" with the data you "
          + "provided.  (Reason: %s)";
      String logMessage = String.format(format,
          serviceReference.getProperty(AlgorithmProperty.LABEL),
          e.getMessage());

      return;
    } catch (Exception e) {
      return;
    }

    if (parameters == null || parameters.isEmpty())
      return;

    final GeneralTreeItem paramItem = new GeneralTreeItem("Parameters",
        Constant.Label, dataItem, Utils.getImage("parameters.png",
            brandPluginID));
    dataItem.addChild(paramItem);
    ObjectClassDefinition obj = provider.getObjectClassDefinition(
        metatypePID, null);
    if (obj != null) {
      AttributeDefinition[] attr = obj
          .getAttributeDefinitions(ObjectClassDefinition.ALL);

      for (int i = 0; i < attr.length; i++) {
        String id = attr[i].getID();
        String name = attr[i].getName();
        // add this into the hashmap of Algorithm Item
        wfi.add(name, id);
        Object valueRaw = parameters.get(id);
        String value = "";
        if (valueRaw != null) {
          value = valueRaw.toString();
        }
View Full Code Here

      try {
        String paramName = wfTreeItem.getParent().getLabel();
        WorkflowTreeItem alfoITem = wfTreeItem.getParent().getParent()
            .getParent();

        AlgorithmWorkflowItem wfg = (AlgorithmWorkflowItem) ((AlgorithmItemGUI) alfoITem)
            .getWfItem();
        Object obj = wfg.getParameterValue(paramName);
        if (obj != null) {
          if (obj instanceof String) {
            obj = newLabel;
          } else if (obj instanceof Integer) {
            obj = Integer.parseInt(newLabel);
          } else if (obj instanceof java.lang.Boolean) {
            obj = Boolean.parseBoolean(newLabel);
          } else if (obj instanceof java.lang.Float) {
            obj = Float.parseFloat(newLabel);
          } else if (obj instanceof java.lang.Double) {
            obj = Double.parseDouble(newLabel);
          } else if (obj instanceof java.lang.Long) {
            obj = Long.parseLong(newLabel);
          } else if (obj instanceof java.lang.Short) {
            obj = Short.parseShort(newLabel);
          }
        } else {
          obj = newLabel;
        }
        wfg.addParameter(paramName, obj);
        wfTreeItem.setLabel(newLabel);
      } catch (Exception e) {
        viewer.refresh();
        this.newEditor.dispose();
        updatingTreeItem = false;
View Full Code Here

              || WorkflowView.this.currentWorkFlowItem == wfGUI) {
            WorkflowView.this.addNewWorkflow("Workflow ");
          }
        } else if (type == Constant.AlgorithmUIItem) {
          AlgorithmItemGUI aiGUI = (AlgorithmItemGUI) itm;
          AlgorithmWorkflowItem wfItem = (AlgorithmWorkflowItem) aiGUI
              .getWfItem();
          Workflow wf = wfItem.getWorkflow();

          WorkflowTreeItem parent = itm.getParent();// GUI
          itm.removeAllChildren();
          parent.removeChild(itm);
          WorkflowView.this.viewer.refresh();
View Full Code Here

TOP

Related Classes of org.cishell.reference.gui.workflow.model.AlgorithmWorkflowItem

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.