E
- W
- @JsType(namespace="xgl") public abstract class Widget<E extends Element<E>,W extends Widget<E,W>> extends Object implements HasHandlers, ReflowScheduler<W>, EventTarget<W>, HasAttachHandlers<W>, HasDetachHandlers<W>, HasTransitionEndHandlers<W>, HasMouseHandlers<W>, HasTouchHandlers<W>, HasKeyHandlers<W>, HasScrollHandlers<W>, HasAnimationStartHandlers<W>, HasAnimationIterationHandlers<W>, HasAnimationEndHandlers<W>, HasActionHandlers<W>, HasDoubleActionHandlers<W>, HasResizeHandlers<W>
Modifier and Type | Field and Description |
---|---|
protected Menu |
contextMenu |
protected HandlerRegistration |
contextMenuHandlerRegistration |
protected Double |
currentHeight |
protected Double |
currentWidth |
protected boolean |
enabled |
protected static EventListener<? extends NativeEvent<?>> |
NATIVE_CONTEXT_MENU_HANDLER |
Modifier and Type | Method and Description |
---|---|
W |
add(Widget<? extends Element<?>,?> widget) |
HandlerRegistration |
addActionHandler(ActionHandler<W> actionHandler,
EventPhase eventPhase) |
W |
addClassName(String cssClassName) |
HandlerRegistration |
addDoubleActionHandler(DoubleActionHandler<W> doubleActionHandler,
EventPhase eventPhase) |
HandlerRegistration |
addDoubleTapHandler(DoubleTapHandler<W> doubleTapHandler,
EventPhase eventPhase) |
W |
addDropTarget(DropTarget<W,?,?> dropTarget) |
<H extends EventHandler> |
addEventHandler(H handler,
Event.Type<H> type) |
<H extends EventHandler> |
addEventHandler(H handler,
Event.Type<H> type,
EventPhase phase) |
HandlerRegistration |
addResizeHandler(ResizeHandler<W> resizeHandler) |
W |
addStyleName(String cssClassName) |
HandlerRegistration |
addTapHandler(TapHandler<W> tapHandler,
EventPhase eventPhase) |
HandlerRegistration |
addTouchHoldHandler(TouchHoldHandler<W> touchHandler,
EventPhase eventPhase) |
boolean |
canDropTargetAccept() |
<T> T |
cast() |
W |
clear() |
W |
clearBackgroundColor()
Clears the background color, the theme's background color will be used.
|
W |
clearDropTargets() |
W |
clearTextColor()
Clears the text color, the theme's color will be used.
|
protected HandlerManager<E,W> |
ensureHandlers() |
protected <H extends EventHandler> |
fireEvent(Event<H> event) |
protected <H extends EventHandler> |
fireEvent(Event<H> event,
EventPhase eventPhase) |
protected void |
fireResizeEvent() |
int |
getAbsoluteLeft() |
int |
getAbsoluteTop() |
Widget<?,?> |
getAncestor(int level) |
List<Widget<?,?>> |
getChildren() |
int |
getChildrenCount() |
ComputedStyle |
getComputedStyle() |
Menu |
getContextMenu() |
protected ContextMenuHandler<W> |
getContextMenuHandler() |
Widget<?,?> |
getDeepestWidget(Element<?> element)
Returns the deepest widget for which the submitted element is wrapped by
the widget or is in the widget hierarchy, provided there is no widget
wrapping the submitted element and there is no widget deeper in the tree.
|
DragSource<W,?> |
getDragSource() |
Set<DropTarget<W,?,?>> |
getDropTargetList() |
E |
getElement() |
<T extends Widget<?,?>> |
getFirstChild() |
String |
getId() |
<T extends Widget<?,?>> |
getLastChild() |
Widget<?,?> |
getNextSibling() |
Widget<?,?> |
getNextSibling(Widget<?,?> widget) |
double |
getOffsetHeight() |
double |
getOffsetWidth() |
Widget<?,?> |
getParent() |
int |
getScrollLeft() |
int |
getScrollTop() |
MutableStyle |
getStyle() |
boolean |
hasClassName(String cssClassName) |
boolean |
hasFocus() |
void |
insert(Widget<? extends Element<?>,?> widget,
Widget<? extends Element<?>,?> beforeWidget) |
boolean |
isAttached() |
boolean |
isDropTarget()
If the widget has any drop target set, then it is a valid drop target
|
boolean |
isEnabled() |
static boolean |
isInEventThread() |
protected void |
onAttach() |
protected void |
onDetach() |
W |
remove(Widget<?,?> widget) |
W |
removeClassName(String cssClassName) |
W |
removeDropTarget(DropTarget<W,?,?> dropTarget) |
W |
removeStyleName(String cssClassName)
Alias for removeClass
|
W |
setBackgroundColor(Color backgroundColor)
Set the background color.
|
W |
setClassName(String cssClassName) |
W |
setContextMenu(Menu contextMenu) |
W |
setDragSource(DragSource<W,?> dragSource) |
W |
setDropTarget(DropTarget<W,?,?>... dropTargets) |
W |
setEnabled(boolean enabled) |
W |
setHeight(Calc height) |
W |
setHeight(double height) |
W |
setHeight(double height,
Unit unit) |
void |
setId(String id) |
W |
setLeft(double left) |
W |
setLeftAndTop(double left,
double top) |
W |
setMaxHeight(Calc height) |
W |
setMaxHeight(double height) |
W |
setMaxHeight(double height,
Unit unit) |
W |
setMaxWidth(Calc width) |
W |
setMaxWidth(double width) |
W |
setMaxWidth(double width,
Unit unit) |
W |
setMinHeight(Calc height) |
W |
setMinHeight(double height) |
W |
setMinHeight(double height,
Unit unit) |
W |
setMinWidth(Calc width) |
W |
setMinWidth(double width) |
W |
setMinWidth(double width,
Unit unit) |
protected void |
setParent(Widget<?,?> parent) |
W |
setPixelSize(int width,
int height) |
W |
setScrollLeft(int scrollLeft) |
W |
setScrollTop(int scrollTop) |
W |
setSize(double width,
double height) |
W |
setTextAlign(TextAlign textAlign)
Set the text alignment.
|
W |
setTextColor(Color textColor)
Set the text color.
|
W |
setTop(double top) |
W |
setWidth(Calc width) |
W |
setWidth(double width) |
W |
setWidth(double width,
Unit unit) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cancelMeasure, cancelMutation, measureAsSoonAsPossible, mutateAsSoonAsPossible, mutateAsSoonAsPossible, scheduleMeasure, scheduleMutation
addAttachHandler
addDetachHandler
addTransitionEndHandler, addTransitionEndHandler
addMouseDownHandler, addMouseDownHandler
addMouseMoveHandler, addMouseMoveHandler
addMouseOutHandler, addMouseOutHandler
addMouseOverHandler, addMouseOverHandler
addMouseUpHandler, addMouseUpHandler
addWheelHandler, addWheelHandler
addClickHandler, addClickHandler
addDoubleClickHandler, addDoubleClickHandler
addContextMenuHandler, addContextMenuHandler
addTouchStartHandler, addTouchStartHandler
addTouchMoveHandler, addTouchMoveHandler
addTouchForceChangeHandler, addTouchForceChangeHandler
addTouchEndHandler, addTouchEndHandler
addTouchCancelHandler, addTouchCancelHandler
addTouchHoldHandler
addTapHandler
addDoubleTapHandler
addKeyDownHandler, addKeyDownHandler
addKeyUpHandler, addKeyUpHandler
addKeyPressHandler, addKeyPressHandler
addScrollHandler, addScrollHandler
addAnimationStartHandler, addAnimationStartHandler
addAnimationIterationHandler, addAnimationIterationHandler
addAnimationEndHandler, addAnimationEndHandler
addActionHandler
addDoubleActionHandler
protected Menu contextMenu
protected HandlerRegistration contextMenuHandlerRegistration
protected boolean enabled
protected static final EventListener<? extends NativeEvent<?>> NATIVE_CONTEXT_MENU_HANDLER
protected Double currentWidth
protected Double currentHeight
public Widget(E element)
public E getElement()
@JsIgnore public final <H extends EventHandler> HandlerRegistration addEventHandler(H handler, Event.Type<H> type)
addEventHandler
in interface HasHandlers
public final <H extends EventHandler> HandlerRegistration addEventHandler(H handler, Event.Type<H> type, EventPhase phase)
addEventHandler
in interface HasHandlers
protected HandlerManager<E,W> ensureHandlers()
public Widget<?,?> getParent()
public Widget<?,?> getAncestor(int level)
public int getChildrenCount()
public <T extends Widget<?,?>> T getFirstChild()
public <T extends Widget<?,?>> T getLastChild()
protected void setParent(Widget<?,?> parent)
public void insert(Widget<? extends Element<?>,?> widget, Widget<? extends Element<?>,?> beforeWidget)
@WillMutate public W add(Widget<? extends Element<?>,?> widget)
protected void onAttach()
protected void onDetach()
public boolean isAttached()
public <T> T cast()
public String getId()
public void setId(String id)
public boolean hasFocus()
public boolean hasClassName(String cssClassName)
@WillMutate public W setClassName(String cssClassName)
@WillMutate public W addClassName(String cssClassName)
@WillMutate public W removeClassName(String cssClassName)
@WillMutate public W removeStyleName(String cssClassName)
cssClassName
- the class name to removepublic MutableStyle getStyle()
public ComputedStyle getComputedStyle()
public int getAbsoluteLeft()
public int getAbsoluteTop()
protected <H extends EventHandler> void fireEvent(Event<H> event)
protected <H extends EventHandler> void fireEvent(Event<H> event, EventPhase eventPhase)
public double getOffsetWidth()
public double getOffsetHeight()
public W setLeft(double left)
public W setTop(double top)
@JsIgnore public W setSize(double width, double height)
public W setLeftAndTop(double left, double top)
public W setPixelSize(int width, int height)
public W clear()
@JsMethod(name="setPixelWidth") public W setWidth(double width)
@JsMethod(name="setPixelHeight") public W setHeight(double height)
@JsMethod(name="setPixelMinWidth") public W setMinWidth(double width)
@JsMethod(name="setPixelMinHeight") public W setMinHeight(double height)
@JsMethod(name="setPixelMaxWidth") public W setMaxWidth(double width)
@JsMethod(name="setPixelMaxHeight") public W setMaxHeight(double height)
@JsIgnore public Widget<?,?> getNextSibling()
@JsIgnore public Widget<?,?> getNextSibling(Widget<?,?> widget)
widget
- The widget for which you want to find the next XGL sibling. It has
to be a child of the current widget.public W clearTextColor()
public W setTextAlign(TextAlign textAlign)
#clearTextAlign()
, the theme's text alignment will be used.textAlign
- the alignment used for the text of this widget. If the alignment
is null, revert to the theme's text alignment.public W setTextColor(Color textColor)
clearTextColor()
, the theme's text color will be used.textColor
- the color used for the text of this widget. If the color is null,
revert to the theme's text color.public W clearBackgroundColor()
public W setBackgroundColor(Color backgroundColor)
clearBackgroundColor()
, the theme's background color will be used.backgroundColor
- the background color to setpublic HandlerRegistration addTapHandler(TapHandler<W> tapHandler, EventPhase eventPhase)
addTapHandler
in interface HasTapHandlers<W extends Widget<E,W>>
public HandlerRegistration addDoubleTapHandler(DoubleTapHandler<W> doubleTapHandler, EventPhase eventPhase)
addDoubleTapHandler
in interface HasDoubleTapHandlers<W extends Widget<E,W>>
@JsIgnore public HandlerRegistration addTouchHoldHandler(TouchHoldHandler<W> touchHandler, EventPhase eventPhase)
addTouchHoldHandler
in interface HasTouchHoldHandlers<W extends Widget<E,W>>
protected ContextMenuHandler<W> getContextMenuHandler()
public boolean isEnabled()
public W setEnabled(boolean enabled)
public W setContextMenu(Menu contextMenu)
contextMenu
- the contextMenu to setpublic Menu getContextMenu()
@JsIgnore public HandlerRegistration addActionHandler(ActionHandler<W> actionHandler, EventPhase eventPhase)
addActionHandler
in interface HasActionHandlers<W extends Widget<E,W>>
@JsIgnore public HandlerRegistration addDoubleActionHandler(DoubleActionHandler<W> doubleActionHandler, EventPhase eventPhase)
addDoubleActionHandler
in interface HasDoubleActionHandlers<W extends Widget<E,W>>
public W setDragSource(DragSource<W,?> dragSource)
dragSource
- the dragSource to setpublic W setDropTarget(DropTarget<W,?,?>... dropTargets)
dropTargets
- the dropTargets to setpublic W addDropTarget(DropTarget<W,?,?> dropTarget)
dropTarget
- the dropTarget to setpublic W removeDropTarget(DropTarget<W,?,?> dropTarget)
dropTarget
- the dropTarget to removepublic W clearDropTargets()
public boolean isDropTarget()
public DragSource<W,?> getDragSource()
public Set<DropTarget<W,?,?>> getDropTargetList()
public boolean canDropTargetAccept()
public Widget<?,?> getDeepestWidget(Element<?> element)
element
- the element for which@WillMeasure protected void fireResizeEvent()
public HandlerRegistration addResizeHandler(ResizeHandler<W> resizeHandler)
addResizeHandler
in interface HasResizeHandlers<W extends Widget<E,W>>
@WillMeasure public int getScrollLeft()
@WillMutate public W setScrollLeft(int scrollLeft)
@WillMeasure public int getScrollTop()
@WillMutate public W setScrollTop(int scrollTop)
public static boolean isInEventThread()
Copyright © 2018 Xalys. All rights reserved.