Package org.openbp.core.model.item

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


        break;
      }
    }
    else
    {
      Item item;
      Model model;
      switch (mode)
      {
      case ModelNotificationService.ADDED:
        item = readItemFromStore(qualifier);
        if (item != null)
        {
          model = item.getModel();
          model.addItem(item);
        }
        break;

      case ModelNotificationService.UPDATED:
        item = getItemByQualifier(qualifier, false);
        if (item != null)
        {
          reloadItemAfterModelUpdate(item);
        }
        break;

      case ModelNotificationService.REMOVED:
        item = getItemByQualifier(qualifier, false);
        if (item != null)
        {
          model = item.getModel();
          model.removeItem(item);
        }
        break;
      }
    }
View Full Code Here


  private void copyItems(Model newModel, Model model, String itemType, ModelMgr mgr)
    throws Exception
  {
    for (Iterator it = model.getItems(itemType); it.hasNext();)
    {
      Item item = (Item) it.next();
      Item newItem = (Item) item.clone();
      mgr.addItem(newModel, newItem, true);
    }
  }
View Full Code Here

    for (Iterator itTypes = itemTable.values().iterator(); itTypes.hasNext();)
    {
      Map items = (Map) itTypes.next();
      for (Iterator itItems = items.values().iterator(); itItems.hasNext();)
      {
        Item item = (Item) itItems.next();

        item.setModel(this);

        item.maintainReferences(flag);

        if ((flag & INSTANTIATE_ITEM) != 0)
        {
          // Instantiate classes referenced by the item
          item.instantiate();
        }
      }
    }
  }
View Full Code Here

   * Note that the appropriate subclass of the {@link Item} class will be returned.
   * @throws OpenBPException If the item does not exist
   */
  public Item getItem(String itemName, String itemType, boolean required)
  {
    Item item = null;

    Map items = (Map) itemTable.get(itemType);
    if (items != null)
      item = (Item) items.get(itemName);

View Full Code Here

  {
    // Copy iterator data to list in order to prevent concurrent modification exception
    Collection coll = CollectionUtil.collection(model.getItems(null));
    for (Iterator it = coll.iterator(); it.hasNext();)
    {
      Item item = (Item) it.next();
      removeItemFromStore(item);
    }

    String modelPath = model.getModelPath();
    String filePath = StringUtil.buildPath(modelPath, CoreConstants.FILE_MODEL_DESCRIPTOR);
View Full Code Here

  protected void reloadItemAfterModelUpdate(Item item)
  {
    String itemType = item.getItemType();
    ItemTypeDescriptor itd = getItemTypeDescriptor(itemType);

    Item newItem = readItemFromStore(item.getModel(), item.getName(), itd);
    try
    {
      item.copyFrom(newItem, Copyable.COPY_SHALLOW);
    }
    catch (CloneNotSupportedException e)
View Full Code Here

    for (int i = 0; i < fileNames.length; ++i)
    {
      String itemName = fileNames[i].substring(0, fileNames[i].lastIndexOf('.'));

      Item item = readItemFromStore(model, itemName, itd);
      if (item != null)
      {
        // Add the item to the model
        try
        {
          model.addItem(item);
        }
        catch (ModelException e)
        {
          getMsgContainer().addMsg(model, "Error adding component $0 to model $1 in model manager $2.", new Object[]
          {
            item.getName(), model.getName(), getClass().getName(), e
          });
        }
      }
    }
  }
View Full Code Here

  // @@ Comparator implementation
  //////////////////////////////////////////////////

  public int compare(Object o1, Object o2)
  {
    Item i1 = (Item) o1;
    Item i2 = (Item) o2;

    if (itemTypes != null)
    {
      String type1 = i1.getItemType();
      String type2 = i2.getItemType();
      if (!type1.equals(type2))
      {
        int n1 = getTypeIndex(type1);
        int n2 = getTypeIndex(type2);

        return n1 - n2;
      }
    }

    String s1;
    String s2;

    if (DisplayObjectPlugin.getInstance().isTitleModeText())
    {
      s1 = i1.getDisplayText();
      s2 = i2.getDisplayText();
    }
    else
    {
      s1 = i1.getName();
      s2 = i2.getName();
    }

    return s1.compareTo(s2);
  }
View Full Code Here

    // Check if there is a configuration bean associated with this type of node
    if (node instanceof MultiSocketNode)
    {
      // Determine the item the figure element references to
      Item referencedItem = null;
      if (node instanceof SubprocessNode)
      {
        referencedItem = ((SubprocessNode) node).getSubprocess();
      }
      else if (node instanceof ActivityNode)
      {
        // TODO Feature 4 Configuration bean not supported currently due to removal of ActivityNode->ActivityItem reference
        // referencedItem = ((ActivityNode) node).getActivity();
      }

      if (referencedItem != null && referencedItem.getConfigurationClassName() != null)
        return true;
    }

    return false;
  }
View Full Code Here

    if (node instanceof MultiSocketNode)
    {
      MultiSocketNode msNode = (MultiSocketNode) node;

      // Determine the item the figure element references to
      Item referencedItem = null;
      if (node instanceof SubprocessNode)
      {
        referencedItem = ((SubprocessNode) node).getSubprocess();
      }
      else if (node instanceof ActivityNode)
      {
        // TODO Feature 4 Configuration bean not supported currently due to removal of ActivityNode->ActivityItem reference
        // referencedItem = ((ActivityNode) node).getActivity();
      }

      // Check if we shall display the settings in the wizard or not
      // (applies only for new nodes, i. e. if refering to the default entry socket)
      if (socketName == null && referencedItem != null && ! referencedItem.isHideSettingsInWizard())
      {
        // 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 ConfigurationBeanPage)
        configurationBean = msNode.getConfigurationBean();
        if (configurationBean == null)
        {
          // We create a new configuration bean (if defined by the underlying activity)
          if (referencedItem != null)
          {
            configurationBean = referencedItem.createConfigurationBean();
          }
        }
      }
    }
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.