Sie zeigen eine alte Version dieser Seite an. Zeigen Sie die aktuelle Version an.

Unterschiede anzeigen Seitenhistorie anzeigen

Version 1 Nächste Version anzeigen »


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) {}
}


  • Keine Stichwörter