Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.
Kommentar: Migrated to Confluence 4.0


To demonstrate the event handling, see the following implementation how to listen for any property- or dom-change event. This plugin will register for all event and display the event object within its text area as soon as an event occurs.

com.jaxfront.demo.api.EventHandling
public class EventHandling extends AbstractCompositeView implements PropertyChangeListener, DOMChangeListener{
private JTextArea _textArea;
protected void defaultBuild() {
setLayout(new BorderLayout());
JComponent visualizer = (JComponent)TypeVisualizerFactory.getInstance().getVisualizer(getModel().getDirectChild("simpleGroup"));
add(visualizer, BorderLayout.NORTH);
visualizer = (JComponent)TypeVisualizerFactory.getInstance().getVisualizer(getModel().getDirectChild("list"));
add(visualizer, BorderLayout.CENTER);
_textArea = new JTextArea();
JScrollPane scrollPane = new JScrollPane(_textArea);
scrollPane.setPreferredSize(new Dimension(300, 300));
add(scrollPane, BorderLayout.SOUTH);
getModel().getDOM().getController().addPropertyChangeListener(this);
getModel().getDOM().addDOMChangeListener(this);
}
public void propertyChange(PropertyChangeEvent event) {
super.propertyChange(event);
_textArea.setText(event.toString());
}
public void domChanged(DOMChangeEvent event) {
super.domChanged(event);
_textArea.setText(event.toString());
}
public void setApplicationRequired(boolean aBoolean) {}
public void setRequired(boolean aBoolean) {}
}