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.
Image Removed
Hinweis |
---|
See class com.jaxfront.demo.api.EventHandling |
Codeblock |
---|
theme | Eclipse |
---|
language | java |
---|
linenumbers | true |
---|
|
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) { |
...
...
_textArea.setText(event.toString()); |
...
...
public void setApplicationRequired(boolean aBoolean) {} |
...
public void setRequired(boolean aBoolean) {} |
...