private HashMap<String, String> unknownComponents;
- private Class<? extends VPaintableWidget>[] classes = new Class[1024];
+ private Class<? extends ComponentConnector>[] classes = new Class[1024];
private String windowId;
return useDebugIdInDom;
}
- public Class<? extends VPaintableWidget> getWidgetClassByEncodedTag(
+ public Class<? extends ComponentConnector> getWidgetClassByEncodedTag(
String tag) {
try {
int parseInt = Integer.parseInt(tag);
public void run() {
pending = false;
if (!isBusy()) {
- Class<? extends VPaintableWidget> nextType = getNextType();
+ Class<? extends ComponentConnector> nextType = getNextType();
if (nextType == null) {
// ensured that all widgets are loaded
deferredWidgetLoader = null;
}
}
- private Class<? extends VPaintableWidget> getNextType() {
- Class<? extends VPaintableWidget>[] deferredLoadedWidgets = widgetSet
+ private Class<? extends ComponentConnector> getNextType() {
+ Class<? extends ComponentConnector>[] deferredLoadedWidgets = widgetSet
.getDeferredLoadedWidgets();
if (deferredLoadedWidgets.length <= nextWidgetIndex) {
return null;
*
* Client-side widgets receive updates from the corresponding server-side
* components as calls to
- * {@link VPaintableWidget#updateFromUIDL(UIDL, ApplicationConnection)} (not to
+ * {@link ComponentConnector#updateFromUIDL(UIDL, ApplicationConnection)} (not to
* be confused with the server side interface
* {@link com.vaadin.terminal.Paintable} ). Any client-side changes (typically
* resulting from user actions) are sent back to the server as variable changes
private boolean validatingLayouts = false;
- private Set<VPaintableWidget> zeroWidthComponents = null;
+ private Set<ComponentConnector> zeroWidthComponents = null;
- private Set<VPaintableWidget> zeroHeightComponents = null;
+ private Set<ComponentConnector> zeroHeightComponents = null;
private final LayoutManager layoutManager = new LayoutManager(this);
*
* @param paintable
*/
- void highlightComponent(VPaintableWidget paintable) {
+ void highlightComponent(ComponentConnector paintable) {
String params = getRepaintAllParameters() + "&highlightComponent="
- + paintableMap.getPid(paintable);
+ + connectorMap.getConnectorId(paintable);
makeUidlRequest("", params, false);
}
private void cleanVariableBurst(ArrayList<MethodInvocation> variableBurst) {
for (int i = 1; i < variableBurst.size(); i++) {
String id = variableBurst.get(i).getPaintableId();
- if (!getPaintableMap().hasPaintable(id)
- && !getPaintableMap().isDragAndDropPaintable(id)) {
+ if (!getConnectorMap().hasConnector(id)
+ && !getConnectorMap().isDragAndDropPaintable(id)) {
// variable owner does not exist anymore
variableBurst.remove(i);
VConsole.log("Removed variable from removed component: " + id);
if (meta.containsKey("repaintAll")) {
repaintAll = true;
view.getWidget().clear();
- getPaintableMap().clear();
+ getConnectorMap().clear();
if (meta.containsKey("invalidLayouts")) {
validatingLayouts = true;
- zeroWidthComponents = new HashSet<VPaintableWidget>();
- zeroHeightComponents = new HashSet<VPaintableWidget>();
+ zeroWidthComponents = new HashSet<ComponentConnector>();
+ zeroHeightComponents = new HashSet<ComponentConnector>();
}
}
if (meta.containsKey("timedRedirect")) {
// Process changes
JsArray<ValueMap> changes = json.getJSValueMapArray("changes");
- ArrayList<VPaintableWidget> updatedVPaintableWidgets = new ArrayList<VPaintableWidget>();
+ ArrayList<ComponentConnector> updatedVPaintableWidgets = new ArrayList<ComponentConnector>();
componentCaptionSizeChanges.clear();
Duration updateDuration = new Duration();
try {
final UIDL change = changes.get(i).cast();
final UIDL uidl = change.getChildUIDL(0);
- VPaintable paintable = paintableMap.getPaintable(uidl
+ Connector paintable = connectorMap.getConnector(uidl
.getId());
if (null == paintable
&& !uidl.getTag().equals(
for (int i = 0; i < keyArray.length(); i++) {
try {
String paintableId = keyArray.get(i);
- VPaintable paintable = paintableMap
- .getPaintable(paintableId);
+ Connector paintable = connectorMap
+ .getConnector(paintableId);
if (null != paintable) {
JSONArray stateDataAndType = new JSONArray(
states.getJavaScriptObject(paintableId));
Object state = JsonDecoder.convertValue(
- stateDataAndType, paintableMap);
+ stateDataAndType, connectorMap);
paintable.setState((SharedState) state);
}
final UIDL change = changes.get(i).cast();
final UIDL uidl = change.getChildUIDL(0);
// TODO optimize
- final VPaintableWidget paintable = (VPaintableWidget) paintableMap
- .getPaintable(uidl.getId());
+ final ComponentConnector paintable = (ComponentConnector) connectorMap
+ .getConnector(uidl.getId());
if (paintable != null) {
paintable.updateFromUIDL(uidl,
ApplicationConnection.this);
+ uidl.getId() + ") rendered.");
} else {
String pid = uidl.getId();
- if (!paintableMap.hasPaintable(pid)) {
- paintableMap.registerPaintable(pid, view);
+ if (!connectorMap.hasConnector(pid)) {
+ connectorMap.registerConnector(pid, view);
}
// VView does not call updateComponent so we
// register any event listeners here
- paintableMap.registerEventListenersFromUIDL(
+ connectorMap.registerEventListenersFromUIDL(
pid, uidl);
// Finally allow VView to update itself
* idToPaintableDetail is already cleanded at the start of
* the changeset handling, bypass cleanup.
*/
- paintableMap.purgeUnregistryBag(false);
+ connectorMap.purgeUnregistryBag(false);
} else {
- paintableMap.purgeUnregistryBag(true);
+ connectorMap.purgeUnregistryBag(true);
}
// TODO build profiling for widget impl loading time
VConsole.log(" Processing time was "
+ String.valueOf(prosessingTime) + "ms for "
+ jsonText.length() + " characters of JSON");
- VConsole.log("Referenced paintables: " + paintableMap.size());
+ VConsole.log("Referenced paintables: " + connectorMap.size());
endRequest();
for (int i = 0; i < invocation.getParameters().length; ++i) {
// TODO non-static encoder? type registration?
paramJson.set(i, JsonEncoder.encode(
- invocation.getParameters()[i], getPaintableMap()));
+ invocation.getParameters()[i], getConnectorMap()));
}
invocationJson.set(3, paramJson);
reqJson.set(reqJson.size(), invocationJson);
* true if the update is to be sent as soon as possible
*/
public void updateVariable(String paintableId, String variableName,
- VPaintable newValue, boolean immediate) {
+ Connector newValue, boolean immediate) {
addVariableToQueue(paintableId, variableName, newValue, immediate);
}
while (childWidgets.hasNext()) {
final Widget child = childWidgets.next();
- if (getPaintableMap().isPaintable(child)) {
+ if (getConnectorMap().isConnector(child)) {
if (handleComponentRelativeSize(child)) {
/*
* @param child
* @return true if the child has a relative size
*/
- private boolean handleComponentRelativeSize(VPaintableWidget paintable) {
+ private boolean handleComponentRelativeSize(ComponentConnector paintable) {
return false;
}
* @return true if the child has a relative size
*/
public boolean handleComponentRelativeSize(Widget widget) {
- return handleComponentRelativeSize(paintableMap.getPaintable(widget));
+ return handleComponentRelativeSize(connectorMap.getConnector(widget));
}
* UIDL to create Paintable from.
* @return Either existing or new Paintable corresponding to UIDL.
*/
- public VPaintableWidget getPaintable(UIDL uidl) {
+ public ComponentConnector getPaintable(UIDL uidl) {
final String pid = uidl.getId();
// the actual content UIDL may be deferred, but it always contains
// enough information to create a paintable instance
- if (!paintableMap.hasPaintable(pid)) {
+ if (!connectorMap.hasConnector(pid)) {
// Create and register a new paintable if no old was found
- VPaintableWidget p = widgetSet.createWidget(uidl.getTag(),
+ ComponentConnector p = widgetSet.createWidget(uidl.getTag(),
configuration);
p.setConnection(this);
p.setId(pid);
p.init();
- paintableMap.registerPaintable(pid, p);
+ connectorMap.registerConnector(pid, p);
}
- return (VPaintableWidget) paintableMap.getPaintable(pid);
+ return (ComponentConnector) connectorMap.getConnector(pid);
}
/**
* Updating TooltipInfo is done in updateComponent method.
*
*/
- public TooltipInfo getTooltipTitleInfo(VPaintableWidget titleOwner,
+ public TooltipInfo getTooltipTitleInfo(ComponentConnector titleOwner,
Object key) {
if (null == titleOwner) {
return null;
}
- return paintableMap.getTooltipInfo(titleOwner, key);
+ return connectorMap.getTooltipInfo(titleOwner, key);
}
private final VTooltip tooltip = new VTooltip(this);
* @param event
* @param owner
*/
- public void handleTooltipEvent(Event event, VPaintableWidget owner) {
+ public void handleTooltipEvent(Event event, ComponentConnector owner) {
tooltip.handleTooltipEvent(event, owner, null);
}
* the key for tooltip if this is "additional" tooltip, null for
* components "main tooltip"
*/
- public void handleTooltipEvent(Event event, VPaintableWidget owner,
+ public void handleTooltipEvent(Event event, ComponentConnector owner,
Object key) {
tooltip.handleTooltipEvent(event, owner, key);
}
};
- private VPaintableMap paintableMap = GWT.create(VPaintableMap.class);
+ private ConnectorMap connectorMap = GWT.create(ConnectorMap.class);
/**
* Components can call this function to run all layout functions. This is
* this method.
* <p>
* Component must also pipe events to
- * {@link #handleTooltipEvent(Event, VPaintableWidget, Object)} method.
+ * {@link #handleTooltipEvent(Event, ComponentConnector, Object)} method.
* <p>
* This method can also be used to deregister tooltips by using null as
* tooltip
* @param key
* key assosiated with given tooltip. Can be any object. For
* example a related dom element. Same key must be given for
- * {@link #handleTooltipEvent(Event, VPaintableWidget, Object)}
+ * {@link #handleTooltipEvent(Event, ComponentConnector, Object)}
* method.
*
* @param tooltip
* the TooltipInfo object containing details shown in tooltip,
* null if deregistering tooltip
*/
- public void registerTooltip(VPaintableWidget paintable, Object key,
+ public void registerTooltip(ComponentConnector paintable, Object key,
TooltipInfo tooltip) {
- paintableMap.registerTooltip(paintable, key, tooltip);
+ connectorMap.registerTooltip(paintable, key, tooltip);
}
/**
* @return true if at least one listener has been registered on server side
* for the event identified by eventIdentifier.
*/
- public boolean hasEventListeners(VPaintableWidget paintable,
+ public boolean hasEventListeners(ComponentConnector paintable,
String eventIdentifier) {
- return paintableMap.hasEventListeners(paintable, eventIdentifier);
+ return connectorMap.hasEventListeners(paintable, eventIdentifier);
}
/**
return uri;
}
- VPaintableMap getPaintableMap() {
- return paintableMap;
+ ConnectorMap getConnectorMap() {
+ return connectorMap;
}
@Deprecated
- public void unregisterPaintable(VPaintable p) {
- paintableMap.unregisterPaintable(p);
+ public void unregisterPaintable(Connector p) {
+ connectorMap.unregisterConnector(p);
}
public VTooltip getVTooltip() {
@Deprecated
public void handleTooltipEvent(Event event, Widget owner, Object key) {
- handleTooltipEvent(event, getPaintableMap().getPaintable(owner), key);
+ handleTooltipEvent(event, getConnectorMap().getConnector(owner), key);
}
@Deprecated
public void handleTooltipEvent(Event event, Widget owner) {
- handleTooltipEvent(event, getPaintableMap().getPaintable(owner));
+ handleTooltipEvent(event, getConnectorMap().getConnector(owner));
}
@Deprecated
public void registerTooltip(Widget owner, Object key, TooltipInfo info) {
- registerTooltip(getPaintableMap().getPaintable(owner), key, info);
+ registerTooltip(getConnectorMap().getConnector(owner), key, info);
}
@Deprecated
public boolean hasEventListeners(Widget widget, String eventIdentifier) {
- return hasEventListeners(getPaintableMap().getPaintable(widget),
+ return hasEventListeners(getConnectorMap().getConnector(widget),
eventIdentifier);
}
--- /dev/null
+/*
+@VaadinApache2LicenseForJavaFiles@
+ */
+
+package com.vaadin.terminal.gwt.client;
+
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * An interface used by client-side widgets or paintable parts to receive
+ * updates from the corresponding server-side components in the form of
+ * {@link UIDL}.
+ *
+ * Updates can be sent back to the server using the
+ * {@link ApplicationConnection#updateVariable()} methods.
+ */
+public interface ComponentConnector extends Connector {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.terminal.gwt.client.VPaintable#getState()
+ */
+ public ComponentState getState();
+
+ /**
+ * TODO: Rename to getWidget
+ */
+ public Widget getWidget();
+
+ /**
+ * Returns the parent {@link ComponentContainerConnector}
+ *
+ * @return
+ */
+ public ComponentContainerConnector getParent();
+
+ public LayoutManager getLayoutManager();
+
+ /**
+ * Returns <code>true</code> if the width of this paintable is currently
+ * undefined. If the width is undefined, the actual width of the paintable
+ * is defined by its contents.
+ *
+ * @return <code>true</code> if the width is undefined, else
+ * <code>false</code>
+ */
+ public boolean isUndefinedWidth();
+
+ /**
+ * Returns <code>true</code> if the height of this paintable is currently
+ * undefined. If the height is undefined, the actual height of the paintable
+ * is defined by its contents.
+ *
+ * @return <code>true</code> if the height is undefined, else
+ * <code>false</code>
+ */
+ public boolean isUndefinedHeight();
+
+ /**
+ * Returns <code>true</code> if the width of this paintable is currently
+ * relative. If the width is relative, the actual width of the paintable is
+ * a percentage of the size allocated to it by its parent.
+ *
+ * @return <code>true</code> if the width is undefined, else
+ * <code>false</code>
+ */
+ public boolean isRelativeWidth();
+
+ /**
+ * Returns <code>true</code> if the height of this paintable is currently
+ * relative. If the height is relative, the actual height of the paintable
+ * is a percentage of the size allocated to it by its parent.
+ *
+ * @return <code>true</code> if the width is undefined, else
+ * <code>false</code>
+ */
+ public boolean isRelativeHeight();
+
+ /**
+ * Gets the width of this paintable as defined on the server.
+ *
+ * @return the server side width definition
+ */
+ public String getDeclaredWidth();
+
+ /**
+ * Gets the height of this paintable as defined on the server.
+ *
+ * @return the server side height definition
+ */
+ public String getDeclaredHeight();
+}
--- /dev/null
+/*
+@VaadinApache2LicenseForJavaFiles@
+ */
+
+package com.vaadin.terminal.gwt.client;
+
+import java.util.Collection;
+
+import com.google.gwt.user.client.ui.HasWidgets;
+
+/**
+ * An interface used by client-side paintables whose widget is a component
+ * container (implements {@link HasWidgets}).
+ */
+public interface ComponentContainerConnector extends ComponentConnector {
+
+ /**
+ * Update child components caption, description and error message.
+ *
+ * <p>
+ * Each component is responsible for maintaining its caption, description
+ * and error message. In most cases components doesn't want to do that and
+ * those elements reside outside of the component. Because of this layouts
+ * must provide service for it's childen to show those elements for them.
+ * </p>
+ *
+ * @param paintable
+ * Child component for which service is requested.
+ * @param uidl
+ * UIDL of the child component.
+ */
+ void updateCaption(ComponentConnector paintable, UIDL uidl);
+
+ /**
+ * Returns the children for this paintable.
+ * <p>
+ * The children for this paintable are defined as all
+ * {@link ComponentConnector}s whose parent is this
+ * {@link ComponentContainerConnector}.
+ * </p>
+ *
+ * @return A collection of children for this paintable. An empty collection
+ * if there are no children.
+ */
+ public Collection<ComponentConnector> getChildren();
+
+}
Element e = targetElement;
while (true) {
- pid = VPaintableMap.get(client).getPid(e);
+ pid = ConnectorMap.get(client).getConnectorId(e);
if (pid != null) {
break;
}
// If we found a Paintable then we use that as reference. We should
// find the Paintable for all but very special cases (like
// overlays).
- w = ((VPaintableWidget) VPaintableMap.get(client).getPaintable(pid))
+ w = ((ComponentConnector) ConnectorMap.get(client).getConnector(pid))
.getWidget();
/*
return null;
}
- String pid = VPaintableMap.get(client).getPid(w.getElement());
+ String pid = ConnectorMap.get(client).getConnectorId(w.getElement());
if (isStaticPid(pid)) {
return pid;
}
w = client.getView().getWidget();
} else if (w == null) {
// Must be static pid (PID_S*)
- w = ((VPaintableWidget) VPaintableMap.get(client).getPaintable(
+ w = ((ComponentConnector) ConnectorMap.get(client).getConnector(
part)).getWidget();
} else if (part.startsWith("domChild[")) {
// The target widget has been found and the rest identifies the
--- /dev/null
+/*
+@VaadinApache2LicenseForJavaFiles@
+ */
+package com.vaadin.terminal.gwt.client;
+
+import com.vaadin.terminal.gwt.client.communication.SharedState;
+
+/**
+ * Interface implemented by all client side classes that can be communicate with
+ * the server. Classes implementing this interface are initialized by the
+ * framework when needed and have the ability to communicate with the server.
+ *
+ * @author Vaadin Ltd
+ * @version @VERSION@
+ * @since 7.0.0
+ */
+public interface Connector {
+ /**
+ * TODO
+ *
+ * @param uidl
+ * @param client
+ */
+ 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.
+ *
+ * @param state
+ * The new state
+ *
+ */
+ public void setState(SharedState state);
+
+ /**
+ * Returns the id for this connector. This must always be what has been set
+ * using {@link #setId(String)}.
+ *
+ * @return The id for the connector.
+ */
+ public String getId();
+
+ /**
+ * Sets the id for the connector. This method is called once by the
+ * framework when the connector is initialized and should never be called
+ * otherwise.
+ * <p>
+ * The connector id is used to map the server and the client side together.
+ * It is unique in this Root and assigned by the framework.
+ * </p>
+ *
+ * @param id
+ * The id of the connector.
+ */
+ public void setId(String id);
+
+ /**
+ * Gets ApplicationConnection instance that created this connector.
+ *
+ * @return The ApplicationConnection as set by
+ * {@link #setConnection(ApplicationConnection)}
+ */
+ public ApplicationConnection getConnection();
+
+ /**
+ * Sets the reference to ApplicationConnection. This method is called by the
+ * framework when the connector is created and should never be called
+ * otherwise.
+ *
+ * @param connection
+ * The ApplicationConnection that created this connector
+ */
+ public void setConnection(ApplicationConnection connection);
+
+ /**
+ * Tests whether the component is enabled or not. A user can not interact
+ * with disabled components. Disabled components are rendered in a style
+ * that indicates the status, usually in gray color. Children of a disabled
+ * component are also disabled.
+ *
+ * @return true if the component is enabled, false otherwise
+ */
+ // public boolean isEnabled();
+
+ /**
+ *
+ * Called once when the connection and id has been set.
+ *
+ * Note that the shared state is not yet available during init().
+ */
+ public void init();
+
+}
--- /dev/null
+/*
+@VaadinApache2LicenseForJavaFiles@
+ */
+package com.vaadin.terminal.gwt.client;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.user.client.ui.HasWidgets;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.terminal.Paintable;
+import com.vaadin.terminal.gwt.client.RenderInformation.Size;
+
+public class ConnectorMap {
+
+ private Map<String, Connector> idToConnector = new HashMap<String, Connector>();
+
+ public static ConnectorMap get(ApplicationConnection applicationConnection) {
+ return applicationConnection.getConnectorMap();
+ }
+
+ @Deprecated
+ private final ComponentDetailMap idToComponentDetail = ComponentDetailMap
+ .create();
+
+ private Set<String> unregistryBag = new HashSet<String>();
+
+ /**
+ * Returns a {@link Connector} by its id
+ *
+ * @param id
+ * The connector id
+ * @return A connector or null if a connector with the given id has not been
+ * registered
+ */
+ public Connector getConnector(String connectorId) {
+ return idToConnector.get(connectorId);
+ }
+
+ /**
+ * Returns a {@link ComponentConnector} element by its root element
+ *
+ * @param element
+ * Root element of the {@link ComponentConnector}
+ * @return A connector or null if a connector with the given id has not been
+ * registered
+ */
+ public ComponentConnector getConnector(Element element) {
+ return (ComponentConnector) getConnector(getConnectorId(element));
+ }
+
+ /**
+ * FIXME: What does this even do and why?
+ *
+ * @param pid
+ * @return
+ */
+ public boolean isDragAndDropPaintable(String pid) {
+ return (pid.startsWith("DD"));
+ }
+
+ /**
+ * Checks if a connector with the given id has been registered.
+ *
+ * @param connectorId
+ * The id to check for
+ * @return true if a connector has been registered with the given id, false
+ * otherwise
+ */
+ public boolean hasConnector(String connectorId) {
+ return idToConnector.containsKey(connectorId);
+ }
+
+ /**
+ * Removes all registered connectors
+ */
+ public void clear() {
+ idToConnector.clear();
+ idToComponentDetail.clear();
+ }
+
+ public ComponentConnector getConnector(Widget widget) {
+ return getConnector(widget.getElement());
+ }
+
+ public void registerConnector(String id, Connector connector) {
+ ComponentDetail componentDetail = GWT.create(ComponentDetail.class);
+ idToComponentDetail.put(id, componentDetail);
+ idToConnector.put(id, connector);
+ if (connector instanceof ComponentConnector) {
+ ComponentConnector pw = (ComponentConnector) connector;
+ setConnectorId(pw.getWidget().getElement(), id);
+ }
+ }
+
+ private native void setConnectorId(Element el, String id)
+ /*-{
+ el.tkPid = id;
+ }-*/;
+
+ /**
+ * Gets the id for a specific connector.
+ * <p>
+ * The id is used in the UIDL to identify a specific widget instance,
+ * effectively linking the widget with it's server side Component.
+ * </p>
+ *
+ * @param connector
+ * 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 Connector#getId()} instead
+ */
+ @Deprecated
+ public String getConnectorId(Connector connector) {
+ if (connector == null) {
+ return null;
+ }
+ return connector.getId();
+ }
+
+ @Deprecated
+ public String getConnectorId(Widget widget) {
+ return getConnectorId(widget.getElement());
+ }
+
+ /**
+ * Gets the connector id using a DOM element - the element should be the
+ * root element for a connector, otherwise no id will be found. Use
+ * {@link #getConnectorId(Connector)} instead whenever possible.
+ *
+ * @see #getConnectorId(Paintable)
+ * @param el
+ * element of the connector whose id is desired
+ * @return the id of the element's connector, if it's a connector
+ */
+ native String getConnectorId(Element el)
+ /*-{
+ return el.tkPid;
+ }-*/;
+
+ /**
+ * Gets the main element for the connector with the given id. The reverse of
+ * {@link #getConnectorId(Element)}.
+ *
+ * @param connectorId
+ * the id of the widget whose element is desired
+ * @return the element for the connector corresponding to the id
+ */
+ public Element getElement(String connectorId) {
+ Connector p = getConnector(connectorId);
+ if (p instanceof ComponentConnector) {
+ return ((ComponentConnector) p).getWidget().getElement();
+ }
+
+ return null;
+ }
+
+ /**
+ * Unregisters the given connector; always use after removing a connector.
+ * This method does not remove the connector from the DOM, but marks the
+ * connector so that ApplicationConnection may clean up its references to
+ * it. Removing the widget from DOM is component containers responsibility.
+ *
+ * @param connector
+ * the connector to remove
+ */
+ public void unregisterConnector(Connector connector) {
+
+ // add to unregistry que
+
+ if (connector == null) {
+ VConsole.error("WARN: Trying to unregister null connector");
+ return;
+ }
+ String id = connector.getId();
+ Widget widget = null;
+ if (connector instanceof ComponentConnector) {
+ widget = ((ComponentConnector) connector).getWidget();
+ }
+
+ if (id == null) {
+ /*
+ * Uncomment the following to debug unregistring components. No
+ * paintables with null id should end here. At least one exception
+ * is our VScrollTableRow, that is hacked to fake it self as a
+ * Paintable to build support for sizing easier.
+ */
+ // if (!(p instanceof VScrollTableRow)) {
+ // VConsole.log("Trying to unregister Paintable not created by Application Connection.");
+ // }
+ } else {
+ unregistryBag.add(id);
+ }
+ if (widget != null && widget instanceof HasWidgets) {
+ unregisterChildConnectors((HasWidgets) widget);
+ }
+
+ }
+
+ public ComponentConnector[] getRegisteredComponentConnectors() {
+ ArrayList<ComponentConnector> result = new ArrayList<ComponentConnector>();
+
+ for (Connector connector : getConnectors()) {
+ if (connector instanceof ComponentConnector) {
+ ComponentConnector componentConnector = (ComponentConnector) connector;
+ if (!unregistryBag.contains(getConnectorId(connector))) {
+ result.add(componentConnector);
+ }
+ }
+ }
+
+ return result.toArray(new ComponentConnector[result.size()]);
+ }
+
+ void purgeUnregistryBag(boolean unregisterConnectors) {
+ if (unregisterConnectors) {
+ for (String connectorId : unregistryBag) {
+ // TODO purge shared state for pid
+ Connector connector = getConnector(connectorId);
+ if (connector == null) {
+ /*
+ * this should never happen, but it does :-( See e.g.
+ * com.vaadin.tests.components.accordion.RemoveTabs (with
+ * test script)
+ */
+ VConsole.error("Tried to unregister component (id="
+ + connectorId
+ + ") that is never registered (or already unregistered)");
+ continue;
+ }
+ Widget widget = null;
+ if (connector instanceof ComponentConnector) {
+ widget = ((ComponentConnector) connector).getWidget();
+ }
+
+ // check if can be cleaned
+ if (widget == null || !widget.isAttached()) {
+ // clean reference to paintable
+ idToComponentDetail.remove(connectorId);
+ idToConnector.remove(connectorId);
+ }
+ /*
+ * else NOP : same component has been reattached to another
+ * parent or replaced by another component implementation.
+ */
+ }
+ }
+
+ unregistryBag.clear();
+ }
+
+ /**
+ * Unregisters the child connectors for the given container recursively.
+ *
+ * Use when after removing a connector that contains other connectors. Does
+ * not unregister the given container itself. Does not actually remove the
+ * widgets from the DOM.
+ *
+ * @see #unregisterConnector(Connector)
+ * @param container
+ * The container that contains the connectors that should be
+ * unregistered
+ */
+ public void unregisterChildConnectors(HasWidgets container) {
+ // FIXME: This should be based on the paintable hierarchy
+ final Iterator<Widget> it = container.iterator();
+ while (it.hasNext()) {
+ final Widget w = it.next();
+ ComponentConnector p = getConnector(w);
+ if (p != null) {
+ // This will unregister the paintable and all its children
+ unregisterConnector(p);
+ } else if (w instanceof HasWidgets) {
+ // For normal widget containers, unregister the children
+ unregisterChildConnectors((HasWidgets) w);
+ }
+ }
+ }
+
+ /**
+ * FIXME: Should not be here
+ *
+ * @param pid
+ * @param uidl
+ */
+ @Deprecated
+ public void registerEventListenersFromUIDL(String pid, UIDL uidl) {
+ ComponentDetail cd = idToComponentDetail.get(pid);
+ if (cd == null) {
+ throw new IllegalArgumentException("Pid must not be null");
+ }
+
+ cd.registerEventListenersFromUIDL(uidl);
+
+ }
+
+ /**
+ * FIXME: Should not be here
+ *
+ * @param paintable
+ * @return
+ */
+ @Deprecated
+ public Size getOffsetSize(ComponentConnector paintable) {
+ return getComponentDetail(paintable).getOffsetSize();
+ }
+
+ /**
+ * FIXME: Should not be here
+ *
+ * @param componentConnector
+ * @return
+ */
+ @Deprecated
+ public void setOffsetSize(ComponentConnector componentConnector,
+ Size newSize) {
+ getComponentDetail(componentConnector).setOffsetSize(newSize);
+ }
+
+ private ComponentDetail getComponentDetail(
+ ComponentConnector componentConnector) {
+ return idToComponentDetail.get(getConnectorId(componentConnector));
+ }
+
+ public int size() {
+ return idToConnector.size();
+ }
+
+ /**
+ * FIXME: Should be moved to VAbstractPaintableWidget
+ *
+ * @param paintable
+ * @return
+ */
+ @Deprecated
+ public TooltipInfo getTooltipInfo(ComponentConnector paintable, Object key) {
+ return getComponentDetail(paintable).getTooltipInfo(key);
+ }
+
+ @Deprecated
+ public TooltipInfo getWidgetTooltipInfo(Widget widget, Object key) {
+ return getTooltipInfo(getConnector(widget), key);
+ }
+
+ public Collection<? extends Connector> getConnectors() {
+ return Collections.unmodifiableCollection(idToConnector.values());
+ }
+
+ /**
+ * FIXME: Should not be here
+ *
+ * @param componentConnector
+ * @return
+ */
+ @Deprecated
+ public void registerTooltip(ComponentConnector componentConnector,
+ Object key, TooltipInfo tooltip) {
+ getComponentDetail(componentConnector).putAdditionalTooltip(key,
+ tooltip);
+
+ }
+
+ /**
+ * FIXME: Should not be here
+ *
+ * @param componentConnector
+ * @return
+ */
+ @Deprecated
+ public boolean hasEventListeners(ComponentConnector componentConnector,
+ String eventIdentifier) {
+ return getComponentDetail(componentConnector).hasEventListeners(
+ eventIdentifier);
+ }
+
+ /**
+ * Tests if the widget is the root widget of a {@link ComponentConnector}.
+ *
+ * @param widget
+ * The widget to test
+ * @return true if the widget is the root widget of a
+ * {@link ComponentConnector}, false otherwise
+ */
+ public boolean isConnector(Widget w) {
+ return getConnectorId(w) != null;
+ }
+
+}
public abstract void printLayoutProblems(ValueMap meta,
ApplicationConnection applicationConnection,
- Set<VPaintableWidget> zeroHeightComponents,
- Set<VPaintableWidget> zeroWidthComponents);
+ Set<ComponentConnector> zeroHeightComponents,
+ Set<ComponentConnector> zeroWidthComponents);
public abstract void setQuietMode(boolean quietDebugMode);
*/
public class EventHelper {
- public static HandlerRegistration updateFocusHandler(VPaintableWidget paintable,
+ public static HandlerRegistration updateFocusHandler(ComponentConnector paintable,
ApplicationConnection client,
HandlerRegistration handlerRegistration) {
if (client.hasEventListeners(paintable, FOCUS)) {
return null;
}
- public static HandlerRegistration updateBlurHandler(VPaintableWidget paintable,
+ public static HandlerRegistration updateBlurHandler(ComponentConnector paintable,
ApplicationConnection client,
HandlerRegistration handlerRegistration) {
if (client.hasEventListeners(paintable, BLUR)) {
if (measuredSize == null) {
measuredSize = new MeasuredSize();
- if (VPaintableMap.get(connection).getPaintable(element) == null) {
+ if (ConnectorMap.get(connection).getConnector(element) == null) {
nonPaintableElements.add(element);
}
setMeasuredSize(element, measuredSize);
}
private boolean needsMeasure(Element e) {
- if (connection.getPaintableMap().getPid(e) != null) {
+ if (connection.getConnectorMap().getConnectorId(e) != null) {
return true;
} else if (getMeasuredSize(e, nullSize).hasDependents()) {
return true;
return element.vMeasuredSize || defaultSize;
}-*/;
- private static final MeasuredSize getMeasuredSize(VPaintableWidget paintable) {
+ private static final MeasuredSize getMeasuredSize(ComponentConnector paintable) {
Element element = paintable.getWidget().getElement();
MeasuredSize measuredSize = getMeasuredSize(element, null);
if (measuredSize == null) {
}
public void doLayout() {
- VPaintableMap paintableMap = connection.getPaintableMap();
- VPaintableWidget[] paintableWidgets = paintableMap
- .getRegisteredPaintableWidgets();
+ ConnectorMap paintableMap = connection.getConnectorMap();
+ ComponentConnector[] paintableWidgets = paintableMap
+ .getRegisteredComponentConnectors();
int passes = 0;
Duration totalDuration = new Duration();
FastStringSet needsHeightUpdate = FastStringSet.create();
FastStringSet needsWidthUpdate = FastStringSet.create();
- for (VPaintableWidget paintable : paintableWidgets) {
+ for (ComponentConnector paintable : paintableWidgets) {
MeasuredSize measuredSize = getMeasuredSize(paintable);
boolean managed = isManagedLayout(paintable);
- VPaintableWidgetContainer parent = paintable.getParent();
+ ComponentContainerConnector parent = paintable.getParent();
boolean managedParent = parent != null
&& isManagedLayout(parent);
for (int i = 0; i < needsWidthUpdateArray.length(); i++) {
String pid = needsWidthUpdateArray.get(i);
- VPaintable paintable = paintableMap.getPaintable(pid);
+ Connector paintable = paintableMap.getConnector(pid);
if (paintable instanceof DirectionalManagedLayout) {
DirectionalManagedLayout cl = (DirectionalManagedLayout) paintable;
cl.layoutHorizontally();
for (int i = 0; i < needsHeightUpdateArray.length(); i++) {
String pid = needsHeightUpdateArray.get(i);
- VPaintableWidget paintable = (VPaintableWidget) paintableMap
- .getPaintable(pid);
+ ComponentConnector paintable = (ComponentConnector) paintableMap
+ .getConnector(pid);
if (paintable instanceof DirectionalManagedLayout) {
DirectionalManagedLayout cl = (DirectionalManagedLayout) paintable;
cl.layoutVertically();
}
}
- for (VPaintableWidget vPaintableWidget : paintableWidgets) {
+ for (ComponentConnector vPaintableWidget : paintableWidgets) {
if (vPaintableWidget instanceof PostLayoutListener) {
((PostLayoutListener) vPaintableWidget).postLayout();
}
+ "ms");
}
- private void measureElements(VPaintableWidget[] paintableWidgets) {
+ private void measureElements(ComponentConnector[] paintableWidgets) {
- for (VPaintableWidget paintableWidget : paintableWidgets) {
+ for (ComponentConnector paintableWidget : paintableWidgets) {
Element element = paintableWidget.getWidget()
.getElement();
MeasuredSize measuredSize = getMeasuredSize(paintableWidget);
JsArrayString dependents = measuredSize.getDependents();
for (int i = 0; i < dependents.length(); i++) {
String pid = dependents.get(i);
- VPaintableWidget dependent = (VPaintableWidget) connection
- .getPaintableMap().getPaintable(pid);
+ ComponentConnector dependent = (ComponentConnector) connection
+ .getConnectorMap().getConnector(pid);
if (dependent != null) {
MeasuredSize dependentSize = getMeasuredSize(dependent);
if (measuredSize.isHeightNeedsUpdate()) {
}
}
- private static boolean isManagedLayout(VPaintableWidget paintable) {
+ private static boolean isManagedLayout(ComponentConnector paintable) {
return paintable instanceof ManagedLayout;
}
public void foceLayout() {
- VPaintableMap paintableMap = connection.getPaintableMap();
- VPaintableWidget[] paintableWidgets = paintableMap
- .getRegisteredPaintableWidgets();
- for (VPaintableWidget vPaintableWidget : paintableWidgets) {
+ ConnectorMap paintableMap = connection.getConnectorMap();
+ ComponentConnector[] paintableWidgets = paintableMap
+ .getRegisteredComponentConnectors();
+ for (ComponentConnector vPaintableWidget : paintableWidgets) {
MeasuredSize measuredSize = getMeasuredSize(vPaintableWidget);
measuredSize.setHeightNeedsUpdate();
measuredSize.setWidthNeedsUpdate();
public void printLayoutProblems(ValueMap meta,
ApplicationConnection applicationConnection,
- Set<VPaintableWidget> zeroHeightComponents,
- Set<VPaintableWidget> zeroWidthComponents) {
+ Set<ComponentConnector> zeroHeightComponents,
+ Set<ComponentConnector> zeroWidthComponents) {
}
public void log(Throwable e) {
/**
* When a component is updated, it's client side widget's
- * {@link VPaintableWidget#updateFromUIDL(UIDL, ApplicationConnection)
+ * {@link ComponentConnector#updateFromUIDL(UIDL, ApplicationConnection)
* updateFromUIDL()} will be called with the updated ("changes") UIDL received
* from the server.
* <p>
* AbstractComponent.paintContent()}. Note that if the UIDL corresponds to a
* Paintable, a component identifier will be returned instead - this is used
* internally and is not needed within
- * {@link VPaintableWidget#updateFromUIDL(UIDL, ApplicationConnection)
+ * {@link ComponentConnector#updateFromUIDL(UIDL, ApplicationConnection)
* updateFromUIDL()}.
*
* @return the name for this section
* the name of the attribute
* @return the Paintable referenced by the attribute, if it exists
*/
- public VPaintable getPaintableAttribute(String name,
+ public Connector getPaintableAttribute(String name,
ApplicationConnection connection) {
- return VPaintableMap.get(connection).getPaintable(
+ return ConnectorMap.get(connection).getConnector(
getStringAttribute(name));
}
* the name of the variable
* @return the Paintable referenced by the variable, if it exists
*/
- public VPaintable getPaintableVariable(String name,
+ public Connector getPaintableVariable(String name,
ApplicationConnection connection) {
- return VPaintableMap.get(connection).getPaintable(
+ return ConnectorMap.get(connection).getConnector(
getStringVariable(name));
}
List<ApplicationConnection> runningApplications = ApplicationConfiguration
.getRunningApplications();
for (ApplicationConnection applicationConnection : runningApplications) {
- VPaintableMap paintableMap = applicationConnection
- .getPaintableMap();
- VPaintableWidget paintable = paintableMap.getPaintable(widget);
+ ConnectorMap paintableMap = applicationConnection
+ .getConnectorMap();
+ ComponentConnector paintable = paintableMap.getConnector(widget);
if (paintable == null) {
continue;
}
- String pid = paintableMap.getPid(paintable);
+ String pid = paintableMap.getConnectorId(paintable);
if (pid != null) {
- VPaintable otherPaintable = paintableMap.getPaintable(pid);
+ Connector otherPaintable = paintableMap.getConnector(pid);
if (otherPaintable == paintable) {
return applicationConnection;
}
* @return The VPaintableWidget which the element is a part of. Null if the
* element does not belong to a child.
*/
- public static VPaintableWidget getPaintableForElement(
+ public static ComponentConnector getPaintableForElement(
ApplicationConnection client, Widget parent, Element element) {
Element rootElement = parent.getElement();
while (element != null && element != rootElement) {
- VPaintableWidget paintable = VPaintableMap.get(client)
- .getPaintable(element);
+ ComponentConnector paintable = ConnectorMap.get(client)
+ .getConnector(element);
if (paintable == null) {
String ownerPid = VCaption.getCaptionOwnerPid(element);
if (ownerPid != null) {
- paintable = (VPaintableWidget) VPaintableMap.get(client)
- .getPaintable(ownerPid);
+ paintable = (ComponentConnector) ConnectorMap.get(client)
+ .getConnector(ownerPid);
}
}
* @param element
* the element to start from
*/
- public static VPaintableWidget findPaintable(ApplicationConnection client,
+ public static ComponentConnector findPaintable(ApplicationConnection client,
Element element) {
Widget widget = Util.findWidget(element, null);
- VPaintableMap vPaintableMap = VPaintableMap.get(client);
- while (widget != null && !vPaintableMap.isPaintable(widget)) {
+ ConnectorMap vPaintableMap = ConnectorMap.get(client);
+ while (widget != null && !vPaintableMap.isConnector(widget)) {
widget = widget.getParent();
}
- return vPaintableMap.getPaintable(widget);
+ return vPaintableMap.getConnector(widget);
}
private static void printPaintablesInvocations(
ArrayList<MethodInvocation> invocations, String id,
ApplicationConnection c) {
- VPaintableWidget paintable = (VPaintableWidget) VPaintableMap.get(c)
- .getPaintable(id);
+ ComponentConnector paintable = (ComponentConnector) ConnectorMap.get(c)
+ .getConnector(id);
if (paintable != null) {
VConsole.log("\t" + id + " (" + paintable.getClass() + ") :");
for (MethodInvocation invocation : invocations) {
Object value = parameters[1];
// TODO paintables inside lists/maps get rendered as
// components in the debug console
- String formattedValue = value instanceof VPaintable ? c
- .getPaintableMap().getPid((VPaintable) value)
+ String formattedValue = value instanceof Connector ? c
+ .getConnectorMap().getConnectorId((Connector) value)
: String.valueOf(value);
formattedParams = parameters[0] + " : " + formattedValue;
}
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.HTML;
import com.vaadin.terminal.gwt.client.ui.Icon;
-import com.vaadin.terminal.gwt.client.ui.VAbstractPaintableWidget;
+import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
import com.vaadin.terminal.gwt.client.ui.VTabsheetBasePaintable;
public class VCaption extends HTML {
public static final String CLASSNAME = "v-caption";
- private final VPaintableWidget owner;
+ private final ComponentConnector owner;
private Element errorIndicatorElement;
}
/**
- * Creates a caption that is not linked to a {@link VPaintableWidget}.
+ * Creates a caption that is not linked to a {@link ComponentConnector}.
*
* When using this constructor, {@link #getOwner()} returns null.
*
}
/**
- * Creates a caption for a {@link VPaintableWidget}.
+ * Creates a caption for a {@link ComponentConnector}.
*
* @param component
* owner of caption, not null
* @param client
* ApplicationConnection
*/
- public VCaption(VPaintableWidget component, ApplicationConnection client) {
+ public VCaption(ComponentConnector component, ApplicationConnection client) {
super();
this.client = client;
owner = component;
if (client != null && owner != null) {
- setOwnerPid(getElement(), VPaintableMap.get(client).getPid(owner));
+ setOwnerPid(getElement(), ConnectorMap.get(client).getConnectorId(owner));
}
setStyleName(CLASSNAME);
setStyleName(style);
boolean hasIcon = uidl
- .hasAttribute(VAbstractPaintableWidget.ATTRIBUTE_ICON);
+ .hasAttribute(AbstractComponentConnector.ATTRIBUTE_ICON);
boolean showRequired = uidl
- .getBooleanAttribute(VAbstractPaintableWidget.ATTRIBUTE_REQUIRED);
+ .getBooleanAttribute(AbstractComponentConnector.ATTRIBUTE_REQUIRED);
boolean showError = uidl
- .hasAttribute(VAbstractPaintableWidget.ATTRIBUTE_ERROR)
- && !uidl.getBooleanAttribute(VAbstractPaintableWidget.ATTRIBUTE_HIDEERRORS);
+ .hasAttribute(AbstractComponentConnector.ATTRIBUTE_ERROR)
+ && !uidl.getBooleanAttribute(AbstractComponentConnector.ATTRIBUTE_HIDEERRORS);
if (hasIcon) {
if (icon == null) {
placedAfterComponent = false;
icon.setUri(uidl
- .getStringAttribute(VAbstractPaintableWidget.ATTRIBUTE_ICON));
+ .getStringAttribute(AbstractComponentConnector.ATTRIBUTE_ICON));
} else if (icon != null) {
// Remove existing
}
}
boolean hasIcon = uidl
- .hasAttribute(VAbstractPaintableWidget.ATTRIBUTE_ICON);
+ .hasAttribute(AbstractComponentConnector.ATTRIBUTE_ICON);
boolean showError = uidl
- .hasAttribute(VAbstractPaintableWidget.ATTRIBUTE_ERROR)
- && !uidl.getBooleanAttribute(VAbstractPaintableWidget.ATTRIBUTE_HIDEERRORS);
+ .hasAttribute(AbstractComponentConnector.ATTRIBUTE_ERROR)
+ && !uidl.getBooleanAttribute(AbstractComponentConnector.ATTRIBUTE_HIDEERRORS);
if (hasIcon) {
if (icon == null) {
placedAfterComponent = false;
icon.setUri(uidl
- .getStringAttribute(VAbstractPaintableWidget.ATTRIBUTE_ICON));
+ .getStringAttribute(AbstractComponentConnector.ATTRIBUTE_ICON));
} else if (icon != null) {
// Remove existing
return true;
}
}
- if (uidl.hasAttribute(VAbstractPaintableWidget.ATTRIBUTE_ERROR)) {
+ if (uidl.hasAttribute(AbstractComponentConnector.ATTRIBUTE_ERROR)) {
return true;
}
- if (uidl.hasAttribute(VAbstractPaintableWidget.ATTRIBUTE_ICON)) {
+ if (uidl.hasAttribute(AbstractComponentConnector.ATTRIBUTE_ICON)) {
return true;
}
- if (uidl.hasAttribute(VAbstractPaintableWidget.ATTRIBUTE_REQUIRED)) {
+ if (uidl.hasAttribute(AbstractComponentConnector.ATTRIBUTE_REQUIRED)) {
return true;
}
*
* @return owner Widget
*/
- public VPaintableWidget getOwner() {
+ public ComponentConnector getOwner() {
return owner;
}
public static final String CLASSNAME = "v-captionwrapper";
VCaption caption;
- VPaintableWidget paintable;
+ ComponentConnector paintable;
/**
* Creates a new caption wrapper panel.
* @param client
* ApplicationConnection
*/
- public VCaptionWrapper(VPaintableWidget toBeWrapped,
+ public VCaptionWrapper(ComponentConnector toBeWrapped,
ApplicationConnection client) {
caption = new VCaption(toBeWrapped, client);
add(caption);
setVisible(!uidl.getBooleanAttribute("invisible"));
}
- public VPaintableWidget getPaintable() {
+ public ComponentConnector getPaintable() {
return paintable;
}
}
public static void printLayoutProblems(ValueMap meta,
ApplicationConnection applicationConnection,
- Set<VPaintableWidget> zeroHeightComponents,
- Set<VPaintableWidget> zeroWidthComponents) {
+ Set<ComponentConnector> zeroHeightComponents,
+ Set<ComponentConnector> zeroWidthComponents) {
impl.printLayoutProblems(meta, applicationConnection,
zeroHeightComponents, zeroWidthComponents);
}
for (ApplicationConnection a : ApplicationConfiguration
.getRunningApplications()) {
- VPaintableWidget paintable = Util.getPaintableForElement(a,
+ ComponentConnector paintable = Util.getPaintableForElement(a,
a.getView().getWidget(), eventTarget);
if (paintable == null) {
paintable = Util.getPaintableForElement(a,
RootPanel.get(), eventTarget);
}
if (paintable != null) {
- String pid = VPaintableMap.get(a).getPid(paintable);
+ String pid = ConnectorMap.get(a).getConnectorId(paintable);
VUIDLBrowser.highlight(paintable);
label.setText("Currently focused :"
+ paintable.getClass() + " ID:" + pid);
.getClientY());
for (ApplicationConnection a : ApplicationConfiguration
.getRunningApplications()) {
- VPaintableWidget paintable = Util.getPaintableForElement(a,
+ ComponentConnector paintable = Util.getPaintableForElement(a,
a.getView().getWidget(), eventTarget);
if (paintable == null) {
paintable = Util.getPaintableForElement(a,
}-*/;
public void printLayoutProblems(ValueMap meta, ApplicationConnection ac,
- Set<VPaintableWidget> zeroHeightComponents,
- Set<VPaintableWidget> zeroWidthComponents) {
+ Set<ComponentConnector> zeroHeightComponents,
+ Set<ComponentConnector> zeroWidthComponents) {
JsArray<ValueMap> valueMapArray = meta
.getJSValueMapArray("invalidLayouts");
int size = valueMapArray.length();
}
private void printClientSideDetectedIssues(
- Set<VPaintableWidget> zeroHeightComponents, ApplicationConnection ac) {
- for (final VPaintableWidget paintable : zeroHeightComponents) {
+ Set<ComponentConnector> zeroHeightComponents, ApplicationConnection ac) {
+ for (final ComponentConnector paintable : zeroHeightComponents) {
final Widget layout = paintable.getParent().getWidget();
VerticalPanel errorDetails = new VerticalPanel();
private void printLayoutError(ValueMap valueMap, SimpleTree root,
final ApplicationConnection ac) {
final String pid = valueMap.getString("id");
- final VPaintableWidget paintable = (VPaintableWidget) VPaintableMap
- .get(ac).getPaintable(pid);
+ final ComponentConnector paintable = (ComponentConnector) ConnectorMap
+ .get(ac).getConnector(pid);
SimpleTree errorNode = new SimpleTree();
VerticalPanel errorDetails = new VerticalPanel();
+++ /dev/null
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client;
-
-import com.vaadin.terminal.gwt.client.communication.SharedState;
-
-/**
- * Interface implemented by all client side classes that can be communicate with
- * the server. Classes implementing this interface are initialized by the
- * framework when needed and have the ability to communicate with the server.
- *
- * @author Vaadin Ltd
- * @version @VERSION@
- * @since 7.0.0
- */
-public interface VPaintable {
- /**
- * TODO
- *
- * @param uidl
- * @param client
- */
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client);
-
- /**
- * Gets the current shared state of the paintable.
- *
- * @return state
- */
- public SharedState getState();
-
- /**
- * Sets a new state for the paintable.
- *
- * @param state
- * The new state
- *
- */
- public void setState(SharedState state);
-
- /**
- * Returns the id for this VPaintable. This must always be what has been set
- * using {@link #setId(String)}.
- *
- * @return The id for the VPaintable.
- */
- public String getId();
-
- /**
- * Sets the id for the VPaintable. This method is called once by the
- * framework when the VPaintable is initialized and should never be called
- * otherwise.
- * <p>
- * The VPaintable id is used to map the server and the client paintables
- * together. It is unique in this root and assigned by the framework.
- * </p>
- *
- * @param id
- * The id of the paintable.
- */
- public void setId(String id);
-
- /**
- * Gets ApplicationConnection instance that created this VPaintable.
- *
- * @return The ApplicationConnection as set by
- * {@link #setConnection(ApplicationConnection)}
- */
- public ApplicationConnection getConnection();
-
- /**
- * Sets the reference to ApplicationConnection. This method is called by the
- * framework when the VPaintable is created and should never be called
- * otherwise.
- *
- * @param connection
- * The ApplicationConnection that created this VPaintable
- */
- public void setConnection(ApplicationConnection connection);
-
- /**
- * Tests whether the component is enabled or not. A user can not interact
- * with disabled components. Disabled components are rendered in a style
- * that indicates the status, usually in gray color. Children of a disabled
- * component are also disabled.
- *
- * @return true if the component is enabled, false otherwise
- */
- // public boolean isEnabled();
-
- /**
- *
- * Called once when the connection and id has been set.
- *
- * Note that the shared state is not yet available during init().
- */
- public void init();
-
-}
+++ /dev/null
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.user.client.ui.HasWidgets;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.Paintable;
-import com.vaadin.terminal.gwt.client.RenderInformation.Size;
-
-public class VPaintableMap {
-
- private Map<String, VPaintable> idToPaintable = new HashMap<String, VPaintable>();
-
- public static VPaintableMap get(ApplicationConnection applicationConnection) {
- return applicationConnection.getPaintableMap();
- }
-
- @Deprecated
- private final ComponentDetailMap idToComponentDetail = ComponentDetailMap
- .create();
-
- private Set<String> unregistryBag = new HashSet<String>();
-
- /**
- * Returns a Paintable by its paintable id
- *
- * @param id
- * The Paintable id
- */
- public VPaintable getPaintable(String pid) {
- return idToPaintable.get(pid);
- }
-
- /**
- * Returns a Paintable element by its root element
- *
- * @param element
- * Root element of the paintable
- */
- public VPaintableWidget getPaintable(Element element) {
- return (VPaintableWidget) getPaintable(getPid(element));
- }
-
- /**
- * FIXME: What does this even do and why?
- *
- * @param pid
- * @return
- */
- public boolean isDragAndDropPaintable(String pid) {
- return (pid.startsWith("DD"));
- }
-
- /**
- * Checks if a paintable with the given paintable id has been registered.
- *
- * @param pid
- * The paintable id to check for
- * @return true if a paintable has been registered with the given paintable
- * id, false otherwise
- */
- public boolean hasPaintable(String pid) {
- return idToPaintable.containsKey(pid);
- }
-
- /**
- * Removes all registered paintable ids
- */
- public void clear() {
- idToPaintable.clear();
- idToComponentDetail.clear();
- }
-
- @Deprecated
- public Widget getWidget(VPaintableWidget paintable) {
- return paintable.getWidget();
- }
-
- @Deprecated
- public VPaintableWidget getPaintable(Widget widget) {
- return getPaintable(widget.getElement());
- }
-
- public void registerPaintable(String pid, VPaintable paintable) {
- ComponentDetail componentDetail = GWT.create(ComponentDetail.class);
- idToComponentDetail.put(pid, componentDetail);
- idToPaintable.put(pid, paintable);
- if (paintable instanceof VPaintableWidget) {
- VPaintableWidget pw = (VPaintableWidget) paintable;
- setPid(pw.getWidget().getElement(), pid);
- }
- }
-
- private native void setPid(Element el, String pid)
- /*-{
- el.tkPid = pid;
- }-*/;
-
- /**
- * Gets the paintableId for a specific paintable.
- * <p>
- * The paintableId is used in the UIDL to identify a specific widget
- * instance, effectively linking the widget with it's server side Component.
- * </p>
- *
- * @param paintable
- * the paintable who's id is needed
- * @return the id for the given paintable or null if the paintable could not
- * be found
- * @deprecated use {@link VPaintable#getId()} instead
- */
- @Deprecated
- public String getPid(VPaintable paintable) {
- if (paintable == null) {
- return null;
- }
- return paintable.getId();
- }
-
- @Deprecated
- public String getPid(Widget widget) {
- return getPid(widget.getElement());
- }
-
- /**
- * Gets the paintableId using a DOM element - the element should be the main
- * element for a paintable otherwise no id will be found. Use
- * {@link #getPid(Paintable)} instead whenever possible.
- *
- * @see #getPid(Paintable)
- * @param el
- * element of the paintable whose pid is desired
- * @return the pid of the element's paintable, if it's a paintable
- */
- native String getPid(Element el)
- /*-{
- return el.tkPid;
- }-*/;
-
- /**
- * Gets the main element for the paintable with the given id. The revers of
- * {@link #getPid(Element)}.
- *
- * @param pid
- * the pid of the widget whose element is desired
- * @return the element for the paintable corresponding to the pid
- */
- public Element getElement(String pid) {
- VPaintable p = getPaintable(pid);
- if (p instanceof VPaintableWidget) {
- return ((VPaintableWidget) p).getWidget().getElement();
- }
-
- return null;
- }
-
- /**
- * Unregisters the given paintable; always use after removing a paintable.
- * This method does not remove the paintable from the DOM, but marks the
- * paintable so that ApplicationConnection may clean up its references to
- * it. Removing the widget from DOM is component containers responsibility.
- *
- * @param p
- * the paintable to remove
- */
- public void unregisterPaintable(VPaintable p) {
-
- // add to unregistry que
-
- if (p == null) {
- VConsole.error("WARN: Trying to unregister null paintable");
- return;
- }
- String id = getPid(p);
- Widget widget = null;
- if (p instanceof VPaintableWidget) {
- widget = ((VPaintableWidget) p).getWidget();
- }
-
- if (id == null) {
- /*
- * Uncomment the following to debug unregistring components. No
- * paintables with null id should end here. At least one exception
- * is our VScrollTableRow, that is hacked to fake it self as a
- * Paintable to build support for sizing easier.
- */
- // if (!(p instanceof VScrollTableRow)) {
- // VConsole.log("Trying to unregister Paintable not created by Application Connection.");
- // }
- } else {
- unregistryBag.add(id);
- }
- if (widget != null && widget instanceof HasWidgets) {
- unregisterChildPaintables((HasWidgets) widget);
- }
-
- }
-
- public VPaintableWidget[] getRegisteredPaintableWidgets() {
- ArrayList<VPaintableWidget> result = new ArrayList<VPaintableWidget>();
-
- for (VPaintable paintable : getPaintables()) {
- if (paintable instanceof VPaintableWidget) {
- VPaintableWidget paintableWidget = (VPaintableWidget) paintable;
- if (!unregistryBag.contains(getPid(paintable))) {
- result.add(paintableWidget);
- }
- }
- }
-
- return result.toArray(new VPaintableWidget[result.size()]);
- }
-
- void purgeUnregistryBag(boolean unregisterPaintables) {
- if (unregisterPaintables) {
- for (String pid : unregistryBag) {
- // TODO purge shared state for pid
- VPaintable paintable = getPaintable(pid);
- if (paintable == null) {
- /*
- * this should never happen, but it does :-( See e.g.
- * com.vaadin.tests.components.accordion.RemoveTabs (with
- * test script)
- */
- VConsole.error("Tried to unregister component (id="
- + pid
- + ") that is never registered (or already unregistered)");
- continue;
- }
- Widget widget = null;
- if (paintable instanceof VPaintableWidget) {
- widget = ((VPaintableWidget) paintable)
- .getWidget();
- }
-
- // check if can be cleaned
- if (widget == null || !widget.isAttached()) {
- // clean reference to paintable
- idToComponentDetail.remove(pid);
- idToPaintable.remove(pid);
- }
- /*
- * else NOP : same component has been reattached to another
- * parent or replaced by another component implementation.
- */
- }
- }
-
- unregistryBag.clear();
- }
-
- /**
- * Unregisters a paintable and all it's child paintables recursively. Use
- * when after removing a paintable that contains other paintables. Does not
- * unregister the given container itself. Does not actually remove the
- * paintable from the DOM.
- *
- * @see #unregisterPaintable(Paintable)
- * @param container
- */
- public void unregisterChildPaintables(HasWidgets container) {
- // FIXME: This should be based on the paintable hierarchy
- final Iterator<Widget> it = container.iterator();
- while (it.hasNext()) {
- final Widget w = it.next();
- VPaintableWidget p = getPaintable(w);
- if (p != null) {
- // This will unregister the paintable and all its children
- unregisterPaintable(p);
- } else if (w instanceof HasWidgets) {
- // For normal widget containers, unregister the children
- unregisterChildPaintables((HasWidgets) w);
- }
- }
- }
-
- /**
- * FIXME: Should not be here
- *
- * @param pid
- * @param uidl
- */
- @Deprecated
- public void registerEventListenersFromUIDL(String pid, UIDL uidl) {
- ComponentDetail cd = idToComponentDetail.get(pid);
- if (cd == null) {
- throw new IllegalArgumentException("Pid must not be null");
- }
-
- cd.registerEventListenersFromUIDL(uidl);
-
- }
-
- /**
- * FIXME: Should not be here
- *
- * @param paintable
- * @return
- */
- @Deprecated
- public Size getOffsetSize(VPaintableWidget paintable) {
- return getComponentDetail(paintable).getOffsetSize();
- }
-
- /**
- * FIXME: Should not be here
- *
- * @param paintable
- * @return
- */
- @Deprecated
- public void setOffsetSize(VPaintableWidget paintable, Size newSize) {
- getComponentDetail(paintable).setOffsetSize(newSize);
- }
-
- private ComponentDetail getComponentDetail(VPaintableWidget paintable) {
- return idToComponentDetail.get(getPid(paintable));
- }
-
- public int size() {
- return idToPaintable.size();
- }
-
- /**
- * FIXME: Should be moved to VAbstractPaintableWidget
- *
- * @param paintable
- * @return
- */
- @Deprecated
- public TooltipInfo getTooltipInfo(VPaintableWidget paintable, Object key) {
- return getComponentDetail(paintable).getTooltipInfo(key);
- }
-
- @Deprecated
- public TooltipInfo getWidgetTooltipInfo(Widget widget, Object key) {
- return getTooltipInfo(getPaintable(widget), key);
- }
-
- public Collection<? extends VPaintable> getPaintables() {
- return Collections.unmodifiableCollection(idToPaintable.values());
- }
-
- /**
- * FIXME: Should not be here
- *
- * @param paintable
- * @return
- */
- @Deprecated
- public void registerTooltip(VPaintableWidget paintable, Object key,
- TooltipInfo tooltip) {
- getComponentDetail(paintable).putAdditionalTooltip(key, tooltip);
-
- }
-
- /**
- * FIXME: Should not be here
- *
- * @param paintable
- * @return
- */
- @Deprecated
- public boolean hasEventListeners(VPaintableWidget paintable,
- String eventIdentifier) {
- return getComponentDetail(paintable).hasEventListeners(eventIdentifier);
- }
-
- /**
- * Tests if the widget is the root widget of a VPaintableWidget.
- *
- * @param widget
- * The widget to test
- * @return true if the widget is the root widget of a VPaintableWidget,
- * false otherwise
- */
- public boolean isPaintable(Widget w) {
- return getPid(w) != null;
- }
-
-}
+++ /dev/null
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client;
-
-import com.google.gwt.user.client.ui.Widget;
-
-/**
- * An interface used by client-side widgets or paintable parts to receive
- * updates from the corresponding server-side components in the form of
- * {@link UIDL}.
- *
- * Updates can be sent back to the server using the
- * {@link ApplicationConnection#updateVariable()} methods.
- */
-public interface VPaintableWidget extends VPaintable {
-
- /*
- * (non-Javadoc)
- *
- * @see com.vaadin.terminal.gwt.client.VPaintable#getState()
- */
- public ComponentState getState();
-
- /**
- * TODO: Rename to getWidget
- */
- public Widget getWidget();
-
- /**
- * Returns the parent {@link VPaintableWidgetContainer}
- *
- * @return
- */
- public VPaintableWidgetContainer getParent();
-
- public LayoutManager getLayoutManager();
-
- /**
- * Returns <code>true</code> if the width of this paintable is currently
- * undefined. If the width is undefined, the actual width of the paintable
- * is defined by its contents.
- *
- * @return <code>true</code> if the width is undefined, else
- * <code>false</code>
- */
- public boolean isUndefinedWidth();
-
- /**
- * Returns <code>true</code> if the height of this paintable is currently
- * undefined. If the height is undefined, the actual height of the paintable
- * is defined by its contents.
- *
- * @return <code>true</code> if the height is undefined, else
- * <code>false</code>
- */
- public boolean isUndefinedHeight();
-
- /**
- * Returns <code>true</code> if the width of this paintable is currently
- * relative. If the width is relative, the actual width of the paintable is
- * a percentage of the size allocated to it by its parent.
- *
- * @return <code>true</code> if the width is undefined, else
- * <code>false</code>
- */
- public boolean isRelativeWidth();
-
- /**
- * Returns <code>true</code> if the height of this paintable is currently
- * relative. If the height is relative, the actual height of the paintable
- * is a percentage of the size allocated to it by its parent.
- *
- * @return <code>true</code> if the width is undefined, else
- * <code>false</code>
- */
- public boolean isRelativeHeight();
-
- /**
- * Gets the width of this paintable as defined on the server.
- *
- * @return the server side width definition
- */
- public String getDeclaredWidth();
-
- /**
- * Gets the height of this paintable as defined on the server.
- *
- * @return the server side height definition
- */
- public String getDeclaredHeight();
-}
+++ /dev/null
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client;
-
-import java.util.Collection;
-
-import com.google.gwt.user.client.ui.HasWidgets;
-
-/**
- * An interface used by client-side paintables whose widget is a component
- * container (implements {@link HasWidgets}).
- */
-public interface VPaintableWidgetContainer extends VPaintableWidget {
-
- /**
- * Update child components caption, description and error message.
- *
- * <p>
- * Each component is responsible for maintaining its caption, description
- * and error message. In most cases components doesn't want to do that and
- * those elements reside outside of the component. Because of this layouts
- * must provide service for it's childen to show those elements for them.
- * </p>
- *
- * @param paintable
- * Child component for which service is requested.
- * @param uidl
- * UIDL of the child component.
- */
- void updateCaption(VPaintableWidget paintable, UIDL uidl);
-
- /**
- * Returns the children for this paintable.
- * <p>
- * The children for this paintable are defined as all
- * {@link VPaintableWidget}s whose parent is this
- * {@link VPaintableWidgetContainer}.
- * </p>
- *
- * @return A collection of children for this paintable. An empty collection
- * if there are no children.
- */
- public Collection<VPaintableWidget> getChildren();
-
-}
private static final int QUICK_OPEN_DELAY = 100;
VErrorMessage em = new VErrorMessage();
Element description = DOM.createDiv();
- private VPaintableWidget tooltipOwner;
+ private ComponentConnector tooltipOwner;
private boolean closing = false;
private boolean opening = false;
}
}
- public void showTooltip(VPaintableWidget owner, Event event, Object key) {
+ public void showTooltip(ComponentConnector owner, Event event, Object key) {
if (closing && tooltipOwner == owner && tooltipKey == key) {
// return to same tooltip, cancel closing
closeTimer.cancel();
}
- public void handleTooltipEvent(Event event, VPaintableWidget owner, Object key) {
+ public void handleTooltipEvent(Event event, ComponentConnector owner, Object key) {
final int type = DOM.eventGetType(event);
if ((VTooltip.TOOLTIP_EVENTS & type) == type) {
if (type == Event.ONMOUSEOVER) {
private String getNodeName(UIDL uidl, ApplicationConfiguration conf,
String name) {
- Class<? extends VPaintableWidget> widgetClassByDecodedTag = conf
+ Class<? extends ComponentConnector> widgetClassByDecodedTag = conf
.getWidgetClassByEncodedTag(name);
if (widgetClassByDecodedTag == VUnknownComponentPaintable.class) {
return conf.getUnknownServerClassNameByEncodedTagName(name)
// same
// host page
for (ApplicationConnection applicationConnection : runningApplications) {
- VPaintableWidget paintable = (VPaintableWidget) VPaintableMap
- .get(applicationConnection).getPaintable(uidl.getId());
+ ComponentConnector paintable = (ComponentConnector) ConnectorMap
+ .get(applicationConnection).getConnector(uidl.getId());
highlight(paintable);
if (event != null && event.getNativeEvent().getShiftKey()) {
applicationConnection.highlightComponent(paintable);
}
}
- static void highlight(VPaintableWidget paintable) {
+ static void highlight(ComponentConnector paintable) {
if (paintable != null) {
Widget w = paintable.getWidget();
Style style = highlight.getStyle();
* A helper class used by WidgetMap implementation. Used by the generated code.
*/
interface WidgetInstantiator {
- public VPaintableWidget get();
+ public ComponentConnector get();
}
protected static HashMap<Class, WidgetInstantiator> instmap = new HashMap<Class, WidgetInstantiator>();
// FIXME: Should use Paintable and not VPaintableWidget
- public VPaintableWidget instantiate(
- Class<? extends VPaintableWidget> classType) {
+ public ComponentConnector instantiate(
+ Class<? extends ComponentConnector> classType) {
return instmap.get(classType).get();
}
// FIXME: Should use Paintable and not VPaintableWidget
- public abstract Class<? extends VPaintableWidget> getImplementationByServerSideClassName(
+ public abstract Class<? extends ComponentConnector> getImplementationByServerSideClassName(
String fullyqualifiedName);
// FIXME: Should use Paintable and not VPaintableWidget
- public abstract Class<? extends VPaintableWidget>[] getDeferredLoadedWidgets();
+ public abstract Class<? extends ComponentConnector>[] getDeferredLoadedWidgets();
// FIXME: Should use Paintable and not VPaintableWidget
public abstract void ensureInstantiator(
- Class<? extends VPaintableWidget> classType);
+ Class<? extends ComponentConnector> classType);
}
/**
* Create an uninitialized component that best matches given UIDL. The
* component must be a {@link Widget} that implements
- * {@link VPaintableWidget}.
+ * {@link ComponentConnector}.
*
* @param tag
* component type tag for the component to create
* @return New uninitialized and unregistered component that can paint given
* UIDL.
*/
- public VPaintableWidget createWidget(String tag,
+ public ComponentConnector createWidget(String tag,
ApplicationConfiguration conf) {
/*
* Yes, this (including the generated code in WidgetMap) may look very
* has no "native" counterpart on client side.
*/
- Class<? extends VPaintableWidget> classType = resolveWidgetType(tag,
+ Class<? extends ComponentConnector> classType = resolveWidgetType(tag,
conf);
if (classType == null || classType == VUnknownComponentPaintable.class) {
}
- protected Class<? extends VPaintableWidget> resolveWidgetType(String tag,
+ protected Class<? extends ComponentConnector> resolveWidgetType(String tag,
ApplicationConfiguration conf) {
- Class<? extends VPaintableWidget> widgetClass = conf
+ Class<? extends ComponentConnector> widgetClass = conf
.getWidgetClassByEncodedTag(tag);
return widgetClass;
* @param applicationConfiguration
* @return
*/
- public Class<? extends VPaintableWidget> getImplementationByClassName(
+ public Class<? extends ComponentConnector> getImplementationByClassName(
String fullyqualifiedName) {
if (fullyqualifiedName == null) {
return VUnknownComponentPaintable.class;
}
- Class<? extends VPaintableWidget> implementationByServerSideClassName = widgetMap
+ Class<? extends ComponentConnector> implementationByServerSideClassName = widgetMap
.getImplementationByServerSideClassName(fullyqualifiedName);
return implementationByServerSideClassName;
}
- public Class<? extends VPaintableWidget>[] getDeferredLoadedWidgets() {
+ public Class<? extends ComponentConnector>[] getDeferredLoadedWidgets() {
return widgetMap.getDeferredLoadedWidgets();
}
- public void loadImplementation(Class<? extends VPaintableWidget> nextType) {
+ public void loadImplementation(Class<? extends ComponentConnector> nextType) {
widgetMap.ensureInstantiator(nextType);
}
* @since 7.0
*/
public interface InitializableClientToServerRpc extends ClientToServerRpc {
- public void initRpc(String paintableId, ApplicationConnection client);
+ public void initRpc(String connectorId, ApplicationConnection client);
}
}
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;
-import com.vaadin.terminal.gwt.client.VPaintable;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
+import com.vaadin.terminal.gwt.client.Connector;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
/**
* Client side decoder for converting shared state and other values from JSON
* @param jsonArray
* JSON array with two elements
* @param idMapper
- * mapper between paintable ID and {@link VPaintable} objects
+ * mapper between connector ID and {@link Connector} objects
* @return converted value (does not contain JSON types)
*/
public static Object convertValue(JSONArray jsonArray,
- VPaintableMap idMapper) {
+ ConnectorMap idMapper) {
String type = ((JSONString) jsonArray.get(0)).stringValue();
return convertValue(type, jsonArray.get(1), idMapper);
}
private static Object convertValue(String variableType, Object value,
- VPaintableMap idMapper) {
+ ConnectorMap idMapper) {
Object val = null;
// TODO type checks etc.
if (JsonEncoder.VTYPE_UNDEFINED.equals(variableType)) {
val = Boolean.valueOf(String.valueOf(value));
} else if (JsonEncoder.VTYPE_PAINTABLE.equals(variableType)) {
// TODO handle properly
- val = idMapper.getPaintable(String.valueOf(value));
+ val = idMapper.getConnector(String.valueOf(value));
} else {
// object, class name as type
VaadinSerializer serializer = serializerMap
}
private static Map<String, Object> convertMap(JSONObject jsonMap,
- VPaintableMap idMapper) {
+ ConnectorMap idMapper) {
HashMap<String, Object> map = new HashMap<String, Object>();
Iterator<String> it = jsonMap.keySet().iterator();
while (it.hasNext()) {
}
private static Object[] convertArray(JSONArray jsonArray,
- VPaintableMap idMapper) {
+ ConnectorMap idMapper) {
List<Object> tokens = new ArrayList<Object>();
for (int i = 0; i < jsonArray.size(); ++i) {
// each entry always has two elements: type and value
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
-import com.vaadin.terminal.gwt.client.VPaintable;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
+import com.vaadin.terminal.gwt.client.Connector;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
/**
* Encoder for converting RPC parameters and other values to JSON for transfer
*
* @param value
* value to convert
- * @param paintableMap
- * mapper from paintables to paintable IDs
+ * @param connectorMap
+ * mapper from connectors to connector IDs
* @return JSON representation of the value
*/
- public static JSONValue encode(Object value, VPaintableMap paintableMap) {
+ public static JSONValue encode(Object value, ConnectorMap connectorMap) {
if (null == value) {
// TODO as undefined type?
return combineTypeAndValue(VTYPE_UNDEFINED, JSONNull.getInstance());
JSONArray jsonArray = new JSONArray();
for (int i = 0; i < array.length; ++i) {
// TODO handle object graph loops?
- jsonArray.set(i, encode(array[i], paintableMap));
+ jsonArray.set(i, encode(array[i], connectorMap));
}
return combineTypeAndValue(VTYPE_ARRAY, jsonArray);
} else if (value instanceof Map) {
for (String mapKey : map.keySet()) {
// TODO handle object graph loops?
Object mapValue = map.get(mapKey);
- jsonMap.put(mapKey, encode(mapValue, paintableMap));
+ jsonMap.put(mapKey, encode(mapValue, connectorMap));
}
return combineTypeAndValue(VTYPE_MAP, jsonMap);
- } else if (value instanceof VPaintable) {
- VPaintable paintable = (VPaintable) value;
+ } else if (value instanceof Connector) {
+ Connector paintable = (Connector) value;
return combineTypeAndValue(VTYPE_PAINTABLE, new JSONString(
- paintableMap.getPid(paintable)));
+ connectorMap.getConnectorId(paintable)));
} else {
return combineTypeAndValue(getTransportType(value), new JSONString(
String.valueOf(value)));
private static String getTransportType(Object value) {
if (value instanceof String) {
return VTYPE_STRING;
- } else if (value instanceof VPaintable) {
+ } else if (value instanceof Connector) {
return VTYPE_PAINTABLE;
} else if (value instanceof Boolean) {
return VTYPE_BOOLEAN;
import java.io.Serializable;
-import com.vaadin.terminal.gwt.client.ui.VAbstractPaintableWidget;
+import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
/**
* Interface to be implemented by all shared state classes used to communicate
* supported data types.
*
* On the client side, for most widgets,
- * {@link VAbstractPaintableWidget#createState()} and
- * {@link VAbstractPaintableWidget#getState()} methods should be overridden to
+ * {@link AbstractComponentConnector#createState()} and
+ * {@link AbstractComponentConnector#getState()} methods should be overridden to
* create and use a shared state instance of the correct type.
*
* Subclasses of a paintable using shared state should also provide a subclass
package com.vaadin.terminal.gwt.client.communication;
import com.google.gwt.json.client.JSONObject;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
/**
* Serializer that can deserialize custom objects received from the server.
* @return deserialized object
*/
// TODO Object -> something
- Object deserialize(JSONObject jsonValue, VPaintableMap idMapper);
+ Object deserialize(JSONObject jsonValue, ConnectorMap idMapper);
}
--- /dev/null
+/*
+@VaadinApache2LicenseForJavaFiles@
+ */
+package com.vaadin.terminal.gwt.client.ui;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.ui.FocusWidget;
+import com.google.gwt.user.client.ui.Focusable;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.terminal.gwt.client.ApplicationConnection;
+import com.vaadin.terminal.gwt.client.ComponentState;
+import com.vaadin.terminal.gwt.client.LayoutManager;
+import com.vaadin.terminal.gwt.client.TooltipInfo;
+import com.vaadin.terminal.gwt.client.UIDL;
+import com.vaadin.terminal.gwt.client.VConsole;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
+import com.vaadin.terminal.gwt.client.ComponentContainerConnector;
+import com.vaadin.terminal.gwt.client.communication.ClientToServerRpc;
+import com.vaadin.terminal.gwt.client.communication.ClientToServerRpc.InitializableClientToServerRpc;
+import com.vaadin.terminal.gwt.client.communication.SharedState;
+
+public abstract class AbstractComponentConnector implements ComponentConnector {
+
+ // Generic UIDL parameter names, to be moved to shared state.
+ // Attributes are here mainly if they apply to all paintable widgets or
+ // affect captions - otherwise, they are in the relevant subclasses.
+ // For e.g. item or context specific attributes, subclasses may use separate
+ // constants, which may refer to these.
+ // Not all references to the string literals have been converted to use
+ // these!
+ public static final String ATTRIBUTE_ICON = "icon";
+ public static final String ATTRIBUTE_REQUIRED = "required";
+ public static final String ATTRIBUTE_ERROR = "error";
+ public static final String ATTRIBUTE_HIDEERRORS = "hideErrors";
+
+ private Widget widget;
+ private ApplicationConnection connection;
+ private String id;
+
+ /* State variables */
+ private boolean enabled = true;
+ private boolean visible = true;
+
+ // shared state from the server to the client
+ private ComponentState state;
+
+ private String declaredWidth = "";
+ private String declaredHeight = "";
+
+ /**
+ * Default constructor
+ */
+ public AbstractComponentConnector() {
+ }
+
+ /**
+ * Called after the application connection reference has been set up
+ */
+ public void init() {
+ }
+
+ /**
+ * Creates and returns the widget for this VPaintableWidget. This method
+ * should only be called once when initializing the paintable.
+ *
+ * @return
+ */
+ protected abstract Widget createWidget();
+
+ /**
+ * Returns the widget associated with this paintable. The widget returned by
+ * this method must not changed during the life time of the paintable.
+ *
+ * @return The widget associated with this paintable
+ */
+ public Widget getWidget() {
+ if (widget == null) {
+ widget = createWidget();
+ }
+
+ return widget;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.terminal.gwt.client.VPaintable#getConnection()
+ */
+ public final ApplicationConnection getConnection() {
+ return connection;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.vaadin.terminal.gwt.client.VPaintable#setConnection(com.vaadin.terminal
+ * .gwt.client.ApplicationConnection)
+ */
+ public final void setConnection(ApplicationConnection connection) {
+ this.connection = connection;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ * Returns the shared state object for a paintable widget.
+ *
+ * A new state instance is created using {@link #createState()} if none has
+ * been set by the server.
+ *
+ * If overriding this method to return a more specific type, also
+ * {@link #createState()} must be overridden.
+ *
+ * @return current shared state (not null)
+ */
+ public ComponentState getState() {
+ if (state == null) {
+ state = createState();
+ }
+
+ return state;
+ }
+
+ /**
+ * Creates a new instance of a shared state object for the widget. Normally,
+ * the state instance is created by the server and sent to the client before
+ * being used - this method is used if no shared state has been sent by the
+ * server.
+ *
+ * When overriding {@link #getState()}, also {@link #createState()} should
+ * be overridden to match it.
+ *
+ * @return newly created component shared state instance
+ */
+ protected ComponentState createState() {
+ return GWT.create(ComponentState.class);
+ }
+
+ public ComponentContainerConnector getParent() {
+ // FIXME: Hierarchy should be set by framework instead of looked up here
+ ConnectorMap paintableMap = ConnectorMap.get(getConnection());
+
+ Widget w = getWidget();
+ while (true) {
+ w = w.getParent();
+ if (w == null) {
+ return null;
+ }
+ if (paintableMap.isConnector(w)) {
+ return (ComponentContainerConnector) paintableMap.getConnector(w);
+ }
+ }
+ }
+
+ protected static boolean isRealUpdate(UIDL uidl) {
+ return !isCachedUpdate(uidl) && !uidl.getBooleanAttribute("invisible")
+ && !uidl.hasAttribute("deferred");
+ }
+
+ protected static boolean isCachedUpdate(UIDL uidl) {
+ return uidl.getBooleanAttribute("cached");
+ }
+
+ public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
+ if (isCachedUpdate(uidl)) {
+ return;
+ }
+
+ ConnectorMap paintableMap = ConnectorMap.get(getConnection());
+ // register the listened events by the server-side to the event-handler
+ // of the component
+ paintableMap.registerEventListenersFromUIDL(getId(), uidl);
+
+ // Visibility
+ setVisible(!uidl.getBooleanAttribute("invisible"), uidl);
+
+ if (uidl.getId().startsWith("PID_S")) {
+ DOM.setElementProperty(getWidget().getElement(), "id",
+ uidl.getId().substring(5));
+ }
+
+ if (!isVisible()) {
+ // component is invisible, delete old size to notify parent, if
+ // later made visible
+ paintableMap.setOffsetSize(this, null);
+ return;
+ }
+
+ if (!isRealUpdate(uidl)) {
+ return;
+ }
+
+ /*
+ * Disabled state may affect (override) tabindex so the order must be
+ * first setting tabindex, then enabled state.
+ */
+ if (uidl.hasAttribute("tabindex")
+ && getWidget() instanceof Focusable) {
+ ((Focusable) getWidget()).setTabIndex(uidl
+ .getIntAttribute("tabindex"));
+ }
+ setEnabled(!getState().isDisabled());
+
+ // Style names
+ String styleName = getStyleNameFromUIDL(getWidget()
+ .getStylePrimaryName(), uidl, getState(),
+ getWidget() instanceof Field);
+ getWidget().setStyleName(styleName);
+
+ // Update tooltip
+ TooltipInfo tooltipInfo = paintableMap.getTooltipInfo(this, null);
+ if (getState().hasDescription()) {
+ tooltipInfo.setTitle(getState().getDescription());
+ } else {
+ tooltipInfo.setTitle(null);
+ }
+ // add error info to tooltip if present
+ if (uidl.hasAttribute(ATTRIBUTE_ERROR)) {
+ tooltipInfo.setErrorUidl(uidl.getErrors());
+ } else {
+ tooltipInfo.setErrorUidl(null);
+ }
+
+ // Set captions
+ if (delegateCaptionHandling()) {
+ getParent().updateCaption(this, uidl);
+ }
+
+ /*
+ * updateComponentSize need to be after caption update so caption can be
+ * taken into account
+ */
+
+ updateComponentSize();
+ }
+
+ private void updateComponentSize() {
+ SharedState state = getState();
+
+ String w = "";
+ String h = "";
+ if (null != state || !(state instanceof ComponentState)) {
+ ComponentState componentState = (ComponentState) state;
+ // TODO move logging to VUIDLBrowser and VDebugConsole
+ // VConsole.log("Paintable state for "
+ // + getPaintableMap().getPid(paintable) + ": "
+ // + String.valueOf(state.getState()));
+ h = componentState.getHeight();
+ w = componentState.getWidth();
+ } else {
+ // TODO move logging to VUIDLBrowser and VDebugConsole
+ VConsole.log("No state for paintable " + getId()
+ + " in VAbstractPaintableWidget.updateComponentSize()");
+ }
+
+ // Parent should be updated if either dimension changed between relative
+ // and non-relative
+ if (w.endsWith("%") != declaredWidth.endsWith("%")) {
+ ComponentContainerConnector parent = getParent();
+ if (parent instanceof ManagedLayout) {
+ getLayoutManager().setWidthNeedsUpdate((ManagedLayout) parent);
+ }
+ }
+
+ if (h.endsWith("%") != declaredHeight.endsWith("%")) {
+ ComponentContainerConnector parent = getParent();
+ if (parent instanceof ManagedLayout) {
+ getLayoutManager().setHeightNeedsUpdate((ManagedLayout) parent);
+ }
+ }
+
+ declaredWidth = w;
+ declaredHeight = h;
+
+ // Set defined sizes
+ Widget component = getWidget();
+
+ component.setStyleName("v-undefined-width", isUndefinedWidth());
+ component.setStyleName("v-undefined-height", isUndefinedHeight());
+
+ component.setHeight(h);
+ component.setWidth(w);
+ }
+
+ public boolean isRelativeHeight() {
+ return declaredHeight.endsWith("%");
+ }
+
+ public boolean isRelativeWidth() {
+ return declaredWidth.endsWith("%");
+ }
+
+ public boolean isUndefinedHeight() {
+ return declaredHeight.length() == 0;
+ }
+
+ public boolean isUndefinedWidth() {
+ return declaredWidth.length() == 0;
+ }
+
+ public String getDeclaredHeight() {
+ return declaredHeight;
+ }
+
+ public String getDeclaredWidth() {
+ return declaredWidth;
+ }
+
+ /**
+ * Sets the enabled state of this paintable
+ *
+ * @param enabled
+ * true if the paintable is enabled, false otherwise
+ */
+ protected void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+
+ if (getWidget() instanceof FocusWidget) {
+ FocusWidget fw = (FocusWidget) getWidget();
+ fw.setEnabled(enabled);
+ }
+
+ }
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * Return true if parent handles caption, false if the paintable handles the
+ * caption itself.
+ *
+ *
+ * @deprecated This should always return true and all components should let
+ * the parent handle the caption and use other attributes for
+ * internal texts in the component
+ * @return
+ */
+ @Deprecated
+ protected boolean delegateCaptionHandling() {
+ return true;
+ }
+
+ /**
+ * Sets the visible state for this paintable.
+ *
+ * @param visible
+ * true if the paintable should be made visible, false otherwise
+ * @param captionUidl
+ * The UIDL that is passed to the parent and onwards to VCaption
+ * if the caption needs to be updated as a result of the
+ * visibility change.
+ */
+ protected void setVisible(boolean visible, UIDL captionUidl) {
+ boolean wasVisible = this.visible;
+ this.visible = visible;
+
+ getWidget().setVisible(visible);
+ if (wasVisible != visible) {
+ // Changed invisibile <-> visible
+ if (wasVisible && delegateCaptionHandling()) {
+ // Must hide caption when component is hidden
+ getParent().updateCaption(this, captionUidl);
+ }
+ }
+ }
+
+ protected boolean isVisible() {
+ return visible;
+ }
+
+ /**
+ * Generates the style name for the widget based on the given primary style
+ * name (typically returned by Widget.getPrimaryStyleName()) and the UIDL
+ * and shared state of the component. An additional "modified" style name
+ * can be added if the field parameter is set to true.
+ *
+ * @param primaryStyleName
+ * @param uidl
+ * @param state
+ * component shared state
+ * @param field
+ * @return
+ */
+ protected static String getStyleNameFromUIDL(String primaryStyleName,
+ UIDL uidl, ComponentState state, boolean field) {
+ boolean enabled = !state.isDisabled();
+
+ StringBuffer styleBuf = new StringBuffer();
+ styleBuf.append(primaryStyleName);
+ styleBuf.append(" v-paintable");
+
+ // first disabling and read-only status
+ if (!enabled) {
+ styleBuf.append(" ");
+ styleBuf.append(ApplicationConnection.DISABLED_CLASSNAME);
+ }
+ if (state.isReadOnly()) {
+ styleBuf.append(" ");
+ styleBuf.append("v-readonly");
+ }
+
+ // add additional styles as css classes, prefixed with component default
+ // stylename
+ if (state.hasStyles()) {
+ final String[] styles = state.getStyle().split(" ");
+ for (int i = 0; i < styles.length; i++) {
+ styleBuf.append(" ");
+ styleBuf.append(primaryStyleName);
+ styleBuf.append("-");
+ styleBuf.append(styles[i]);
+ styleBuf.append(" ");
+ styleBuf.append(styles[i]);
+ }
+ }
+
+ // add modified classname to Fields
+ if (field && uidl.hasAttribute("modified")) {
+ styleBuf.append(" ");
+ styleBuf.append(ApplicationConnection.MODIFIED_CLASSNAME);
+ }
+
+ // add error classname to components w/ error
+ if (uidl.hasAttribute(ATTRIBUTE_ERROR)) {
+ styleBuf.append(" ");
+ styleBuf.append(primaryStyleName);
+ styleBuf.append(ApplicationConnection.ERROR_CLASSNAME_EXT);
+ }
+ // add required style to required components
+ if (uidl.hasAttribute(ATTRIBUTE_REQUIRED)) {
+ styleBuf.append(" ");
+ styleBuf.append(primaryStyleName);
+ styleBuf.append(ApplicationConnection.REQUIRED_CLASSNAME_EXT);
+ }
+
+ return styleBuf.toString();
+ }
+
+ /**
+ * Sets the shared state for the paintable widget.
+ *
+ * @param new shared state (must be compatible with the return value of
+ * {@link #getState()} - {@link ComponentState} if
+ * {@link #getState()} is not overridden
+ */
+ public final void setState(SharedState state) {
+ this.state = (ComponentState) state;
+ }
+
+ /**
+ * Initialize the given RPC proxy object so it is connected to this
+ * paintable.
+ *
+ * @param clientToServerRpc
+ * The RPC instance to initialize. Must have been created using
+ * GWT.create().
+ */
+ protected <T extends ClientToServerRpc> T initRPC(T clientToServerRpc) {
+ ((InitializableClientToServerRpc) clientToServerRpc).initRpc(getId(),
+ getConnection());
+ return clientToServerRpc;
+ }
+
+ public LayoutManager getLayoutManager() {
+ return LayoutManager.get(connection);
+ }
+}
--- /dev/null
+/*
+@VaadinApache2LicenseForJavaFiles@
+ */
+package com.vaadin.terminal.gwt.client.ui;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import com.google.gwt.user.client.ui.HasOneWidget;
+import com.google.gwt.user.client.ui.HasWidgets;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
+import com.vaadin.terminal.gwt.client.ComponentContainerConnector;
+
+public abstract class AbstractComponentContainerConnector extends
+ AbstractComponentConnector implements ComponentContainerConnector {
+
+ /**
+ * Default constructor
+ */
+ public AbstractComponentContainerConnector() {
+ }
+
+ public Collection<ComponentConnector> getChildren() {
+ Collection<ComponentConnector> children = new ArrayList<ComponentConnector>();
+
+ addDescendantPaintables(getWidget(), children,
+ ConnectorMap.get(getConnection()));
+
+ return children;
+ }
+
+ private static void addDescendantPaintables(Widget widget,
+ Collection<ComponentConnector> paintables, ConnectorMap paintableMap) {
+ // FIXME: Store hierarchy instead of doing lookup every time
+
+ if (widget instanceof HasWidgets) {
+ for (Widget child : (HasWidgets) widget) {
+ addIfPaintable(child, paintables, paintableMap);
+ }
+ } else if (widget instanceof HasOneWidget) {
+ Widget child = ((HasOneWidget) widget).getWidget();
+ addIfPaintable(child, paintables, paintableMap);
+ }
+ }
+
+ private static void addIfPaintable(Widget widget,
+ Collection<ComponentConnector> paintables, ConnectorMap paintableMap) {
+ ComponentConnector paintable = paintableMap.getConnector(widget);
+ if (paintable != null) {
+ // If widget is a paintable, add it to the collection
+ paintables.add(paintable);
+ } else {
+ // Else keep looking for paintables inside the widget
+ addDescendantPaintables(widget, paintables, paintableMap);
+ }
+ }
+
+}
import com.google.gwt.user.client.Element;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.MouseEventDetails;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
public abstract class ClickEventHandler implements DoubleClickHandler,
ContextMenuHandler, MouseUpHandler {
private HandlerRegistration contextMenuHandlerRegistration;
protected String clickEventIdentifier;
- protected VPaintableWidget paintable;
+ protected ComponentConnector paintable;
private ApplicationConnection client;
- public ClickEventHandler(VPaintableWidget paintable,
+ public ClickEventHandler(ComponentConnector paintable,
String clickEventIdentifier) {
this.paintable = paintable;
this.clickEventIdentifier = clickEventIdentifier;
protected void fireClick(NativeEvent event) {
ApplicationConnection client = getApplicationConnection();
- String pid = VPaintableMap.get(getApplicationConnection()).getPid(
+ String pid = ConnectorMap.get(getApplicationConnection()).getConnectorId(
paintable);
MouseEventDetails mouseDetails = new MouseEventDetails(event,
import com.google.gwt.user.client.Element;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.MouseEventDetails;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
public abstract class LayoutClickEventHandler extends ClickEventHandler {
- public LayoutClickEventHandler(VPaintableWidget paintable,
+ public LayoutClickEventHandler(ComponentConnector paintable,
String clickEventIdentifier) {
super(paintable, clickEventIdentifier);
}
- protected abstract VPaintableWidget getChildComponent(Element element);
+ protected abstract ComponentConnector getChildComponent(Element element);
@Override
protected void fireClick(NativeEvent event) {
ApplicationConnection client = getApplicationConnection();
- String pid = VPaintableMap.get(getApplicationConnection()).getPid(
+ String pid = ConnectorMap.get(getApplicationConnection()).getConnectorId(
paintable);
MouseEventDetails mouseDetails = new MouseEventDetails(event,
getRelativeToElement());
- VPaintableWidget childComponent = getChildComponent((Element) event
+ ComponentConnector childComponent = getChildComponent((Element) event
.getEventTarget().cast());
Map<String, Object> parameters = new HashMap<String, Object>();
*/
package com.vaadin.terminal.gwt.client.ui;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
-public interface ManagedLayout extends VPaintableWidget {
+public interface ManagedLayout extends ComponentConnector {
}
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ui.richtextarea.VRichTextArea;
/**
}
/**
- * A focusable {@link VPaintableWidget} implementing this interface will be
+ * A focusable {@link ComponentConnector} implementing this interface will be
* notified before shortcut actions are handled if it will be the target of
* the action (most commonly means it is the focused component during the
* keyboard combination is triggered by the user).
*/
- public interface BeforeShortcutActionListener extends VPaintableWidget {
+ public interface BeforeShortcutActionListener extends ComponentConnector {
/**
* This method is called by ShortcutActionHandler before firing the
* shortcut if the Paintable is currently focused (aka the target of the
}
}
- public void handleKeyboardEvent(final Event event, VPaintableWidget target) {
+ public void handleKeyboardEvent(final Event event, ComponentConnector target) {
final int modifiers = KeyboardListenerCollection
.getKeyboardModifiers(event);
final char keyCode = (char) DOM.eventGetKeyCode(event);
}
private void fireAction(final Event event, final ShortcutAction a,
- VPaintableWidget target) {
+ ComponentConnector target) {
final Element et = DOM.eventGetTarget(event);
if (target == null) {
target = Util.findPaintable(client, et);
}
- final VPaintableWidget finalTarget = target;
+ final ComponentConnector finalTarget = target;
event.preventDefault();
package com.vaadin.terminal.gwt.client.ui;
import com.google.gwt.user.client.ui.HasWidgets;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
-public interface Table extends VPaintableWidget, HasWidgets {
+public interface Table extends ComponentConnector, HasWidgets {
final int SELECT_MODE_NONE = 0;
final int SELECT_MODE_SINGLE = 1;
final int SELECT_MODE_MULTI = 2;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VCaption;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
public class VAbsoluteLayout extends ComplexPanel {
String bottom;
private String zIndex;
- private VPaintableWidget paintable;
+ private ComponentConnector paintable;
private VCaption caption;
- public AbsoluteWrapper(VPaintableWidget paintable) {
+ public AbsoluteWrapper(ComponentConnector paintable) {
this.paintable = paintable;
setStyleName(CLASSNAME + "-wrapper");
}
@Override
public void setWidget(Widget w) {
// this fixes #5457 (Widget implementation can change on-the-fly)
- paintable = VPaintableMap.get(client).getPaintable(w);
+ paintable = ConnectorMap.get(client).getConnector(w);
super.setWidget(w);
}
* @return The Paintable which the element is a part of. Null if the element
* belongs to the layout and not to a child.
*/
- VPaintableWidget getComponent(Element element) {
+ ComponentConnector getComponent(Element element) {
return Util.getPaintableForElement(client, this, element);
}
import com.vaadin.terminal.gwt.client.DirectionalManagedLayout;
import com.vaadin.terminal.gwt.client.EventId;
import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ui.VAbsoluteLayout.AbsoluteWrapper;
-public class VAbsoluteLayoutPaintable extends VAbstractPaintableWidgetContainer
+public class VAbsoluteLayoutPaintable extends AbstractComponentContainerConnector
implements DirectionalManagedLayout {
private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler(
this, EventId.LAYOUT_CLICK) {
@Override
- protected VPaintableWidget getChildComponent(Element element) {
+ protected ComponentConnector getChildComponent(Element element) {
return getWidget().getComponent(element);
}
}
}
- public void updateCaption(VPaintableWidget component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component, UIDL uidl) {
AbsoluteWrapper parent2 = (AbsoluteWrapper) (component
.getWidget()).getParent();
parent2.updateCaption(uidl);
public void layoutVertically() {
VAbsoluteLayout layout = getWidget();
- for (VPaintableWidget paintable : getChildren()) {
+ for (ComponentConnector paintable : getChildren()) {
Widget widget = paintable.getWidget();
AbsoluteWrapper wrapper = (AbsoluteWrapper) widget.getParent();
Style wrapperStyle = wrapper.getElement().getStyle();
public void layoutHorizontally() {
VAbsoluteLayout layout = getWidget();
- for (VPaintableWidget paintable : getChildren()) {
+ for (ComponentConnector paintable : getChildren()) {
Widget widget = paintable.getWidget();
AbsoluteWrapper wrapper = (AbsoluteWrapper) widget.getParent();
Style wrapperStyle = wrapper.getElement().getStyle();
+++ /dev/null
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.ui.FocusWidget;
-import com.google.gwt.user.client.ui.Focusable;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.ComponentState;
-import com.vaadin.terminal.gwt.client.LayoutManager;
-import com.vaadin.terminal.gwt.client.TooltipInfo;
-import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.VConsole;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
-import com.vaadin.terminal.gwt.client.VPaintableWidgetContainer;
-import com.vaadin.terminal.gwt.client.communication.ClientToServerRpc;
-import com.vaadin.terminal.gwt.client.communication.ClientToServerRpc.InitializableClientToServerRpc;
-import com.vaadin.terminal.gwt.client.communication.SharedState;
-
-public abstract class VAbstractPaintableWidget implements VPaintableWidget {
-
- // Generic UIDL parameter names, to be moved to shared state.
- // Attributes are here mainly if they apply to all paintable widgets or
- // affect captions - otherwise, they are in the relevant subclasses.
- // For e.g. item or context specific attributes, subclasses may use separate
- // constants, which may refer to these.
- // Not all references to the string literals have been converted to use
- // these!
- public static final String ATTRIBUTE_ICON = "icon";
- public static final String ATTRIBUTE_REQUIRED = "required";
- public static final String ATTRIBUTE_ERROR = "error";
- public static final String ATTRIBUTE_HIDEERRORS = "hideErrors";
-
- private Widget widget;
- private ApplicationConnection connection;
- private String id;
-
- /* State variables */
- private boolean enabled = true;
- private boolean visible = true;
-
- // shared state from the server to the client
- private ComponentState state;
-
- private String declaredWidth = "";
- private String declaredHeight = "";
-
- /**
- * Default constructor
- */
- public VAbstractPaintableWidget() {
- }
-
- /**
- * Called after the application connection reference has been set up
- */
- public void init() {
- }
-
- /**
- * Creates and returns the widget for this VPaintableWidget. This method
- * should only be called once when initializing the paintable.
- *
- * @return
- */
- protected abstract Widget createWidget();
-
- /**
- * Returns the widget associated with this paintable. The widget returned by
- * this method must not changed during the life time of the paintable.
- *
- * @return The widget associated with this paintable
- */
- public Widget getWidget() {
- if (widget == null) {
- widget = createWidget();
- }
-
- return widget;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.vaadin.terminal.gwt.client.VPaintable#getConnection()
- */
- public final ApplicationConnection getConnection() {
- return connection;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * com.vaadin.terminal.gwt.client.VPaintable#setConnection(com.vaadin.terminal
- * .gwt.client.ApplicationConnection)
- */
- public final void setConnection(ApplicationConnection connection) {
- this.connection = connection;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * Returns the shared state object for a paintable widget.
- *
- * A new state instance is created using {@link #createState()} if none has
- * been set by the server.
- *
- * If overriding this method to return a more specific type, also
- * {@link #createState()} must be overridden.
- *
- * @return current shared state (not null)
- */
- public ComponentState getState() {
- if (state == null) {
- state = createState();
- }
-
- return state;
- }
-
- /**
- * Creates a new instance of a shared state object for the widget. Normally,
- * the state instance is created by the server and sent to the client before
- * being used - this method is used if no shared state has been sent by the
- * server.
- *
- * When overriding {@link #getState()}, also {@link #createState()} should
- * be overridden to match it.
- *
- * @return newly created component shared state instance
- */
- protected ComponentState createState() {
- return GWT.create(ComponentState.class);
- }
-
- public VPaintableWidgetContainer getParent() {
- // FIXME: Hierarchy should be set by framework instead of looked up here
- VPaintableMap paintableMap = VPaintableMap.get(getConnection());
-
- Widget w = getWidget();
- while (true) {
- w = w.getParent();
- if (w == null) {
- return null;
- }
- if (paintableMap.isPaintable(w)) {
- return (VPaintableWidgetContainer) paintableMap.getPaintable(w);
- }
- }
- }
-
- protected static boolean isRealUpdate(UIDL uidl) {
- return !isCachedUpdate(uidl) && !uidl.getBooleanAttribute("invisible")
- && !uidl.hasAttribute("deferred");
- }
-
- protected static boolean isCachedUpdate(UIDL uidl) {
- return uidl.getBooleanAttribute("cached");
- }
-
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- if (isCachedUpdate(uidl)) {
- return;
- }
-
- VPaintableMap paintableMap = VPaintableMap.get(getConnection());
- // register the listened events by the server-side to the event-handler
- // of the component
- paintableMap.registerEventListenersFromUIDL(getId(), uidl);
-
- // Visibility
- setVisible(!uidl.getBooleanAttribute("invisible"), uidl);
-
- if (uidl.getId().startsWith("PID_S")) {
- DOM.setElementProperty(getWidget().getElement(), "id",
- uidl.getId().substring(5));
- }
-
- if (!isVisible()) {
- // component is invisible, delete old size to notify parent, if
- // later made visible
- paintableMap.setOffsetSize(this, null);
- return;
- }
-
- if (!isRealUpdate(uidl)) {
- return;
- }
-
- /*
- * Disabled state may affect (override) tabindex so the order must be
- * first setting tabindex, then enabled state.
- */
- if (uidl.hasAttribute("tabindex")
- && getWidget() instanceof Focusable) {
- ((Focusable) getWidget()).setTabIndex(uidl
- .getIntAttribute("tabindex"));
- }
- setEnabled(!getState().isDisabled());
-
- // Style names
- String styleName = getStyleNameFromUIDL(getWidget()
- .getStylePrimaryName(), uidl, getState(),
- getWidget() instanceof Field);
- getWidget().setStyleName(styleName);
-
- // Update tooltip
- TooltipInfo tooltipInfo = paintableMap.getTooltipInfo(this, null);
- if (getState().hasDescription()) {
- tooltipInfo.setTitle(getState().getDescription());
- } else {
- tooltipInfo.setTitle(null);
- }
- // add error info to tooltip if present
- if (uidl.hasAttribute(ATTRIBUTE_ERROR)) {
- tooltipInfo.setErrorUidl(uidl.getErrors());
- } else {
- tooltipInfo.setErrorUidl(null);
- }
-
- // Set captions
- if (delegateCaptionHandling()) {
- getParent().updateCaption(this, uidl);
- }
-
- /*
- * updateComponentSize need to be after caption update so caption can be
- * taken into account
- */
-
- updateComponentSize();
- }
-
- private void updateComponentSize() {
- SharedState state = getState();
-
- String w = "";
- String h = "";
- if (null != state || !(state instanceof ComponentState)) {
- ComponentState componentState = (ComponentState) state;
- // TODO move logging to VUIDLBrowser and VDebugConsole
- // VConsole.log("Paintable state for "
- // + getPaintableMap().getPid(paintable) + ": "
- // + String.valueOf(state.getState()));
- h = componentState.getHeight();
- w = componentState.getWidth();
- } else {
- // TODO move logging to VUIDLBrowser and VDebugConsole
- VConsole.log("No state for paintable " + getId()
- + " in VAbstractPaintableWidget.updateComponentSize()");
- }
-
- // Parent should be updated if either dimension changed between relative
- // and non-relative
- if (w.endsWith("%") != declaredWidth.endsWith("%")) {
- VPaintableWidgetContainer parent = getParent();
- if (parent instanceof ManagedLayout) {
- getLayoutManager().setWidthNeedsUpdate((ManagedLayout) parent);
- }
- }
-
- if (h.endsWith("%") != declaredHeight.endsWith("%")) {
- VPaintableWidgetContainer parent = getParent();
- if (parent instanceof ManagedLayout) {
- getLayoutManager().setHeightNeedsUpdate((ManagedLayout) parent);
- }
- }
-
- declaredWidth = w;
- declaredHeight = h;
-
- // Set defined sizes
- Widget component = getWidget();
-
- component.setStyleName("v-undefined-width", isUndefinedWidth());
- component.setStyleName("v-undefined-height", isUndefinedHeight());
-
- component.setHeight(h);
- component.setWidth(w);
- }
-
- public boolean isRelativeHeight() {
- return declaredHeight.endsWith("%");
- }
-
- public boolean isRelativeWidth() {
- return declaredWidth.endsWith("%");
- }
-
- public boolean isUndefinedHeight() {
- return declaredHeight.length() == 0;
- }
-
- public boolean isUndefinedWidth() {
- return declaredWidth.length() == 0;
- }
-
- public String getDeclaredHeight() {
- return declaredHeight;
- }
-
- public String getDeclaredWidth() {
- return declaredWidth;
- }
-
- /**
- * Sets the enabled state of this paintable
- *
- * @param enabled
- * true if the paintable is enabled, false otherwise
- */
- protected void setEnabled(boolean enabled) {
- this.enabled = enabled;
-
- if (getWidget() instanceof FocusWidget) {
- FocusWidget fw = (FocusWidget) getWidget();
- fw.setEnabled(enabled);
- }
-
- }
-
- public boolean isEnabled() {
- return enabled;
- }
-
- /**
- * Return true if parent handles caption, false if the paintable handles the
- * caption itself.
- *
- *
- * @deprecated This should always return true and all components should let
- * the parent handle the caption and use other attributes for
- * internal texts in the component
- * @return
- */
- @Deprecated
- protected boolean delegateCaptionHandling() {
- return true;
- }
-
- /**
- * Sets the visible state for this paintable.
- *
- * @param visible
- * true if the paintable should be made visible, false otherwise
- * @param captionUidl
- * The UIDL that is passed to the parent and onwards to VCaption
- * if the caption needs to be updated as a result of the
- * visibility change.
- */
- protected void setVisible(boolean visible, UIDL captionUidl) {
- boolean wasVisible = this.visible;
- this.visible = visible;
-
- getWidget().setVisible(visible);
- if (wasVisible != visible) {
- // Changed invisibile <-> visible
- if (wasVisible && delegateCaptionHandling()) {
- // Must hide caption when component is hidden
- getParent().updateCaption(this, captionUidl);
- }
- }
- }
-
- protected boolean isVisible() {
- return visible;
- }
-
- /**
- * Generates the style name for the widget based on the given primary style
- * name (typically returned by Widget.getPrimaryStyleName()) and the UIDL
- * and shared state of the component. An additional "modified" style name
- * can be added if the field parameter is set to true.
- *
- * @param primaryStyleName
- * @param uidl
- * @param state
- * component shared state
- * @param field
- * @return
- */
- protected static String getStyleNameFromUIDL(String primaryStyleName,
- UIDL uidl, ComponentState state, boolean field) {
- boolean enabled = !state.isDisabled();
-
- StringBuffer styleBuf = new StringBuffer();
- styleBuf.append(primaryStyleName);
- styleBuf.append(" v-paintable");
-
- // first disabling and read-only status
- if (!enabled) {
- styleBuf.append(" ");
- styleBuf.append(ApplicationConnection.DISABLED_CLASSNAME);
- }
- if (state.isReadOnly()) {
- styleBuf.append(" ");
- styleBuf.append("v-readonly");
- }
-
- // add additional styles as css classes, prefixed with component default
- // stylename
- if (state.hasStyles()) {
- final String[] styles = state.getStyle().split(" ");
- for (int i = 0; i < styles.length; i++) {
- styleBuf.append(" ");
- styleBuf.append(primaryStyleName);
- styleBuf.append("-");
- styleBuf.append(styles[i]);
- styleBuf.append(" ");
- styleBuf.append(styles[i]);
- }
- }
-
- // add modified classname to Fields
- if (field && uidl.hasAttribute("modified")) {
- styleBuf.append(" ");
- styleBuf.append(ApplicationConnection.MODIFIED_CLASSNAME);
- }
-
- // add error classname to components w/ error
- if (uidl.hasAttribute(ATTRIBUTE_ERROR)) {
- styleBuf.append(" ");
- styleBuf.append(primaryStyleName);
- styleBuf.append(ApplicationConnection.ERROR_CLASSNAME_EXT);
- }
- // add required style to required components
- if (uidl.hasAttribute(ATTRIBUTE_REQUIRED)) {
- styleBuf.append(" ");
- styleBuf.append(primaryStyleName);
- styleBuf.append(ApplicationConnection.REQUIRED_CLASSNAME_EXT);
- }
-
- return styleBuf.toString();
- }
-
- /**
- * Sets the shared state for the paintable widget.
- *
- * @param new shared state (must be compatible with the return value of
- * {@link #getState()} - {@link ComponentState} if
- * {@link #getState()} is not overridden
- */
- public final void setState(SharedState state) {
- this.state = (ComponentState) state;
- }
-
- /**
- * Initialize the given RPC proxy object so it is connected to this
- * paintable.
- *
- * @param clientToServerRpc
- * The RPC instance to initialize. Must have been created using
- * GWT.create().
- */
- protected <T extends ClientToServerRpc> T initRPC(T clientToServerRpc) {
- ((InitializableClientToServerRpc) clientToServerRpc).initRpc(getId(),
- getConnection());
- return clientToServerRpc;
- }
-
- public LayoutManager getLayoutManager() {
- return LayoutManager.get(connection);
- }
-}
+++ /dev/null
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import com.google.gwt.user.client.ui.HasOneWidget;
-import com.google.gwt.user.client.ui.HasWidgets;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
-import com.vaadin.terminal.gwt.client.VPaintableWidgetContainer;
-
-public abstract class VAbstractPaintableWidgetContainer extends
- VAbstractPaintableWidget implements VPaintableWidgetContainer {
-
- /**
- * Default constructor
- */
- public VAbstractPaintableWidgetContainer() {
- }
-
- public Collection<VPaintableWidget> getChildren() {
- Collection<VPaintableWidget> children = new ArrayList<VPaintableWidget>();
-
- addDescendantPaintables(getWidget(), children,
- VPaintableMap.get(getConnection()));
-
- return children;
- }
-
- private static void addDescendantPaintables(Widget widget,
- Collection<VPaintableWidget> paintables, VPaintableMap paintableMap) {
- // FIXME: Store hierarchy instead of doing lookup every time
-
- if (widget instanceof HasWidgets) {
- for (Widget child : (HasWidgets) widget) {
- addIfPaintable(child, paintables, paintableMap);
- }
- } else if (widget instanceof HasOneWidget) {
- Widget child = ((HasOneWidget) widget).getWidget();
- addIfPaintable(child, paintables, paintableMap);
- }
- }
-
- private static void addIfPaintable(Widget widget,
- Collection<VPaintableWidget> paintables, VPaintableMap paintableMap) {
- VPaintableWidget paintable = paintableMap.getPaintable(widget);
- if (paintable != null) {
- // If widget is a paintable, add it to the collection
- paintables.add(paintable);
- } else {
- // Else keep looking for paintables inside the widget
- addDescendantPaintables(widget, paintables, paintableMap);
- }
- }
-
-}
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.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
public abstract class VAbstractSplitPanelPaintable extends
- VAbstractPaintableWidgetContainer implements SimpleManagedLayout {
+ AbstractComponentContainerConnector implements SimpleManagedLayout {
public static final String SPLITTER_CLICK_EVENT_IDENTIFIER = "sp_click";
- public void updateCaption(VPaintableWidget component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component, UIDL uidl) {
// TODO Implement caption handling
}
getWidget().position = uidl.getStringAttribute("position");
- final VPaintableWidget newFirstChildPaintable = client
+ final ComponentConnector newFirstChildPaintable = client
.getPaintable(uidl.getChildUIDL(0));
- final VPaintableWidget newSecondChildPaintable = client
+ final ComponentConnector newSecondChildPaintable = client
.getPaintable(uidl.getChildUIDL(1));
Widget newFirstChild = newFirstChildPaintable.getWidget();
Widget newSecondChild = newSecondChildPaintable.getWidget();
if (getWidget().firstChild != newFirstChild) {
if (getWidget().firstChild != null) {
- client.unregisterPaintable(VPaintableMap.get(client)
- .getPaintable(getWidget().firstChild));
+ client.unregisterPaintable(ConnectorMap.get(client)
+ .getConnector(getWidget().firstChild));
}
getWidget().setFirstWidget(newFirstChild);
}
if (getWidget().secondChild != newSecondChild) {
if (getWidget().secondChild != null) {
- client.unregisterPaintable(VPaintableMap.get(client)
- .getPaintable(getWidget().secondChild));
+ client.unregisterPaintable(ConnectorMap.get(client)
+ .getConnector(getWidget().secondChild));
}
getWidget().setSecondWidget(newSecondChild);
}
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VCaption;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
public class VAccordion extends VTabsheetBase {
private StackItem moveStackItemIfNeeded(StackItem item, int newIndex,
UIDL tabUidl) {
UIDL tabContentUIDL = null;
- VPaintableWidget tabContent = null;
+ ComponentConnector tabContent = null;
if (tabUidl.getChildCount() > 0) {
tabContentUIDL = tabUidl.getChildUIDL(0);
tabContent = client.getPaintable(tabContentUIDL);
public void replaceWidget(Widget newWidget) {
if (getWidgetCount() > 1) {
Widget oldWidget = getWidget(1);
- VPaintableWidget oldPaintable = VPaintableMap.get(client)
- .getPaintable(oldWidget);
- VPaintableMap.get(client).unregisterPaintable(oldPaintable);
+ ComponentConnector oldPaintable = ConnectorMap.get(client)
+ .getConnector(oldWidget);
+ ConnectorMap.get(client).unregisterConnector(oldPaintable);
widgets.remove(oldWidget);
remove(1);
}
}
public void setContent(UIDL contentUidl) {
- final VPaintableWidget newPntbl = client.getPaintable(contentUidl);
+ final ComponentConnector newPntbl = client.getPaintable(contentUidl);
Widget newWidget = newPntbl.getWidget();
if (getChildWidget() == null) {
add(newWidget, content);
return DOM.getFirstChild(content).getOffsetWidth();
}
- public boolean contains(VPaintableWidget p) {
+ public boolean contains(ComponentConnector p) {
return (getChildWidget() == p.getWidget());
}
}
boolean isDynamicWidth() {
- VPaintableWidget paintable = VPaintableMap.get(client).getPaintable(
+ ComponentConnector paintable = ConnectorMap.get(client).getConnector(
this);
return paintable.isUndefinedWidth();
}
boolean isDynamicHeight() {
- VPaintableWidget paintable = VPaintableMap.get(client).getPaintable(
+ ComponentConnector paintable = ConnectorMap.get(client).getConnector(
this);
return paintable.isUndefinedHeight();
}
}
@Override
- protected VPaintableWidget getTab(int index) {
+ protected ComponentConnector getTab(int index) {
if (index < getWidgetCount()) {
Widget w = getStackItem(index);
- return VPaintableMap.get(client).getPaintable(w);
+ return ConnectorMap.get(client).getConnector(w);
}
return null;
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.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ui.VAccordion.StackItem;
public class VAccordionPaintable extends VTabsheetBasePaintable implements
return GWT.create(VAccordion.class);
}
- public void updateCaption(VPaintableWidget component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component, UIDL uidl) {
/* Accordion does not render its children's captions */
}
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.communication.ClientToServerRpc;
-public class VButtonPaintable extends VAbstractPaintableWidget {
+public class VButtonPaintable extends AbstractComponentConnector {
/**
* RPC interface for calls from client to server.
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.VTooltip;
-public class VCheckBoxPaintable extends VAbstractPaintableWidget {
+public class VCheckBoxPaintable extends AbstractComponentConnector {
@Override
protected boolean delegateCaptionHandling() {
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VCaption;
import com.vaadin.terminal.gwt.client.VConsole;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ValueMap;
public class VCssLayout extends SimplePanel {
for (final Iterator<Object> i = uidl.getChildIterator(); i
.hasNext();) {
final UIDL r = (UIDL) i.next();
- final VPaintableWidget child = client.getPaintable(r);
+ final ComponentConnector child = client.getPaintable(r);
final Widget widget = child.getWidget();
if (widget.getParent() == this) {
oldWidgets.remove(widget);
// them
for (Widget w : oldWidgets) {
remove(w);
- VPaintableMap paintableMap = VPaintableMap.get(client);
- if (paintableMap.isPaintable(w)) {
- final VPaintableWidget p = VPaintableMap.get(client)
- .getPaintable(w);
+ ConnectorMap paintableMap = ConnectorMap.get(client);
+ if (paintableMap.isConnector(w)) {
+ final ComponentConnector p = ConnectorMap.get(client)
+ .getConnector(w);
client.unregisterPaintable(p);
}
VCaption vCaption = widgetToCaption.remove(w);
insert(child, index);
}
- public void updateCaption(VPaintableWidget paintable, UIDL uidl) {
+ public void updateCaption(ComponentConnector paintable, UIDL uidl) {
Widget widget = paintable.getWidget();
VCaption caption = widgetToCaption.get(widget);
if (VCaption.isNeeded(uidl, paintable.getState())) {
}
}
- VPaintableWidget getComponent(Element element) {
+ ComponentConnector getComponent(Element element) {
return Util
.getPaintableForElement(client, VCssLayout.this, element);
}
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.EventId;
import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
-public class VCssLayoutPaintable extends VAbstractPaintableWidgetContainer {
+public class VCssLayoutPaintable extends AbstractComponentContainerConnector {
private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler(
this, EventId.LAYOUT_CLICK) {
@Override
- protected VPaintableWidget getChildComponent(Element element) {
+ protected ComponentConnector getChildComponent(Element element) {
return getWidget().panel.getComponent(element);
}
return GWT.create(VCssLayout.class);
}
- public void updateCaption(VPaintableWidget component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component, UIDL uidl) {
getWidget().panel.updateCaption(component, uidl);
}
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.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
public class VCustomComponentPaintable extends
- VAbstractPaintableWidgetContainer {
+ AbstractComponentContainerConnector {
@Override
public void updateFromUIDL(UIDL uidl, final ApplicationConnection client) {
}
final UIDL child = uidl.getChildUIDL(0);
if (child != null) {
- final VPaintableWidget paintable = client.getPaintable(child);
+ final ComponentConnector paintable = client.getPaintable(child);
Widget widget = paintable.getWidget();
if (widget != getWidget().getWidget()) {
if (getWidget().getWidget() != null) {
- client.unregisterPaintable(VPaintableMap.get(client)
- .getPaintable(getWidget().getWidget()));
+ client.unregisterPaintable(ConnectorMap.get(client)
+ .getConnector(getWidget().getWidget()));
getWidget().clear();
}
getWidget().setWidget(widget);
return (VCustomComponent) super.getWidget();
}
- public void updateCaption(VPaintableWidget component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component, UIDL uidl) {
// NOP, custom component dont render composition roots caption
}
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VCaption;
import com.vaadin.terminal.gwt.client.VCaptionWrapper;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
/**
* Custom Layout implements complex layout defined with HTML template.
final HashMap<String, Widget> locationToWidget = new HashMap<String, Widget>();
/** Widget to captionwrapper map */
- private final HashMap<VPaintableWidget, VCaptionWrapper> paintableToCaptionWrapper = new HashMap<VPaintableWidget, VCaptionWrapper>();
+ private final HashMap<ComponentConnector, VCaptionWrapper> paintableToCaptionWrapper = new HashMap<ComponentConnector, VCaptionWrapper>();
/** Name of the currently rendered style */
String currentTemplateName;
}
/** Update caption for given widget */
- public void updateCaption(VPaintableWidget paintable, UIDL uidl) {
+ public void updateCaption(ComponentConnector paintable, UIDL uidl) {
VCaptionWrapper wrapper = paintableToCaptionWrapper.get(paintable);
Widget widget = paintable.getWidget();
if (VCaption.isNeeded(uidl, paintable.getState())) {
/** Removes given widget from the layout */
@Override
public boolean remove(Widget w) {
- VPaintableWidget paintable = VPaintableMap.get(client).getPaintable(w);
+ ComponentConnector paintable = ConnectorMap.get(client).getConnector(w);
client.unregisterPaintable(paintable);
final String location = getLocation(w);
if (location != null) {
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.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
-public class VCustomLayoutPaintable extends VAbstractPaintableWidgetContainer
+public class VCustomLayoutPaintable extends AbstractComponentContainerConnector
implements SimpleManagedLayout {
/** Update the layout from UIDL */
if (uidlForChild.getTag().equals("location")) {
final String location = uidlForChild.getStringAttribute("name");
UIDL childUIDL = uidlForChild.getChildUIDL(0);
- final VPaintableWidget childPaintable = client
+ final ComponentConnector childPaintable = client
.getPaintable(childUIDL);
Widget childWidget = childPaintable.getWidget();
try {
return GWT.create(VCustomLayout.class);
}
- public void updateCaption(VPaintableWidget paintable, UIDL uidl) {
+ public void updateCaption(ComponentConnector paintable, UIDL uidl) {
getWidget().updateCaption(paintable, uidl);
}
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.VConsole;
-public class VDateFieldPaintable extends VAbstractPaintableWidget {
+public class VDateFieldPaintable extends AbstractComponentConnector {
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
import com.vaadin.terminal.gwt.client.RenderInformation.Size;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VConsole;
-import com.vaadin.terminal.gwt.client.VPaintable;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.Connector;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.VTooltip;
import com.vaadin.terminal.gwt.client.ValueMap;
import com.vaadin.terminal.gwt.client.ui.dd.DDUtil;
private boolean startDrag(NativeEvent event) {
if (dragStartMode == WRAPPER || dragStartMode == COMPONENT) {
VTransferable transferable = new VTransferable();
- transferable.setDragSource(VPaintableMap.get(client).getPaintable(
+ transferable.setDragSource(ConnectorMap.get(client).getConnector(
VDragAndDropWrapper.this));
- VPaintableWidget paintable = Util.findPaintable(client,
+ ComponentConnector paintable = Util.findPaintable(client,
(Element) event.getEventTarget().cast());
Widget widget = paintable.getWidget();
transferable.setData("component", paintable);
}
if (VDragAndDropManager.get().getCurrentDropHandler() != getDropHandler()) {
VTransferable transferable = new VTransferable();
- transferable.setDragSource(VPaintableMap.get(client)
- .getPaintable(this));
+ transferable.setDragSource(ConnectorMap.get(client)
+ .getConnector(this));
vaadinDragEvent = VDragAndDropManager.get().startDrag(
transferable, event, false);
}
private String getPid() {
- return VPaintableMap.get(client).getPid((VPaintable) this);
+ return ConnectorMap.get(client).getConnectorId((Connector) this);
}
public VDropHandler getDropHandler() {
}
@Override
- public VPaintableWidget getPaintable() {
- return VPaintableMap.get(client).getPaintable(
+ public ComponentConnector getPaintable() {
+ return ConnectorMap.get(client).getConnector(
VDragAndDropWrapper.this);
}
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VConsole;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
public class VEmbedded extends HTML {
public static String CLASSNAME = "v-embedded";
html.append("codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" ");
}
- VPaintableWidget paintable = VPaintableMap.get(client).getPaintable(
+ ComponentConnector paintable = ConnectorMap.get(client).getConnector(
this);
String height = paintable.getDeclaredHeight();
String width = paintable.getDeclaredWidth();
import com.vaadin.terminal.gwt.client.VConsole;
import com.vaadin.terminal.gwt.client.VTooltip;
-public class VEmbeddedPaintable extends VAbstractPaintableWidget {
+public class VEmbeddedPaintable extends AbstractComponentConnector {
public static final String CLICK_EVENT_IDENTIFIER = "click";
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VConsole;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.VTooltip;
/**
* Should be called when the width changes or when the icon changes.
*/
protected void updateRootWidth() {
- VPaintableWidget paintable = VPaintableMap.get(client).getPaintable(
+ ComponentConnector paintable = ConnectorMap.get(client).getConnector(
this);
if (paintable.isUndefinedWidth()) {
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.ui.VFilterSelect.FilterSelectSuggestion;
-public class VFilterSelectPaintable extends VAbstractPaintableWidget implements
+public class VFilterSelectPaintable extends AbstractComponentConnector implements
SimpleManagedLayout {
/*
import com.vaadin.terminal.gwt.client.Focusable;
import com.vaadin.terminal.gwt.client.StyleConstants;
import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.VTooltip;
/**
for (final Iterator<?> it = uidl.getChildIterator(); it.hasNext(); i++) {
prepareCell(i, 1);
final UIDL childUidl = (UIDL) it.next();
- final VPaintableWidget childPaintable = client
+ final ComponentConnector childPaintable = client
.getPaintable(childUidl);
Widget childWidget = childPaintable.getWidget();
Caption caption = widgetToCaption.get(childWidget);
if (oldWidget == null) {
setWidget(i, COLUMN_WIDGET, childWidget);
} else if (oldWidget != childWidget) {
- final VPaintableWidget oldPaintable = VPaintableMap.get(
- client).getPaintable(oldWidget);
+ final ComponentConnector oldPaintable = ConnectorMap.get(
+ client).getConnector(oldWidget);
client.unregisterPaintable(oldPaintable);
setWidget(i, COLUMN_WIDGET, childWidget);
}
while (getRowCount() > i) {
Widget w = getWidget(i, COLUMN_WIDGET);
- final VPaintableWidget p = VPaintableMap.get(client)
- .getPaintable(w);
+ final ComponentConnector p = ConnectorMap.get(client)
+ .getConnector(w);
client.unregisterPaintable(p);
widgetToCaption.remove(w);
removeRow(i);
}
}
- public void updateCaption(VPaintableWidget paintable, UIDL uidl) {
+ public void updateCaption(ComponentConnector paintable, UIDL uidl) {
final Caption c = widgetToCaption.get(paintable
.getWidget());
if (c != null) {
public static final String CLASSNAME = "v-caption";
- private final VPaintableWidget owner;
+ private final ComponentConnector owner;
private Element requiredFieldIndicator;
* return null
* @param client
*/
- public Caption(VPaintableWidget component, ApplicationConnection client) {
+ public Caption(ComponentConnector component, ApplicationConnection client) {
super();
this.client = client;
owner = component;
boolean isEmpty = true;
- if (uidl.hasAttribute(VAbstractPaintableWidget.ATTRIBUTE_ICON)) {
+ if (uidl.hasAttribute(AbstractComponentConnector.ATTRIBUTE_ICON)) {
if (icon == null) {
icon = new Icon(client);
DOM.insertChild(getElement(), icon.getElement(), 0);
}
icon.setUri(uidl
- .getStringAttribute(VAbstractPaintableWidget.ATTRIBUTE_ICON));
+ .getStringAttribute(AbstractComponentConnector.ATTRIBUTE_ICON));
isEmpty = false;
} else {
if (icon != null) {
removeStyleDependentName("hasdescription");
}
- if (uidl.getBooleanAttribute(VAbstractPaintableWidget.ATTRIBUTE_REQUIRED)) {
+ if (uidl.getBooleanAttribute(AbstractComponentConnector.ATTRIBUTE_REQUIRED)) {
if (requiredFieldIndicator == null) {
requiredFieldIndicator = DOM.createSpan();
DOM.setInnerText(requiredFieldIndicator, "*");
*
* @return owner Widget
*/
- public VPaintableWidget getOwner() {
+ public ComponentConnector getOwner() {
return owner;
}
private static final String CLASSNAME = VFormLayout.CLASSNAME
+ "-error-indicator";
Element errorIndicatorElement;
- private VPaintableWidget owner;
+ private ComponentConnector owner;
public ErrorFlag() {
setStyleName(CLASSNAME);
sinkEvents(VTooltip.TOOLTIP_EVENTS);
}
- public void updateFromUIDL(UIDL uidl, VPaintableWidget component) {
+ public void updateFromUIDL(UIDL uidl, ComponentConnector component) {
owner = component;
if (uidl.hasAttribute("error")
- && !uidl.getBooleanAttribute(VAbstractPaintableWidget.ATTRIBUTE_HIDEERRORS)) {
+ && !uidl.getBooleanAttribute(AbstractComponentConnector.ATTRIBUTE_HIDEERRORS)) {
if (errorIndicatorElement == null) {
errorIndicatorElement = DOM.createDiv();
DOM.setInnerHTML(errorIndicatorElement, " ");
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.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
-public class VFormLayoutPaintable extends VAbstractPaintableWidgetContainer {
+public class VFormLayoutPaintable extends AbstractComponentContainerConnector {
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
getWidget().client = client;
getWidget().table.updateFromUIDL(uidl, client);
}
- public void updateCaption(VPaintableWidget component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component, UIDL uidl) {
getWidget().table.updateCaption(component, uidl);
}
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.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
-public class VFormPaintable extends VAbstractPaintableWidgetContainer implements
+public class VFormPaintable extends AbstractComponentContainerConnector implements
SimpleManagedLayout {
@Override
if (uidl.getChildCount() > 1
&& !uidl.getChildUIDL(1).getTag().equals("actions")) {
// render footer
- VPaintableWidget newFooter = client.getPaintable(uidl
+ ComponentConnector newFooter = client.getPaintable(uidl
.getChildUIDL(1));
Widget newFooterWidget = newFooter.getWidget();
if (getWidget().footer == null) {
getWidget().footer = newFooterWidget;
} else if (newFooter != getWidget().footer) {
getWidget().remove(getWidget().footer);
- client.unregisterPaintable(VPaintableMap.get(getConnection())
- .getPaintable(getWidget().footer));
+ client.unregisterPaintable(ConnectorMap.get(getConnection())
+ .getConnector(getWidget().footer));
getWidget().add(newFooter.getWidget(),
getWidget().footerContainer);
}
} else {
if (getWidget().footer != null) {
getWidget().remove(getWidget().footer);
- client.unregisterPaintable(VPaintableMap.get(getConnection())
- .getPaintable(getWidget().footer));
+ client.unregisterPaintable(ConnectorMap.get(getConnection())
+ .getConnector(getWidget().footer));
}
}
final UIDL layoutUidl = uidl.getChildUIDL(0);
- VPaintableWidget newLayout = client.getPaintable(layoutUidl);
+ ComponentConnector newLayout = client.getPaintable(layoutUidl);
Widget newLayoutWidget = newLayout.getWidget();
if (getWidget().lo == null) {
// Layout not rendered before
getWidget().fieldContainer);
} else if (getWidget().lo != newLayoutWidget) {
// Layout has changed
- client.unregisterPaintable(VPaintableMap.get(getConnection())
- .getPaintable(getWidget().lo));
+ client.unregisterPaintable(ConnectorMap.get(getConnection())
+ .getConnector(getWidget().lo));
getWidget().remove(getWidget().lo);
getWidget().lo = newLayoutWidget;
getWidget().add(newLayoutWidget,
}
}
- public void updateCaption(VPaintableWidget component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component, UIDL uidl) {
// NOP form don't render caption for neither field layout nor footer
// layout
}
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VCaption;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ui.layout.VLayoutSlot;
import com.vaadin.terminal.gwt.client.ui.layout.VPaintableLayoutSlot;
setStyleName(CLASSNAME);
}
- private VPaintableWidget getPaintable() {
- return VPaintableMap.get(client).getPaintable(this);
+ private ComponentConnector getPaintable() {
+ return ConnectorMap.get(client).getConnector(this);
}
/**
// about childUidl
hasContent = childUidl != null;
if (hasContent) {
- VPaintableWidget paintable = client.getPaintable(childUidl);
+ ComponentConnector paintable = client.getPaintable(childUidl);
if (slot == null || slot.getPaintable() != paintable) {
slot = new VPaintableLayoutSlot(CLASSNAME, paintable);
* @return The Paintable which the element is a part of. Null if the element
* belongs to the layout and not to a child.
*/
- VPaintableWidget getComponent(Element element) {
+ ComponentConnector getComponent(Element element) {
return Util.getPaintableForElement(client, this, element);
}
import com.vaadin.terminal.gwt.client.EventId;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.VCaption;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ui.VGridLayout.Cell;
import com.vaadin.terminal.gwt.client.ui.layout.VLayoutSlot;
-public class VGridLayoutPaintable extends VAbstractPaintableWidgetContainer
+public class VGridLayoutPaintable extends AbstractComponentContainerConnector
implements DirectionalManagedLayout {
private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler(
this, EventId.LAYOUT_CLICK) {
@Override
- protected VPaintableWidget getChildComponent(Element element) {
+ protected ComponentConnector getChildComponent(Element element) {
return getWidget().getComponent(element);
}
if (w.getParent() == layout) {
w.removeFromParent();
- VPaintableMap paintableMap = VPaintableMap.get(client);
- paintableMap.unregisterPaintable(paintableMap.getPaintable(w));
+ ConnectorMap paintableMap = ConnectorMap.get(client);
+ paintableMap.unregisterConnector(paintableMap.getConnector(w));
}
cell.slot.getWrapperElement().removeFromParent();
}
getLayoutManager().setNeedsUpdate(this);
}
- public void updateCaption(VPaintableWidget paintable, UIDL uidl) {
+ public void updateCaption(ComponentConnector paintable, UIDL uidl) {
VGridLayout layout = getWidget();
if (VCaption.isNeeded(uidl, paintable.getState())) {
Cell cell = layout.widgetToCell.get(paintable
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.UIDL;
-public class VLinkPaintable extends VAbstractPaintableWidget {
+public class VLinkPaintable extends AbstractComponentConnector {
@Override
protected boolean delegateCaptionHandling() {
import com.vaadin.terminal.gwt.client.LayoutManager;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.VCaption;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ValueMap;
import com.vaadin.terminal.gwt.client.ui.layout.VLayoutSlot;
import com.vaadin.terminal.gwt.client.ui.layout.VPaintableLayoutSlot;
public abstract class VMeasuringOrderedLayoutPaintable extends
- VAbstractPaintableWidgetContainer implements DirectionalManagedLayout {
+ AbstractComponentContainerConnector implements DirectionalManagedLayout {
@Override
public void init() {
getWidget().spacingMeasureElement);
}
- public void updateCaption(VPaintableWidget component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component, UIDL uidl) {
VMeasuringOrderedLayout layout = getWidget();
if (VCaption.isNeeded(uidl, component.getState())) {
VLayoutSlot layoutSlot = layout.getSlotForChild(component
return;
}
- HashSet<VPaintableWidget> previousChildren = new HashSet<VPaintableWidget>(
+ HashSet<ComponentConnector> previousChildren = new HashSet<ComponentConnector>(
getChildren());
VMeasuringOrderedLayout layout = getWidget();
// TODO Support reordering elements!
for (final Iterator<Object> it = uidl.getChildIterator(); it.hasNext();) {
final UIDL childUIDL = (UIDL) it.next();
- final VPaintableWidget child = client.getPaintable(childUIDL);
+ final ComponentConnector child = client.getPaintable(childUIDL);
Widget widget = child.getWidget();
VLayoutSlot slot = layout.getSlotForChild(widget);
previousChildren.remove(child);
}
- for (VPaintableWidget child : previousChildren) {
+ for (ComponentConnector child : previousChildren) {
Widget widget = child.getWidget();
// Don't remove and unregister if it has been moved to a different
if (widget.getParent() == getWidget()) {
layout.removeSlot(layout.getSlotForChild(widget));
- VPaintableMap vPaintableMap = VPaintableMap.get(client);
- vPaintableMap.unregisterPaintable(child);
+ ConnectorMap vPaintableMap = ConnectorMap.get(client);
+ vPaintableMap.unregisterConnector(child);
}
}
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
-public abstract class VMediaBasePaintable extends VAbstractPaintableWidget {
+public abstract class VMediaBasePaintable extends AbstractComponentConnector {
public static final String TAG_SOURCE = "src";
public static final String ATTRIBUTE_CHECKED = "checked";
public static final String ATTRIBUTE_ITEM_DESCRIPTION = "description";
- public static final String ATTRIBUTE_ITEM_ICON = VAbstractPaintableWidget.ATTRIBUTE_ICON;
+ public static final String ATTRIBUTE_ITEM_ICON = AbstractComponentConnector.ATTRIBUTE_ICON;
public static final String ATTRIBUTE_ITEM_DISABLED = "disabled";
public static final String ATTRIBUTE_ITEM_STYLE = "style";
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.ui.VMenuBar.CustomMenuItem;
-public class VMenuBarPaintable extends VAbstractPaintableWidget implements
+public class VMenuBarPaintable extends AbstractComponentConnector implements
SimpleManagedLayout {
/**
* This method must be implemented to update the client-side component from
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.ui.VButtonPaintable.ButtonClientToServerRpc;
-public class VNativeButtonPaintable extends VAbstractPaintableWidget {
+public class VNativeButtonPaintable extends AbstractComponentConnector {
@Override
public void init() {
public static final String ATTRIBUTE_NOTIFICATION_STYLE = "style";
public static final String ATTRIBUTE_NOTIFICATION_CAPTION = "caption";
public static final String ATTRIBUTE_NOTIFICATION_MESSAGE = "message";
- public static final String ATTRIBUTE_NOTIFICATION_ICON = VAbstractPaintableWidget.ATTRIBUTE_ICON;
+ public static final String ATTRIBUTE_NOTIFICATION_ICON = AbstractComponentConnector.ATTRIBUTE_ICON;
public static final String ATTRIBUTE_NOTIFICATION_POSITION = "position";
public static final String ATTRIBUTE_NOTIFICATION_DELAY = "delay";
import com.vaadin.terminal.gwt.client.UIDL;
public abstract class VOptionGroupBasePaintable extends
- VAbstractPaintableWidget {
+ AbstractComponentConnector {
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.Focusable;
import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner;
public class VPanel extends SimplePanel implements ShortcutActionHandlerOwner,
private Element errorIndicatorElement;
- VPaintableWidget layout;
+ ComponentConnector layout;
ShortcutActionHandler shortcutHandler;
void setIconUri(UIDL uidl, ApplicationConnection client) {
final String iconUri = uidl
- .hasAttribute(VAbstractPaintableWidget.ATTRIBUTE_ICON) ? uidl
- .getStringAttribute(VAbstractPaintableWidget.ATTRIBUTE_ICON)
+ .hasAttribute(AbstractComponentConnector.ATTRIBUTE_ICON) ? uidl
+ .getStringAttribute(AbstractComponentConnector.ATTRIBUTE_ICON)
: null;
if (iconUri == null) {
if (icon != null) {
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.LayoutManager;
import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
-public class VPanelPaintable extends VAbstractPaintableWidgetContainer
+public class VPanelPaintable extends AbstractComponentContainerConnector
implements SimpleManagedLayout, PostLayoutListener {
public static final String CLICK_EVENT_IDENTIFIER = "click";
// Render content
final UIDL layoutUidl = uidl.getChildUIDL(0);
- final VPaintableWidget newLayout = client.getPaintable(layoutUidl);
+ final ComponentConnector newLayout = client.getPaintable(layoutUidl);
if (newLayout != getWidget().layout) {
if (getWidget().layout != null) {
client.unregisterPaintable(getWidget().layout);
}
}
- public void updateCaption(VPaintableWidget component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component, UIDL uidl) {
// NOP: layouts caption, errors etc not rendered in Panel
}
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VCaptionWrapper;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.VTooltip;
import com.vaadin.terminal.gwt.client.ui.richtextarea.VRichTextArea;
*/
protected class CustomPopup extends VOverlay {
- private VPaintableWidget popupComponentPaintable = null;
+ private ComponentConnector popupComponentPaintable = null;
Widget popupComponentWidget = null;
VCaptionWrapper captionWrapper = null;
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- VPaintableWidget newPopupComponent = client.getPaintable(uidl
+ ComponentConnector newPopupComponent = client.getPaintable(uidl
.getChildUIDL(0));
if (newPopupComponent != popupComponentPaintable) {
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.VCaption;
import com.vaadin.terminal.gwt.client.VCaptionWrapper;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
-public class VPopupViewPaintable extends VAbstractPaintableWidgetContainer {
+public class VPopupViewPaintable extends AbstractComponentContainerConnector {
@Override
protected boolean delegateCaptionHandling() {
/**
*
*
- * @see com.vaadin.terminal.gwt.client.VPaintableWidget#updateFromUIDL(com.vaadin.terminal.gwt.client.UIDL,
+ * @see com.vaadin.terminal.gwt.client.ComponentConnector#updateFromUIDL(com.vaadin.terminal.gwt.client.UIDL,
* com.vaadin.terminal.gwt.client.ApplicationConnection)
*/
@Override
}
}// updateFromUIDL
- public void updateCaption(VPaintableWidget component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component, UIDL uidl) {
if (VCaption.isNeeded(uidl, component.getState())) {
if (getWidget().popup.captionWrapper != null) {
getWidget().popup.captionWrapper
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.UIDL;
-public class VProgressIndicatorPaintable extends VAbstractPaintableWidget {
+public class VProgressIndicatorPaintable extends AbstractComponentConnector {
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VConsole;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.VTooltip;
import com.vaadin.terminal.gwt.client.ui.VScrollTable.VScrollTableBody.VScrollTableRow;
import com.vaadin.terminal.gwt.client.ui.dd.DDUtil;
void purgeUnregistryBag() {
for (Iterator<Panel> iterator = lazyUnregistryBag.iterator(); iterator
.hasNext();) {
- VPaintableMap.get(client)
- .unregisterChildPaintables(iterator.next());
+ ConnectorMap.get(client)
+ .unregisterChildConnectors(iterator.next());
}
lazyUnregistryBag.clear();
}
addCell(uidl, cell.toString(), aligns[col++], style,
isRenderHtmlInCells(), sorted, description);
} else {
- final VPaintableWidget cellContent = client
+ final ComponentConnector cellContent = client
.getPaintable((UIDL) cell);
addCell(uidl, cellContent.getWidget(),
return index;
}
- protected void paintComponent(VPaintableWidget p, UIDL uidl) {
+ protected void paintComponent(ComponentConnector p, UIDL uidl) {
if (isAttached()) {
p.updateFromUIDL(uidl, client);
} else {
super.onAttach();
if (pendingComponentPaints != null) {
for (UIDL uidl : pendingComponentPaints) {
- VPaintableWidget paintable = (VPaintableWidget) VPaintableMap
- .get(client).getPaintable(uidl.getId());
+ ComponentConnector paintable = (ComponentConnector) ConnectorMap
+ .get(client).getConnector(uidl.getId());
paintable.updateFromUIDL(uidl, client);
}
pendingComponentPaints.clear();
if (!containsWidget) {
// Only text nodes has tooltips
- if (VPaintableMap.get(client).getWidgetTooltipInfo(
+ if (ConnectorMap.get(client).getWidgetTooltipInfo(
VScrollTable.this, target) != null) {
// Cell has description, use it
client.handleTooltipEvent(event,
Element targetTdOrTr) {
mDown = true;
VTransferable transferable = new VTransferable();
- transferable.setDragSource(VPaintableMap.get(client)
- .getPaintable(VScrollTable.this));
+ transferable.setDragSource(ConnectorMap.get(client)
+ .getConnector(VScrollTable.this));
transferable.setData("itemId", "" + rowKey);
NodeList<TableCellElement> cells = rowElement.getCells();
for (int i = 0; i < cells.getLength(); i++) {
}
@Override
- public VPaintableWidget getPaintable() {
- return VPaintableMap.get(client).getPaintable(VScrollTable.this);
+ public ComponentConnector getPaintable() {
+ return ConnectorMap.get(client).getConnector(VScrollTable.this);
}
public ApplicationConnection getApplicationConnection() {
}
private boolean isDynamicWidth() {
- VPaintableWidget paintable = VPaintableMap.get(client).getPaintable(
+ ComponentConnector paintable = ConnectorMap.get(client).getConnector(
this);
return paintable.isUndefinedWidth();
}
private boolean isDynamicHeight() {
- VPaintableWidget paintable = VPaintableMap.get(client).getPaintable(
+ ComponentConnector paintable = ConnectorMap.get(client).getConnector(
this);
return paintable.isUndefinedHeight();
}
import com.vaadin.terminal.gwt.client.DirectionalManagedLayout;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
-public class VScrollTablePaintable extends VAbstractPaintableWidgetContainer
+public class VScrollTablePaintable extends AbstractComponentContainerConnector
implements DirectionalManagedLayout {
/*
return (VScrollTable) super.getWidget();
}
- public void updateCaption(VPaintableWidget component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component, UIDL uidl) {
// NOP, not rendered
}
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.UIDL;
-public class VSliderPaintable extends VAbstractPaintableWidget {
+public class VSliderPaintable extends AbstractComponentConnector {
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VCaption;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ui.label.VLabel;
public class VTabsheet extends VTabsheetBase {
@Override
public boolean updateCaption(UIDL uidl) {
if (uidl.hasAttribute(VTabsheetBasePaintable.ATTRIBUTE_TAB_DESCRIPTION)
- || uidl.hasAttribute(VAbstractPaintableWidget.ATTRIBUTE_ERROR)) {
+ || uidl.hasAttribute(AbstractComponentConnector.ATTRIBUTE_ERROR)) {
TooltipInfo tooltipInfo = new TooltipInfo();
tooltipInfo
.setTitle(uidl
.getStringAttribute(VTabsheetBasePaintable.ATTRIBUTE_TAB_DESCRIPTION));
- if (uidl.hasAttribute(VAbstractPaintableWidget.ATTRIBUTE_ERROR)) {
+ if (uidl.hasAttribute(AbstractComponentConnector.ATTRIBUTE_ERROR)) {
tooltipInfo.setErrorUidl(uidl.getErrors());
}
client.registerTooltip(getTabsheet(), getElement(),
}
boolean isDynamicWidth() {
- VPaintableWidget paintable = VPaintableMap.get(client).getPaintable(
+ ComponentConnector paintable = ConnectorMap.get(client).getConnector(
this);
return paintable.isUndefinedWidth();
}
boolean isDynamicHeight() {
- VPaintableWidget paintable = VPaintableMap.get(client).getPaintable(
+ ComponentConnector paintable = ConnectorMap.get(client).getConnector(
this);
return paintable.isUndefinedHeight();
}
tab.recalculateCaptionWidth();
UIDL tabContentUIDL = null;
- VPaintableWidget tabContentPaintable = null;
+ ComponentConnector tabContentPaintable = null;
Widget tabContentWidget = null;
if (tabUidl.getChildCount() > 0) {
tabContentUIDL = tabUidl.getChildUIDL(0);
}
private void renderContent(final UIDL contentUIDL) {
- final VPaintableWidget content = client.getPaintable(contentUIDL);
+ final ComponentConnector content = client.getPaintable(contentUIDL);
if (tp.getWidgetCount() > activeTabIndex) {
Widget old = tp.getWidget(activeTabIndex);
if (old != content) {
tp.remove(activeTabIndex);
- VPaintableMap paintableMap = VPaintableMap.get(client);
- if (paintableMap.isPaintable(old)) {
- paintableMap.unregisterPaintable(paintableMap
- .getPaintable(old));
+ ConnectorMap paintableMap = ConnectorMap.get(client);
+ if (paintableMap.isConnector(old)) {
+ paintableMap.unregisterConnector(paintableMap
+ .getConnector(old));
}
tp.insert(content.getWidget(), activeTabIndex);
}
*/
private void updateTabScroller() {
if (!isDynamicWidth()) {
- VPaintableWidget paintable = VPaintableMap.get(client)
- .getPaintable(this);
+ ComponentConnector paintable = ConnectorMap.get(client)
+ .getConnector(this);
DOM.setStyleAttribute(tabs, "width", paintable.getDeclaredWidth());
}
}
@Override
- protected VPaintableWidget getTab(int index) {
+ protected ComponentConnector getTab(int index) {
if (tp.getWidgetCount() > index) {
Widget widget = tp.getWidget(index);
- return VPaintableMap.get(client).getPaintable(widget);
+ return ConnectorMap.get(client).getConnector(widget);
}
return null;
}
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.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
abstract class VTabsheetBase extends ComplexPanel {
* Implement in extending classes. This method should return the Paintable
* corresponding to the given index.
*/
- protected abstract VPaintableWidget getTab(int index);
+ protected abstract ComponentConnector getTab(int index);
/**
* Implement in extending classes. This method should remove the rendered
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.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
public abstract class VTabsheetBasePaintable extends
- VAbstractPaintableWidgetContainer {
+ AbstractComponentContainerConnector {
public static final String ATTRIBUTE_TAB_DISABLED = "disabled";
public static final String ATTRIBUTE_TAB_DESCRIPTION = "description";
}
for (int i = 0; i < getWidget().getTabCount(); i++) {
- VPaintableWidget p = getWidget().getTab(i);
+ ComponentConnector p = getWidget().getTab(i);
// During the initial rendering the paintable might be null (this is
// weird...)
if (p != null) {
for (Iterator<Widget> iterator = oldWidgets.iterator(); iterator
.hasNext();) {
Widget oldWidget = iterator.next();
- VPaintableWidget oldPaintable = VPaintableMap.get(client)
- .getPaintable(oldWidget);
+ ComponentConnector oldPaintable = ConnectorMap.get(client)
+ .getConnector(oldWidget);
if (oldWidget.isAttached()) {
oldWidget.removeFromParent();
}
- VPaintableMap.get(client).unregisterPaintable(oldPaintable);
+ ConnectorMap.get(client).unregisterConnector(oldPaintable);
}
}
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.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
public class VTabsheetPaintable extends VTabsheetBasePaintable implements
SimpleManagedLayout {
return (VTabsheet) super.getWidget();
}
- public void updateCaption(VPaintableWidget component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component, UIDL uidl) {
/* Tabsheet does not render its children's captions */
}
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.BeforeShortcutActionListener;
-public class VTextFieldPaintable extends VAbstractPaintableWidget implements
+public class VTextFieldPaintable extends AbstractComponentConnector implements
BeforeShortcutActionListener {
@Override
import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.VTooltip;
import com.vaadin.terminal.gwt.client.ui.dd.DDUtil;
import com.vaadin.terminal.gwt.client.ui.dd.VAbstractDropHandler;
}
@Override
- public VPaintableWidget getPaintable() {
- return VPaintableMap.get(client).getPaintable(VTree.this);
+ public ComponentConnector getPaintable() {
+ return ConnectorMap.get(client).getConnector(VTree.this);
}
public ApplicationConnection getApplicationConnection() {
if (mouseDownEvent != null) {
// start actual drag on slight move when mouse is down
VTransferable t = new VTransferable();
- t.setDragSource(VPaintableMap.get(client).getPaintable(
+ t.setDragSource(ConnectorMap.get(client).getConnector(
VTree.this));
t.setData("itemId", key);
VDragEvent drag = VDragAndDropManager.get().startDrag(
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.ui.VTree.TreeNode;
-public class VTreePaintable extends VAbstractPaintableWidget {
+public class VTreePaintable extends AbstractComponentConnector {
public static final String ATTRIBUTE_NODE_STYLE = "style";
public static final String ATTRIBUTE_NODE_CAPTION = "caption";
- public static final String ATTRIBUTE_NODE_ICON = VAbstractPaintableWidget.ATTRIBUTE_ICON;
+ public static final String ATTRIBUTE_NODE_ICON = AbstractComponentConnector.ATTRIBUTE_ICON;
public static final String ATTRIBUTE_ACTION_CAPTION = "caption";
- public static final String ATTRIBUTE_ACTION_ICON = VAbstractPaintableWidget.ATTRIBUTE_ICON;
+ public static final String ATTRIBUTE_ACTION_ICON = AbstractComponentConnector.ATTRIBUTE_ICON;
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.VUIDLBrowser;
-public class VUnknownComponentPaintable extends VAbstractPaintableWidget {
+public class VUnknownComponentPaintable extends AbstractComponentConnector {
@Override
protected boolean delegateCaptionHandling() {
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.UIDL;
-public class VUploadPaintable extends VAbstractPaintableWidget {
+public class VUploadPaintable extends AbstractComponentConnector {
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VConsole;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner;
/**
String theme;
- VPaintableWidget layout;
+ ComponentConnector layout;
final LinkedHashSet<VWindow> subWindows = new LinkedHashSet<VWindow>();
if (uidl.hasAttribute("scrollTo")) {
Scheduler.get().scheduleDeferred(new Command() {
public void execute() {
- final VPaintableWidget paintable = (VPaintableWidget) uidl
+ final ComponentConnector paintable = (ComponentConnector) uidl
.getPaintableAttribute("scrollTo", connection);
paintable.getWidget().getElement()
.scrollIntoView();
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VConsole;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
-public class VViewPaintable extends VAbstractPaintableWidgetContainer {
+public class VViewPaintable extends AbstractComponentContainerConnector {
private static final String CLICK_EVENT_IDENTIFIER = VPanelPaintable.CLICK_EVENT_IDENTIFIER;
// Draw this application level window
UIDL childUidl = uidl.getChildUIDL(childIndex);
- final VPaintableWidget lo = client.getPaintable(childUidl);
+ final ComponentConnector lo = client.getPaintable(childUidl);
if (getWidget().layout != null) {
if (getWidget().layout != lo) {
for (final Iterator<VWindow> rem = removedSubWindows.iterator(); rem
.hasNext();) {
final VWindow w = rem.next();
- client.unregisterPaintable(VPaintableMap.get(getConnection())
- .getPaintable(w));
+ client.unregisterPaintable(ConnectorMap.get(getConnection())
+ .getConnector(w));
getWidget().subWindows.remove(w);
w.hide();
}
// set focused component when render phase is finished
Scheduler.get().scheduleDeferred(new Command() {
public void execute() {
- VPaintableWidget paintable = (VPaintableWidget) uidl
+ ComponentConnector paintable = (ComponentConnector) uidl
.getPaintableAttribute("focused", getConnection());
final Widget toBeFocused = paintable
}
};
- public void updateCaption(VPaintableWidget component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component, UIDL uidl) {
// NOP The main view never draws caption for its layout
}
import com.vaadin.terminal.gwt.client.EventId;
import com.vaadin.terminal.gwt.client.Focusable;
import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner;
/**
public static final int Z_INDEX = 10000;
- VPaintableWidget layout;
+ ComponentConnector layout;
Element contents;
while (w != null) {
if (w instanceof Console) {
return true; // allow debug-window clicks
- } else if (w instanceof VPaintableWidget) {
+ } else if (w instanceof ComponentConnector) {
return false;
}
w = w.getParent();
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.BeforeShortcutActionListener;
-public class VWindowPaintable extends VAbstractPaintableWidgetContainer
+public class VWindowPaintable extends AbstractComponentContainerConnector
implements BeforeShortcutActionListener, SimpleManagedLayout,
PostLayoutListener {
getWidget()
.setCaption(
getState().getCaption(),
- uidl.getStringAttribute(VAbstractPaintableWidget.ATTRIBUTE_ICON));
+ uidl.getStringAttribute(AbstractComponentConnector.ATTRIBUTE_ICON));
}
getWidget().visibilityChangesDisabled = true;
childUidl = uidl.getChildUIDL(childIndex++);
}
- final VPaintableWidget lo = client.getPaintable(childUidl);
+ final ComponentConnector lo = client.getPaintable(childUidl);
if (getWidget().layout != null) {
if (getWidget().layout != lo) {
// remove old
}
}
- public void updateCaption(VPaintableWidget component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component, UIDL uidl) {
// NOP, window has own caption, layout captio not rendered
}
import com.vaadin.event.Transferable;
import com.vaadin.event.dd.DropTarget;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.UIDL;
public abstract class VAbstractDropHandler implements VDropHandler {
* side counterpart of the Paintable is expected to implement
* {@link DropTarget} interface.
*/
- public abstract VPaintableWidget getPaintable();
+ public abstract ComponentConnector getPaintable();
}
import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ValueMap;
/**
}
private void addActiveDragSourceStyleName() {
- VPaintableWidget dragSource = currentDrag.getTransferable()
+ ComponentConnector dragSource = currentDrag.getTransferable()
.getDragSource();
dragSource.getWidget().addStyleName(
ACTIVE_DRAG_SOURCE_STYLENAME);
* handled. E.g. hidden on start, removed in drophandler ->
* would flicker in case removed eagerly.
*/
- final VPaintableWidget dragSource = currentDrag
+ final ComponentConnector dragSource = currentDrag
.getTransferable().getDragSource();
final ApplicationConnection client = currentDropHandler
.getApplicationConnection();
}
- private void removeActiveDragSourceStyleName(VPaintableWidget dragSource) {
+ private void removeActiveDragSourceStyleName(ComponentConnector dragSource) {
dragSource.getWidget().removeStyleName(
ACTIVE_DRAG_SOURCE_STYLENAME);
}
if (currentDropHandler == null) {
return;
}
- VPaintableWidget paintable = currentDropHandler.getPaintable();
+ ComponentConnector paintable = currentDropHandler.getPaintable();
ApplicationConnection client = currentDropHandler
.getApplicationConnection();
/*
*/
package com.vaadin.terminal.gwt.client.ui.dd;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
/**
* TODO Javadoc!
@Override
protected boolean accept(VDragEvent drag, UIDL configuration) {
try {
- VPaintableWidget component = drag.getTransferable().getDragSource();
+ ComponentConnector component = drag.getTransferable().getDragSource();
int c = configuration.getIntAttribute("c");
for (int i = 0; i < c; i++) {
String requiredPid = configuration
.getStringAttribute("component" + i);
VDropHandler currentDropHandler = VDragAndDropManager.get()
.getCurrentDropHandler();
- VPaintableWidget paintable = (VPaintableWidget) VPaintableMap
+ ComponentConnector paintable = (ComponentConnector) ConnectorMap
.get(currentDropHandler.getApplicationConnection())
- .getPaintable(requiredPid);
+ .getConnector(requiredPid);
if (paintable == component) {
return true;
}
package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
/**
* Vaadin Widgets that want to receive something via drag and drop implement
/**
* Returns the Paintable into which this DragHandler is associated
*/
- public VPaintableWidget getPaintable();
+ public ComponentConnector getPaintable();
/**
* Returns the application connection to which this {@link VDropHandler}
*/
package com.vaadin.terminal.gwt.client.ui.dd;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
/**
* Used to detect Widget from widget tree that has {@link #getDropHandler()}
*
* Decide whether to get rid of this class. If so, {@link VAbstractDropHandler}
- * must extend {@link VPaintableWidget}.
+ * must extend {@link ComponentConnector}.
*
*/
public interface VHasDropHandler {
*/
package com.vaadin.terminal.gwt.client.ui.dd;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
final public class VIsOverId extends VAcceptCriterion {
String pid = configuration.getStringAttribute("s");
VDropHandler currentDropHandler = VDragAndDropManager.get()
.getCurrentDropHandler();
- VPaintableWidget paintable = currentDropHandler.getPaintable();
- VPaintableMap paintableMap = VPaintableMap.get(currentDropHandler
+ ComponentConnector paintable = currentDropHandler.getPaintable();
+ ConnectorMap paintableMap = ConnectorMap.get(currentDropHandler
.getApplicationConnection());
- String pid2 = paintableMap.getPid(paintable);
+ String pid2 = paintableMap.getConnectorId(paintable);
if (pid2.equals(pid)) {
Object searchedId = drag.getDropDetails().get("itemIdOver");
String[] stringArrayAttribute = configuration
*/
package com.vaadin.terminal.gwt.client.ui.dd;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
final public class VItemIdIs extends VAcceptCriterion {
protected boolean accept(VDragEvent drag, UIDL configuration) {
try {
String pid = configuration.getStringAttribute("s");
- VPaintableWidget dragSource = drag.getTransferable()
+ ComponentConnector dragSource = drag.getTransferable()
.getDragSource();
VDropHandler currentDropHandler = VDragAndDropManager.get()
.getCurrentDropHandler();
- String pid2 = VPaintableMap.get(
- currentDropHandler.getApplicationConnection()).getPid(
+ String pid2 = ConnectorMap.get(
+ currentDropHandler.getApplicationConnection()).getConnectorId(
dragSource);
if (pid2.equals(pid)) {
Object searchedId = drag.getTransferable().getData("itemId");
*/
package com.vaadin.terminal.gwt.client.ui.dd;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.UIDL;
final public class VSourceIsTarget extends VAcceptCriterion {
@Override
protected boolean accept(VDragEvent drag, UIDL configuration) {
- VPaintableWidget dragSource = drag.getTransferable().getDragSource();
- VPaintableWidget paintable = VDragAndDropManager.get().getCurrentDropHandler()
+ ComponentConnector dragSource = drag.getTransferable().getDragSource();
+ ComponentConnector paintable = VDragAndDropManager.get().getCurrentDropHandler()
.getPaintable();
return paintable == dragSource;
import java.util.Map;
import com.vaadin.event.dd.DragSource;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
/**
* Client side counterpart for Transferable in com.vaadin.event.Transferable
*/
public class VTransferable {
- private VPaintableWidget component;
+ private ComponentConnector component;
private final Map<String, Object> variables = new HashMap<String, Object>();
*
* @return the component
*/
- public VPaintableWidget getDragSource() {
+ public ComponentConnector getDragSource() {
return component;
}
* @param component
* the component to set
*/
- public void setDragSource(VPaintableWidget component) {
+ public void setDragSource(ComponentConnector component) {
this.component = component;
}
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.ui.VAbstractPaintableWidget;
+import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
-public class VLabelPaintable extends VAbstractPaintableWidget {
+public class VLabelPaintable extends AbstractComponentConnector {
public VLabelPaintable() {
}
import com.vaadin.terminal.gwt.client.LayoutManager;
import com.vaadin.terminal.gwt.client.VCaption;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ui.ManagedLayout;
public class VPaintableLayoutSlot extends VLayoutSlot {
- final VPaintableWidget paintable;
+ final ComponentConnector paintable;
private LayoutManager layoutManager;
- public VPaintableLayoutSlot(String baseClassName, VPaintableWidget paintable) {
+ public VPaintableLayoutSlot(String baseClassName, ComponentConnector paintable) {
super(baseClassName, paintable.getWidget());
this.paintable = paintable;
layoutManager = paintable.getLayoutManager();
}
- public VPaintableWidget getPaintable() {
+ public ComponentConnector getPaintable() {
return paintable;
}
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
import com.vaadin.terminal.gwt.client.ui.Field;
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler;
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner;
shortcutHandler
.handleKeyboardEvent(com.google.gwt.user.client.Event
.as(event.getNativeEvent()),
- VPaintableMap.get(client).getPaintable(this));
+ ConnectorMap.get(client).getConnector(this));
}
}
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.BeforeShortcutActionListener;
-import com.vaadin.terminal.gwt.client.ui.VAbstractPaintableWidget;
+import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
-public class VRichTextAreaPaintable extends VAbstractPaintableWidget implements
+public class VRichTextAreaPaintable extends AbstractComponentConnector implements
BeforeShortcutActionListener {
@Override
* A server side component sends its state to the client in a paint request (see
* {@link Paintable} and {@link PaintTarget} on the server side). The client
* widget receives these paint requests as calls to
- * {@link com.vaadin.terminal.gwt.client.VPaintableWidget#updateFromUIDL()}. The
+ * {@link com.vaadin.terminal.gwt.client.ComponentConnector#updateFromUIDL()}. The
* client component communicates back to the server by sending a list of
* variable changes (see {@link ApplicationConnection#updateVariable()} and
* {@link VariableOwner#changeVariables(Object, Map)}).
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory;
import com.google.gwt.user.rebind.SourceWriter;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
+import com.vaadin.terminal.gwt.client.ConnectorMap;
import com.vaadin.terminal.gwt.client.communication.JsonDecoder;
import com.vaadin.terminal.gwt.client.communication.VaadinSerializer;
sourceWriter.println("public " + beanTypeName + " deserialize("
+ JSONObject.class.getName() + " jsonValue, "
- + VPaintableMap.class.getName() + " idMapper) {");
+ + ConnectorMap.class.getName() + " idMapper) {");
sourceWriter.indent();
// VButtonState state = GWT.create(VButtonState.class);
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory;
import com.google.gwt.user.rebind.SourceWriter;
import com.vaadin.terminal.Paintable;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ui.VViewPaintable;
import com.vaadin.ui.ClientWidget;
import com.vaadin.ui.ClientWidget.LoadStyle;
*/
public class WidgetMapGenerator extends Generator {
- private static String paintableClassName = VPaintableWidget.class.getName();
+ private static String paintableClassName = ComponentConnector.class.getName();
private String packageName;
private String className;
.iterator(); iterator.hasNext();) {
Class<? extends Paintable> class1 = iterator.next();
- Class<? extends com.vaadin.terminal.gwt.client.VPaintableWidget> clientClass = getClientClass(class1);
+ Class<? extends com.vaadin.terminal.gwt.client.ComponentConnector> clientClass = getClientClass(class1);
if (typeOracle.findType(clientClass.getName()) == null) {
// GWT widget not inherited
logger.log(Type.WARN, "Widget class " + clientClass.getName()
ArrayList<Class<? extends Paintable>> lazyLoadedWidgets = new ArrayList<Class<? extends Paintable>>();
- HashSet<Class<? extends com.vaadin.terminal.gwt.client.VPaintableWidget>> widgetsWithInstantiator = new HashSet<Class<? extends com.vaadin.terminal.gwt.client.VPaintableWidget>>();
+ HashSet<Class<? extends com.vaadin.terminal.gwt.client.ComponentConnector>> widgetsWithInstantiator = new HashSet<Class<? extends com.vaadin.terminal.gwt.client.ComponentConnector>>();
for (Class<? extends Paintable> class1 : paintablesHavingWidgetAnnotation) {
- Class<? extends com.vaadin.terminal.gwt.client.VPaintableWidget> clientClass = getClientClass(class1);
+ Class<? extends com.vaadin.terminal.gwt.client.ComponentConnector> clientClass = getClientClass(class1);
if (widgetsWithInstantiator.contains(clientClass)) {
continue;
}
}
first = false;
ClientWidget annotation = class2.getAnnotation(ClientWidget.class);
- Class<? extends com.vaadin.terminal.gwt.client.VPaintableWidget> value = annotation
+ Class<? extends com.vaadin.terminal.gwt.client.ComponentConnector> value = annotation
.value();
sourceWriter.print(value.getName() + ".class");
}
.println("fullyQualifiedName = fullyQualifiedName.intern();");
for (Class<? extends Paintable> class1 : paintablesHavingWidgetAnnotation) {
- Class<? extends com.vaadin.terminal.gwt.client.VPaintableWidget> clientClass = getClientClass(class1);
+ Class<? extends com.vaadin.terminal.gwt.client.ComponentConnector> clientClass = getClientClass(class1);
sourceWriter.print("if ( fullyQualifiedName == \"");
sourceWriter.print(class1.getName());
sourceWriter.print("\" ) { ensureInstantiator("
}
- private static Class<? extends com.vaadin.terminal.gwt.client.VPaintableWidget> getClientClass(
+ private static Class<? extends com.vaadin.terminal.gwt.client.ComponentConnector> getClientClass(
Class<? extends Paintable> class1) {
- Class<? extends com.vaadin.terminal.gwt.client.VPaintableWidget> clientClass;
+ Class<? extends com.vaadin.terminal.gwt.client.ComponentConnector> clientClass;
if (Root.class == class1) {
clientClass = VViewPaintable.class;
} else {
import com.vaadin.terminal.Resource;
import com.vaadin.terminal.Terminal;
import com.vaadin.terminal.gwt.client.ComponentState;
-import com.vaadin.terminal.gwt.client.ui.VAbstractPaintableWidget;
+import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
import com.vaadin.terminal.gwt.server.ComponentSizeValidator;
import com.vaadin.terminal.gwt.server.RpcManager;
import com.vaadin.terminal.gwt.server.RpcTarget;
// related code has been updated
if (getIcon() != null) {
target.addAttribute(
- VAbstractPaintableWidget.ATTRIBUTE_ICON, getIcon());
+ AbstractComponentConnector.ATTRIBUTE_ICON, getIcon());
}
if (eventIdentifiers != null) {
import com.vaadin.terminal.ErrorMessage;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
-import com.vaadin.terminal.gwt.client.ui.VAbstractPaintableWidget;
+import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
/**
* <p>
// Adds the required attribute
if (!isReadOnly() && isRequired()) {
- target.addAttribute(VAbstractPaintableWidget.ATTRIBUTE_REQUIRED,
+ target.addAttribute(AbstractComponentConnector.ATTRIBUTE_REQUIRED,
true);
}
// Hide the error indicator if needed
if (shouldHideErrors()) {
- target.addAttribute(VAbstractPaintableWidget.ATTRIBUTE_HIDEERRORS,
+ target.addAttribute(AbstractComponentConnector.ATTRIBUTE_HIDEERRORS,
true);
}
}
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.widgetsetutils.CustomWidgetMapGenerator;
import com.vaadin.terminal.gwt.widgetsetutils.EagerWidgetMapGenerator;
import com.vaadin.terminal.gwt.widgetsetutils.LazyWidgetMapGenerator;
/**
* @return the client side counterpart for the annotated component
*/
- Class<? extends VPaintableWidget> value();
+ Class<? extends ComponentConnector> value();
/**
* Depending on the used WidgetMap generator, these optional hints may be
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.Resource;
-import com.vaadin.terminal.gwt.client.ui.VAbstractPaintableWidget;
+import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
import com.vaadin.terminal.gwt.client.ui.VFilterSelectPaintable;
/**
// Adds the required attribute
if (!isReadOnly() && isRequired()) {
- target.addAttribute(VAbstractPaintableWidget.ATTRIBUTE_REQUIRED,
+ target.addAttribute(AbstractComponentConnector.ATTRIBUTE_REQUIRED,
true);
}
// Hide the error indicator if needed
if (shouldHideErrors()) {
- target.addAttribute(VAbstractPaintableWidget.ATTRIBUTE_HIDEERRORS,
+ target.addAttribute(AbstractComponentConnector.ATTRIBUTE_HIDEERRORS,
true);
}
}
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.Resource;
-import com.vaadin.terminal.gwt.client.ui.VAbstractPaintableWidget;
+import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
import com.vaadin.terminal.gwt.client.ui.VTabsheet;
import com.vaadin.terminal.gwt.client.ui.VTabsheetBasePaintable;
import com.vaadin.terminal.gwt.client.ui.VTabsheetPaintable;
// VCaption.updateCaption(uidl)
final Resource icon = tab.getIcon();
if (icon != null) {
- target.addAttribute(VAbstractPaintableWidget.ATTRIBUTE_ICON,
+ target.addAttribute(AbstractComponentConnector.ATTRIBUTE_ICON,
icon);
}
final String caption = tab.getCaption();
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.ui.VAbstractPaintableWidget;
+import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
-public class VMyDragSourcePaintable extends VAbstractPaintableWidget {
+public class VMyDragSourcePaintable extends AbstractComponentConnector {
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
import com.google.gwt.user.client.ui.Composite;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ui.dd.VDragEvent;
import com.vaadin.terminal.gwt.client.ui.dd.VDropHandler;
import com.vaadin.terminal.gwt.client.ui.dd.VHasDropHandler;
return this;
}
- public VPaintableWidget getPaintable() {
+ public ComponentConnector getPaintable() {
// TODO Auto-generated method stub
return null;
}
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.ui.VAbstractPaintableWidget;
+import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
-public class VMyDropTargetPaintable extends VAbstractPaintableWidget {
+public class VMyDropTargetPaintable extends AbstractComponentConnector {
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {