Package org.openbp.jaspira.propertybrowser.nodes

Examples of org.openbp.jaspira.propertybrowser.nodes.AbstractNode


    // No node at this postion or root node selected.
    if (path == null || path.getPathCount() < 2)
      return null;

    AbstractNode treenode = (AbstractNode) path.getLastPathComponent();

    if (treenode != null)
    {
      ObjectNode odn = treenode.getObjectNode();

      if (odn != null && odn.getObject() instanceof ProcessVariable)
      {
        if (!propertyBrowser.saveObject())
          return null;
View Full Code Here


    actions [ACTION_INDEX_ADD] = new JaspiraAction(resourceCollection, "propertybrowser.addelement")
    {
      public void actionPerformed(ActionEvent ae)
      {
        // Add a new node to the collection
        final AbstractNode newPos = addNewNode();
        if (newPos != null)
        {
          // Set the focus to the edit column of the next row (usually the 'name' field of the new node)
          // Adding a new node caused a model change, so select after all model change events have been processed.
          // (Don't ask, it works...)
          SwingUtilities.invokeLater(new Runnable()
          {
            public void run()
            {
              SwingUtilities.invokeLater(new Runnable()
              {
                public void run()
                {
                  selectNode(newPos, 1, 1);
                }
              });
            }
          });
        }
      }
    };

    actions [ACTION_INDEX_COPY] = new JaspiraAction(resourceCollection, "propertybrowser.copyelement")
    {
      public void actionPerformed(ActionEvent ae)
      {
        // Copy the node contents to the clipboard
        copyNode();

        // We have copied something, make sure the paste action reflects this.
        updateActionState();
      }
    };

    actions [ACTION_INDEX_CUT] = new JaspiraAction(resourceCollection, "propertybrowser.cutelement")
    {
      public void actionPerformed(ActionEvent ae)
      {
        // Copy the node contents to the clipboard
        copyNode();

        // Remove the node from the collection
        AbstractNode newPos = removeNode();
        if (newPos != null)
        {
          // Set the focus to the edit column of the next row (usually the 'name' field of the new node)
          selectNode(newPos, 0, 0);
        }

        // We have copied something, make sure the paste action reflects this.
        updateActionState();
      }
    };

    actions [ACTION_INDEX_PASTE] = new JaspiraAction(resourceCollection, "propertybrowser.pasteelement")
    {
      public void actionPerformed(ActionEvent ae)
      {
        // Paste an element from the clipboard to a new node of the collection
        final AbstractNode newPos = pasteNode();
        if (newPos != null)
        {
          // Set the focus to the edit column of the next row (usually the 'name' field of the new node)
          // Adding a new node caused a model change, so select after all model change events have been processed.
          // (Don't ask, it works...)
          SwingUtilities.invokeLater(new Runnable()
          {
            public void run()
            {
              SwingUtilities.invokeLater(new Runnable()
              {
                public void run()
                {
                  selectNode(newPos, 1, 1);
                }
              });
            }
          });
        }
      }
    };

    actions [ACTION_INDEX_REMOVE] = new JaspiraAction(resourceCollection, "propertybrowser.removeelement")
    {
      public void actionPerformed(ActionEvent ae)
      {
        // Remove the node from the collection
        AbstractNode newPos = removeNode();
        if (newPos != null)
        {
          // Set the focus to the edit column of the next row (usually the 'name' field of the new node)
          selectNode(newPos, 0, 0);
        }
View Full Code Here

      // Node not associated with a collection, no popup menu
      return null;
    }

    // Get the node we refer to
    AbstractNode objectNode = cdn == currentNode ? currentNode : currentNode.getObjectNode();

    // Open the path to the collection
    TreePath path = getPathByNode(cdn);
    expandPath(path);

    // Add a new member
    AbstractNode newNode = cdn.addNewNodeAfter(objectNode, null);

    if (newNode != null)
    {
      // Open the new list member
      path = getPathByNode(newNode);
View Full Code Here

  public AbstractNode removeNode()
  {
    if (currentNode == null)
      return null;

    AbstractNode newCurrentNode = currentNode;

    if (currentNode instanceof CollectionNode)
    {
      // Remove all elements of the collection
      String msg = resourceCollection.getRequiredString("propertybrowser.removeall");
      int result = JMsgBox.show(null, msg, JMsgBox.TYPE_YESNO | JMsgBox.DEFAULT_NO);
      if (result != JMsgBox.TYPE_YES)
      {
        return null;
      }

      ((CollectionNode) currentNode).removeAllNodes();

      firePropertyBrowserEvent(new PropertyBrowserEvent(PropertyBrowserEvent.ELEMENT_DELETED, this, currentNode));
    }
    else
    {
      CollectionNode cdn = currentNode.getAssociatedCollectionNode();
      if (cdn == null)
      {
        // Node not associated with a collection, no popup menu
        return null;
      }

      // Get the node we refer to
      AbstractNode objectNode = currentNode.getObjectNode();

      // Make the collection node remove the element
      newCurrentNode = cdn.removeNode(objectNode);

      firePropertyBrowserEvent(new PropertyBrowserEvent(PropertyBrowserEvent.ELEMENT_DELETED, this, objectNode));
View Full Code Here

      // Do nothing
      return null;
    }

    // Get the node we refer to
    AbstractNode objectNode = cdn == currentNode ? currentNode : currentNode.getObjectNode();

    // Open the path to the collection
    TreePath path = getPathByNode(cdn);
    expandPath(path);

    // Add a new member
    AbstractNode newNode = cdn.addNewNodeAfter(objectNode, o);

    firePropertyBrowserEvent(new PropertyBrowserEvent(PropertyBrowserEvent.ELEMENT_PASTED, this, newNode));

    if (newNode != null)
    {
View Full Code Here

    {
      // Node not associated with a collection, no popup menu
      return;
    }

    AbstractNode objectNode = currentNode.getObjectNode();
    cdn.moveNodeUp(objectNode);

    if (saveImmediately)
    {
      fireObjectModified();
View Full Code Here

    {
      // Node not associated with a collection, no popup menu
      return;
    }

    AbstractNode objectNode = currentNode.getObjectNode();
    cdn.moveNodeDown(objectNode);

    if (saveImmediately)
    {
      fireObjectModified();
View Full Code Here

      currentPE.resetComponentDisplay();
    }

    super.changeSelection(newRow, newCol, toggle, extend);

    AbstractNode node = (AbstractNode) getNodeByRow(newRow);
    firePropertyBrowserEvent(new PropertyBrowserEvent(PropertyBrowserEvent.SELECTION_CHANGED, this, node));
  }
View Full Code Here

    boolean canMoveUp = false;
    boolean canMoveDown = false;

    if (cdn != null && cdn != currentNode && cdn.allowsNodeReordering())
    {
      AbstractNode objectNode = currentNode.getObjectNode();

      int index = cdn.getChildIndex(objectNode);
      int n = cdn.getChildCount();

      canMoveUp = n > 1 && index > 0;
View Full Code Here

    // Expansion must be done botton-up, so process the children first
    if (node.getChildCount() >= 0)
    {
      for (Enumeration e = node.children(); e.hasMoreElements();)
      {
        AbstractNode n = (AbstractNode) e.nextElement();
        performDefaultExpansion(n);
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.openbp.jaspira.propertybrowser.nodes.AbstractNode

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.