javax.swing.JTree.validate()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(100)

本文整理了Java中javax.swing.JTree.validate()方法的一些代码示例,展示了JTree.validate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTree.validate()方法的具体详情如下:
包路径:javax.swing.JTree
类名称:JTree
方法名:validate

JTree.validate介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-propertyeditors

public void run() {
    tree.validate();
    targetScroll.validate();
  }
});

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-jsfsupport-designtime

public void run() {
    tree.validate();
    targetScroll.validate();
  }
});

代码示例来源:origin: apache/felix

private void setUnubscribedVariableOf(UPnPDeviceTreeNode selectedNode){
  Enumeration list = selectedNode.children();
  while (list.hasMoreElements()){
    UPnPDeviceTreeNode node =  (UPnPDeviceTreeNode) list.nextElement();
    if (node.category == UPnPDeviceTreeNode.SUBSCRIBED_STATE)
      node.category = UPnPDeviceTreeNode.EVENTED_STATE;
  }
  JTree tree = Mediator.getUPnPDeviceTree();
  tree.validate();
  tree.repaint();
}

代码示例来源:origin: apache/felix

private void setSubscribedVariableOf(UPnPDeviceTreeNode selectedNode){
  Enumeration list = selectedNode.children();
  while (list.hasMoreElements()){
    UPnPDeviceTreeNode node =  (UPnPDeviceTreeNode) list.nextElement();
    if (node.category == UPnPDeviceTreeNode.EVENTED_STATE)
      node.category = UPnPDeviceTreeNode.SUBSCRIBED_STATE;
  }
  JTree tree = Mediator.getUPnPDeviceTree();
  tree.validate();
  tree.repaint();
}

代码示例来源:origin: frenchc/jetm

public void run() {
  model.synchronizeToEtmState();
  performanceGraph.validate();
  performanceGraph.repaint();
 }
});

代码示例来源:origin: org.apache.directory.server/apacheds-xdbm-tools

public void selectTreeNode( Long id )
{
  Stack<TreeNode> stack = new Stack<TreeNode>();
  Object[] comps;
  TreeNode parent = nodes.get( id );
  while ( parent != null && ( parent != parent.getParent() ) )
  {
    stack.push( parent );
    parent = parent.getParent();
  }
  if ( stack.size() == 0 )
  {
    comps = new Object[1];
    comps[0] = root;
  }
  else
  {
    comps = new Object[stack.size()];
  }
  for ( int ii = 0; stack.size() > 0 && ii < comps.length; ii++ )
  {
    comps[ii] = stack.pop();
  }
  TreePath path = new TreePath( comps );
  tree.scrollPathToVisible( path );
  tree.getSelectionModel().setSelectionPath( path );
  tree.validate();
}

代码示例来源:origin: org.apache.directory/com.springsource.org.apache.directory.server.core

public void selectTreeNode( BigInteger id )
{
  Stack stack = new Stack();
  Object[] comps = null;
  TreeNode parent = ( EntryNode ) nodes.get( id );
  while ( parent != null && ( parent != parent.getParent() ) )
  {
    stack.push( parent );
    parent = parent.getParent();
  }
  if ( stack.size() == 0 )
  {
    comps = new Object[1];
    comps[0] = root;
  }
  else
  {
    comps = new Object[stack.size()];
  }
  for ( int ii = 0; stack.size() > 0 && ii < comps.length; ii++ )
  {
    comps[ii] = stack.pop();
  }
  TreePath path = new TreePath( comps );
  tree.scrollPathToVisible( path );
  tree.getSelectionModel().setSelectionPath( path );
  tree.validate();
}

代码示例来源:origin: net.sf.ingenias/editor

private void removeEntityFromTree(DefaultMutableTreeNode dtn,Object entity){
 DefaultMutableTreeNode root=(DefaultMutableTreeNode)this.arbolObjetos.getModel().getRoot();
 DefaultMutableTreeNode node= root.getFirstLeaf();
 while (node!=null){
  if (node.getUserObject()!=null && node.getUserObject() instanceof Entity &&
    ((Entity)node.getUserObject()).getId().equals(((Entity)entity).getId())) {
   DefaultTreeModel dtm=(DefaultTreeModel)arbolObjetos.getModel();
   ((DefaultMutableTreeNode) node.getParent()).remove(node);
   node.removeFromParent();
   node=null;
  } else
   node=node.getNextLeaf();
 }
 this.reload();
 arbolObjetos.validate();
}

代码示例来源:origin: org.jacorb/jacorb

/**
 */
public void valueChanged (TreeSelectionEvent e )
{
// change contentTable only when it's a simple selection
  DefaultMutableTreeNode treeNode =
    (DefaultMutableTreeNode)e.getPath().getLastPathComponent();
  TypeSystemNode node =
    (TypeSystemNode)treeNode.getUserObject();
  contentTable.setModel(typeSystem.getTableModel(treeNode));
  contentTable.clearSelection();
  TableColumnModel tabColMod = contentTable.getColumnModel();
  for (int i=0; i<contentTable.getColumnCount(); i++)
  {
    TableColumn tabCol = tabColMod.getColumn(i);
    tabCol.setCellEditor( null );
    // otherwise columns would be editable
  }
  setSelectedNode(node);
  contentTable.validate();
  treeView.validate();
}

代码示例来源:origin: org.apache.river.examples/browser

public EntryTreePanel(boolean isControllable) {
 this.isControllable = isControllable;
 // Init this panel
 setLayout(new BorderLayout());
 // Init tree node and model (attribute tree nodes)
 root = new ObjectNode(isControllable);
 //initTree();
 model = new DefaultTreeModel(root);
 // Init tree view
 tree = new JTree(model);
 //tree.addMouseListener(new DoubleClicker(this));
 tree.setRootVisible(false);
 ObjectNodeRenderer renderer = new ObjectNodeRenderer();
 tree.setCellRenderer(renderer);
 tree.setRowHeight(0);	// let the renderer handle it
 scrollPane = new JScrollPane(tree);
 add(scrollPane, "Center");
 tree.validate();
 scrollPane.validate();
}

代码示例来源:origin: org.apache.river.examples/browser

public void refreshPanel() {
 // reconstruct nodes
 root.removeAllChildren();
 initTree();
 
 model.nodeStructureChanged(root);
 tree.validate();
 scrollPane.validate();
}

代码示例来源:origin: org.jacorb/jacorb

treeView.validate();

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-propertyeditors

public void sourceBeanChanged(DesignBean bean) {
  if (showingBean == bean) return;
  showingBean = bean;
  if (varNode != null) {
    rootNode.remove(varNode);
    treeModel.reload();
    tree.validate();
    varNode = null;
  }
  if (showingBean != null) {
    DesignBean uiDataBean = findUIDataParentWithVar(showingBean);
    if (uiDataBean != null) {
      varNode = new UIDataVarNode(rootNode, uiDataBean);
      rootNode.add(1, varNode);
      treeModel.reload();
      tree.validate();
    }
  }
  refreshTarget();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-jsfsupport-designtime

public void sourceBeanChanged(DesignBean bean) {
  if (showingBean == bean) return;
  showingBean = bean;
  if (varNode != null) {
    rootNode.remove(varNode);
    treeModel.reload();
    tree.validate();
    varNode = null;
  }
  if (showingBean != null) {
    DesignBean uiDataBean = findUIDataParentWithVar(showingBean);
    if (uiDataBean != null) {
      varNode = new BindingTargetNode.UIDataVarNode(treeModel, uiDataBean);
      rootNode.add(1, varNode);
      treeModel.reload();
      tree.validate();
    }
  }
  refreshTarget();
}

代码示例来源:origin: org.jacorb/jacorb

/**
 * @param typeSystemNode typesystem.TypeSystemNode
 */
public void followTypeOf(TypeSystemNode typeSystemNode)
{
DefaultMutableTreeNode treeNode=null;
if ( typeSystemNode instanceof TypeAssociator )
  {
    TypeSystemNode assTypeNode =
      ((TypeAssociator)typeSystemNode).getAssociatedTypeSystemNode();
    if (assTypeNode.getModelRepresentant(treeModel)!=null)
    {
      treeNode =
        (DefaultMutableTreeNode)assTypeNode.getModelRepresentant(treeModel);
    }
}
if ( treeNode != null )
  {
  // If Node is an AbstractContainer or has an associated
  // TypeSystemNode, jump to the corresponding location in treeView
    DefaultTreeModel treeModel =
      (DefaultTreeModel)treeView.getModel();
    TreePath fullTreePath =
      new TreePath(treeModel.getPathToRoot(treeNode));
    treeView.scrollPathToVisible(fullTreePath);
    // set selection to node
    treeView.setSelectionPath(fullTreePath);
    treeView.validate();
}
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-jsfsupport-designtime

public void sourceContextChanged(DesignContext context) {
  if (showingContext != null && showingContext == context) return;
  showingContext = context;
  rootNode.removeAll();
  rootNode.add(new BindingTargetNode.NullTargetNode(treeModel));
  ArrayList expands = new ArrayList();
  if (context != null && context.getProject() != null) {
    
    //DesignContext[] acs = context.getProject().getDesignContexts();
    DesignContext[] acs = getDesignContexts(context);
    
    acs = sortContexts(acs);
    for (int i = 0; acs != null && i < acs.length; i++) {
      //System.out.println("ADDING NEW CONTEXT: " + context.getDisplayName());
      BindingTargetNode node = new BindingTargetNode.ContextTargetNode(treeModel, acs[i]);
      expands.add(new TreePath(new Object[] {rootNode, node}));
      rootNode.add(node);
    }
  }
  treeModel.reload();
  tree.validate();
  for (int i = 0; i < expands.size(); i++) {
    tree.expandPath((TreePath)expands.get(i));
  }
  refreshTarget();
}

代码示例来源:origin: org.apache.directory/com.springsource.org.apache.directory.server.core

tree.validate();

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-propertyeditors

tree.validate();
for (int i = 0; i < expands.size(); i++) {
  tree.expandPath((TreePath)expands.get(i));

代码示例来源:origin: nu.zoom/eon2

/**
 * Tries to show the given distinguished name in the tree. The tree will
 * expand to show the given name. This will only operate on a cached copy of
 * the directory tree.
 *
 * @param dn
 *            The name to show.
 */
public void showDN(Name dn) {
  if ((treeModel == null) || (treeModel.getRoot() == null)) {
    return;
  }
  DirectoryTreeNode currentLdapTreeNode = (DirectoryTreeNode) treeModel.getRoot();
  TreePath path = new TreePath(currentLdapTreeNode);
  for (int i = 0; i < dn.size(); i++) {
    String namePart = dn.get(i);
    DirectoryTreeNode child = currentLdapTreeNode.getChildWithRDN(namePart);
    if (child != null) {
      path = path.pathByAddingChild(child);
      currentLdapTreeNode = child;
    } else {
      break;
    }
  }
  tree.expandPath(path);
  tree.setSelectionPath(path);
  tree.scrollPathToVisible(path);
  tree.validate();
}

代码示例来源:origin: org.apache.directory.server/apacheds-xdbm-tools

tree.validate();

相关文章

JTree类方法