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

The following are Jave code examples for showing how to use setValue() of the org.openide.nodes.Node class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: incubator-netbeans   File: ViewUtilTest.java   Source Code and License Vote up 5 votes
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
Project: incubator-netbeans   File: DefaultSettings.java   Source Code and License Vote up 5 votes
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 3
Project: incubator-netbeans   File: Installer.java   Source Code and License Vote up 5 votes
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 4
Project: incubator-netbeans   File: DefaultSettings.java   Source Code and License Vote up 4 votes
private void clearAttributes( Node node ) {
    for( int i=0; i<KNOWN_PROPERTIES.length; i++ ) {
        node.setValue( KNOWN_PROPERTIES[i], NULL_VALUE );
    }
}