@@ -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(); | |||
} |
@@ -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); | |||
} | |||
} |
@@ -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(); |
@@ -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. | |||
* |
@@ -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; | |||
} |
@@ -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; | |||
} | |||
@@ -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)) { |
@@ -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()); | |||
} |
@@ -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); | |||
} |
@@ -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; | |||
@@ -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); | |||
} |