PDA

View Full Version : mimic toolbar button (>>) click without user actually clicking it in border layout?



cgokey2
9 Feb 2012, 11:56 AM
Sorry, I posted this over in bugs and meant to post it here...
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()
{
/*should this class be moved to it's own file?*/
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 want to MIMIC clicking the toolbar button here.
leftNav.expand();
presenter.onExpandLeftNav();
leftNav.layout(true);
}
});
return p;
}
};



Any help here would be really appreciated.

Thanks,
Chris

cgokey2
15 Feb 2012, 10:25 AM
Any ideas? Is there a way that I can just fake a button click event to the toolbar button (>>), that will also give me the desired affect?

Chris

Perfectchaos
23 Feb 2012, 2:30 PM
I am also interested in doing this. For me, it would be best if clicking on the panel opens it normally without the popup. But also disabling the popup completely would work in my case. I haven't been able to either quite yet.

PC

cgokey2
23 Feb 2012, 8:25 PM
I was able to hack this to make it work. I had to create my own custom class and copy some code from the source which was private, but it would be really nice if there was some property like:

borderlayout.setOpenInPopupPanel(false);

Chris