summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorSauli Tähkäpää <sauli@vaadin.com>2014-10-02 22:19:05 +0300
committerSauli Tähkäpää <sauli@vaadin.com>2014-10-16 16:00:02 +0300
commit8ecf9ecc332f396e5356b2d98dcfbd9b93cac3fd (patch)
tree7fcb074c3362d4c9c46014ca45fc5aaaff74c782 /client
parent45d329410979d5bbc2e2a8dd768756d10944a46f (diff)
downloadvaadin-framework-8ecf9ecc332f396e5356b2d98dcfbd9b93cac3fd.tar.gz
vaadin-framework-8ecf9ecc332f396e5356b2d98dcfbd9b93cac3fd.zip
Implement HasEnabled in VPopupView. (#14797)
Change-Id: I7384fb6312a921330d8b57193e53c235213dcf00
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ui/VPopupView.java40
1 files changed, 28 insertions, 12 deletions
diff --git a/client/src/com/vaadin/client/ui/VPopupView.java b/client/src/com/vaadin/client/ui/VPopupView.java
index 1a59501d38..7d98110446 100644
--- a/client/src/com/vaadin/client/ui/VPopupView.java
+++ b/client/src/com/vaadin/client/ui/VPopupView.java
@@ -33,13 +33,7 @@ import com.google.gwt.event.logical.shared.CloseHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
-import com.google.gwt.user.client.ui.Focusable;
-import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.HasWidgets;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.RootPanel;
-import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.*;
import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.ComponentConnector;
import com.vaadin.client.DeferredWorker;
@@ -51,7 +45,7 @@ import com.vaadin.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner;
import com.vaadin.client.ui.popupview.VisibilityChangeEvent;
import com.vaadin.client.ui.popupview.VisibilityChangeHandler;
-public class VPopupView extends HTML implements Iterable<Widget>,
+public class VPopupView extends HTML implements HasEnabled, Iterable<Widget>,
DeferredWorker {
public static final String CLASSNAME = "v-popupview";
@@ -78,6 +72,7 @@ public class VPopupView extends HTML implements Iterable<Widget>,
private final Label loading = new Label();
private boolean popupShowInProgress;
+ private boolean enabled = true;
/**
* loading constructor
@@ -97,10 +92,12 @@ public class VPopupView extends HTML implements Iterable<Widget>,
addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
- preparePopup(popup);
- showPopup(popup);
- center();
- fireEvent(new VisibilityChangeEvent(true));
+ if(isEnabled()) {
+ preparePopup(popup);
+ showPopup(popup);
+ center();
+ fireEvent(new VisibilityChangeEvent(true));
+ }
}
});
@@ -197,6 +194,25 @@ public class VPopupView extends HTML implements Iterable<Widget>,
}-*/;
/**
+ * Returns true if the popup is enabled, false if not.
+ */
+ @Override
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * Sets whether this popup is enabled.
+ *
+ * @param enabled <code>true</code> to enable the popup, <code>false</code>
+ * to disable it
+ */
+ @Override
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ /**
* This class is only public to enable overriding showPopup, and is
* currently not intended to be extended or otherwise used directly. Its API
* (other than it being a VOverlay) is to be considered private and