Versionen im Vergleich

Schlüssel

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


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.

Hinweis
See class com.jaxfront.demo.api.ChangeState
Codeblock
themeEclipse
languagejava
linenumberstrue
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")) {
_visible = !_visible;
targetVisualizer.setVisible(_visible);
}
else if (actionName.equals("collapse")) {
_collapse = !_collapse;
if (_collapse) ((AbstractView)targetVisualizer.getInplementation()).getBorderPanel().collapseInitially();
else ((AbstractView)targetVisualizer.getInplementation()).getBorderPanel().expandInitially();
}
else if (actionName.equals("treeNode")) {
_treeNode = !_treeNode; 
if (_treeNode) ((AbstractView)targetVisualizer.getInplementation()).addTreeNode(true);
else ((AbstractView)targetVisualizer.getInplementation()).removeTreeNode(true);
}
}
}