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

The following are Jave code examples for showing how to use addPropertyChangeListener() 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: PropertiesRowModel.java   Source Code and License Vote up 6 votes
@Override
public Object getValueFor(Object node, int column) {
    Node n = Visualizer.findNode(node);
    if (n == null) {
        throw new IllegalStateException("TreeNode must be VisualizerNode but was: " + node + " of class " + node.getClass().getName());
    }
    PropertyChangeListener cacheEntry = nodesListenersCache.get (n);
    if (cacheEntry == null) {
        PropertyChangeListener p = WeakListeners.propertyChange(pcl, n);
        nodesListenersCache.put(n, p);
        n.addPropertyChangeListener(p);
        NodeListener l = WeakListeners.create(NodeListener.class, nl, n);
        n.addNodeListener(l);
    }
    Node.Property theRealProperty = getPropertyFor(n, prop[column]);
    return theRealProperty;
}
 
Example 2
Project: incubator-netbeans   File: PropertySheet.java   Source Code and License Vote up 6 votes
/** Attach to a node, detaching from the last one if non-null.  */
public void attach(Node n) {
    if (currNode != n) {
        if (currNode != null) {
            detach();
        }

        if (n != null) {
            n.addPropertyChangeListener(inner);
            n.addNodeListener(this);

            if (PropUtils.isLoggable(PropertySheet.class)) {
                PropUtils.log(PropertySheet.class, "Now listening for changes on " + n);
            }
        }

        currNode = n;
    }
}
 
Example 3
Project: incubator-netbeans   File: Tab.java   Source Code and License Vote up 6 votes
/** Initialize this top component properly with information
* obtained from specified root context node */
private void initializeWithRootContext (Node rc) {
    // update TC's attributes
    setToolTipText(rc.getDisplayName());
    setName(rc.getDisplayName());
    updateTitle();
    // attach listener
    if (weakRcL == null) {
        weakRcL = WeakListeners.propertyChange(
            rcListener(), rc
        );
    }
    rc.addPropertyChangeListener(weakRcL);

    if (weakNRcL == null) {
        weakNRcL = NodeOp.weakNodeListener (
            rcListener(), rc
        );
    }
    rc.addNodeListener(weakNRcL);
}
 
Example 4
Project: incubator-netbeans   File: NodeTableModel.java   Source Code and License Vote up 5 votes
public void insertNode(Node node) {
    Node[] nodes;
    if(nodeRows == null) {
        nodes = new Node[1];
    } else {
        nodes = new Node[nodeRows.length + 1];
        System.arraycopy(nodeRows, 0, nodes, 0, nodeRows.length);
    }
    nodes[nodes.length - 1] = node;
    node.addPropertyChangeListener(pcl);
    nodeRows = nodes;
    fireTableDataChanged();
}
 
Example 5
Project: incubator-netbeans   File: IndexedEditorPanel.java   Source Code and License Vote up 4 votes
/** Creates new form IndexedEditorPanel */
public IndexedEditorPanel(Node node, Node.Property[] props) {
    treeTableView1 = new TreeTableView();

    // install proper border
    setBorder((Border) UIManager.get("Nb.ScrollPane.border")); // NOI18N
    initComponents();
    propertiesLabel.setLabelFor(treeTableView1);

    jPanel2.setLayout(new java.awt.BorderLayout());
    jPanel2.add(treeTableView1);

    detailsPanel.setLayout(new java.awt.BorderLayout());
    getExplorerManager().setRootContext(node);

    rootNode = node;
    prop = props[0];
    getExplorerManager().addPropertyChangeListener(this);
    treeTableView1.setProperties(props);
    treeTableView1.setRootVisible(false);
    treeTableView1.setDefaultActionAllowed(false);
    treeTableView1.setTreePreferredWidth(200);

    node.addPropertyChangeListener(this);

    try {
        ClassLoader l = Lookup.getDefault().lookup(ClassLoader.class);
        if (l == null) {
            l = Thread.currentThread().getContextClassLoader();
        }
        if (l == null) {
            l = getClass().getClassLoader();
        }
        
        selectedLookup = org.openide.util.lookup.Lookups.proxy(this);

        NodeAction globalMoveUp = SystemAction.get(Class.forName("org.openide.actions.MoveUpAction", true, l).asSubclass(NodeAction.class)); // NOI18N
        NodeAction globalMoveDown = SystemAction.get(Class.forName("org.openide.actions.MoveDownAction", true, l).asSubclass(NodeAction.class)); // NOI18N
        NodeAction globalNewAction = SystemAction.get(Class.forName("org.openide.actions.NewAction", true, l).asSubclass(NodeAction.class)); // NOI18N

        // Get context aware instances.
        moveUp = globalMoveUp.createContextAwareInstance(selectedLookup);
        moveDown = globalMoveDown.createContextAwareInstance(selectedLookup);
        newAction = globalNewAction.createContextAwareInstance(selectedLookup);
    } catch (ClassNotFoundException cnfe) {
        LOG.log(Level.INFO, "Maybe missing openide.actions module?", cnfe);
    }

    java.util.ResourceBundle bundle = NbBundle.getBundle(IndexedEditorPanel.class);
    treeTableView1.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Properties"));
    newButton.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_New"));
    deleteButton.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Delete"));
    upButton.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_MoveUp"));
    downButton.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_MoveDown"));
    getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_IndexedEditorPanel"));
}