当前位置: 首页>>代码示例>>Java>>正文


Java TreeSelectionEvent类代码示例

本文整理汇总了Java中javax.swing.event.TreeSelectionEvent的典型用法代码示例。如果您正苦于以下问题:Java TreeSelectionEvent类的具体用法?Java TreeSelectionEvent怎么用?Java TreeSelectionEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TreeSelectionEvent类属于javax.swing.event包,在下文中一共展示了TreeSelectionEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: valueChanged

import javax.swing.event.TreeSelectionEvent; //导入依赖的package包/类
@Override
public void valueChanged(TreeSelectionEvent ev) {
    TreePath[] paths = tree.getSelectionPaths();

    if (paths == null) {
        // part of bugfix #37279, if DnD is active then is useless select a nearby node
        if (ExplorerDnDManager.getDefault().isDnDActive()) {
            return;
        }

        callSelectionChanged(new Node[0]);
    } else {
        // we need to force no changes to nodes hierarchy =>
        // we are requesting read request, but it is not necessary
        // to execute the next action immediatelly, so postReadRequest
        // should be enough
        readAccessPaths = paths;
        Children.MUTEX.postReadRequest(this);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:TreeView.java

示例2: HintsPanel

import javax.swing.event.TreeSelectionEvent; //导入依赖的package包/类
public HintsPanel(HintMetadata preselected, @NullAllowed final CustomizerContext<?, ?> cc, ClassPathBasedHintWrapper cpBased) {
    this.cpBased = cpBased;
    this.queryStatus = cc == null ? QueryStatus.NEVER : QueryStatus.SHOW_QUERIES;
    this.showHeavyInspections = true;
    init(null, true, false, false, false, cc == null, false, cc != null);
    select(preselected);
    configurationsPanel.setVisible(false);
    
    if (cc != null) {
        errorTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
            @Override public void valueChanged(TreeSelectionEvent e) {
                HintMetadata hm = getSelectedHint();

                if (hm != null) {
                    cc.setSelectedId(AnalyzerImpl.ID_JAVA_HINTS_PREFIX + hm.id);
                }
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:HintsPanel.java

示例3: valueChanged

import javax.swing.event.TreeSelectionEvent; //导入依赖的package包/类
@Override
public void valueChanged(TreeSelectionEvent e) {
    if (e.isAddedPath()) {
        otherTreeSelectionModel.clearSelection();
    }
    int idx = treeModel.getIndexOfChild(treeModel.getRoot(), e.getPath().getLastPathComponent());
    if (idx >= 0) {
        if (otherListModel != null) {
            idx += otherListModel.getSize() + 1;
        }
        if (e.isAddedPath()) {
            list.setSelectionInterval(idx, idx);
        } else {
            list.removeSelectionInterval(idx, idx);
        }
    } else {
        list.clearSelection();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:PathsCustomizer.java

示例4: valueChanged

import javax.swing.event.TreeSelectionEvent; //导入依赖的package包/类
@Override
public void valueChanged(TreeSelectionEvent e) {
	TreePath newLeadSelectionPath = e.getNewLeadSelectionPath();
	if (newLeadSelectionPath == null) {
		return;
	}
	Object lastPathComponent = newLeadSelectionPath.getLastPathComponent();
	if (lastPathComponent instanceof ValueSourceTreeNode) {

		ValueSourceTreeNode valueSourceNode = (ValueSourceTreeNode) lastPathComponent;
		// get the selected PVC
		ValueSource selectedValueSource = valueSourceNode.getUserObject();

		if (selectedValueSource == currentValueSource) {
			return;
		}

		// change current PlotValueConfig
		currentValueSource = selectedValueSource;

	} else {
		currentValueSource = null;
	}

}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:26,代码来源:DataTableColumnDropTextFieldTransferHandler.java

示例5: valueChanged

import javax.swing.event.TreeSelectionEvent; //导入依赖的package包/类
@Override
public void valueChanged(TreeSelectionEvent e) {
	TreePath newLeadSelectionPath = e.getNewLeadSelectionPath();
	if (newLeadSelectionPath == null) {
		selectedRangeAxisConfig = null;
		return;
	}
	Object lastPathComponent = newLeadSelectionPath.getLastPathComponent();
	if (lastPathComponent instanceof RangeAxisConfigTreeNode) {

		RangeAxisConfig selectedConfig = ((RangeAxisConfigTreeNode) lastPathComponent).getUserObject();

		selectedRangeAxisConfig = selectedConfig;

		adaptGUI();

	} else {
		selectedRangeAxisConfig = null;
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:21,代码来源:RangeAxisConfigPanel.java

示例6: valueChanged

import javax.swing.event.TreeSelectionEvent; //导入依赖的package包/类
@Override
public void valueChanged(TreeSelectionEvent e) {
	TreePath[] paths = getSelectionPaths();
	// If only one item has been selected, then change the text in the
	// description area
	if (paths == null) {
		return;
	}
	if (paths.length == 1) {
		DefaultMutableTreeNode node = (DefaultMutableTreeNode) paths[0].getLastPathComponent();
		if (!node.getAllowsChildren()) {
			ClusterTreeLeaf leaf = (ClusterTreeLeaf) node.getUserObject();
			ObjectVisualizer viz = ObjectVisualizerService.getVisualizerForObject(clusterModel);
			viz.startVisualization(leaf.getId());
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:18,代码来源:ClusterTreeVisualization.java

示例7: AvailableTreeTable

import javax.swing.event.TreeSelectionEvent; //导入依赖的package包/类
public AvailableTreeTable() {
	super();
	setTreeTableModel(new AvailableTreeTableModel(data.getRoot()));
	sizeColumns();
	setRowHeight(CELL_HEIGHT);
	setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	getTableHeader().setReorderingAllowed(false);

	addTreeSelectionListener(new TreeSelectionListener() {
		@Override
		public void valueChanged(TreeSelectionEvent e) {
			TreePath path = e.getPath();
			TreeTableNode node = (TreeTableNode) path.getLastPathComponent();
			if ("template".equals(node.getType())) {
				tempDownload.setEnabled(true);
			} else {
				tempDownload.setEnabled(false);
			}
		}
	});
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:22,代码来源:TemplateAddingPanel.java

示例8: valueChanged

import javax.swing.event.TreeSelectionEvent; //导入依赖的package包/类
/** Required by TreeSelectionListener interface. */
public void valueChanged(TreeSelectionEvent e) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();

    if (node == null)
        return;

    Object nodeInfo = node.getUserObject();
    if (node.isLeaf()) {
        BookInfo book = (BookInfo) nodeInfo;
        displayURL(book.bookURL);
        if (DEBUG) {
            System.out.print(book.bookURL + ":  \n    ");
        }
    } else {
        displayURL(helpURL);
    }
    if (DEBUG) {
        System.out.println(nodeInfo.toString());
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:22,代码来源:TreeDemo.java

示例9: valueChanged

import javax.swing.event.TreeSelectionEvent; //导入依赖的package包/类
public void valueChanged(TreeSelectionEvent e) {
  super.valueChanged(e);

  final TreePath p = e.getPath();
  if (p != null) {
    final DefaultMutableTreeNode node =
      (DefaultMutableTreeNode) p.getLastPathComponent();

    Object x[] = node.getUserObjectPath();
    Configurable[] userObjectPath = new Configurable[x.length];

    for (int i = 0; i < x.length; i++) {
      userObjectPath[i] = (Configurable) x[i];
    }

    path = ArrayUtils.copyOfRange(userObjectPath, 1, userObjectPath.length);
  }
  else {
    path = null;
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:22,代码来源:ChooseComponentPathDialog.java

示例10: valueChanged

import javax.swing.event.TreeSelectionEvent; //导入依赖的package包/类
/** Required by TreeSelectionListener interface. */
public void valueChanged(TreeSelectionEvent e) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode)
                       tree.getLastSelectedPathComponent();

    if (node == null) return;

    Object nodeInfo = node.getUserObject();
    if (node.isLeaf()) {
        BookInfo book = (BookInfo)nodeInfo;
        displayURL(book.bookURL);
        if (DEBUG) {
            System.out.print(book.bookURL + ":  \n    ");
        }
    } else {
        displayURL(helpURL); 
    }
    if (DEBUG) {
        System.out.println(nodeInfo.toString());
    }
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:22,代码来源:TreeDemo.java

示例11: OurTree

import javax.swing.event.TreeSelectionEvent; //导入依赖的package包/类
/** Construct a Tree object with the given font size. */
public OurTree(int fontSize) {
	Font font = OurUtil.getVizFont().deriveFont((float) fontSize);
	OurTreeRenderer renderer = new OurTreeRenderer(fontSize);
	renderer.setFont(font);
	renderer.invalidate();
	renderer.validate();
	setRowHeight(0); // To allow variable row height on Mac OS X
	setCellRenderer(renderer);
	setFont(font);
	setBorder(new EmptyBorder(8, 8, 2, 2));
	getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
	putClientProperty("JTree.lineStyle", "Angled");
	setRootVisible(true);
	setForeground(Color.BLACK);
	setBackground(Color.WHITE);
	setOpaque(true);
	addTreeSelectionListener(new TreeSelectionListener() {
		public void valueChanged(TreeSelectionEvent e) {
			TreePath path = OurTree.this.getSelectionPath();
			if (path != null)
				OurTree.this.listeners.fire(OurTree.this, Listener.Event.CLICK, path.getLastPathComponent());
		}
	});
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:26,代码来源:OurTree.java

示例12: valueChanged

import javax.swing.event.TreeSelectionEvent; //导入依赖的package包/类
/**
 * Emphasises/deemphasises cells in the associated jmodel, based on the list
 * selection.
 */
@Override
public void valueChanged(TreeSelectionEvent e) {
    Set<JCell<?>> emphSet = new HashSet<>();
    TreePath[] selectionPaths = getSelectionPaths();
    if (selectionPaths != null) {
        for (TreePath selectedPath : selectionPaths) {
            Object treeNode = selectedPath.getLastPathComponent();
            if (treeNode instanceof LabelTree.EntryNode) {
                Entry entry = ((EntryNode) treeNode).getEntry();
                Set<JCell<G>> occurrences = getFilter().getJCells(entry);
                if (occurrences != null) {
                    emphSet.addAll(occurrences);
                }
            }
        }
    }
    this.jGraph.setSelectionCells(emphSet.toArray());
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:23,代码来源:LabelTree.java

示例13: createInnerComponent

import javax.swing.event.TreeSelectionEvent; //导入依赖的package包/类
protected void createInnerComponent() {
    panel.removeAll();
    Attribute[] attributes = getAttributes();
    RootCreater rootCreater = getRootCreater();

    component = new RowTreeTableComponent(engine, qualifier, accessRules,
            rootCreater, attributes, framework);

    rowSet = component.getRowSet();
    table = component.getTable();

    table.getTreeSelectionModel().addTreeSelectionListener(
            new TreeSelectionListener() {
                @Override
                public void valueChanged(TreeSelectionEvent e) {
                    refreshActions();
                }
            });
    refreshActions();
    panel.add(component, BorderLayout.CENTER);
    panel.revalidate();
    panel.repaint();
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:24,代码来源:AbstractTableView.java

示例14: valueChanged

import javax.swing.event.TreeSelectionEvent; //导入依赖的package包/类
/**
 * This function analyses a tree selection event and calls the
 * right methods to take care of building the requested unit's
 * details.
 *
 * @param event The incoming TreeSelectionEvent.
 */
@Override
public void valueChanged(TreeSelectionEvent event) {
    detailPanel.removeAll();
    DefaultMutableTreeNode node
        = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
    if (node != null) {
        if (node.isLeaf()) {
            OptionGroup group = (OptionGroup) node.getUserObject();
            for (Option option : group.getOptions()) {
                addOptionUI(option, editable && group.isEditable());
            }
        } else {
            tree.expandPath(event.getPath());
        }
    }
    detailPanel.revalidate();
    detailPanel.repaint();
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:26,代码来源:OptionGroupUI.java

示例15: valueChanged

import javax.swing.event.TreeSelectionEvent; //导入依赖的package包/类
@Override
public void valueChanged(TreeSelectionEvent evt) {
    // Get all nodes whose selection status has changed
    TreePath[] paths = evt.getPaths();

    if (paths.length > 0
            && evt.isAddedPath(0)
            && paths[0].getLastPathComponent() instanceof DefaultMutableTreeNode) {
        if (((DefaultMutableTreeNode) paths[0].getLastPathComponent())
                .isLeaf()
                && !((DefaultMutableTreeNode) paths[0]
                .getLastPathComponent()).isRoot()) {
            // a leaf has been selected, allow delete relation
            deleteRelationButton.setEnabled(true);
        } else {
            deleteRelationButton.setEnabled(false);
        }
    }

}
 
开发者ID:CLARIN-PL,项目名称:WordnetLoom,代码行数:21,代码来源:ViwnLexicalUnitRelationsViewUI.java


注:本文中的javax.swing.event.TreeSelectionEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。