Package org.openbp.core.model.item

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


    try
    {
      clearPages();

      Item item = context.getItem();

      // Add the generator selection page only if the item does not contain generator info
      if (context.getSelectedGenerator() == null)
      {
        // Check if there are any generators defined for this item type that operate on items of this type
        List list = GeneratorMgr.getInstance().getGenerators(item.getItemType(), true);
        if (list != null)
        {
          // Create the selection page displaying all available
          // generators and add it to the wizard
          int n = list.size();
View Full Code Here


      // Restore the current focus
      focusedPlugin.focusPlugin();
    }

    // The the edited item and reset the item member for garbage collection
    Item ret = context.getItem();
    context = null;
    return ret;
  }
View Full Code Here

        else
        {
          clearPropertyBrowser();
        }

        Item item = context.getItem();

        if (context.isNewItem() && !context.isItemSaved() && !failed)
        {
          // Check if the item already exists if not created yet
          try
          {
            ModelQualifier itemQualifier = item.getQualifier();

            if (item instanceof Model)
            {
              if (ModelConnector.getInstance().getOptionalModelByQualifier(itemQualifier) != null)
              {
View Full Code Here

     * true: Save successful.<br>
     * false: Save failed.
     */
    public boolean executeSave(PropertyBrowser pb)
    {
      Item modifiedItem = (Item) pb.getModifiedObject();

      try
      {
        context.getItem().copyFrom(modifiedItem, Copyable.COPY_FIRST_LEVEL);
      }
View Full Code Here

     * Sets the object to edit in the property browser.
     */
    private void initializePropertyBrowser()
    {
      GeneratorContext context = getContext();
      Item item = context.getItem();

      PropertyBrowser oe = getPropertyBrowser();
      oe.setObjectModified(false);
      oe.setOriginalObject(context.getOriginalItem());

      try
      {
        if (context.isNewItem() && !context.isItemSaved())
        {
          // Make the object name editable if it's a new item

          // Create the property browser tree and clone it
          ObjectNode rootNode = NodeStructureMgr.getInstance().createEditorStructureFor(item.getClass());

          // Set the read-only property of the 'Name' property to false
          changeReadOnlyModeOfPropertyDescriptor(rootNode, "Name", false);
          // TODO Feature 3 Allow for selecting the model for new items; implement setOwningModelQualifier
          // changeReadOnlyModeOfPropertyDescriptor(rootNode, "OwningModelQualifier", false);
View Full Code Here

      {
        // Add the itemtype to the tree as a group
        PropertyNode objectPathNode = new PropertyNode();
        try
        {
          Item item = ModelConnector.getInstance().getItemByQualifier(qualifier, true);
          objectPathNode.setNodeMapper(displayMapper);
          objectPathNode.setPropertyData(item);
        }
        catch (OpenBPException e)
        {
View Full Code Here

   *
   * @return The selected item or the item of the selected item or null
   */
  public Item getSelectedItem()
  {
    Item ret = null;

    List list = itemTree.getSelectedObjects();
    if (list != null)
    {
      int n = list.size();
      for (int i = 0; i < n; ++i)
      {
        Object o = list.get(i);

        if (o instanceof Item)
        {
          Item item = (Item) o;

          if (ret != null && ret != item)
          {
            // More than 1 item selected will be treated as 'no item selected'.
            return null;
View Full Code Here

  public boolean canCopy()
  {
    // We can copy/cut if there is an item on the clipboard.
    // Not supported for models.
    Item item = getSelectedItem();
    return item != null && !(item instanceof Model);
  }
View Full Code Here

        int dotIndex = itemPath.lastIndexOf(".");
        if (folderIndex > 0 && dotIndex > 0)
        {
          String itemName = itemPath.substring(folderIndex + 1, dotIndex);

          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

    // to the item contained already in the model in order not to loose
    // relations to any dependent objects that might be contained in
    // or referenced by the item

    // Get the item that belongs to the model
    Item currentItem = getItemByQualifier(argItem.getQualifier(), true);

    // Update the model item from the argument item
    // Perform a flat copy only, the contained objects will remain the same
    try
    {
      // copyFrom will overwrite the parent model information; save it
      Model currentModel = currentItem.getModel();

      // Copy the item data
      currentItem.copyFrom(argItem, Copyable.COPY_DEEP);

      // Repair hiearchy and establish links
      currentItem.setModel(currentModel);
      currentItem.maintainReferences(ModelObject.RESOLVE_GLOBAL_REFS | ModelObject.RESOLVE_LOCAL_REFS);
    }
    catch (CloneNotSupportedException e)
    {
      throw new ModelException("Clone", "Cannot update component '" + currentItem.getQualifier() + "': " + e.getMessage());
    }

    // Save the item file
    saveItemToStore(currentItem);

    // Instantiate classes referenced by the item if we are expected to
    if (isInstantiateItems())
    {
      currentItem.instantiate();
    }
  }
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.