Class AbstractDecorator<T>
- java.lang.Object
-
- com.google.gwt.user.client.ui.UIObject
-
- com.google.gwt.user.client.ui.Widget
-
- com.google.gwt.user.client.ui.Composite
-
- de.knightsoftnet.validators.client.decorators.AbstractDecorator<T>
-
- Type Parameters:
T- the type of data being edited
- All Implemented Interfaces:
com.google.gwt.editor.client.Editor<T>,com.google.gwt.editor.client.HasEditorErrors<T>,com.google.gwt.editor.client.IsEditor<com.google.gwt.editor.ui.client.adapters.ValueBoxEditor<T>>,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
- Direct Known Subclasses:
AbstractDecoratorWithLabel,UniversalDecorator,UniversalDecoratorWithIcons
public abstract class AbstractDecorator<T> extends com.google.gwt.user.client.ui.Composite implements com.google.gwt.editor.client.HasEditorErrors<T>, com.google.gwt.editor.client.IsEditor<com.google.gwt.editor.ui.client.adapters.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.HasEnabledThis abstract class combines some methods which are used by decorators.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceAbstractDecorator.ResourcesA ClientBundle that provides images and decoratorStyle sheets for the decorator.
-
Field Summary
Fields Modifier and Type Field Description protected com.google.gwt.user.client.ui.SimplePanelcontentscontent panel.protected DecoratorStyledecoratorStylevalue box resource with css.protected com.google.gwt.user.client.ui.Widgetwidgetthe widget.
-
Constructor Summary
Constructors Constructor Description AbstractDecorator(com.google.gwt.user.client.ui.Widget pwidget)Constructs a Decorator using aWidgetwidget with error location.AbstractDecorator(com.google.gwt.user.client.ui.Widget pwidget, PanelLocationEnum errorLocation)Constructs a Decorator using aWidgetwidget with error location.AbstractDecorator(com.google.gwt.user.client.ui.Widget pwidget, PanelLocationEnum errorLocation, AbstractDecorator.Resources decoratorResource)Constructs a Decorator using aWidgetwidget with error location and style sheet.AbstractDecorator(PanelLocationEnum errorLocation)Constructs a Decorator.AbstractDecorator(PanelLocationEnum errorLocation, AbstractDecorator.Resources resource)Constructs a Decorator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.gwt.event.shared.HandlerRegistrationaddKeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler phandler)com.google.gwt.event.shared.HandlerRegistrationaddKeyUpHandler(com.google.gwt.event.dom.client.KeyUpHandler pkeyUpHandler)protected voidaddValueChangeHandler(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.HandlerRegistrationaddValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<T> phandler)com.google.gwt.editor.ui.client.adapters.ValueBoxEditor<T>asEditor()Returns the associatedValueBoxEditor.voidclearErrors()clear errors.protected booleaneditorErrorMatches(com.google.gwt.editor.client.EditorError perror)Checks if a error belongs to this widget.protected static AbstractDecorator.ResourcesgetDefaultResources()get default resource, if not set, create one.com.google.gwt.user.client.ui.FlowPanelgetLayout()intgetTabIndex()TgetValue()com.google.gwt.user.client.ui.WidgetgetWidget()get the widget.booleanisEnabled()booleanisFocusOnError()check if focus on error is active.voidsetAccessKey(char pkey)voidsetChildWidget(com.google.gwt.user.client.ui.Widget pwidget)Set the widget that the EditorPanel will display.voidsetEditor(ExtendedValueBoxEditor<T> peditor)Sets the associatedValueBoxEditor.voidsetEnabled(boolean penabled)voidsetFocus(boolean pfocused)voidsetFocusOnError(boolean pfocusOnError)set focus on error flag, if it's true, the widget get's the focus if validation finds an error.voidsetTabIndex(int pindex)voidsetValue(T pvalue)voidsetValue(T pvalue, boolean pfireEvents)voidshowErrors(List<com.google.gwt.editor.client.EditorError> errors)The default implementation will display, but not consume, received errors whosegetEditor()method returns the Editor passed intosetEditor(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
-
-
-
-
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 aWidgetwidget with error location and style sheet.- Parameters:
pwidget- the widgeterrorLocation- location of the error textdecoratorResource- resource with css information
-
AbstractDecorator
public AbstractDecorator(com.google.gwt.user.client.ui.Widget pwidget, PanelLocationEnum errorLocation)Constructs a Decorator using aWidgetwidget with error location.- Parameters:
pwidget- the widgeterrorLocation- location of the error text
-
AbstractDecorator
public AbstractDecorator(com.google.gwt.user.client.ui.Widget pwidget)
Constructs a Decorator using aWidgetwidget with error location.- Parameters:
pwidget- the widget
-
AbstractDecorator
public AbstractDecorator(PanelLocationEnum errorLocation, AbstractDecorator.Resources resource)
Constructs a Decorator.- Parameters:
errorLocation- location of the error textresource- 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.
-
setChildWidget
@UiChild(limit=1, tagname="widget") public void setChildWidget(com.google.gwt.user.client.ui.Widget pwidget)Set the widget that the EditorPanel will display. This method will automatically callsetEditor(de.knightsoftnet.validators.client.decorators.ExtendedValueBoxEditor<T>).- Parameters:
pwidget- aIsEditorwidget
-
addValueChangeHandler
public final com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<T> phandler)
- Specified by:
addValueChangeHandlerin interfacecom.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<com.google.gwt.editor.client.EditorError> errors)
The default implementation will display, but not consume, received errors whosegetEditor()method returns the Editor passed intosetEditor(de.knightsoftnet.validators.client.decorators.ExtendedValueBoxEditor<T>).- Specified by:
showErrorsin interfacecom.google.gwt.editor.client.HasEditorErrors<T>- Parameters:
errors- a List ofEditorErrorinstances
-
editorErrorMatches
protected boolean editorErrorMatches(com.google.gwt.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()
-
setValue
public final void setValue(T pvalue)
-
setValue
public void setValue(T pvalue, boolean pfireEvents)
- Specified by:
setValuein interfacecom.google.gwt.user.client.ui.HasValue<T>
-
setTabIndex
public final void setTabIndex(int pindex)
- Specified by:
setTabIndexin interfacecom.google.gwt.user.client.ui.Focusable
-
getTabIndex
public final int getTabIndex()
- Specified by:
getTabIndexin interfacecom.google.gwt.user.client.ui.Focusable
-
setAccessKey
public final void setAccessKey(char pkey)
- Specified by:
setAccessKeyin interfacecom.google.gwt.user.client.ui.Focusable
-
setFocus
public final void setFocus(boolean pfocused)
- Specified by:
setFocusin interfacecom.google.gwt.user.client.ui.Focusable
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabledin interfacecom.google.gwt.user.client.ui.HasEnabled
-
setEnabled
public void setEnabled(boolean penabled)
- Specified by:
setEnabledin interfacecom.google.gwt.user.client.ui.HasEnabled
-
getWidget
public final com.google.gwt.user.client.ui.Widget getWidget()
get the widget.- Overrides:
getWidgetin classcom.google.gwt.user.client.ui.Composite- Returns:
- the widget
-
asEditor
public com.google.gwt.editor.ui.client.adapters.ValueBoxEditor<T> asEditor()
Returns the associatedValueBoxEditor.- Specified by:
asEditorin interfacecom.google.gwt.editor.client.IsEditor<T>- Returns:
- a
ValueBoxEditorinstance - See Also:
setEditor(ExtendedValueBoxEditor)
-
setEditor
public final void setEditor(ExtendedValueBoxEditor<T> peditor)
Sets the associatedValueBoxEditor.- Parameters:
peditor- aValueBoxEditorinstance- See Also:
asEditor()
-
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:
addKeyPressHandlerin interfacecom.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:
addKeyUpHandlerin interfacecom.google.gwt.event.dom.client.HasKeyUpHandlers
-
-