PDA

View Full Version : mimic a toolbar button click without the user actually clicking it?



cgokey2
9 Feb 2012, 11:32 AM
Is there a way to mimic a toolbar button (">>") click without the user actually clicking it?

Let me explain...

I've got a BorderLayout with a West panel that collapses. If you click on the collapse panel itself,
it opens the West container in a popup (normal behavior). If you click on the toolbar button (">>"), it opens the left panel like normal (not as a popup, also normal behavior).

I really don't want the popup effect. So what I've done is this is override the createCollapsePanel method and add an onClick event on the collapsed panel itself. Then in this onClick event I then just want to mimic clicking the toolbar button (">>").

Here is how I'm attempting to do it:


BorderLayout mainLayout = new BorderLayout()
{
protected CollapsePanel createCollapsePanel(ContentPanel panel
, BorderLayoutData data)
{


CollapsePanel p = super.createCollapsePanel(panel, data);
p.setId("ktree-refinment-collapse-panel");
p.addListener(Events.OnClick, new Listener<BaseEvent>()
{
public void handleEvent(BaseEvent baseEvent)
{
// REALLY would like to just MIMIC a button click on the toolbar button.
leftNav.expand();
presenter.onExpandLeftNav();
leftNav.layout(true);
}
});
return p;
}
};




Any help here would be really appreciated.

Thanks,
Chris