Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated scrollpanel for ui designer.

  • Loading branch information...
commit 80939287ebff50478f2aeebc15de86685030ba23 1 parent b4665e9
@dennisjzh authored
View
32 src/com/gwtmobile/ui/client/widgets/DesignTimeMessagePanel.java
@@ -1,32 +0,0 @@
-package com.gwtmobile.ui.client.widgets;
-
-import com.google.gwt.user.client.ui.Widget;
-import com.gwtmobile.ui.client.CSS.StyleNames.Primary;
-import com.gwtmobile.ui.client.CSS.StyleNames.Secondary;
-import com.gwtmobile.ui.client.utils.Utils;
-
-//Internal class, not public
-class DesignTimeMessagePanel extends HTMLPanel {
-
- private boolean error = false;
- public DesignTimeMessagePanel(Widget w) {
- super("");
- addMessage("Empty " + Utils.getSimpleName(w.getClass()) + ".");
- setStyleName(Primary.DesignTimeMessagePanel);
- }
-
- public Label addMessage(String message) {
- Label label = new Label(message);
- this.add(label);
- return label;
- }
-
- public void addErrorMessage(String message) {
- addMessage(message).addStyleName(Secondary.Error);
- error = true;
- }
-
- public boolean hasError() {
- return error;
- }
-}
View
6 src/com/gwtmobile/ui/client/widgets/PanelBase.java
@@ -63,8 +63,10 @@ public void add(Widget w) {
public boolean isDesignTimeEmptyLabel(Widget w) {
return Beans.isDesignTime() &&
(w instanceof Label) &&
- ((Label)w).getText().equals("Empty FlowPanel");
+ ((Label)w).getText().startsWith("Empty ");
}
- protected String getDesignTimeMessage() {return null;};
+ protected String getDesignTimeMessage() {
+ return "Add widgets to the panel.";
+ };
}
View
17 src/com/gwtmobile/ui/client/widgets/ScrollPanel.java
@@ -49,11 +49,9 @@ public ScrollPanel() {
setStyleName(Primary.ScrollPanel);
setWithPadding(withPadding);
this.initScrollbar();
- // this panel needs to be handled differently !!
- // the designtime message needs to be addded to the inner panel
- if (Beans.isDesignTime()) {
- add(new DesignTimeMessagePanel(this));
- }
+ if (Beans.isDesignTime()) {
+ intPanel.add(new Label("Empty ScrollPanel. " + getDesignTimeMessage()));
+ }
}
public boolean isWithPadding() {
@@ -322,14 +320,9 @@ public void onSwipeHorizontal(SwipeEvent e) {
@Override
public void add(Widget w) {
- //assert getWidgetCount() == 99 : "Can only add one widget to ScrollPanel. " + w.getClass().getName();
-
if (Beans.isDesignTime()) {
- if (getWidgetCount() == 1 && getWidget(0) instanceof DesignTimeMessagePanel) {
- DesignTimeMessagePanel designTimePanel = (DesignTimeMessagePanel) getWidget(0);
- if (!designTimePanel.hasError()) {
- intPanel.clear();
- }
+ if (getWidgetCount() == 1 && isDesignTimeEmptyLabel(getWidget(0))) {
+ clear();
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.