本文整理汇总了Java中javax.swing.tree.DefaultMutableTreeNode.setUserObject方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultMutableTreeNode.setUserObject方法的具体用法?Java DefaultMutableTreeNode.setUserObject怎么用?Java DefaultMutableTreeNode.setUserObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.tree.DefaultMutableTreeNode
的用法示例。
在下文中一共展示了DefaultMutableTreeNode.setUserObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateNotificationsNodeLabel
import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
/**
* Update the label of the supplied MBean tree node.
*/
// Call on EDT
private void updateNotificationsNodeLabel(
DefaultMutableTreeNode node, String label) {
synchronized (mbeansTab.getTree()) {
invalidate();
XNodeInfo oldUserObject = (XNodeInfo) node.getUserObject();
XNodeInfo newUserObject = new XNodeInfo(
oldUserObject.getType(), oldUserObject.getData(),
label, oldUserObject.getToolTipText());
node.setUserObject(newUserObject);
DefaultTreeModel model =
(DefaultTreeModel) mbeansTab.getTree().getModel();
model.nodeChanged(node);
validate();
repaint();
}
}
示例2: traverseFileSystem
import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private void traverseFileSystem(Entry poifsNode, DefaultMutableTreeNode treeNode) throws TreeModelLoadException {
final String qualifier;
if (poifsNode.getParent() == null) {
qualifier = "OLERootEntry";
} else if (poifsNode instanceof DirectoryNode) {
qualifier = "OLEDirEntry";
} else {
qualifier = "OLEEntry";
}
treeNode.setUserObject(appContext.getBean(qualifier, poifsNode, treeNode));
if (poifsNode instanceof DirectoryNode) {
for (Entry poifsChild : ((DirectoryNode)poifsNode)) {
DefaultMutableTreeNode treeChild = new DefaultMutableTreeNode();
treeNode.add(treeChild);
traverseFileSystem(poifsChild, treeChild);
}
}
}
示例3: removeMultiple
import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
@Override
protected void removeMultiple(DefaultMutableTreeNode node){
// --- Remind all needed informations -------------------------------------------
DefaultMutableTreeNode previousNode = node.getPreviousNode();
DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) node.getParent();
DynType dt = (DynType) node.getUserObject();
JPanel deletePanel = dt.getPanel();
JPanel parentPanel = (JPanel) deletePanel.getParent();
int movement = (deletePanel.getHeight() + 2) * (-1);
// --- Remove node from the parent node and panel -------------------------------
DynType dyntype = (DynType) node.getUserObject();
node.setUserObject(null);
parentNode.remove(node);
this.getTreeNodesByDynType().remove(dyntype);
// --- remove the panel from the parent -----------------------------------------
parentPanel.remove(deletePanel);
parentPanel.validate();
this.setPanelBounds(parentPanel);
// --- Now move the rest of the elements on the form ----------------------------
this.moveAfterAddOrRemove(movement, previousNode);
// --- refresh the GUI ----------------------------------------------------------
this.adjustPreferredSize();
}
示例4: editRayAction
import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
/**
* Shows the a dialog allowing the user to edit the ray.
*/
private void editRayAction() {
// getProperty the currently selected body
TreePath path = this.tree.getSelectionPath();
// make sure something is selected
if (path != null) {
// getProperty the selected node
DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
// make sure its a ray that is selected
if (node.getUserObject() instanceof SandboxRay) {
// getProperty the ray from the node
SandboxRay ray = (SandboxRay) node.getUserObject();
// show the right dialog
synchronized (Simulation.LOCK) {
SandboxRay nRay = EditRayDialog.show(ControlUtilities.getParentWindow(this), ray);
this.simulation.getRays().remove(ray);
this.simulation.getRays().add(nRay);
node.setUserObject(nRay);
}
}
}
}
示例5: addSection
import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private void addSection(final Section section, final DefaultMutableTreeNode parent, final PropertySet ps) {
DefaultMutableTreeNode secNode = new DefaultMutableTreeNode();
final HPSFSection secModel = appContext.getBean(HPSFSection.class, section, secNode);
secNode.setUserObject(secModel);
parent.add(secNode);
for (final Property p : section.getProperties()) {
addProperty(p, secNode, ps);
}
}
示例6: addProperty
import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private void addProperty(final Property property, final DefaultMutableTreeNode parent, final PropertySet ps) {
DefaultMutableTreeNode propNode = new DefaultMutableTreeNode();
final HPSFProperty propModel = appContext.getBean(HPSFProperty.class, property, propNode);
propModel.setPropertySet(ps);
propNode.setUserObject(propModel);
parent.add(propNode);
}
示例7: load
import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
@Override
public void load(Object source) throws TreeModelLoadException {
try {
ppt = new HSLFSlideShow((DirectoryNode)source);
final DefaultMutableTreeNode slNode = getNamedTreeNode(parent, HSLFSlideShow.POWERPOINT_DOCUMENT);
HSLFRootEntry rootNode = appContext.getBean(HSLFRootEntry.class, ppt, slNode);
slNode.setUserObject(rootNode);
loadRecords(slNode,ppt.getSlideShowImpl().getRecords());
final DefaultMutableTreeNode picNode = getNamedTreeNode(parent, "Pictures");
loadPictures(picNode);
loadCurrentUser(parent);
} catch (IOException e) {
throw new TreeModelLoadException("Can't load HSLF slideshow",e);
}
}
示例8: loadRecords
import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private void loadRecords(final DefaultMutableTreeNode parentNode, final Record[] records) {
for (final Record r : records) {
final String qualifier;
if (r instanceof RecordContainer) {
qualifier = "HSLFDirEntry";
} else if (r instanceof PPDrawing) {
qualifier = "HSLFDrawing";
} else {
qualifier = "HSLFEntry";
}
final DefaultMutableTreeNode childNode = new DefaultMutableTreeNode();
final TreeModelEntry dirEntry = (TreeModelEntry)appContext.getBean(qualifier, r, childNode);
childNode.setUserObject(dirEntry);
parentNode.add(childNode);
if (r instanceof RecordContainer) {
loadRecords(childNode, ((RecordContainer)r).getChildRecords());
} else if (r instanceof PPDrawing) {
loadEscherRecords(childNode, ((PPDrawing)r).getEscherRecords());
} else if (r instanceof PPDrawingGroup) {
loadEscherRecords(childNode, Collections.singletonList(((PPDrawingGroup)r).getDggContainer()));
} else if (r instanceof ExOleObjStg) {
loadOleEmbed(childNode, (ExOleObjStg)r);
} else if (r instanceof TxMasterStyleAtom) {
loadTextProp(childNode, "characterStyles", ((TxMasterStyleAtom)r).getCharacterStyles());
loadTextProp(childNode, "paragraphStyles", ((TxMasterStyleAtom)r).getParagraphStyles());
}
}
}
示例9: refreshInterfaceList
import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private void refreshInterfaceList() {
this.interfacesRootNode.removeAllChildren();
int i = this.currClassFile.interfaces.getInterfacesCount();
for (int j = 0; j < i; j++) {
String str = this.currClassFile.interfaces.getInterfaceName(j);
DefaultMutableTreeNode localDefaultMutableTreeNode = new DefaultMutableTreeNode(str);
localDefaultMutableTreeNode.setUserObject(str);
this.interfacesRootNode.add(localDefaultMutableTreeNode);
}
this.treeInterfaces.setModel(new DefaultTreeModel(this.interfacesRootNode));
}
示例10: loadPictures
import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private void loadPictures(final DefaultMutableTreeNode parentNode) {
for (HSLFPictureData p : ppt.getPictureData()) {
final DefaultMutableTreeNode childNode = new DefaultMutableTreeNode();
final HSLFPictureEntry pic = appContext.getBean(HSLFPictureEntry.class, p, childNode);
childNode.setUserObject(pic);
parentNode.add(childNode);
}
}
示例11: loadEscherRecords
import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private void loadEscherRecords(final DefaultMutableTreeNode parentNode, List<EscherRecord> records) {
for (EscherRecord r : records) {
final DefaultMutableTreeNode childNode = new DefaultMutableTreeNode();
final HSLFEscherRecord escher = appContext.getBean(HSLFEscherRecord.class, r, childNode);
childNode.setUserObject(escher);
parentNode.add(childNode);
if (r instanceof EscherContainerRecord) {
loadEscherRecords(childNode, ((EscherContainerRecord)r).getChildRecords());
} else if (r instanceof HSLFEscherClientDataRecord) {
final List<? extends Record> hslfRecords = ((HSLFEscherClientDataRecord)r).getHSLFChildRecords();
loadRecords(childNode, hslfRecords.toArray(new Record[hslfRecords.size()]));
}
}
}
示例12: load
import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
@Override
public void load(Object source) throws TreeModelLoadException {
try {
wb = new HSSFWorkbook((DirectoryNode)source, true);
final DefaultMutableTreeNode wbNode = getNamedTreeNode(parent, InternalWorkbook.WORKBOOK_DIR_ENTRY_NAMES);
HSSFRootEntry rootNode = appContext.getBean(HSSFRootEntry.class, wb, wbNode);
wbNode.setUserObject(rootNode);
loadRecords(wbNode, wb.getInternalWorkbook().getRecords());
} catch (IOException e) {
throw new TreeModelLoadException("Can't load HSSF workbook",e);
}
}
示例13: dimensionConfigAdded
import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private void dimensionConfigAdded(PlotDimension dimension, DimensionConfig dimensionConfig) {
PlotConfigurationTreeNode root = (PlotConfigurationTreeNode) this.root;
DefaultMutableTreeNode child = (DefaultMutableTreeNode) root.getChild(dimension);
child.setUserObject(dimensionConfig);
// change selection path
TreePath path = new TreePath(getPathToRoot(child));
makeVisibleAndSelect(path);
}
示例14: initComponents
import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private void initComponents() {
TreeDemo demo = new TreeDemo();
JTree tree = (JTree) ComponentUtils.findComponent(JTree.class, demo);
DefaultMutableTreeNode root = (DefaultMutableTreeNode) tree.getModel().getRoot();
root.setUserObject("Root node [] , / Special");
Container contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
contentPane.add(new JButton("Click-Me"), BorderLayout.NORTH);
contentPane.add(demo, BorderLayout.CENTER);
setSize(640, 480);
setLocation(100, 100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
示例15: getDependencyTree
import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private DefaultMutableTreeNode getDependencyTree(Dependency dependency) throws Exception
{
DefaultMutableTreeNode rootnode = new DefaultMutableTreeNode();
if(dependency.isDirect())
{
AIndicator indi = getIndicatorClass(dependency.getDependency()).getConstructor(null).newInstance(null);
rootnode.setUserObject(indi);
Dependency[] deps = indi.getDependencies();
if(deps!=null)
{
for(Dependency dep:deps)
{
rootnode.add(getDependencyTree(dep));
}
}
}
else
{
rootnode.setUserObject(dependency);
for(String indicator: dependency.getDependencies())
{
//Dependency d = dependency.clone();
//d.setDependency(indicator);
// d ist hier immer indirect dependency, folglich wird getDependencyTree immer wieder aufgerufen
// spontan:
Dependency d = new Dependency(indicator);
// muss aber noch den rest des codes checken
rootnode.add(getDependencyTree(d));
}
}
return rootnode;
}