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

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

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

JTree.addTreeWillExpandListener介绍

暂无

代码示例

代码示例来源:origin: skylot/jadx

tree.addTreeWillExpandListener(new TreeWillExpandListener() {
  @Override
  public void treeWillExpand(TreeExpansionEvent event) {

代码示例来源:origin: pentaho/mondrian

public void setMetaData(JdbcMetaData jdbcMetaData) {
  try {
    this.jdbcMetaData = jdbcMetaData;
    Node rootNode = new Node(null, NodeType.ROOT, null);
    root = new DefaultMutableTreeNode(rootNode);
    for (String schemaName : jdbcMetaData.getAllSchemas()) {
      Node cat = new Node(schemaName, NodeType.CATALOG, null);
      DefaultMutableTreeNode catTreeNode =
        new DefaultMutableTreeNode(cat);
      cat.treeNode = catTreeNode;
      root.add(catTreeNode);
      List<String> tables = jdbcMetaData.getAllTables(schemaName);
      for (String tableName : tables) {
        Node table = new Node(tableName, NodeType.TABLE, null);
        DefaultMutableTreeNode tableTreeNode =
          new DefaultMutableTreeNode(table);
        table.treeNode = tableTreeNode;
        catTreeNode.add(tableTreeNode);
      }
      cat.gotChildren = true;
    }
    rootNode.gotChildren = true;
    treeModel = new DefaultTreeModel(root, true);
    tree.setModel(treeModel);
    tree.addTreeWillExpandListener(this);
    updater = new JTreeUpdater(tree);
  } catch (Exception ex) {
    LOGGER.error(ex);
  }
}

代码示例来源:origin: bcdev/beam

void addWillExpandListener() {
  jTree.addTreeWillExpandListener(new TreeWillExpandListener() {
    @Override
    public void treeWillExpand(final TreeExpansionEvent event) throws ExpandVetoException {
      new SwingWorker<Void, Void>() {
        @Override
        protected Void doInBackground() throws Exception {
          uiContext.updateStatusBar("Loading subtree...");
          uiContext.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
          Object lastPathComponent = event.getPath().getLastPathComponent();
          DefaultMutableTreeNode parent = (DefaultMutableTreeNode) lastPathComponent;
          DefaultMutableTreeNode child = (DefaultMutableTreeNode) parent.getChildAt(0);
          if (CatalogTreeUtils.isCatalogReferenceNode(child)) {
            resolveCatalogReferenceNode(child, true);
          }
          return null;
        }
        @Override
        protected void done() {
          uiContext.updateStatusBar("Ready.");
          uiContext.setCursor(Cursor.getDefaultCursor());
        }
      }.execute();
    }
    @Override
    public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
    }
  });
}

代码示例来源:origin: xyz.cofe/gui.swing

component.addTreeWillExpandListener(ml);

代码示例来源:origin: xSAVIKx/AndroidScreencast

/**
 * Default Constructor
 *
 * @param userObject an Object provided by the user that constitutes the node's data
 * @param tree       the JTree containing this Node
 * @param cancelable
 */
public LazyLoadingTreeNode(Object userObject, JTree tree, boolean cancelable) {
  super(userObject);
  tree.addTreeWillExpandListener(this);
  this.tree = tree;
  this.cancelable = cancelable;
  setAllowsChildren(true);
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime

@Override
public void setUI(JTree tree,
         boolean addExpandTreeListener,
         boolean addOneClickSelectionListener,
         TreeSelectionListener listener,
         TreeWillExpandListener willExpandListener) {
  setUI(tree);
  if (willExpandListener != null) {
    tree.addTreeWillExpandListener(willExpandListener);
  }
  if (addExpandTreeListener) {
    tree.addTreeWillExpandListener(expandListener);
  }
  if (listener != null) {
    tree.addTreeSelectionListener(listener);
  }
  if (addOneClickSelectionListener) {
    tree.addTreeSelectionListener(selectionListener);
  }
}

代码示例来源:origin: xyz.cofe/gui.swing

component.addTreeWillExpandListener(ml);

代码示例来源:origin: sc.fiji/fiji-lib

public void openFrame(String label, DefaultMutableTreeNode node) {
  node(node, label);
  root = new DefaultMutableTreeNode("Root");
  root.add(node);
  JTree tree = new JTree(root);
  tree.setRootVisible(false);
  tree.addTreeWillExpandListener(this);
  JScrollPane pane = new JScrollPane(tree);
  //pane.setMinimumSize(new Dimension(300, 100));
  JFrame frame = new JFrame("Object Inspector");
  frame.setContentPane(pane);
  frame.setMinimumSize(new Dimension(600, 500));
  frame.pack();
  frame.setDefaultCloseOperation(frame.DISPOSE_ON_CLOSE);
  frame.setVisible(true);
}

代码示例来源:origin: org.languagetool/languagetool-gui-commons

static void install(JTree tree) {
 TreeListener listener = new TreeListener(tree);
 tree.addMouseListener(listener);
 tree.addKeyListener(listener);
 tree.addTreeWillExpandListener(listener);
}

代码示例来源:origin: org.jspresso/jspresso-ulc-components-client

/**
 * {@inheritDoc}
 */
@Override
public void restoreState(Anything args) {
 super.restoreState(args);
 JTree basicTree = (JTree) getBasicComponent();
 basicTree.addTreeWillExpandListener(new TreeWillExpandListener() {
  /**
   * {@inheritDoc}
   */
  public void treeWillCollapse(TreeExpansionEvent event) {
   sendOptionalEventULC(
     ExtendedTreeConstants.EXTENDED_TREE_EXPANSION_EVENT,
     ExtendedTreeConstants.EXTENDED_TREE_WILL_COLLAPSE,
     treePathToAnything(event.getPath()));
  }
  /**
   * {@inheritDoc}
   */
  public void treeWillExpand(TreeExpansionEvent event) {
   sendOptionalEventULC(
     ExtendedTreeConstants.EXTENDED_TREE_EXPANSION_EVENT,
     ExtendedTreeConstants.EXTENDED_TREE_WILL_EXPAND,
     treePathToAnything(event.getPath()));
  }
 });
}

代码示例来源:origin: org.jspresso.framework/jspresso-ulc-components-client

/**
 * {@inheritDoc}
 */
@Override
public void restoreState(Anything args) {
 super.restoreState(args);
 JTree basicTree = (JTree) getBasicComponent();
 basicTree.addTreeWillExpandListener(new TreeWillExpandListener() {
  /**
   * {@inheritDoc}
   */
  public void treeWillCollapse(TreeExpansionEvent event) {
   sendOptionalEventULC(
     ExtendedTreeConstants.EXTENDED_TREE_EXPANSION_EVENT,
     ExtendedTreeConstants.EXTENDED_TREE_WILL_COLLAPSE,
     treePathToAnything(event.getPath()));
  }
  /**
   * {@inheritDoc}
   */
  public void treeWillExpand(TreeExpansionEvent event) {
   sendOptionalEventULC(
     ExtendedTreeConstants.EXTENDED_TREE_EXPANSION_EVENT,
     ExtendedTreeConstants.EXTENDED_TREE_WILL_EXPAND,
     treePathToAnything(event.getPath()));
  }
 });
}

代码示例来源:origin: uk.gov.nationalarchives/droid-ui

tree.addTreeWillExpandListener(new ResourceTreeWillExpandListener());
tree.addTreeSelectionListener(new FileTreeSelectionListener());

代码示例来源:origin: digital-preservation/droid

tree.addTreeWillExpandListener(new ResourceTreeWillExpandListener());
tree.addTreeSelectionListener(new FileTreeSelectionListener());

代码示例来源:origin: org.xworker/xworker_core

public static void createTreeWillExpandListeners(ActionContext actionContext){
  Thing self = (Thing) actionContext.get("self");
  JTree parent = (JTree) actionContext.get("parent");
  
  for(Thing child : self.getChilds()){
    TreeWillExpandListener obj = (TreeWillExpandListener) child.doAction("create", actionContext);
    if(obj != null){
      parent.addTreeWillExpandListener(obj);
    }
  }
}

代码示例来源:origin: nroduit/Weasis

tree.addTreeWillExpandListener(new JITreeDiskWillExpandAdapter());

代码示例来源:origin: imagej/ImageJA

pTree.addTreeWillExpandListener(this);

代码示例来源:origin: net.imagej/ij

pTree.addTreeWillExpandListener(this);

代码示例来源:origin: org.netbeans.api/org-openide-explorer

tree.addTreeWillExpandListener(managerListener);

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

tree.addTreeWillExpandListener (managerListener);

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

tree.addTreeWillExpandListener (managerListener);

相关文章

JTree类方法