Class AbstractDecorator<T>

  • Type Parameters:
    T - the type of data being edited
    All Implemented Interfaces:
    com.google.gwt.event.dom.client.HasKeyPressHandlers, com.google.gwt.event.dom.client.HasKeyUpHandlers, com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.logical.shared.HasValueChangeHandlers<T>, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.TakesValue<T>, com.google.gwt.user.client.ui.Focusable, com.google.gwt.user.client.ui.HasEnabled, com.google.gwt.user.client.ui.HasValue<T>, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.IsRenderable, com.google.gwt.user.client.ui.IsWidget, org.gwtproject.editor.client.Editor<T>, org.gwtproject.editor.client.HasEditorErrors<T>, org.gwtproject.editor.client.IsEditor<ValueBoxEditor<T>>
    Direct Known Subclasses:
    AbstractDecoratorWithLabel, UniversalDecorator, UniversalDecoratorWithIcons

    public abstract class AbstractDecorator<T>
    extends com.google.gwt.user.client.ui.Composite
    implements org.gwtproject.editor.client.HasEditorErrors<T>, org.gwtproject.editor.client.IsEditor<ValueBoxEditor<T>>, com.google.gwt.user.client.ui.HasValue<T>, com.google.gwt.event.logical.shared.HasValueChangeHandlers<T>, com.google.gwt.event.dom.client.HasKeyUpHandlers, com.google.gwt.event.dom.client.HasKeyPressHandlers, com.google.gwt.user.client.ui.Focusable, com.google.gwt.user.client.ui.HasEnabled
    This abstract class combines some methods which are used by decorators.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  AbstractDecorator.Resources
      A ClientBundle that provides images and decoratorStyle sheets for the decorator.
      • Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject

        com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
      • Nested classes/interfaces inherited from interface org.gwtproject.editor.client.Editor

        org.gwtproject.editor.client.Editor.Ignore, org.gwtproject.editor.client.Editor.Path
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected com.google.gwt.user.client.ui.SimplePanel contents
      content panel.
      protected DecoratorStyle decoratorStyle
      value box resource with css.
      protected com.google.gwt.user.client.ui.Widget widget
      the widget.
      • Fields inherited from class com.google.gwt.user.client.ui.UIObject

        DEBUG_ID_PREFIX
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.google.gwt.event.shared.HandlerRegistration addKeyPressHandler​(com.google.gwt.event.dom.client.KeyPressHandler phandler)  
      com.google.gwt.event.shared.HandlerRegistration addKeyUpHandler​(com.google.gwt.event.dom.client.KeyUpHandler pkeyUpHandler)  
      protected void addValueChangeHandler​(com.google.gwt.event.logical.shared.HasValueChangeHandlers<T> pwidget)
      add a change handler to clear error state on value change.
      com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler​(com.google.gwt.event.logical.shared.ValueChangeHandler<T> phandler)  
      ValueBoxEditor<T> asEditor()
      Returns the associated ValueBoxEditor.
      void clearErrors()
      clear errors.
      protected boolean editorErrorMatches​(org.gwtproject.editor.client.EditorError perror)
      Checks if a error belongs to this widget.
      protected static AbstractDecorator.Resources getDefaultResources()
      get default resource, if not set, create one.
      com.google.gwt.user.client.ui.FlowPanel getLayout()  
      int getTabIndex()  
      T getValue()  
      com.google.gwt.user.client.ui.Widget getWidget()
      get the widget.
      boolean isEnabled()  
      boolean isFocusOnError()
      check if focus on error is active.
      void setAccessKey​(char pkey)  
      void setChildWidget​(com.google.gwt.user.client.ui.Widget pwidget)
      Set the widget that the EditorPanel will display.
      void setEditor​(ExtendedValueBoxEditor<T> peditor)
      Sets the associated ValueBoxEditor.
      void setEnabled​(boolean penabled)  
      void setFocus​(boolean pfocused)  
      void setFocusOnError​(boolean pfocusOnError)
      set focus on error flag, if it's true, the widget get's the focus if validation finds an error.
      void setTabIndex​(int pindex)  
      void setValue​(T pvalue)  
      void setValue​(T pvalue, boolean pfireEvents)  
      void showErrors​(List<org.gwtproject.editor.client.EditorError> errors)
      The default implementation will display, but not consume, received errors whose getEditor() method returns the Editor passed into setEditor(de.knightsoftnet.validators.client.decorators.ExtendedValueBoxEditor<T>).
      • Methods inherited from class com.google.gwt.user.client.ui.Composite

        claimElement, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
      • Methods inherited from class com.google.gwt.user.client.ui.Widget

        addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
      • Methods inherited from class com.google.gwt.user.client.ui.UIObject

        addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
      • Methods inherited from interface com.google.gwt.event.shared.HasHandlers

        fireEvent
    • Field Detail

      • contents

        protected final com.google.gwt.user.client.ui.SimplePanel contents
        content panel.
      • decoratorStyle

        protected final DecoratorStyle decoratorStyle
        value box resource with css.
      • widget

        protected com.google.gwt.user.client.ui.Widget widget
        the widget.
    • Constructor Detail

      • AbstractDecorator

        public AbstractDecorator​(PanelLocationEnum errorLocation)
        Constructs a Decorator.
        Parameters:
        errorLocation - location of the error text
      • AbstractDecorator

        public AbstractDecorator​(com.google.gwt.user.client.ui.Widget pwidget,
                                 PanelLocationEnum errorLocation,
                                 AbstractDecorator.Resources decoratorResource)
        Constructs a Decorator using a Widget widget with error location and style sheet.
        Parameters:
        pwidget - the widget
        errorLocation - location of the error text
        decoratorResource - resource with css information
      • AbstractDecorator

        public AbstractDecorator​(com.google.gwt.user.client.ui.Widget pwidget,
                                 PanelLocationEnum errorLocation)
        Constructs a Decorator using a Widget widget with error location.
        Parameters:
        pwidget - the widget
        errorLocation - location of the error text
      • AbstractDecorator

        public AbstractDecorator​(com.google.gwt.user.client.ui.Widget pwidget)
        Constructs a Decorator using a Widget widget with error location.
        Parameters:
        pwidget - the widget
      • AbstractDecorator

        public AbstractDecorator​(PanelLocationEnum errorLocation,
                                 AbstractDecorator.Resources resource)
        Constructs a Decorator.
        Parameters:
        errorLocation - location of the error text
        resource - resource with css information
    • Method Detail

      • getLayout

        public com.google.gwt.user.client.ui.FlowPanel getLayout()
      • getDefaultResources

        protected static AbstractDecorator.Resources getDefaultResources()
        get default resource, if not set, create one.
        Returns:
        default resource.
      • addValueChangeHandler

        public final com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler​(com.google.gwt.event.logical.shared.ValueChangeHandler<T> phandler)
        Specified by:
        addValueChangeHandler in interface com.google.gwt.event.logical.shared.HasValueChangeHandlers<T>
      • addValueChangeHandler

        protected void addValueChangeHandler​(com.google.gwt.event.logical.shared.HasValueChangeHandlers<T> pwidget)
        add a change handler to clear error state on value change.
        Parameters:
        pwidget - widget to set the handler to
      • clearErrors

        public void clearErrors()
        clear errors.
      • showErrors

        public void showErrors​(List<org.gwtproject.editor.client.EditorError> errors)
        The default implementation will display, but not consume, received errors whose getEditor() method returns the Editor passed into setEditor(de.knightsoftnet.validators.client.decorators.ExtendedValueBoxEditor<T>).
        Specified by:
        showErrors in interface org.gwtproject.editor.client.HasEditorErrors<T>
        Parameters:
        errors - a List of EditorError instances
      • editorErrorMatches

        protected boolean editorErrorMatches​(org.gwtproject.editor.client.EditorError perror)
        Checks if a error belongs to this widget.
        Parameters:
        perror - editor error to check
        Returns:
        true if the error belongs to this widget
      • getValue

        public final T getValue()
        Specified by:
        getValue in interface com.google.gwt.user.client.ui.HasValue<T>
        Specified by:
        getValue in interface com.google.gwt.user.client.TakesValue<T>
      • setValue

        public final void setValue​(T pvalue)
        Specified by:
        setValue in interface com.google.gwt.user.client.ui.HasValue<T>
        Specified by:
        setValue in interface com.google.gwt.user.client.TakesValue<T>
      • setValue

        public void setValue​(T pvalue,
                             boolean pfireEvents)
        Specified by:
        setValue in interface com.google.gwt.user.client.ui.HasValue<T>
      • setTabIndex

        public final void setTabIndex​(int pindex)
        Specified by:
        setTabIndex in interface com.google.gwt.user.client.ui.Focusable
      • getTabIndex

        public final int getTabIndex()
        Specified by:
        getTabIndex in interface com.google.gwt.user.client.ui.Focusable
      • setAccessKey

        public final void setAccessKey​(char pkey)
        Specified by:
        setAccessKey in interface com.google.gwt.user.client.ui.Focusable
      • setFocus

        public final void setFocus​(boolean pfocused)
        Specified by:
        setFocus in interface com.google.gwt.user.client.ui.Focusable
      • isEnabled

        public boolean isEnabled()
        Specified by:
        isEnabled in interface com.google.gwt.user.client.ui.HasEnabled
      • setEnabled

        public void setEnabled​(boolean penabled)
        Specified by:
        setEnabled in interface com.google.gwt.user.client.ui.HasEnabled
      • getWidget

        public final com.google.gwt.user.client.ui.Widget getWidget()
        get the widget.
        Overrides:
        getWidget in class com.google.gwt.user.client.ui.Composite
        Returns:
        the widget
      • isFocusOnError

        public final boolean isFocusOnError()
        check if focus on error is active.
        Returns:
        true if widget should get focus on error
      • setFocusOnError

        public final void setFocusOnError​(boolean pfocusOnError)
        set focus on error flag, if it's true, the widget get's the focus if validation finds an error.
        Parameters:
        pfocusOnError - the focusOnError to set
      • addKeyPressHandler

        public final com.google.gwt.event.shared.HandlerRegistration addKeyPressHandler​(com.google.gwt.event.dom.client.KeyPressHandler phandler)
        Specified by:
        addKeyPressHandler in interface com.google.gwt.event.dom.client.HasKeyPressHandlers
      • addKeyUpHandler

        public com.google.gwt.event.shared.HandlerRegistration addKeyUpHandler​(com.google.gwt.event.dom.client.KeyUpHandler pkeyUpHandler)
        Specified by:
        addKeyUpHandler in interface com.google.gwt.event.dom.client.HasKeyUpHandlers