com.vaadin.client.ui.

Class AbstractComponentConnector

    • Field Detail

      • SIGNIFICANT_MOVE_THRESHOLD

        protected int SIGNIFICANT_MOVE_THRESHOLD

        Default threshold for determining whether touch move is significant.

    • Constructor Detail

      • AbstractComponentConnector

        public AbstractComponentConnector()

        Default constructor.

    • Method Detail

      • unregisterTouchHandlers

        protected void unregisterTouchHandlers()

        The new default behavior is for long taps to fire a contextclick event if there's a contextclick listener attached to the component. If you do not want this in your component, override this with a blank method to get rid of said behavior.

        Since:

        7.6

      • registerTouchHandlers

        protected void registerTouchHandlers()

        The new default behavior is for long taps to fire a contextclick event if there's a contextclick listener attached to the component. If you do not want this in your component, override this with a blank method to get rid of said behavior. Some Vaadin Components already handle the long tap as a context menu. This method is unnecessary for those.

        Since:

        7.6

      • shouldHandleLongTap

        protected boolean shouldHandleLongTap()

        Checks whether a long tap needs handling.

        Returns:

        true if long tap handling is needed, false otherwise

      • sendContextClickEvent

        protected void sendContextClickEvent​(MouseEventDetails details,
                                             com.google.gwt.dom.client.EventTarget eventTarget)

        This method sends the context menu event to the server-side. Can be overridden to provide extra information through an alternative RPC interface.

        Parameters:

        details - the mouse event details

        eventTarget - the target of the event

        Since:

        7.6

      • createWidget

        protected com.google.gwt.user.client.ui.Widget createWidget()

        Creates and returns the widget for this VPaintableWidget. This method should only be called once when initializing the paintable.

        You should typically not override this method since the framework by default generates an implementation that uses GWT.create(Class) to create a widget of the same type as returned by the most specific override of getWidget(). If you do override the method, you can't call super.createWidget() since the metadata needed for that implementation is not generated if there's an override of the method.

        Returns:

        a new widget instance to use for this component connector

      • getWidget

        public com.google.gwt.user.client.ui.Widget getWidget()

        Returns the widget associated with this paintable. The widget returned by this method must not changed during the life time of the paintable.

        Specified by:

        getWidget in interface HasWidget

        Returns:

        The widget associated with this paintable

      • isRealUpdate

        @Deprecated
        public static boolean isRealUpdate​(UIDL uidl)
        Deprecated.

        Checks whether the update is 'real' or contains cached information.

        Parameters:

        uidl - the UIDL to check

        Returns:

        true if doesn't have "cached" attribute, false otherwise

      • setWidgetEnabled

        public void setWidgetEnabled​(boolean widgetEnabled)

        Description copied from interface: ComponentConnector

        Sets the enabled state of the widget associated to this connector.

        Specified by:

        setWidgetEnabled in interface ComponentConnector

        Parameters:

        widgetEnabled - true if the widget should be enabled, false otherwise

      • updateComponentSize

        protected void updateComponentSize()

        Updates the component size based on the shared state, invoking the layout manager if necessary.

      • updateComponentSize

        protected void updateComponentSize​(String newWidth,
                                           String newHeight)

        Updates the component size, invoking the layout manager if necessary.

        Parameters:

        newWidth - The new width as a CSS string. Cannot be null.

        newHeight - The new height as a CSS string. Cannot be null.

      • updateWidgetSize

        protected void updateWidgetSize​(String newWidth,
                                        String newHeight)

        Updates the DOM size of this connector's widget.

        Parameters:

        newWidth - The new width as a CSS string. Cannot be null.

        newHeight - The new height as a CSS string. Cannot be null.

        Since:

        7.1.15

      • isRelativeHeight

        public boolean isRelativeHeight()

        Description copied from interface: ComponentConnector

        Returns true 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.

        Specified by:

        isRelativeHeight in interface ComponentConnector

        Returns:

        true if the width is undefined, else false

      • isRelativeWidth

        public boolean isRelativeWidth()

        Description copied from interface: ComponentConnector

        Returns true 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.

        Specified by:

        isRelativeWidth in interface ComponentConnector

        Returns:

        true if the width is undefined, else false

      • isUndefinedHeight

        public boolean isUndefinedHeight()

        Description copied from interface: ComponentConnector

        Returns true 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.

        Specified by:

        isUndefinedHeight in interface ComponentConnector

        Returns:

        true if the height is undefined, else false

      • isUndefinedWidth

        public boolean isUndefinedWidth()

        Description copied from interface: ComponentConnector

        Returns true 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.

        Specified by:

        isUndefinedWidth in interface ComponentConnector

        Returns:

        true if the width is undefined, else false

      • delegateCaptionHandling

        public boolean delegateCaptionHandling()

        Description copied from interface: ComponentConnector

        Return true if parent handles caption, false if the paintable handles the caption itself.

        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

        Specified by:

        delegateCaptionHandling in interface ComponentConnector

        Returns:

        true if caption handling is delegated to the parent, false if parent should not be allowed to render caption

      • updateWidgetStyleNames

        protected void updateWidgetStyleNames()

        Updates the user defined, read-only and error style names for the widget based the shared state. User defined style names are prefixed with the primary style name of the widget returned by getWidget()

        This method can be overridden to provide additional style names for the component, for example see AbstractFieldConnector

      • setWidgetStyleName

        protected void setWidgetStyleName​(String styleName,
                                          boolean add)

        This is used to add / remove state related style names from the widget.

        Override this method for example if the style name given here should be updated in another widget in addition to the one returned by the getWidget().

        Parameters:

        styleName - the style name to be added or removed

        add - true to add the given style, false to remove it

      • setWidgetStyleNameWithPrefix

        @Deprecated
        protected void setWidgetStyleNameWithPrefix​(String prefix,
                                                    String styleName,
                                                    boolean add)
        Deprecated.
        This will be removed once styles are no longer added with prefixes.

        This is used to add / remove state related prefixed style names from the widget.

        Override this method if the prefixed style name given here should be updated in another widget in addition to the one returned by the Connector's getWidget(), or if the prefix should be different. For example see TextualDateConnector.setWidgetStyleNameWithPrefix(String, String, boolean)

        Parameters:

        prefix - the prefix for the style name

        styleName - the style name to be added or removed

        add - true to add the given style, false to remove it

      • getTooltipInfo

        public TooltipInfo getTooltipInfo​(com.google.gwt.dom.client.Element element)

        Description copied from interface: ComponentConnector

        Gets the tooltip info for the given element.

        When overriding this method, ComponentConnector.hasTooltip() should also be overridden to return true in all situations where this method might return a non-empty result.

        Specified by:

        getTooltipInfo in interface ComponentConnector

        Parameters:

        element - The element to lookup a tooltip for

        Returns:

        The tooltip for the element or null if no tooltip is defined for this element.

      • hasTooltip

        public boolean hasTooltip()

        Description copied from interface: ComponentConnector

        Check whether there might be a tooltip for this component. The framework will only add event listeners for automatically handling tooltips (using ComponentConnector.getTooltipInfo(Element)) if this method returns true.

        This is only done to optimize performance, so in cases where the status is not known, it's safer to return true so that there will be a tooltip handler even though it might not be needed in all cases.

        Specified by:

        hasTooltip in interface ComponentConnector

        Returns:

        true if some part of the component might have a tooltip, otherwise false

      • getIconUri

        protected String getIconUri()

        Gets the URI of the icon set for this component.

        Returns:

        the URI of the icon, or null if no icon has been defined.

      • getIcon

        protected Icon getIcon()

        Gets the icon set for this component.

        Returns:

        the icon, or null if no icon has been defined.

      • flush

        public void flush()

        Description copied from interface: ComponentConnector

        Called for the active (focused) connector when a situation occurs that the focused connector might have buffered changes which need to be processed before other activity takes place.

        This is currently called when the user changes the fragment using the back/forward button in the browser and allows the focused field to submit its value to the server before the fragment change event takes place.

        Specified by:

        flush in interface ComponentConnector

      • isErrorIndicatorVisible

        public boolean isErrorIndicatorVisible()

        Description copied from interface: HasErrorIndicator

        Checks if an error indicator should be shown for the given connector.

        Specified by:

        isErrorIndicatorVisible in interface HasErrorIndicator

        Returns:

        true to show an indicator, false otherwise

      • onDragSourceAttached

        public void onDragSourceAttached()

        Invoked when a DragSourceExtensionConnector has been attached to this component.

        By default, does nothing. If you need to apply some changes to the widget, override this method.

        This is a framework internal method, and should not be invoked manually.

        Since:

        8.1

        See Also:

        onDragSourceDetached()

      • onDragSourceDetached

        public void onDragSourceDetached()

        Invoked when a DragSourceExtensionConnector has been removed from this component.

        By default, does nothing.

        This is a framework internal method, and should not be invoked manually.

        Since:

        8.1

        See Also:

        onDragSourceAttached()

      • onDropTargetAttached

        public void onDropTargetAttached()

        Invoked when a DropTargetExtensionConnector has been attached to this component.

        By default, does nothing. If you need to apply some changes to the widget, override this method.

        This is a framework internal method, and should not be invoked manually.

        Since:

        8.1

        See Also:

        onDropTargetDetached()

      • onDropTargetDetached

        public void onDropTargetDetached()

        Invoked when a DropTargetExtensionConnector has been removed from this component.

        By default, does nothing.

        This is a framework internal method, and should not be invoked manually.

        Since:

        8.1

        See Also:

        onDropTargetAttached()