*/
public void processInput(BridgeComponentPeer peer, BridgeInputContext context, Map inputForm) throws InputException
{
if (hasEvent(peer, inputForm)) //quick check for table visibility
{
JTree tree = (JTree) peer.getComponentObject();
TreeModel model = tree.getModel();
String pathString = (String) inputForm.get(peer.getId());
String actionKey = peer.getId() + "-action";
String action = (String) inputForm.get(actionKey);
if (!StringUtils.isNullOrEmpty(action))
{
if (action.equals("selected"))
{
TreePath path = getTreePath(model, pathString);
TreeEvent evt = new TreeEvent(tree, path)
{
public void dispatch()
{
((JTree) getSource()).setSelectionPath(getPath());
}
};
postEvent(context, evt);
} else if (action.equals("selected-doubleclicked"))
{
TreePath path = getTreePath(model, pathString);
TreeEvent evt = new TreeEvent(tree, path)
{
public void dispatch()
{
JTree tree = (JTree)getSource();
TreePath path = getPath();
tree.setSelectionPath(path);
if (tree.isExpanded(path)){
tree.collapsePath(path);
} else {
tree.expandPath(path);
}
MouseListener[] listeners = tree.getMouseListeners();
Rectangle rec = tree.getPathBounds(path);
for (int i=0; i<listeners.length; i++){
listeners[i].mousePressed(
new MouseEvent(tree, MouseEvent.MOUSE_CLICKED, System.currentTimeMillis(), 0, (int)rec.getX(), (int)rec.getY(), 2, false)
);
}
}
};
postEvent(context, evt);
} else if (action.equals("addSelected"))
{
TreeSelectionModel smodel = tree.getSelectionModel();
TreePath path = getTreePath(model, pathString);
if (smodel.isPathSelected(path))
{
TreeEvent evt = new TreeEvent(tree, path)
{
public void dispatch()
{
((JTree) getSource()).removeSelectionPath(getPath());
}
};
postEvent(context, evt);
} else
{
TreeEvent evt = new TreeEvent(tree, path)
{
public void dispatch()
{
((JTree) getSource()).removeSelectionPath(getPath());
}
};
postEvent(context, evt);
}
tree.setSelectionPath(path);
} else if (action.equals("expanded"))
{
TreePath path = getTreePath(model, pathString);
TreeEvent evt = new TreeEvent(tree, path)
{