public void propertyChange(PropertyChangeEvent evt) { ChoiceView.this.removeActionListener(this); try { if (ExplorerManager.PROP_SELECTED_NODES.equals(evt.getPropertyName())) { Node[] selectedNodes = (Node[]) evt.getNewValue(); updateSelection(); return; } if (!showExploredContext && ExplorerManager.PROP_ROOT_CONTEXT.equals(evt.getPropertyName())) { updateChoice(); return; } if (showExploredContext && ExplorerManager.PROP_EXPLORED_CONTEXT.equals(evt.getPropertyName())) { updateChoice(); return; } } finally { ChoiceView.this.addActionListener(this); } }
/** Initialize view. */ private void initializeChoice () { setRenderer (new NodeRenderer()); setModel (model = createModel ()); iListener = new PropertyIL(); }
/** Default constructor. */ public ChoiceView() { super(); initializeChoice(); }
@Override public void addNotify() { manager = ExplorerManager.find(this); manager.addVetoableChangeListener(iListener); manager.addPropertyChangeListener(iListener); updateChoice(); addActionListener(iListener); super.addNotify(); }
private void updateChoice() { if (manager == null) { return; } if (showExploredContext) { model.setNode(manager.getExploredContext()); } else { model.setNode(manager.getRootContext()); } updateSelection(); }
@Override public void removeNotify() { super.removeNotify(); removeActionListener(iListener); if (manager != null) { manager.removeVetoableChangeListener(iListener); manager.removePropertyChangeListener(iListener); } }
private void updateSelection() { Node[] nodes = manager.getSelectedNodes(); if (nodes.length > 0) { setSelectedItem(VisualizerNode.getVisualizer(null, nodes[0])); } else { setSelectedItem(showExploredContext ? manager.getExploredContext() : manager.getRootContext()); } }
/** Set showing of explored contexts. * @param b <code>true</code> to show the explored context, <code>false</code> the root context */ public void setShowExploredContext(boolean b) { showExploredContext = b; updateChoice(); }
public void actionPerformed(java.awt.event.ActionEvent actionEvent) { int s = getSelectedIndex (); if (s < 0 || s >= model.getSize()) { return; } Node n = Visualizer.findNode (model.getElementAt (s)); manager.removeVetoableChangeListener(this); manager.removePropertyChangeListener(this); try { manager.setSelectedNodes(new Node[] { n }); } catch (PropertyVetoException ex) { updateChoice(); // no selection change allowed } finally { manager.addVetoableChangeListener(this); manager.addPropertyChangeListener(this); } }
public void addNotify() { manager = ExplorerManager.find (this); manager.addVetoableChangeListener(iListener); manager.addPropertyChangeListener(iListener); updateChoice(); addActionListener (iListener); super.addNotify (); }
private void updateChoice() { if (showExploredContext) { model.setNode (manager.getExploredContext ()); } else { model.setNode (manager.getRootContext ()); } updateSelection (); }
public void removeNotify() { super.removeNotify (); removeActionListener (iListener); manager.removeVetoableChangeListener(iListener); manager.removePropertyChangeListener(iListener); }
private void updateSelection() { Node[] nodes = manager.getSelectedNodes (); if (nodes.length > 0) { setSelectedItem ( VisualizerNode.getVisualizer (null, nodes[0]) ); } else { setSelectedItem (showExploredContext ? manager.getExploredContext() : manager.getRootContext()); } }
/** Set showing of explored contexts. * @param b <code>true</code> to show the explored context, <code>false</code> the root context */ public void setShowExploredContext (boolean b) { showExploredContext = b; updateChoice(); }
public void actionPerformed(java.awt.event.ActionEvent actionEvent) { int s = getSelectedIndex(); if ((s < 0) || (s >= model.getSize())) { return; } Node n = Visualizer.findNode(model.getElementAt(s)); manager.removeVetoableChangeListener(this); manager.removePropertyChangeListener(this); try { manager.setSelectedNodes(new Node[] { n }); } catch (PropertyVetoException ex) { updateChoice(); // no selection change allowed } finally { manager.addVetoableChangeListener(this); manager.addPropertyChangeListener(this); } } }
/** Initialize view. */ private void initializeChoice() { setRenderer(new NodeRenderer()); setModel(model = createModel()); iListener = new PropertyIL(); }
public void addNotify() { manager = ExplorerManager.find (this); manager.addVetoableChangeListener(iListener); manager.addPropertyChangeListener(iListener); updateChoice(); addActionListener (iListener); super.addNotify (); }
public void propertyChange(PropertyChangeEvent evt) { ChoiceView.this.removeActionListener (this); try { if (ExplorerManager.PROP_SELECTED_NODES.equals(evt.getPropertyName())) { Node[] selectedNodes = (Node[])evt.getNewValue(); updateSelection(); return; } if ( !showExploredContext && ExplorerManager.PROP_ROOT_CONTEXT.equals(evt.getPropertyName()) ) { updateChoice(); return; } if ( showExploredContext && ExplorerManager.PROP_EXPLORED_CONTEXT.equals (evt.getPropertyName()) ) { updateChoice(); return; } } finally { ChoiceView.this.addActionListener (this); } }
/** Default constructor. */ public ChoiceView () { super (); initializeChoice (); }
private void updateChoice() { if (showExploredContext) { model.setNode (manager.getExploredContext ()); } else { model.setNode (manager.getRootContext ()); } updateSelection (); }