Package org.openbp.core.model.item

Examples of org.openbp.core.model.item.Item


    // Select initial nodes only
    itemTree.setSelectableObjectClasses(new Class [] { InitialNode.class, });

    ItemTreeState state = new ItemTreeState();

    Item item = wizard.getContext().getItem();
    Model currentModel = item.getOwningModel();

    if (item instanceof ProcessItem)
    {
      // Open the tree at the target item
      state.addExpandedQualifier(item.getQualifier());
    }
    else
    {
      // Open the tree at the model of the target item
      state.addExpandedQualifier(currentModel.getQualifier());
View Full Code Here


   * @param processType Process type in case of a process item
   * @return The new item
   */
  public static Item createItem(Model model, String suggestedName, String suggestedDisplayName, ItemTypeDescriptor itd, String processType)
  {
    Item item = itd.getItemFactory().createItem(model, suggestedName, suggestedDisplayName);

    if (item instanceof Model)
    {
      initializeModelDirectorySetup((Model) item);
    }
View Full Code Here

    if (tn != null)
    {
      // Perform template-based generation step

      // Search the template file in the chosen template set directory and backwards
      Item item = context.getItem();
      Model model = item.getOwningModel();
      String modelPath = model.getModelPath();

      context.setProperty("modelPath", modelPath);
      context.setProperty("model", model);
      context.setProperty("item", item);
View Full Code Here

      {
        ModelObject mo = ((ProcessElementContainer) figure).getReferredProcessElement();
        Object originalObject = null;

        // Determine the item the figure element references to
        Item referencedItem = null;
        if (mo instanceof SubprocessNode)
        {
          referencedItem = ((SubprocessNode) mo).getSubprocess();
        }

        if (editor() instanceof NodeItemEditorPlugin)
        {
          // We are in the nodeeditor, we need not the process object,
          // but the item behind it
          if (referencedItem != null)
          {
            // Get the reference object for name uniqueness checks
            originalObject = ModelConnector.getInstance().getItemByQualifier(referencedItem.getQualifier(), false);

            // We will edit the referenced item directly
            mo = referencedItem;
          }
        }
        else
        {
          if (mo instanceof MultiSocketNode)
          {
            MultiSocketNode node = (MultiSocketNode) mo;

            // If we edit an activity node, create a configuration bean if not already there
            // in order to be able to edit the settings in the property browser.
            // The bean will be removed if it contains the default values only when saving the activity node again
            // (see plugin_propertybrowser_executesave () in the ModelerEventModule)
            if (node.getConfigurationBean() == null)
            {
              // We create a new configuration bean (if defined by the underlying activity)
              if (referencedItem != null)
              {
                node.setConfigurationBean(referencedItem.createConfigurationBean());
              }
            }
          }
        }
View Full Code Here

          }
        }

        for (Iterator itItems = getModel().getItems(itemType); itItems.hasNext();)
        {
          Item item = (Item) itItems.next();

          if (filterMgr == null || filterMgr.acceptsItem(item))
          {
            if (ungroupedItems == null)
              ungroupedItems = new ArrayList();
            ungroupedItems.add(item);
          }
        }

        if (ungroupedItems != null)
        {
          if (showGroups)
          {
            // Iterate the items and store the grouped one in the group table
            for (Iterator it = ungroupedItems.iterator(); it.hasNext();)
            {
              Item item = (Item) it.next();

              String group = item.getFunctionalGroup();
              if (group != null)
              {
                // Remove the item from the lis of ungrouped items
                it.remove();

                if (groupTable == null)
                {
                  groupTable = new HashMap();
                }

                List items = (List) groupTable.get(group);
                if (items == null)
                {
                  items = new ArrayList();
                  groupTable.put(group, items);
                }
                items.add(item);
              }
            }
          }
        }
      }

      if (ungroupedItems != null && ungroupedItems.size() > 0)
      {
        // Add the ungrouped items to the model node first

        // Sort
        Collections.sort(ungroupedItems, itemComparator);

        // Recurse down
        int nItems = ungroupedItems.size();
        for (int iItems = 0; iItems < nItems; ++iItems)
        {
          Item item = (Item) ungroupedItems.get(iItems);

          ItemNode itemNode = new ItemNode(item, this);
          addChild(itemNode);

          itemNode.addChildObjects();
        }
      }

      if (groupTable != null)
      {
        // Add the item groups

        // Sort the groups
        List groups = CollectionUtil.iteratorToArrayList(groupTable.keySet().iterator());
        Collections.sort(groups);

        // Add the groups to the model node in sorted order
        int nGroups = groups.size();
        for (int iGroups = 0; iGroups < nGroups; ++iGroups)
        {
          String group = (String) groups.get(iGroups);

          List items = (List) groupTable.get(group);

          GroupNode groupNode = new GroupNode(group, this);
          addChild(groupNode);

          Collections.sort(items, itemComparator);

          int nItems = items.size();
          for (int iItems = 0; iItems < nItems; ++iItems)
          {
            Item item = (Item) items.get(iItems);

            ItemNode itemNode = new ItemNode(item, groupNode);
            groupNode.addChild(itemNode);

            itemNode.addChildObjects();
View Full Code Here

   * @throws GeneratorException If one of the necessary requirements is not met.
   * The exception message should describe the problem.
   */
  public void checkRequirements(GeneratorContext context)
  {
    Item item = context.getItem();
    if (requiredItemPropertyList != null && item != null)
    {
      StringBuffer errMsg = null;
      ObjectDescriptor od = null;

      int n = requiredItemPropertyList.size();
      for (int i = 0; i < n; ++i)
      {
        String property = (String) requiredItemPropertyList.get(i);

        Object value = null;
        try
        {
          value = PropertyAccessUtil.getProperty(item, property);
        }
        catch (PropertyException e)
        {
          System.err.println("Cannot access property '" + property + "': " + e);
        }

        if (value == null)
        {
          // Property not present
          if (errMsg == null)
          {
            // Initial text
            errMsg = new StringBuffer("The following required properties of the component have not been set:\n");
            try
            {
              // Get the object descriptor, but skip errors
              od = ObjectDescriptorMgr.getInstance().getDescriptor(item.getClass(), 0);
            }
            catch (XMLDriverException e)
            {
              System.err.println("Cannot access object descriptor for class '" + item.getClass().getName() + "': " + e);
            }
          }
          else
          {
            errMsg.append('\n');
View Full Code Here

    if (! itemBrowser.isPluginFocused())
      // Probably activated using a keyboard shortcut from somewhere else...
      return EVENT_IGNORED;

    // Get the model and the current item
    Item item = itemBrowser.getSelectedItem();

    String msg = itemBrowser.getPluginResourceCollection().getRequiredString(item instanceof Model ? "msg.removemodel" : "msg.removeitem");
    int response = JMsgBox.showFormat(null, msg, item.getQualifier(), JMsgBox.TYPE_YESNO);

    if (response == JMsgBox.TYPE_YES)
    {
      VetoableEvent ve = new VetoableEvent(itemBrowser, "standard.file.askdelete", item.getQualifier());
      itemBrowser.fireEvent(ve);

      if (! ve.isVetoed())
      {
        // Select something different than the current node
View Full Code Here

   * @param jae Event
   * @return The event status code
   */
  public JaspiraEventHandlerCode run(JaspiraActionEvent jae)
  {
    Item item = itemBrowser.getSelectedItem();

    if (item instanceof ProcessItem || item instanceof Model)
    {
      // Fire the event that runs the model
      itemBrowser.fireEvent(new JaspiraEvent(itemBrowser, "debugger.client.run", item));
View Full Code Here

  public JaspiraEventHandlerCode plugin_propertybrowser_executesave(PropertyBrowserSaveEvent oee)
  {
    if (! (oee.original instanceof Item))
      return EVENT_IGNORED;

    Item originalItem = (Item) oee.original;
    Item modifiedItem = (Item) oee.getObject();

    // We fire an ask event to determine if this item is currently beeing edited
    // If so, we will ignore this save request, it will be handled by the editor that edits the item.
    AskEvent ae = new AskEvent(itemBrowser, "global.edit.geteditedinstance", originalItem);
    itemBrowser.fireEvent(ae);
    Item editedItem = (Item) ae.getAnswer();
    if (editedItem != null)
      // We will use the edited item instead of the current one as node provider (may be newer!)
      return EVENT_IGNORED;

    oee.saved = updateItem(originalItem, modifiedItem);
View Full Code Here

  {
    if (e.eventType == ItemTreeEvent.OPEN)
    {
      // Double-click or ENTER ->
      // Simulate a DnD of the item to the currently selected model object
      Item item = getSelectedItem();

      if (item != null && !(item instanceof Model))
      {
        fireEvent("modeler.view.importtoselection", new BasicTransferable(item));
      }
View Full Code Here

TOP

Related Classes of org.openbp.core.model.item.Item

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.