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

The following examples show how to use org.openide.nodes.Node#setValue() . 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 check out the related API usage on the sidebar.
Example 1
Source File: ViewUtilTest.java    From netbeans with 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 File: Installer.java    From netbeans with 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 File: DefaultSettings.java    From netbeans with 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 File: DefaultSettings.java    From netbeans with 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 );
    }
}