private JavaScriptConnectorState getConnectorState() { JavaScriptConnectorState state = (JavaScriptConnectorState) connector .getState(); return state; }
@Override protected AbstractComponentState getState(boolean markAsDirty) { return (AbstractComponentState) super.getState(markAsDirty); }
/** * Returns the shared state bean with information to be sent from the server * to the client. * * Subclasses should override this method and set any relevant fields of the * state returned by super.getState(). * * @since 7.0 * * @return updated component shared state */ @Override protected AbstractComponentState getState() { return (AbstractComponentState) super.getState(); }
/** * Returns the shared state for this connector. The shared state object is * shared between the server connector and the client connector. Changes are * only communicated from the server to the client and not in the other * direction. * <p> * As a side effect, marks the connector dirty so any changes done to the * state will be sent to the client. Use {@code getState(false)} to avoid * marking the connector as dirty. * </p> * * @return The shared state for this connector. Never null. */ protected SharedState getState() { return getState(true); }
@Override public JsonObject encodeState() { return LegacyCommunicationManager.encodeState(this, getState(false)); }
/** * Registers a resource with this connector using the given key. This will * make the URL for retrieving the resource available to the client-side * connector using * {@link com.vaadin.terminal.gwt.client.ui.AbstractConnector#getResourceUrl(String)} * with the same key. * * @param key * the string key to associate the resource with * @param resource * the resource to set, or <code>null</code> to clear a previous * association. */ protected void setResource(String key, Resource resource) { ResourceReference resourceReference = ResourceReference.create(resource, this, key); if (resourceReference == null) { getState().resources.remove(key); } else { getState().resources.put(key, resourceReference); } }
/** * Gets a resource defined using {@link #setResource(String, Resource)} with * the corresponding key. * * @param key * the string identifier of the resource * @return a resource, or <code>null</code> if there's no resource * associated with the given key * * @see #setResource(String, Resource) */ protected Resource getResource(String key) { return ResourceReference .getResource(getState(false).resources.get(key)); }
eventIdentifier, getState());
eventRouter.removeListener(eventType, target); if (!eventRouter.hasListeners(eventType)) { ComponentStateUtil.removeRegisteredEventListener(getState(), eventIdentifier);