[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Problem modeless PopUp in Workplace  XML
Forum Index -> Development
Author Message
mreich

Power User
[Avatar]

Joined: 30/01/2009 08:34:23
Messages: 750
Offline

Hi community,

I've some problems using a modeless popup, as a kind of container where I can add / remove objects by dnd.
I my idea was to create a popup as final instance property:
Code:
 private final ModelessPopup popup = getWorkpage().createModelessPopupInWorkpageContext();

Then I have a method which should open the popup if it's not opened already!
Code:
 public void onPutIntoCopyPool(ActionEvent ae) {
 	if(popup.getOpened()) return;
 	LabelPopUpUI labelPopUpUI = getLabelPopUpUI();
 	labelPopUpUI.setEntityID(null);
 	labelPopUpUI.initialize();
 	labelPopUpUI.prepareCallback(new IPopUpCallback(){
 		public void ok(Object object) {popup.close();}
 		public void cancel() {popup.close();}
 	});
 	popup.open(Constants.Page.LABELPOPUP.getUrl(), "Label", 250, 300, new DefaultModelessPopupListener(popup));
 	popup.setUndecorated(false);
 	popup.setCloseonclickoutside(false);
 }

But when calling the method no popup appears? Although the
Code:
 popup.getOpened() returns true, after first call?

When I put the instantiation of the popup into the methods scope the popup opens?
But then I have the problem that I cannot use the popup.getOpened() check?

Is there a kind of pattern, where I can realize such a singelton modeless popup?

regards
Markus
[WWW]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5542
Offline

Hi,

The problem is...:

Code:
  private final ModelessPopup popup = getWorkpage().createModelessPopupInWorkpageContext();
 


The getWorkpage() is not available before the "workpage" environment is set from outside, and this is done within the constructor of your backing bean (where the IWorkpageDispatcher is passed). From scanning the code you should get a NullPointer.

So, that's the reason why it works within the method - then the constructor already is processed.

Then: I would not keep a final instance to the popup. When the popup is closed then it is taken out of the list of popups - and we expect that it "has died". Re-awaking it is not planned ;-)

So, if you keep a final instance for some strucure reason, then do it by making an own popup-manager-abstraction, which always opens up a new popup (== calling createModalPopup) when the popup is required.

Regards, Björn

PS: coding at 00:50 does not sound healthy. Better watch TV at this point of time!

Björn Müller, CaptainCasa GmbH
mreich

Power User
[Avatar]

Joined: 30/01/2009 08:34:23
Messages: 750
Offline

Ok, I found out that the pop-up is opened, but behind workpage? But I think, I have make another approach, this seems to get to complex if I have to build an own pop-up manager.

... and you're completely right coding at this point of time is not very productive at all ;-)
[WWW]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5542
Offline

Hi,
if the popup is opened on top of a modeless popup you may explicitly rule, which window is taken as base window by using the ModalPopup API:

ModalPopup.setStartFromRootWindow(false)

Regards, Björn

Björn Müller, CaptainCasa GmbH
mreich

Power User
[Avatar]

Joined: 30/01/2009 08:34:23
Messages: 750
Offline

ok, to summarize this up, to be sure I understood this right ;-)

When I want to realize a modeless popup which should serve as kind of singleton container (a kind of visual clipboard), I had to create a kind of popup manager by my own?

Markus
[WWW]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5542
Offline

...yes.

A CaptainCasa's popup lifecycle is:

(.) create
(.) open
(.) close

After "close": no action allowed anymore.

Regards, Björn

Björn Müller, CaptainCasa GmbH
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team