public static void methodEventUsingBrowser(final TreePath path,final FeatureTreeNode feature,final int panel)
{
FeatureShowcaseDocument featShowDoc = feature.getFeatureShowcaseDocument();
final ItsNatFreeTree tree = featShowDoc.getItsNatFreeTree();
final ItsNatDocument itsNatDoc = feature.getItsNatDocument();
final ItsNatHTMLInputCheckBox joystickCB = featShowDoc.getJoystickModeCheckBox();
Runnable dispCode = new Runnable()
{
public void run()
{
// Joystick mode temporally disabled, because on load time and fast load,
// event listeners in the component are not added until the load event is fired.
boolean useJoystick = joystickCB.isSelected();
if (useJoystick) joystickCB.setSelected(false);
Element featureElem;
MouseEvent event1;
synchronized(itsNatDoc)
{
featureElem = tree.getItsNatTreeUI().getParentElementFromTreePath(path);
event1 = createMouseEvent(itsNatDoc);
}
((EventTarget)featureElem).dispatchEvent(event1); // Select feature
if (panel == feature.getFirstPanel())
return;
for( ; ; )
{
synchronized(itsNatDoc)
{
if (tree.getTreeSelectionModel().isPathSelected(path))
break;
}
try{ Thread.sleep(200); }catch(InterruptedException ex) { throw new RuntimeException(ex); }
}
Element tabElem;
MouseEvent event2;
synchronized(itsNatDoc)
{
tabElem = feature.getTabElement(panel);
event2 = createMouseEvent(itsNatDoc);
}
((EventTarget)tabElem).dispatchEvent(event2); // Select tab
if (useJoystick) joystickCB.setSelected(true);
}
};
ClientDocument client = itsNatDoc.getClientDocumentOwner();
client.startEventDispatcherThread(dispCode);
}