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


Java DefaultTreeModel.nodeChanged方法代码示例

本文整理汇总了Java中javax.swing.tree.DefaultTreeModel.nodeChanged方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultTreeModel.nodeChanged方法的具体用法?Java DefaultTreeModel.nodeChanged怎么用?Java DefaultTreeModel.nodeChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.tree.DefaultTreeModel的用法示例。


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

示例1: toggle

import javax.swing.tree.DefaultTreeModel; //导入方法依赖的package包/类
private boolean toggle(TreePath treePath) {
    
    if( treePath == null ) {
        return false;
    }

    Object o = ((DefaultMutableTreeNode)treePath.getLastPathComponent()).getUserObject();

    DefaultTreeModel dtm = (DefaultTreeModel)cfgTree.getModel();
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) treePath.getLastPathComponent();

    if ( o instanceof Item ) {
        Item item = (Item)o;
        
        if ( node.getAllowsChildren() ) {
            return false;
        }
        
        item.value = !item.value;            
        dtm.nodeChanged(node);
        dtm.nodeChanged(node.getParent());
        scs.notifyChanged();
    }
    
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:FmtSpaces.java

示例2: updateNotificationsNodeLabel

import javax.swing.tree.DefaultTreeModel; //导入方法依赖的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();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:XSheet.java

示例3: circuitChanged

import javax.swing.tree.DefaultTreeModel; //导入方法依赖的package包/类
@Override
public void circuitChanged(CircuitEvent event) {
	int action = event.getAction();
	DefaultTreeModel model = (DefaultTreeModel) getModel();
	if (action == CircuitEvent.ACTION_SET_NAME) {
		model.nodeChanged(this);
	} else {
		if (computeChildren()) {
			model.nodeStructureChanged(this);
		} else if (action == CircuitEvent.ACTION_INVALIDATE) {
			Object o = event.getData();
			for (int i = children.size() - 1; i >= 0; i--) {
				Object o2 = children.get(i);
				if (o2 instanceof ComponentNode) {
					ComponentNode n = (ComponentNode) o2;
					if (n.comp == o) {
						int[] changed = { i };
						children.remove(i);
						model.nodesWereRemoved(this, changed, new Object[] { n });
						children.add(i, new ComponentNode(this, n.comp));
						model.nodesWereInserted(this, changed);
					}
				}
			}
		}
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:28,代码来源:ComponentSelector.java

示例4: ElistTablePanel

import javax.swing.tree.DefaultTreeModel; //导入方法依赖的package包/类
public ElistTablePanel(GUIFramework framework, Qualifier qualifier) {
    leafIcon = new ImageIcon(getClass().getResource(
            "/com/ramussoft/gui/table/sheet.png"));
    folderIcon = new ImageIcon(getClass().getResource(
            "/com/ramussoft/gui/table/folder.png"));
    folderSheetIcon = new ImageIcon(getClass().getResource(
            "/com/ramussoft/gui/table/folder-sheet.png"));
    setRootVisible(false);
    List<Attribute> list = qualifier.getAttributes();
    if (list.size() > 0)
        attribute = list.get(0);
    for (Attribute attr : list) {
        if (attr.getId() == qualifier.getAttributeForName()) {
            attribute = attr;
            break;
        }
    }
    Attribute[] attributes;
    if (attribute != null)
        attributes = new Attribute[]{attribute};
    else
        attributes = new Attribute[]{};
    rowSet = new RowSet(framework.getEngine(), qualifier, attributes) {

        @Override
        protected void removedFromChildren(Row parentRow, Row row, int i) {
            try {
                model.nodesWereRemoved(parentRow, new int[]{i},
                        new Object[]{row});
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        @Override
        protected void added(Row parent, final Row row, int index) {
            super.added(parent, row, index);
            if (parent == null)
                parent = getRoot();
            try {
                model.nodesWereInserted(parent, new int[]{index});
                expandPath(new TreePath(model.getPathToRoot(parent)));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        @Override
        protected void attributeChanged(Row row, Attribute attr,
                                        Object newValue, Object oldValue, boolean journaled) {
            if (attribute.getId() == attr.getId()) {
                try {
                    model.nodeChanged(row);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    };

    model = new DefaultTreeModel(rowSet.getRoot());
    setModel(model);
    for (int i = 0; i < getRowCount(); i++)
        expandRow(i);
    setRowHeight(ElistTableTabView.CELL_BORDER);
    this.addMouseMotionListener(new MouseMotionAdapter() {
        @Override
        public void mouseMoved(MouseEvent e) {
            setToolTipText(getToolTipText(e));
        }
    });

    setCellRenderer(renderer);
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:75,代码来源:ElistTablePanel.java


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