]> source.dussan.org Git - vaadin-framework.git/commitdiff
#8324 Splitted VUnknownComponent into Widget and Paintable.
authorJens Jansson <peppe@vaadin.com>
Tue, 31 Jan 2012 09:15:50 +0000 (11:15 +0200)
committerArtur Signell <artur@vaadin.com>
Tue, 31 Jan 2012 13:08:18 +0000 (15:08 +0200)
src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java
src/com/vaadin/terminal/gwt/client/WidgetSet.java
src/com/vaadin/terminal/gwt/client/ui/VUnknownComponent.java
src/com/vaadin/terminal/gwt/client/ui/VUnknownComponentPaintable.java [new file with mode: 0644]

index 169934024b72b6dd2c5869a5f8ac5610938549ff..862d156eb6d6af4dce4dbd61bf2a999bda490ba2 100644 (file)
@@ -18,6 +18,7 @@ import com.google.gwt.core.client.Scheduler.ScheduledCommand;
 import com.google.gwt.user.client.Command;
 import com.google.gwt.user.client.Timer;
 import com.vaadin.terminal.gwt.client.ui.VUnknownComponent;
+import com.vaadin.terminal.gwt.client.ui.VUnknownComponentPaintable;
 
 public class ApplicationConfiguration implements EntryPoint {
 
@@ -381,13 +382,14 @@ public class ApplicationConfiguration implements EntryPoint {
         return useDebugIdInDom;
     }
 
-    public Class<? extends VPaintableWidget> getWidgetClassByEncodedTag(String tag) {
+    public Class<? extends VPaintableWidget> getWidgetClassByEncodedTag(
+            String tag) {
         try {
             int parseInt = Integer.parseInt(tag);
             return classes[parseInt];
         } catch (Exception e) {
             // component was not present in mappings
-            return VUnknownComponent.class;
+            return VUnknownComponentPaintable.class;
         }
     }
 
index e6e365c258130e095a8dc9b32bd1faa34c431cee..4f3e510f9af930205c1fa052c36760576b695192 100644 (file)
@@ -10,7 +10,7 @@ import com.vaadin.terminal.gwt.client.ui.VFilterSelectPaintable;
 import com.vaadin.terminal.gwt.client.ui.VListSelectPaintable;
 import com.vaadin.terminal.gwt.client.ui.VSplitPanelHorizontal;
 import com.vaadin.terminal.gwt.client.ui.VSplitPanelVertical;
-import com.vaadin.terminal.gwt.client.ui.VUnknownComponent;
+import com.vaadin.terminal.gwt.client.ui.VUnknownComponentPaintable;
 import com.vaadin.terminal.gwt.client.ui.VView;
 import com.vaadin.terminal.gwt.client.ui.VWindow;
 
@@ -50,10 +50,11 @@ public class WidgetSet {
 
         final Class<? extends VPaintableWidget> classType = resolveWidgetType(
                 uidl, conf);
-        if (classType == null || classType == VUnknownComponent.class) {
+        if (classType == null || classType == VUnknownComponentPaintable.class) {
             String serverSideName = conf
                     .getUnknownServerClassNameByEncodedTagName(uidl.getTag());
-            VUnknownComponent c = GWT.create(VUnknownComponent.class);
+            VUnknownComponentPaintable c = GWT
+                    .create(VUnknownComponentPaintable.class);
             c.setServerSideClassName(serverSideName);
             return c;
         } else if (VWindow.class == classType) {
@@ -121,7 +122,7 @@ public class WidgetSet {
     public Class<? extends VPaintableWidget> getImplementationByClassName(
             String fullyqualifiedName) {
         if (fullyqualifiedName == null) {
-            return VUnknownComponent.class;
+            return VUnknownComponentPaintable.class;
         }
         Class<? extends VPaintableWidget> implementationByServerSideClassName = widgetMap
                 .getImplementationByServerSideClassName(fullyqualifiedName);
index 5b3790f5216ae799f51383f99653fd8311b319b8..ad702430f630a9ec6e0dad516687ed2a3748df1e 100644 (file)
@@ -6,19 +6,14 @@ package com.vaadin.terminal.gwt.client.ui;
 
 import com.google.gwt.user.client.ui.Composite;
 import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
 import com.vaadin.terminal.gwt.client.SimpleTree;
-import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.VUIDLBrowser;
 
-public class VUnknownComponent extends Composite implements VPaintableWidget {
+public class VUnknownComponent extends Composite {
 
     com.google.gwt.user.client.ui.Label caption = new com.google.gwt.user.client.ui.Label();;
     SimpleTree uidlTree;
-    private VerticalPanel panel;
-    private String serverClassName = "unkwnown";
+    protected VerticalPanel panel;
+    protected String serverClassName = "unkwnown";
 
     public VUnknownComponent() {
         panel = new VerticalPanel();
@@ -32,33 +27,7 @@ public class VUnknownComponent extends Composite implements VPaintableWidget {
         this.serverClassName = serverClassName;
     }
 
-    public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
-        if (client.updateComponent(this, uidl, false)) {
-            return;
-        }
-        setCaption("Widgetset does not contain implementation for "
-                + serverClassName
-                + ". Check its @ClientWidget mapping, widgetsets "
-                + "GWT module description file and re-compile your"
-                + " widgetset. In case you have downloaded a vaadin"
-                + " add-on package, you might want to refer to "
-                + "<a href='http://vaadin.com/using-addons'>add-on "
-                + "instructions</a>. Unrendered UIDL:");
-        if (uidlTree != null) {
-            uidlTree.removeFromParent();
-        }
-
-        uidlTree = new VUIDLBrowser(uidl, client.getConfiguration());
-        uidlTree.open(true);
-        uidlTree.setText("Unrendered UIDL");
-        panel.add(uidlTree);
-    }
-
     public void setCaption(String c) {
         caption.getElement().setInnerHTML(c);
     }
-
-    public Widget getWidgetForPaintable() {
-        return this;
-    }
 }
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VUnknownComponentPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VUnknownComponentPaintable.java
new file mode 100644 (file)
index 0000000..252d752
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+@VaadinApache2LicenseForJavaFiles@
+ */
+
+package com.vaadin.terminal.gwt.client.ui;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.terminal.gwt.client.ApplicationConnection;
+import com.vaadin.terminal.gwt.client.UIDL;
+import com.vaadin.terminal.gwt.client.VUIDLBrowser;
+
+public class VUnknownComponentPaintable extends VAbstractPaintableWidget {
+
+    public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
+        if (client.updateComponent(this, uidl, false)) {
+            return;
+        }
+        getWidgetForPaintable().setCaption(
+                "Widgetset does not contain implementation for "
+                        + getWidgetForPaintable().serverClassName
+                        + ". Check its @ClientWidget mapping, widgetsets "
+                        + "GWT module description file and re-compile your"
+                        + " widgetset. In case you have downloaded a vaadin"
+                        + " add-on package, you might want to refer to "
+                        + "<a href='http://vaadin.com/using-addons'>add-on "
+                        + "instructions</a>. Unrendered UIDL:");
+        if (getWidgetForPaintable().uidlTree != null) {
+            getWidgetForPaintable().uidlTree.removeFromParent();
+        }
+
+        getWidgetForPaintable().uidlTree = new VUIDLBrowser(uidl,
+                client.getConfiguration());
+        getWidgetForPaintable().uidlTree.open(true);
+        getWidgetForPaintable().uidlTree.setText("Unrendered UIDL");
+        getWidgetForPaintable().panel.add(getWidgetForPaintable().uidlTree);
+    }
+
+    @Override
+    protected Widget createWidget() {
+        return GWT.create(VUnknownComponent.class);
+    }
+
+    @Override
+    public VUnknownComponent getWidgetForPaintable() {
+        return (VUnknownComponent) super.getWidgetForPaintable();
+    }
+
+    public void setServerSideClassName(String serverClassName) {
+        getWidgetForPaintable().setServerSideClassName(serverClassName);
+    }
+}