Class WAbstractArea
- java.lang.Object
-
- eu.webtoolkit.jwt.WObject
-
- eu.webtoolkit.jwt.WAbstractArea
-
- Direct Known Subclasses:
WCircleArea,WPolygonArea,WRectArea
public abstract class WAbstractArea extends WObject
Abstract base class for interactive areas in a widget.Use an WAbstractArea (or rather, one of its concrete implementations), to define interactivity that applies on a part of a
WImageorWPaintedWidget. The area may be defined using different shapes throughWRectArea,WCircleAreaorWPolygonArea.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddStyleClass(java.lang.String styleClass)Adds a style class.voidaddStyleClass(java.lang.String styleClass, boolean force)Adds a style class.EventSignal1<WMouseEvent>clicked()Event signal emitted when a mouse key was clicked on this widget.EventSignal1<WMouseEvent>doubleClicked()Event signal emitted when a mouse key was double clicked on this widget.EventSignalenterPressed()Event signal emitted when enter was pressed.EventSignalescapePressed()Event signal emitted when escape was pressed.WStringgetAlternateText()Returns the alternate text.CursorgetCursor()Returns the cursor.protected java.lang.StringgetJsRef()WLinkgetLink()Returns the link.java.lang.StringgetStyleClass()Returns the style class.WStringgetToolTip()Returns the tooltip text.protected abstract java.lang.StringgetUpdateAreaCoordsJS()booleanisHole()Returns whether this area specifies a hole.booleanisTransformable()EventSignal1<WKeyEvent>keyPressed()Event signal emitted when a "character" was entered.EventSignal1<WKeyEvent>keyWentDown()Event signal emitted when a keyboard key is pushed down.EventSignal1<WKeyEvent>keyWentUp()Event signal emitted when a keyboard key is released.EventSignal1<WMouseEvent>mouseDragged()Event signal emitted when the mouse is dragged over this widget.EventSignal1<WMouseEvent>mouseMoved()Event signal emitted when the mouse moved over this widget.EventSignal1<WMouseEvent>mouseWentDown()Event signal emitted when a mouse key was pushed down on this widget.EventSignal1<WMouseEvent>mouseWentOut()Event signal emitted when the mouse went out of this widget.EventSignal1<WMouseEvent>mouseWentOver()Event signal emitted when the mouse entered this widget.EventSignal1<WMouseEvent>mouseWentUp()Event signal emitted when a mouse key was released on this widget.EventSignal1<WMouseEvent>mouseWheel()Event signal emitted when the mouse scroll wheel was used.voidremoveStyleClass(java.lang.String styleClass)Removes a style class.voidremoveStyleClass(java.lang.String styleClass, boolean force)Removes a style class.voidsetAlternateText(java.lang.CharSequence text)Sets an alternate text.voidsetCursor(Cursor cursor)Sets the cursor.voidsetCursor(java.lang.String cursorImage)Sets a custom cursor image URL.voidsetCursor(java.lang.String cursorImage, Cursor fallback)Sets a custom cursor image URL.voidsetHole(boolean hole)Specifies that this area specifies a hole for another area.voidsetLink(WLink link)Sets a link.voidsetObjectName(java.lang.String name)Sets an object name.voidsetStyleClass(java.lang.String styleClass)Defines a style class.voidsetToolTip(java.lang.CharSequence text)Sets the tooltip.voidsetTransformable(boolean transformable)protected booleanupdateDom(DomElement element, boolean all)-
Methods inherited from class eu.webtoolkit.jwt.WObject
getId, getObjectName, remove, setFormData, tr
-
-
-
-
Method Detail
-
setHole
public void setHole(boolean hole)
Specifies that this area specifies a hole for another area.When set to
true, this area will define an area that does not provide interactivity. When it preceeds other, overlapping, areas, it acts as if it cuts a hole in those areas.The default value is
false.- See Also:
isHole()
-
isHole
public boolean isHole()
Returns whether this area specifies a hole.- See Also:
setHole(boolean hole)
-
setTransformable
public void setTransformable(boolean transformable)
-
isTransformable
public boolean isTransformable()
-
setLink
public void setLink(WLink link)
Sets a link.By setting a link, the area behaves like a
WAnchor.By default, no destination link is set.
Note: Even when no destination link is set, in some circumstances, an identity URL ('#') will be linked to on the underlying HTML <area> element (see also
setCursor()).
-
getLink
public WLink getLink()
Returns the link.- See Also:
setLink(WLink link)
-
setAlternateText
public void setAlternateText(java.lang.CharSequence text)
Sets an alternate text.The alternate text should provide a fallback for browsers that do not display an image. If no sensible fallback text can be provided, an empty text is preferred over nonsense.
This should not be confused with
getToolTip()text, which provides additional information that is displayed when the mouse hovers over the area.The default alternate text is an empty text ("").
- See Also:
getAlternateText()
-
getAlternateText
public WString getAlternateText()
Returns the alternate text.- See Also:
setAlternateText(CharSequence text)
-
setToolTip
public void setToolTip(java.lang.CharSequence text)
Sets the tooltip.The tooltip is displayed when the cursor hovers over the area.
-
getToolTip
public WString getToolTip()
Returns the tooltip text.- See Also:
setToolTip(CharSequence text)
-
setStyleClass
public void setStyleClass(java.lang.String styleClass)
Defines a style class.Note: Only few CSS declarations are known to affect the look of a image area, the most notable one being the 'cursor'. Other things will simply be ignored.
-
getStyleClass
public java.lang.String getStyleClass()
Returns the style class.- See Also:
setStyleClass(String styleClass)
-
addStyleClass
public void addStyleClass(java.lang.String styleClass, boolean force)Adds a style class.Note: Only few CSS declarations are known to affect the look of a image area, the most notable one being the 'cursor'. Other things will simply be ignored.
-
addStyleClass
public final void addStyleClass(java.lang.String styleClass)
Adds a style class.
-
removeStyleClass
public void removeStyleClass(java.lang.String styleClass, boolean force)Removes a style class.
-
removeStyleClass
public final void removeStyleClass(java.lang.String styleClass)
Removes a style class.
-
setCursor
public void setCursor(Cursor cursor)
Sets the cursor.This sets the mouse cursor that is shown when the mouse pointer is over the area. Most browsers only support
Cursor.PointingHand, which is activated by a non-empty ref.
-
setCursor
public void setCursor(java.lang.String cursorImage, Cursor fallback)Sets a custom cursor image URL.The URL should point to a .cur file. For optimal portability, make sure that the .cur file is proparly constructed. A renamed .ico file will not work on Internet Explorer.
-
setCursor
public final void setCursor(java.lang.String cursorImage)
Sets a custom cursor image URL.
-
getCursor
public Cursor getCursor()
Returns the cursor.- See Also:
setCursor(Cursor cursor)
-
keyWentDown
public EventSignal1<WKeyEvent> keyWentDown()
Event signal emitted when a keyboard key is pushed down.The keyWentDown signal is the first signal emitted when a key is pressed (before the
keyPressed()signal). UnlikekeyPressed()however it is also emitted for modifier keys (such as "shift", "control", ...) or keyboard navigation keys that do not have a corresponding character.- See Also:
keyPressed(),keyWentUp()
-
keyPressed
public EventSignal1<WKeyEvent> keyPressed()
Event signal emitted when a "character" was entered.The keyPressed signal is emitted when a key is pressed, and a character is entered. Unlike
keyWentDown(), it is emitted only for key presses that result in a character being entered, and thus not for modifier keys or keyboard navigation keys.- See Also:
keyWentDown()
-
keyWentUp
public EventSignal1<WKeyEvent> keyWentUp()
Event signal emitted when a keyboard key is released.This is the counter-part of the
keyWentDown()event. Every key-down has its corresponding key-up.- See Also:
keyWentDown()
-
enterPressed
public EventSignal enterPressed()
Event signal emitted when enter was pressed.This signal is emitted when the Enter or Return key was pressed.
- See Also:
keyPressed(),Key.Enter
-
escapePressed
public EventSignal escapePressed()
Event signal emitted when escape was pressed.This signal is emitted when the Escape key was pressed.
- See Also:
keyPressed(),Key.Escape
-
clicked
public EventSignal1<WMouseEvent> clicked()
Event signal emitted when a mouse key was clicked on this widget.The event details contains information such as the
WMouseEvent.getButton(), optionalkeyboard modifiers, and mouse coordinates relative to theWMouseEvent.getWidget(), the windowWMouseEvent.getWindow(), or theWMouseEvent.getDocument().Note: When JavaScript is disabled, the event details contain invalid information.
-
doubleClicked
public EventSignal1<WMouseEvent> doubleClicked()
Event signal emitted when a mouse key was double clicked on this widget.The event details contains information such as the
WMouseEvent.getButton(), optionalkeyboard modifiers, and mouse coordinates relative to theWMouseEvent.getWidget(), the windowWMouseEvent.getWindow(), or theWMouseEvent.getDocument().Note: When JavaScript is disabled, the signal will never fire.
-
mouseWentDown
public EventSignal1<WMouseEvent> mouseWentDown()
Event signal emitted when a mouse key was pushed down on this widget.The event details contains information such as the
WMouseEvent.getButton(), optionalkeyboard modifiers, and mouse coordinates relative to theWMouseEvent.getWidget(), the windowWMouseEvent.getWindow(), or theWMouseEvent.getDocument().Note: When JavaScript is disabled, the signal will never fire.
-
mouseWentUp
public EventSignal1<WMouseEvent> mouseWentUp()
Event signal emitted when a mouse key was released on this widget.The event details contains information such as the
WMouseEvent.getButton(), optionalkeyboard modifiers, and mouse coordinates relative to theWMouseEvent.getWidget(), the windowWMouseEvent.getWindow(), or theWMouseEvent.getDocument().Note: When JavaScript is disabled, the signal will never fire.
-
mouseWentOut
public EventSignal1<WMouseEvent> mouseWentOut()
Event signal emitted when the mouse went out of this widget.Note: When JavaScript is disabled, the signal will never fire.
-
mouseWentOver
public EventSignal1<WMouseEvent> mouseWentOver()
Event signal emitted when the mouse entered this widget.Note: When JavaScript is disabled, the signal will never fire.
-
mouseMoved
public EventSignal1<WMouseEvent> mouseMoved()
Event signal emitted when the mouse moved over this widget.Note: When JavaScript is disabled, the signal will never fire.
-
mouseDragged
public EventSignal1<WMouseEvent> mouseDragged()
Event signal emitted when the mouse is dragged over this widget.The mouse event contains information on the button(s) currently pressed. If multiple buttons are currently pressed, only the button with smallest enum value is returned.
Note: When JavaScript is disabled, the signal will never fire.
-
mouseWheel
public EventSignal1<WMouseEvent> mouseWheel()
Event signal emitted when the mouse scroll wheel was used.The event details contains information such as the
wheel delta, optionalkeyboard modifiers, and mouse coordinates relative to theWMouseEvent.getWidget(), the windowWMouseEvent.getWindow(), or theWMouseEvent.getDocument().Note: When JavaScript is disabled, the signal will never fire.
-
setObjectName
public void setObjectName(java.lang.String name)
Description copied from class:WObjectSets an object name.The object name can be used to easily identify a type of object in the DOM, and does not need to be unique. It will usually reflect the widget type or role. The object name is prepended to the auto-generated object
WObject.getId().The default object name is empty.
- Overrides:
setObjectNamein classWObject- Parameters:
name- the object name.
-
updateDom
protected boolean updateDom(DomElement element, boolean all)
-
getUpdateAreaCoordsJS
protected abstract java.lang.String getUpdateAreaCoordsJS()
-
getJsRef
protected java.lang.String getJsRef()
-
-