PDA

View Full Version : Mask complete complete Document



Druadan
6 Dec 2010, 10:52 AM
Hi Community,

i plan to realize a window based application in GWT.
Essential is that i can show masks over all displayed Windows e.g. a "Connection lost" message in a mask. So no the user cant interact with some ui elements during the connection is lost.

Is there a way to realize this?

sven
6 Dec 2010, 10:54 AM
You can for example mask the body element.


XDOM.getBodyEl().mask("mask");

Is this what you are looking for?

Druadan
6 Dec 2010, 11:06 AM
I've tried this before, but the problem is that the z-index of the windows seems higher than the mask. So i can still interact with windows.

sven
6 Dec 2010, 11:10 AM
You could increase the zindex for the mask.

Another solution would be to show a modal window with some message in there.

Druadan
6 Dec 2010, 11:21 AM
Yeah this works ... partial :)


El mask = XDOM.getBodyEl().mask("Hello World!");
mask.setZIndex(XDOM.getTopZIndex());
This takes the mask element on top of all other components, unlikely also on top of the mask message element. And as far as i can see there is no possibility to get the mask message element and increase the z-index.

My Solution:


public static void maskBody(String message) {
El mask = XDOM.getBodyEl().mask(message);
mask.setZIndex(XDOM.getTopZIndex());

NodeList<Element> divElements = Document.get().getElementsByTagName("div");
for (int i = 0; i < divElements.getLength(); i++) {
Element divElement = divElements.getItem(i);
if (divElement.getClassName().contains("ext-el-mask-msg")) {
El maskMsg = El.fly(divElement);
if (maskMsg.firstChild().getInnerHtml().equals(message)) {
maskMsg.setZIndex(XDOM.getTopZIndex());
}
}
}
}


Is El.fly() the right way?

sven
7 Dec 2010, 2:29 AM
When using El.fly you should never save a reference to it.