The builtin UI actions can be fired any time within your own code. The following example shows how to call the setVisible, collapse/expand and adTreeNode/removeTreeNode method within an own action implementation.
Image Removed
Hinweis |
---|
See class com.jaxfront.demo.api.ChangeState |
Codeblock |
---|
theme | Eclipse |
---|
language | java |
---|
linenumbers | true |
---|
|
public class ChangeState extends AbstractAction { |
...
private boolean _visible = true; |
...
private boolean _collapse = false; |
...
private boolean _treeNode = false; |
...
public void actionPerformed(ActionEvent event) { |
...
Document dom = (Document)getValue(XUITypes.VALUE_DOM); |
...
Type source = (Type)getValue(XUITypes.VALUE_SOURCE); |
...
String actionName = event.getActionCommand(); |
...
Type target = source.getParent().getDirectChild("list"); |
...
Visualizer targetVisualizer = TypeVisualizerFactory.getInstance().getVisualizer(target); |
...
if (actionName.equals("visibility")) { |
...
...
targetVisualizer.setVisible(_visible); |
...
...
else if (actionName.equals("collapse")) { |
...
...
if (_collapse) ((AbstractView)targetVisualizer.getInplementation()).getBorderPanel().collapseInitially(); |
...
else ((AbstractView)targetVisualizer.getInplementation()).getBorderPanel().expandInitially(); |
...
...
else if (actionName.equals("treeNode")) { |
...
...
if (_treeNode) ((AbstractView)targetVisualizer.getInplementation()).addTreeNode(true); |
...
else ((AbstractView)targetVisualizer.getInplementation()).removeTreeNode(true); |
...
...
...