]> source.dussan.org Git - vaadin-framework.git/commitdiff
Connector interface. Renamed getId() -> getConnectorId() to avoid mixups
authorArtur Signell <artur@vaadin.com>
Mon, 12 Mar 2012 14:33:32 +0000 (16:33 +0200)
committerArtur Signell <artur@vaadin.com>
Wed, 14 Mar 2012 14:00:25 +0000 (16:00 +0200)
src/com/vaadin/terminal/gwt/client/Connector.java [new file with mode: 0644]
src/com/vaadin/terminal/gwt/client/ConnectorMap.java
src/com/vaadin/terminal/gwt/client/LayoutManager.java
src/com/vaadin/terminal/gwt/client/ServerConnector.java
src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java
src/com/vaadin/terminal/gwt/client/ui/AbstractConnector.java
src/com/vaadin/terminal/gwt/client/ui/AbstractOrderedLayoutConnector.java
src/com/vaadin/terminal/gwt/client/ui/FormConnector.java
src/com/vaadin/terminal/gwt/client/ui/PanelConnector.java
src/com/vaadin/terminal/gwt/client/ui/RootConnector.java
src/com/vaadin/terminal/gwt/client/ui/WindowConnector.java

diff --git a/src/com/vaadin/terminal/gwt/client/Connector.java b/src/com/vaadin/terminal/gwt/client/Connector.java
new file mode 100644 (file)
index 0000000..d6e2b61
--- /dev/null
@@ -0,0 +1,29 @@
+package com.vaadin.terminal.gwt.client;
+
+import com.vaadin.terminal.gwt.client.communication.SharedState;
+
+/**
+ * TODO Add javadoc
+ * 
+ * @author Vaadin Ltd
+ * @version @VERSION@
+ * @since 7.0.0
+ * 
+ */
+public interface Connector {
+    /**
+     * Gets the current shared state of the connector.
+     * 
+     * @return state
+     */
+    public SharedState getState();
+
+    /**
+     * Returns the id for this connector. This must always be what has been set
+     * in {@link #doInit(String, ApplicationConnection)} and must never change.
+     * 
+     * @return The id for the connector.
+     */
+    public String getConnectorId();
+
+}
index 286b8396cd138baf61e1c88154dd255798c0b3cc..1ec3b84eebdfb4896258281db64c4cf8222752fa 100644 (file)
@@ -117,14 +117,14 @@ public class ConnectorMap {
      *            the connector whose id is needed
      * @return the id for the given connector or null if the connector could not
      *         be found
-     * @deprecated use {@link ServerConnector#getId()} instead
+     * @deprecated use {@link ServerConnector#getConnectorId()} instead
      */
     @Deprecated
     public String getConnectorId(ServerConnector connector) {
         if (connector == null) {
             return null;
         }
-        return connector.getId();
+        return connector.getConnectorId();
     }
 
     @Deprecated
@@ -181,7 +181,7 @@ public class ConnectorMap {
             VConsole.error("WARN: Trying to unregister null connector");
             return;
         }
-        String id = connector.getId();
+        String id = connector.getConnectorId();
         Widget widget = null;
         if (connector instanceof ComponentConnector) {
             widget = ((ComponentConnector) connector).getWidget();
@@ -206,7 +206,7 @@ public class ConnectorMap {
         for (ServerConnector connector : getConnectors()) {
             if (connector instanceof ComponentConnector) {
                 ComponentConnector componentConnector = (ComponentConnector) connector;
-                if (!unregistryBag.contains(connector.getId())) {
+                if (!unregistryBag.contains(connector.getConnectorId())) {
                     result.add(componentConnector);
                 }
             }
index bc1a0c8bba0c4f8a14c08d6f8d58a804ed54f0c7..8bd7a3dac74b9110d93cbd0faeef529943692231 100644 (file)
@@ -37,7 +37,7 @@ public class LayoutManager {
         if (measuredSize.isWidthNeedsUpdate()) {
             ownerSize.setWidthNeedsUpdate();
         }
-        measuredSize.addDependent(owner.getId());
+        measuredSize.addDependent(owner.getConnectorId());
     }
 
     private MeasuredSize ensureMeasured(Element element) {
@@ -95,7 +95,7 @@ public class LayoutManager {
         if (measuredSize == null) {
             return;
         }
-        measuredSize.removeDependent(owner.getId());
+        measuredSize.removeDependent(owner.getConnectorId());
         if (!needsMeasure(element)) {
             nonPaintableElements.remove(element);
             setMeasuredSize(element, null);
@@ -139,18 +139,18 @@ public class LayoutManager {
 
                 if (measuredSize.isHeightNeedsUpdate()) {
                     if (managed) {
-                        needsHeightUpdate.add(paintable.getId());
+                        needsHeightUpdate.add(paintable.getConnectorId());
                     }
                     if (!paintable.isRelativeHeight() && managedParent) {
-                        needsHeightUpdate.add(parent.getId());
+                        needsHeightUpdate.add(parent.getConnectorId());
                     }
                 }
                 if (measuredSize.isWidthNeedsUpdate()) {
                     if (managed) {
-                        needsWidthUpdate.add(paintable.getId());
+                        needsWidthUpdate.add(paintable.getConnectorId());
                     }
                     if (!paintable.isRelativeWidth() && managedParent) {
-                        needsWidthUpdate.add(parent.getId());
+                        needsWidthUpdate.add(parent.getConnectorId());
                     }
                 }
                 measuredSize.clearDirtyState();
index ef10cc2566f70dbbb748a80c72eeea559b4cc6b0..4cccb6cf8afd014fc9546cffcf2f025750d03823 100644 (file)
@@ -17,7 +17,7 @@ import com.vaadin.terminal.gwt.client.communication.SharedState;
  * @version @VERSION@
  * @since 7.0.0
  */
-public interface ServerConnector {
+public interface ServerConnector extends Connector {
     /**
      * TODO
      * 
@@ -26,13 +26,6 @@ public interface ServerConnector {
      */
     public void updateFromUIDL(UIDL uidl, ApplicationConnection client);
 
-    /**
-     * Gets the current shared state of the connector.
-     * 
-     * @return state
-     */
-    public SharedState getState();
-
     /**
      * Sets a new state for the connector.
      * 
@@ -44,14 +37,6 @@ public interface ServerConnector {
     @Deprecated
     public void setState(SharedState state);
 
-    /**
-     * Returns the id for this connector. This must always be what has been set
-     * in {@link #doInit(String, ApplicationConnection)} and must never change.
-     * 
-     * @return The id for the connector.
-     */
-    public String getId();
-
     /**
      * Gets ApplicationConnection instance that created this connector.
      * 
index 5f0b22261a07542934f371e3d81cae23f5337775..582fc3078cb9a2fd1689fe97f415a6d1382bbe32 100644 (file)
@@ -127,7 +127,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector
         ConnectorMap paintableMap = ConnectorMap.get(getConnection());
         // register the listened events by the server-side to the event-handler
         // of the component
-        paintableMap.registerEventListenersFromUIDL(getId(), uidl);
+        paintableMap.registerEventListenersFromUIDL(getConnectorId(), uidl);
 
         // Visibility
         setVisible(!uidl.getBooleanAttribute("invisible"), uidl);
@@ -210,7 +210,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector
             w = componentState.getWidth();
         } else {
             // TODO move logging to VUIDLBrowser and VDebugConsole
-            VConsole.log("No state for paintable " + getId()
+            VConsole.log("No state for paintable " + getConnectorId()
                     + " in VAbstractPaintableWidget.updateComponentSize()");
         }
 
@@ -425,7 +425,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector
      *            GWT.create().
      */
     protected <T extends ServerRpc> T initRPC(T clientToServerRpc) {
-        ((InitializableClientToServerRpc) clientToServerRpc).initRpc(getId(),
+        ((InitializableClientToServerRpc) clientToServerRpc).initRpc(getConnectorId(),
                 getConnection());
         return clientToServerRpc;
     }
index f83944271ed1a4568098eb01650be5363931dc35..8ba2bb4d31060939e6550f4dc7762fcafb4a159f 100644 (file)
@@ -42,7 +42,7 @@ public abstract class AbstractConnector implements ServerConnector {
      * 
      * @see com.vaadin.terminal.gwt.client.Connector#getId()
      */
-    public String getId() {
+    public String getConnectorId() {
         return id;
     }
 
index c49b55eef71bd451ef4ba84d0d4cca67b7a95f1c..619eb8d9802a2ec1831761e381841d82866ba32e 100644 (file)
@@ -85,7 +85,7 @@ public abstract class AbstractOrderedLayoutConnector extends
             }
             layout.addOrMove(slot, currentIndex++);
 
-            String pid = child.getId();
+            String pid = child.getConnectorId();
 
             AlignmentInfo alignment;
             if (alignments.containsKey(pid)) {
index 3107780d596a8bb99872278eed80b689dadcf9be..05db22e6ae15876fc648508e9c786141c02c2eb2 100644 (file)
@@ -140,7 +140,7 @@ public class FormConnector extends AbstractComponentContainerConnector
             if (childUidl != null) {
                 if (getWidget().shortcutHandler == null) {
                     getWidget().shortcutHandler = new ShortcutActionHandler(
-                            getId(), client);
+                            getConnectorId(), client);
                     getWidget().keyDownRegistration = getWidget()
                             .addDomHandler(getWidget(), KeyDownEvent.getType());
                 }
index b48b0e823276386f498ccf9c253428a48388a294..f990fc590d5926eb813e7ace1f360736698eef07 100644 (file)
@@ -164,7 +164,7 @@ public class PanelConnector extends AbstractComponentContainerConnector
                 if (childUidl.getTag().equals("actions")) {
                     if (getWidget().shortcutHandler == null) {
                         getWidget().shortcutHandler = new ShortcutActionHandler(
-                                getId(), client);
+                                getConnectorId(), client);
                     }
                     getWidget().shortcutHandler.updateActionMap(childUidl);
                 }
index 37afeafce7f92439c52ba7bd604283c22e93cf6b..ffe9f7f16bb4f74b04b6267c950909f01cf58e01 100644 (file)
@@ -39,10 +39,10 @@ public class RootConnector extends AbstractComponentContainerConnector
         ConnectorMap paintableMap = ConnectorMap.get(getConnection());
         // register the listened events by the server-side to the event-handler
         // of the component
-        paintableMap.registerEventListenersFromUIDL(getId(), uidl);
+        paintableMap.registerEventListenersFromUIDL(getConnectorId(), uidl);
 
         getWidget().rendering = true;
-        getWidget().id = getId();
+        getWidget().id = getConnectorId();
         boolean firstPaint = getWidget().connection == null;
         getWidget().connection = client;
 
index 7775766689c90afb1988400edbb91f46c147fb6c..7e9f7c95804ce9ab98b433ff12924b9936e13447 100644 (file)
@@ -55,12 +55,12 @@ public class WindowConnector extends AbstractComponentContainerConnector
 
     @Override
     public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
-        getWidget().id = getId();
+        getWidget().id = getConnectorId();
         getWidget().client = client;
 
         // Workaround needed for Testing Tools (GWT generates window DOM
         // slightly different in different browsers).
-        DOM.setElementProperty(getWidget().closeBox, "id", getId()
+        DOM.setElementProperty(getWidget().closeBox, "id", getConnectorId()
                 + "_window_close");
 
         if (uidl.hasAttribute("invisible")) {
@@ -169,7 +169,7 @@ public class WindowConnector extends AbstractComponentContainerConnector
                 if (childUidl.getTag().equals("actions")) {
                     if (getWidget().shortcutHandler == null) {
                         getWidget().shortcutHandler = new ShortcutActionHandler(
-                                getId(), client);
+                                getConnectorId(), client);
                     }
                     getWidget().shortcutHandler.updateActionMap(childUidl);
                 }