Examples of TreeModel


Examples of javax.swing.tree.TreeModel

            }
        }
       
        if (treeNode == null)
        {
            TreeModel treeModel = tree.getModelObject();
           
            if (treeModel != null && treeModel.getRoot() != null)
            {
                treeNode = (DefaultMutableTreeNode) treeModel.getRoot();
            }
        }

        if (treeNode == null)
        {
View Full Code Here

Examples of javax.swing.tree.TreeModel

  }

  @RunsInCurrentThread
  @Nonnull TreePath findMatchingPath(@Nonnull JTree tree, @Nonnull String path) {
    String[] pathStrings = splitPath(path);
    TreeModel model = tree.getModel();
    List<Object> newPathValues = newArrayList();
    Object node = model.getRoot();
    int pathElementCount = pathStrings.length;
    for (int stringIndex = 0; stringIndex < pathElementCount; stringIndex++) {
      String pathString = pathStrings[stringIndex];
      Object match = null;
      if (stringIndex == 0 && tree.isRootVisible()) {
        if (!pathString.equals(value(tree, node))) {
          throw pathNotFound(path);
        }
        newPathValues.add(node);
        continue;
      }
      int childCount = model.getChildCount(node);
      for (int childIndex = 0; childIndex < childCount; childIndex++) {
        Object child = model.getChild(node, childIndex);
        if (pathString.equals(value(tree, child))) {
          if (match != null) {
            throw multipleMatchingNodes(pathString, value(tree, node));
          }
          match = child;
View Full Code Here

Examples of javax.swing.tree.TreeModel

     */
    public void renderNode(BridgePeer peer, BridgeRenderContext context,
            Object output, TreePath path, String treePath) throws RenderingException
    {
        JTree tree = (JTree) peer.getComponentObject();
        TreeModel model = tree.getModel();  
        Component com = null;
        Object value = path.getLastPathComponent();
               
        boolean enableFlag = true;
        boolean edit = tree.isEditable();
        if (edit)
        {
            com = (Component)tree.getCellEditor().getTreeCellEditorComponent(tree, value, true, true, model.isLeaf(value), 0);           
        } else
        {
            com = (Component)tree.getCellRenderer().getTreeCellRendererComponent(tree, value, true, true, model.isLeaf(value), 0, true);           
        }
        BridgePeer childPeer = context.getContext().getPeer(com);
        if (childPeer == null)
        {
            tree.add(com);
View Full Code Here

Examples of javax.swing.tree.TreeModel

   * Checks whether the model has been changed, and if so unregister and register listeners.
   */
  private void checkModel()
  {
    // find out whether the model object (the TreeModel) has been changed
    TreeModel model = getModelObject();
    if (model != previousModel)
    {
      if (previousModel != null)
      {
        previousModel.removeTreeModelListener(this);
      }

      previousModel = model;

      if (model != null)
      {
        model.addTreeModelListener(this);
      }
      // model has been changed, redraw whole tree
      invalidateAll();
    }
  }
View Full Code Here

Examples of javax.swing.tree.TreeModel

   *            The tree node
   * @return iterable presentation of node children
   */
  public final Iterator<Object> nodeChildren(Object node)
  {
    TreeModel model = getTreeModel();
    int count = model.getChildCount(node);
    List<Object> nodes = new ArrayList<Object>(count);
    for (int i = 0; i < count; ++i)
    {
      nodes.add(model.getChild(node, i));
    }
    return nodes.iterator();
  }
View Full Code Here

Examples of javax.swing.tree.TreeModel

                                    dirtyPanelSet.clear();
                                }

                                // Now just go ahead and remove the Cell from
                                // the tree.
                                TreeModel m = cellHierarchyTree.getModel();
                                ((DefaultTreeModel) m).removeNodeFromParent(node);
                                cellNodes.remove(cell);
                            }
                        }
                        else if (status == CellStatus.RENDERING) {
View Full Code Here

Examples of javax.swing.tree.TreeModel

   * Checks whether the model has been changed, and if so unregister and register listeners.
   */
  private void checkModel()
  {
    // find out whether the model object (the TreeModel) has been changed
    TreeModel model = getModelObject();
    if (model != previousModel)
    {
      if (previousModel != null)
      {
        previousModel.removeTreeModelListener(this);
      }

      previousModel = model;

      if (model != null)
      {
        model.addTreeModelListener(this);
      }
      // model has been changed, redraw whole tree
      invalidateAll();
    }
  }
View Full Code Here

Examples of javax.swing.tree.TreeModel

   *            The tree node
   * @return iterable presentation of node children
   */
  public final Iterator<Object> nodeChildren(Object node)
  {
    TreeModel model = getTreeModel();
    int count = model.getChildCount(node);
    List<Object> nodes = new ArrayList<Object>(count);
    for (int i = 0; i < count; ++i)
    {
      nodes.add(model.getChild(node, i));
    }
    return nodes.iterator();
  }
View Full Code Here

Examples of net.sf.saxon.om.TreeModel

     * @throws net.sf.saxon.s9api.SaxonApiException
     *          if the Receiver cannot be created
     */

    public Receiver getReceiver(Configuration config) throws SaxonApiException {
        TreeModel model = treeModel;
        if (model == null) {
            model = TreeModel.getTreeModel(config.getTreeModel());
        }
        builder = model.makeBuilder();
        if (baseURI != null) {
            builder.setBaseURI(baseURI.toString());
        }
        builder.setPipelineConfiguration(config.makePipelineConfiguration());
        return builder;
View Full Code Here

Examples of org.apache.myfaces.custom.tree.model.TreeModel

        FacesContext context = FacesContext.getCurrentInstance();

        if (value != null) {
            ValueBinding valueBinding = context.getApplication()
                    .createValueBinding(value);
            TreeModel treeModel = (TreeModel) (valueBinding.getValue(context));

            if (treeModel == null) {
                // create default model
                treeModel = new DefaultTreeModel();
                valueBinding.setValue(context, treeModel);
            }
        }
        int answer = super.doStartTag();
        HtmlTree tree = (HtmlTree) getComponentInstance();

        if (getCreated() && Boolean.parseBoolean(expandRoot)) {
            // component was created, so expand the root node
            TreeModel model = tree.getModel(context);

            if (model != null) {
                tree.expandPath(new TreePath(new Object[] { model.getRoot() }),
                        context);
            }
        }

        tree.addToModelListeners();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.