CopyableLabel: Do not hide instances in the current dialog
When displaying a dialog or popup that contains a CopyableLabel, allow the label to show its flash movie. The movie will paint on top of the dialog/popup and appear visually correct to the user. Change-Id: I40dd1d3a02e0247ac7d229e96357b328dfecde64
This commit is contained in:
parent
74f574324d
commit
888161bb20
@ -14,8 +14,10 @@
|
|||||||
|
|
||||||
package com.google.gwtexpui.clippy.client;
|
package com.google.gwtexpui.clippy.client;
|
||||||
|
|
||||||
|
import static com.google.gwt.dom.client.Style.Visibility.HIDDEN;
|
||||||
|
import static com.google.gwt.dom.client.Style.Visibility.VISIBLE;
|
||||||
|
|
||||||
import com.google.gwt.core.client.Scheduler;
|
import com.google.gwt.core.client.Scheduler;
|
||||||
import com.google.gwt.dom.client.Style;
|
|
||||||
import com.google.gwt.event.dom.client.BlurEvent;
|
import com.google.gwt.event.dom.client.BlurEvent;
|
||||||
import com.google.gwt.event.dom.client.BlurHandler;
|
import com.google.gwt.event.dom.client.BlurHandler;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
@ -170,10 +172,15 @@ public class CopyableLabel extends Composite implements HasText {
|
|||||||
UserAgent.addDialogVisibleHandler(new DialogVisibleHandler() {
|
UserAgent.addDialogVisibleHandler(new DialogVisibleHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void onDialogVisible(DialogVisibleEvent event) {
|
public void onDialogVisible(DialogVisibleEvent event) {
|
||||||
swf.getStyle().setVisibility(
|
if (event.contains(CopyableLabel.this)) {
|
||||||
event.isVisible()
|
if (event.isVisible()) {
|
||||||
? Style.Visibility.HIDDEN
|
swf.getStyle().setVisibility(VISIBLE);
|
||||||
: Style.Visibility.VISIBLE);
|
}
|
||||||
|
} else {
|
||||||
|
swf.getStyle().setVisibility(event.isVisible()
|
||||||
|
? HIDDEN
|
||||||
|
: VISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
package com.google.gwtexpui.user.client;
|
package com.google.gwtexpui.user.client;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
public class DialogVisibleEvent extends GwtEvent<DialogVisibleHandler> {
|
public class DialogVisibleEvent extends GwtEvent<DialogVisibleHandler> {
|
||||||
private static Type<DialogVisibleHandler> TYPE;
|
private static Type<DialogVisibleHandler> TYPE;
|
||||||
@ -26,12 +27,23 @@ public class DialogVisibleEvent extends GwtEvent<DialogVisibleHandler> {
|
|||||||
return TYPE;
|
return TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final Widget parent;
|
||||||
private final boolean visible;
|
private final boolean visible;
|
||||||
|
|
||||||
DialogVisibleEvent(boolean visible) {
|
DialogVisibleEvent(Widget w, boolean visible) {
|
||||||
|
this.parent = w;
|
||||||
this.visible = visible;
|
this.visible = visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean contains(Widget c) {
|
||||||
|
for (; c != null; c = c.getParent()) {
|
||||||
|
if (c == parent) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
return visible;
|
return visible;
|
||||||
}
|
}
|
||||||
|
@ -43,19 +43,19 @@ public class PluginSafeDialogBox extends DialogBox {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVisible(final boolean show) {
|
public void setVisible(final boolean show) {
|
||||||
UserAgent.fireDialogVisible(show);
|
UserAgent.fireDialogVisible(this, show);
|
||||||
super.setVisible(show);
|
super.setVisible(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void show() {
|
public void show() {
|
||||||
UserAgent.fireDialogVisible(true);
|
UserAgent.fireDialogVisible(this, true);
|
||||||
super.show();
|
super.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void hide(final boolean autoClosed) {
|
public void hide(final boolean autoClosed) {
|
||||||
UserAgent.fireDialogVisible(false);
|
UserAgent.fireDialogVisible(this, false);
|
||||||
super.hide(autoClosed);
|
super.hide(autoClosed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,19 +43,19 @@ public class PluginSafePopupPanel extends PopupPanel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVisible(final boolean show) {
|
public void setVisible(final boolean show) {
|
||||||
UserAgent.fireDialogVisible(show);
|
UserAgent.fireDialogVisible(this, show);
|
||||||
super.setVisible(show);
|
super.setVisible(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void show() {
|
public void show() {
|
||||||
UserAgent.fireDialogVisible(true);
|
UserAgent.fireDialogVisible(this, true);
|
||||||
super.show();
|
super.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void hide(final boolean autoClosed) {
|
public void hide(final boolean autoClosed) {
|
||||||
UserAgent.fireDialogVisible(false);
|
UserAgent.fireDialogVisible(this, false);
|
||||||
super.hide(autoClosed);
|
super.hide(autoClosed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ import com.google.gwt.event.shared.EventBus;
|
|||||||
import com.google.gwt.event.shared.HandlerRegistration;
|
import com.google.gwt.event.shared.HandlerRegistration;
|
||||||
import com.google.gwt.event.shared.SimpleEventBus;
|
import com.google.gwt.event.shared.SimpleEventBus;
|
||||||
import com.google.gwt.user.client.Window;
|
import com.google.gwt.user.client.Window;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User agent feature tests we don't create permutations for.
|
* User agent feature tests we don't create permutations for.
|
||||||
@ -39,8 +40,8 @@ public class UserAgent {
|
|||||||
return bus.addHandler(DialogVisibleEvent.getType(), handler);
|
return bus.addHandler(DialogVisibleEvent.getType(), handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fireDialogVisible(boolean visible) {
|
static void fireDialogVisible(Widget w, boolean visible) {
|
||||||
bus.fireEvent(new DialogVisibleEvent(visible));
|
bus.fireEvent(new DialogVisibleEvent(w, visible));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static native boolean hasFlash()
|
private static native boolean hasFlash()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user