Java Code Examples for org.openide.nodes.Node#setValue()

The following examples show how to use org.openide.nodes.Node#setValue() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: netbeans   File: ViewUtilTest.java    License: Apache License 2.0 5 votes vote down vote up
public void testRenameForSlowNode() {
    Node n = new AbstractNode(Children.LEAF) {
        boolean renamed;
        
        @Override
        public synchronized void setName(String s) {
            renamed = true;
            notifyAll();
            assertFalse("Not in AWT", EventQueue.isDispatchThread());
            super.setName(s);
        }

        @Override
        public synchronized String toString() {
            while (!renamed) {
                try {
                    wait();
                } catch (InterruptedException ex) {
                    Exceptions.printStackTrace(ex);
                }
            }
            return super.getName();
        }
    };

    n.setValue("slowRename", true);
    ViewUtil.nodeRename(n, "newName");
    assertEquals("newName", n.toString());
}
 
Example 2
Source Project: netbeans   File: Installer.java    License: Apache License 2.0 5 votes vote down vote up
private void procesLog(LogRecord r, LinkedList<Node> nodes, StringBuilder builder){
    Node n = UINode.create(r);
    nodes.add(n);
    try {
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        int offset = builder.length();
        n.setValue("offset", offset); // NOI18N
        LogRecords.write(os, r);
        builder.append(os.toString("UTF-8"));
    } catch (IOException ex) {
        Installer.LOG.log(Level.WARNING, null, ex);
    }
}
 
Example 3
Source Project: netbeans   File: DefaultSettings.java    License: Apache License 2.0 5 votes vote down vote up
private void set( Node node, String attrName, Object newValue, Object defaultValue ) {
    if( null == node )
        return;
    Object oldValue = get( node, attrName, defaultValue );
    if( oldValue.equals( newValue ) ) {
        return;
    }
    node.setValue( NODE_ATTR_PREFIX+attrName, newValue );
    store();
    propertySupport.firePropertyChange( attrName, oldValue, newValue );
}
 
Example 4
Source Project: netbeans   File: DefaultSettings.java    License: Apache License 2.0 4 votes vote down vote up
private void clearAttributes( Node node ) {
    for( int i=0; i<KNOWN_PROPERTIES.length; i++ ) {
        node.setValue( KNOWN_PROPERTIES[i], NULL_VALUE );
    }
}