com.sencha.gxt.core.client.dom
Class XElement

java.lang.Object
  extended by com.google.gwt.core.client.JavaScriptObject
      extended by com.google.gwt.dom.client.Node
          extended by com.google.gwt.dom.client.Element
              extended by com.google.gwt.user.client.Element
                  extended by com.sencha.gxt.core.client.dom.XElement
Direct Known Subclasses:
FxElement

public class XElement
extends Element

Adds additional features and functionality to the GWT Element class.

XElement's cannot be directly instantiated. New XElements can be created using the static createElement(String) method.


Nested Class Summary
static class XElement.VisMode
          VisMode enumeration.
 
Field Summary
 
Fields inherited from class com.google.gwt.dom.client.Element
DRAGGABLE_AUTO, DRAGGABLE_FALSE, DRAGGABLE_TRUE
 
Fields inherited from class com.google.gwt.dom.client.Node
DOCUMENT_NODE, ELEMENT_NODE, TEXT_NODE
 
Method Summary
 void addClassName(String... classNames)
          Adds the style name to the element.
 void addEventsSunk(int event)
          Adds the event type to the element's sunk events.
static String addUnits(String v, String defaultUnit)
          Tests to see if the value has units, otherwise appends the default (px).
 Point adjustForConstraints(Point p)
          Ensures the element is within the browser viewport.
 void alignTo(Element elem, Style.AnchorAlignment alignment, int[] offsets)
          Aligns the element with another element relative to the specified anchor points.
 void applyStyles(String styles)
          Sets multiple style properties.
static XElement as(Node node)
          Assert that the given Node is an Element and automatically typecast it.
 void center()
          Centers the element in the viewport.
 void center(boolean constrainViewport)
          Centers the element.
 void center(Element container)
          Centers an element.
 XElement child(String selector)
          Selects a single child at any depth below this element based on the passed CSS selector.
 Element childElement(String selector)
          Selects a single child at any depth below this element based on the passed CSS selector.
 void clearOpacity()
          Clears the set opacity correctly.
 void click()
          Generators a native dom click on the element.
 XElement createChild(String html)
          Creates and adds a child using the HTML fragment.
static XElement createElement(String tagName)
          Creates a new element based on the specified HTML tag name.
 void disable()
          Disables the element.
 void disableTextSelection(boolean disable)
          Enables or disables text selection for the element.
 XElement down(String selector)
          Selects a single *direct* child based on the passed CSS selector (the selector should not contain an id).
 void enable()
          Enables the element.
 List<FastMap<Object>> ensureVisible()
          Walks up the DOM and ensures all elements are visible.
 XElement findParent(String selector, int maxDepth)
          Looks at this node and then at parent nodes for a match of the passed simple selector (e.g.
 Element findParentElement(String selector, int maxDepth)
          Looks at this node and then at parent nodes for a match of the passed simple selector (e.g.
 Point getAlignToXY(Element elem, Style.AnchorAlignment alignment, int[] offsets)
          Gets the x,y coordinates to align this element with another element.
 Point getAlignToXY(Element elem, Style.AnchorAlignment alignment, int ox, int oy)
          Gets the x,y coordinates to align this element with another element.
 Point getAnchorXY(Style.Anchor anchor, boolean local)
          Returns the x,y coordinates specified by the anchor position on the element.
 Rectangle getBounds()
          Returns the elements bounds in page coordinates.
 Rectangle getBounds(boolean local)
          Returns the elements bounds in page coordinates.
 Rectangle getBounds(boolean local, boolean adjust)
          Returns the element's bounds in page coordinates.
 int getChildIndex(Element child)
          Returns the index of the child element.
 int getComputedHeight()
          Returns either the offsetHeight or the height of this element based on it's CSS height.
 FastMap<String> getComputedStyle(List<String> props)
          Returns a map of style values mapped by property name.
 String getComputedStyle(String prop)
          Normalizes currentStyle and computedStyle.
 int getComputedWidth()
          Returns either the offsetWidth or the width of this element based on it's CSS width.
 Size getFrameSize()
          Returns the sum width of the padding and borders for all "sides".
 int getFrameWidth(Style.Side... side)
          Returns the sum width of the padding and borders for the passed "sides".
 int getHeight(boolean content)
          Returns the element's height.
 String getId(boolean autoGenId)
          Returns the element's id.
 int getLeft()
          Returns the top Y coordinate.
 int getLeft(boolean local)
          Gets the left X coordinate.
 int getMargins(Style.Side... sides)
          Returns the total margin size of the specified sides.
 Point getOffsetsTo(Element to)
          Returns the offsets between two elements.
 int getPadding(Style.Side... sides)
          Returns the width of the padding(s) for the specified side(s).
 Point getPosition(boolean local)
          Returns the widget's current position.
 Region getRegion()
          Returns the region of the given element.
 int getRight(boolean local)
          Returns the right X coordinate of the element (element X position + element width).
 Scroll getScroll()
          Returns the body elements current scroll position.
 Size getSize()
          Returns the size of the element.
 Size getSize(boolean content)
          Returns the element's size.
 Size getStyleSize()
          Returns the element's size (excluding padding and borders), using style attribute before offsets.
 Size getStyleSize(boolean contentOnly)
          Returns the element's size, using style attribute before offsets.
 Element getSubChild(int depth)
          Returns the element's sub child.
 int getTextWidth()
          Returns the measured width of the element's text.
 int getTop()
          Returns the top Y coordinate.
 int getTop(boolean local)
          Gets the top Y coordinate.
 XElement.VisMode getVisMode()
          Returns the vis mode.
 int getWidth(boolean content)
          Returns the element's width.
 int getX()
          Gets the current X position of the element based on page coordinates.
 Point getXY()
          Gets the current position of the element based on page coordinates.
 int getY()
          Gets the current Y position of the element based on page coordinates.
 int getZIndex()
          Returns the element's z-index.
 boolean hasClassName(String test)
          Checks if the specified class name exists on this element.
 void hide()
          Hides this element.
 int indexOf(Element child)
          Returns the index of the child.
 void insertBefore(Element element)
          Inserts this element before the passed element.
 void insertBefore(NodeList<Element> elements)
          Inserts the elements before this element.
 void insertChild(Element child, int index)
          Inserts an element at the specified index.
 XElement insertFirst(String html)
          Creates and inserts a child element.
 XElement insertHtml(String where, String html)
          Inserts an html fragment into this element
 boolean is(String selector)
          Returns true if this element matches the passed simple selector (e.g.
 boolean isBorderBox()
          Returns true if the element is a border box.
static boolean isBorderBox(Element element)
          Returns true if the passed element has a border box.
 boolean isConnected()
          Returns true if the element is part of the browser's DOM.
 boolean isStyleAttribute(String attr, String value)
          Tests the style for the given value.
 boolean isStyleProperty(Map<String,String> map, boolean matchAll)
          Tests style property values for matches.
 boolean isVisible()
          Returns whether the element is currently visible.
 boolean isVisible(boolean deep)
          Returns whether the element is currently visible.
 Request load(RequestBuilder builder)
          Retrieves the data using the request builder and updates the element's contents.
 void makePositionable()
          Makes an element positionable.
 void makePositionable(boolean absolute)
          Makes an element positionable.
 void mask(String message)
          Puts a mask over this element to disable user interaction.
 void removeChildren()
          Removes all the elements children.
 void removeClassName(String... classNames)
          Removes the style names(s) from the element.
 void repaint()
          Forces the Browser to repaint this element.
 void replaceClassName(String oldClassName, String newClassName, boolean deep)
          Replace one class name with another.
 void restoreVisible(List<FastMap<Object>> list)
          Restores any elements made visible with ensureVisible().
 void scrollIntoView(Element container, boolean hscroll)
          Scrolls the element into view.
 void scrollIntoView(Element container, boolean hscroll, int[] offsets)
          Scrolls the element into view.
 void scrollTo(Style.ScrollDirection side, int value)
          Scrolls this element the specified scroll point.
 NodeList<Element> select(String selector)
          Selects child nodes based on the passed CSS selector (the selector should not contain an id).
 XElement selectNode(String selector)
          Selects a single element.
 void setAttributeNS(String nameSpace, String name, String value)
          Sets the attribute, determined by it names, using the given name space and value.
 void setBorders(boolean show)
          Adds or removes a border.
 void setBounds(int x, int y, int width, int height)
          Sets the element's bounds.
 void setBounds(int x, int y, int width, int height, boolean adjust)
          Sets the element's bounds.
 void setBounds(Rectangle bounds)
          Sets the element's bounds.
 void setBounds(Rectangle bounds, boolean content)
          Sets the element's bounds.
 void setClassName(String cls, boolean add)
          Adds or removes the class name.
 void setDisplayed(boolean display)
          Sets the CSS display property.
 void setHeight(int height)
          Sets the elements height.
 void setHeight(int height, boolean adjust)
          Sets the elements height.
 void setHeight(String height)
          Sets the elements height.
 void setLeft(int left)
          Sets the element's left position directly using CSS style (instead of setX(int)).
 void setLeftTop(int left, int top)
          Quick set left and top adding default units.
 void setMargins(int margin)
          Sets the elements's margin.
 void setMargins(Margins margin)
          Sets the elements's margin.
 void setOpacity(double opacity)
          Cross-browser support for setting opacity.
 void setPadding(Padding padding)
          Sets the elements's padding.
 void setSize(int width, int height)
          Sets the element's size.
 void setSize(int width, int height, boolean adjust)
          Set the size of the element.
 void setSize(Size size)
          Sets the element's size.
 void setTop(int top)
          Sets the element's top position directly using CSS style (instead of setY(int)).
 void setVisibility(boolean visible)
          Sets the elements CSS visibility property.
 void setVisible(boolean visible)
          Sets the visibility of the element using the getVisMode().
 void setVisMode(XElement.VisMode visMode)
          Sets the vis mode (defaults to XElement.VisMode.DISPLAY.
 void setWidth(int width)
          Sets the element's width.
 void setWidth(int width, boolean adjust)
          Sets the elements's width.
 void setWidth(String width)
          Sets the elements width.
 void setX(int x)
          Sets the X position of the element based on page coordinates.
 void setXY(int x, int y)
          Sets the elements position in page coordinates.
 void setXY(Point p)
          Sets the element's position in page coordinates.
 void setY(int y)
          Sets the Y position of the element based on page coordinates.
 void setZIndex(int zIndex)
          Sets the element's z-index.
 void show()
          Shows this element.
 void swapClassName(String oldClassName, String newClassName)
          Replace one class name with another.
 void toggleClassName(String className)
          Toggles the given class name, adding if not already present, removing if present.
 Point translatePoints(Point p)
          Translates the passed page coordinates into left/top css values for this element.
 void unmask()
          Removes a previously applied mask.
 void unwrap(XElement child, Rectangle bounds)
          Unwraps the child element.
 void updateZIndex(int adj)
          Sets the element's z-index using XDOM.getTopZIndex() to ensure it has the highest values.
 Rectangle wrap(Element wrapper)
          Wraps the element with the specified wrapper.
 
Methods inherited from class com.google.gwt.dom.client.Element
addClassName, as, blur, dispatchEvent, focus, getAbsoluteBottom, getAbsoluteLeft, getAbsoluteRight, getAbsoluteTop, getAttribute, getClassName, getClientHeight, getClientWidth, getDir, getDraggable, getElementsByTagName, getFirstChildElement, getId, getInnerHTML, getInnerText, getLang, getNextSiblingElement, getOffsetHeight, getOffsetLeft, getOffsetParent, getOffsetTop, getOffsetWidth, getPropertyBoolean, getPropertyDouble, getPropertyInt, getPropertyJSO, getPropertyObject, getPropertyString, getScrollHeight, getScrollLeft, getScrollTop, getScrollWidth, getString, getStyle, getTabIndex, getTagName, getTitle, hasAttribute, hasTagName, is, is, removeAttribute, removeClassName, replaceClassName, scrollIntoView, setAttribute, setClassName, setDir, setDraggable, setId, setInnerHTML, setInnerText, setLang, setPropertyBoolean, setPropertyDouble, setPropertyInt, setPropertyJSO, setPropertyObject, setPropertyString, setScrollLeft, setScrollTop, setTabIndex, setTitle
 
Methods inherited from class com.google.gwt.dom.client.Node
appendChild, cloneNode, getChild, getChildCount, getChildNodes, getFirstChild, getLastChild, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentElement, getParentNode, getPreviousSibling, hasChildNodes, hasParentElement, insertAfter, insertBefore, insertFirst, isOrHasChild, removeChild, removeFromParent, replaceChild, setNodeValue
 
Methods inherited from class com.google.gwt.core.client.JavaScriptObject
cast, createArray, createFunction, createObject, equals, hashCode, toSource, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

addUnits

public static String addUnits(String v,
                              String defaultUnit)
Tests to see if the value has units, otherwise appends the default (px).

Parameters:
v - the value
Returns:
the value with units

as

public static XElement as(Node node)
Assert that the given Node is an Element and automatically typecast it.


createElement

public static final XElement createElement(String tagName)
Creates a new element based on the specified HTML tag name.

Parameters:
tagName - the element tag name
Returns:
the new element

isBorderBox

public static boolean isBorderBox(Element element)
Returns true if the passed element has a border box.

Parameters:
element - the element to test
Returns:
true if the passed element has a border box

addClassName

public final void addClassName(String... classNames)
Adds the style name to the element. Duplicate styles are automatically filtered out.

Parameters:
classNames - the new class names

addEventsSunk

public final void addEventsSunk(int event)
Adds the event type to the element's sunk events.

Parameters:
event - the events to add

adjustForConstraints

public final Point adjustForConstraints(Point p)
Ensures the element is within the browser viewport.

Parameters:
p - the target destination
Returns:
the new location

alignTo

public final void alignTo(Element elem,
                          Style.AnchorAlignment alignment,
                          int[] offsets)
Aligns the element with another element relative to the specified anchor points.

Parameters:
elem - the element to align to
alignment - the position to align to
offsets - the offsets or null

applyStyles

public final void applyStyles(String styles)
Sets multiple style properties. Style attribute names must be in lower camel case, e.g. "backgroundColor:white; color:red;"

Parameters:
styles - a style specification string

center

public final void center()
Centers the element in the viewport.


center

public final void center(boolean constrainViewport)
Centers the element.

Parameters:
constrainViewport - true to constrain the element position to the viewport.

center

public final void center(Element container)
Centers an element.

Parameters:
container - the container element

child

public final XElement child(String selector)
Selects a single child at any depth below this element based on the passed CSS selector.

Parameters:
selector - the css selector
Returns:
the child element

childElement

public final Element childElement(String selector)
Selects a single child at any depth below this element based on the passed CSS selector.

Parameters:
selector - the css selector
Returns:
the child element

clearOpacity

public final void clearOpacity()
Clears the set opacity correctly. This is mostly needed only on IE.


click

public final void click()
Generators a native dom click on the element.


createChild

public final XElement createChild(String html)
Creates and adds a child using the HTML fragment.

Parameters:
html - the html fragment
Returns:
the new child

disable

public final void disable()
Disables the element.


disableTextSelection

public final void disableTextSelection(boolean disable)
Enables or disables text selection for the element. A circular reference will be created when disabling text selection. Disabling should be cleared when the element is detached. See the Component source for an example.

Parameters:
disable - true to disable, false to enable

down

public final XElement down(String selector)
Selects a single *direct* child based on the passed CSS selector (the selector should not contain an id).

Parameters:
selector - the CSS selector
Returns:
the child element

enable

public final void enable()
Enables the element.


ensureVisible

public final List<FastMap<Object>> ensureVisible()
Walks up the DOM and ensures all elements are visible. Useful when trying to calculate offsets or page coordinates.

Returns:
list of meta data, see restoreVisible(List)

findParent

public final XElement findParent(String selector,
                                 int maxDepth)
Looks at this node and then at parent nodes for a match of the passed simple selector (e.g. div.some-class or span:first-child).

Parameters:
selector - the simple selector to test
Returns:
the matching element

findParentElement

public final Element findParentElement(String selector,
                                       int maxDepth)
Looks at this node and then at parent nodes for a match of the passed simple selector (e.g. div.some-class or span:first-child).

Parameters:
selector - the simple selector to test
maxDepth - the max depth
Returns:
the matching element

getAlignToXY

public final Point getAlignToXY(Element elem,
                                Style.AnchorAlignment alignment,
                                int ox,
                                int oy)
Gets the x,y coordinates to align this element with another element.

Parameters:
elem - the element to align to
alignment - the alignment
ox - x offset
oy - y offset
Returns:
the point

getAlignToXY

public final Point getAlignToXY(Element elem,
                                Style.AnchorAlignment alignment,
                                int[] offsets)
Gets the x,y coordinates to align this element with another element.

Parameters:
elem - the element to align to
alignment - the alignment
offsets - an array of x and y offsets (may be be null for 0, 0)
Returns:
the point

getAnchorXY

public final Point getAnchorXY(Style.Anchor anchor,
                               boolean local)
Returns the x,y coordinates specified by the anchor position on the element.

Parameters:
anchor - the specified anchor position (defaults to "c"). See alignTo(com.google.gwt.dom.client.Element, com.sencha.gxt.core.client.Style.AnchorAlignment, int[]) for details on supported anchor positions.
local - true to get the local (element top/left-relative) anchor position instead of page coordinates
Returns:
the position

getBounds

public final Rectangle getBounds()
Returns the elements bounds in page coordinates.

Returns:
the bounds

getBounds

public final Rectangle getBounds(boolean local)
Returns the elements bounds in page coordinates.

Parameters:
local - if true the element's left and top are returned instead of page coordinates
Returns:
the bounds

getBounds

public final Rectangle getBounds(boolean local,
                                 boolean adjust)
Returns the element's bounds in page coordinates.

Parameters:
local - if true the element's left and top are returned instead of page coordinates
adjust - if true sizes get adjusted
Returns:
the element's bounds

getChildIndex

public final int getChildIndex(Element child)
Returns the index of the child element.

Returns:
the index

getComputedHeight

public final int getComputedHeight()
Returns either the offsetHeight or the height of this element based on it's CSS height.

Returns:
the height

getComputedStyle

public final FastMap<String> getComputedStyle(List<String> props)
Returns a map of style values mapped by property name.

Parameters:
props - the list of CSS property names
Returns:
the map of property and values

getComputedStyle

public final String getComputedStyle(String prop)
Normalizes currentStyle and computedStyle.

Parameters:
prop - the style attribute whose value is returned.
Returns:
the current value of the style attribute for this element.

getComputedWidth

public final int getComputedWidth()
Returns either the offsetWidth or the width of this element based on it's CSS width.

Returns:
the width

getFrameSize

public final Size getFrameSize()
Returns the sum width of the padding and borders for all "sides". See #getBorderWidth() for more information about the sides.

Returns:
the frame size

getFrameWidth

public final int getFrameWidth(Style.Side... side)
Returns the sum width of the padding and borders for the passed "sides".

Parameters:
side - the sides
Returns:
the width

getHeight

public final int getHeight(boolean content)
Returns the element's height.

Parameters:
content - true to get the height minus borders and padding
Returns:
the element's height

getId

public final String getId(boolean autoGenId)
Returns the element's id.

Parameters:
autoGenId - true to set an id if one does not exist
Returns:
the id

getLeft

public final int getLeft()
Returns the top Y coordinate.

Returns:
the top value

getLeft

public final int getLeft(boolean local)
Gets the left X coordinate.

Parameters:
local - true to get the local css position instead of page coordinate
Returns:
the left value

getMargins

public final int getMargins(Style.Side... sides)
Returns the total margin size of the specified sides.

Parameters:
sides - the sides from which to calculate the margin. Passing more than one side will yield the sum of the margins of those sides of the element.
Returns:
the sum of the widths of the margins

getOffsetsTo

public final Point getOffsetsTo(Element to)
Returns the offsets between two elements. Both element must be part of the DOM tree and not have display:none to have page coordinates.

Parameters:
to - the to element
Returns:
the xy page offsets

getPadding

public final int getPadding(Style.Side... sides)
Returns the width of the padding(s) for the specified side(s).

Parameters:
sides - the sides from which to calculate the padding. Passing more than one side will yield the sum of the padding of those sides of the element.
Returns:
the sum of the widths of the padding

getPosition

public final Point getPosition(boolean local)
Returns the widget's current position. The widget must be attached to return page coordinates.

Parameters:
local - true to return the element's left and top rather than page coordinates
Returns:
the position

getRegion

public final Region getRegion()
Returns the region of the given element. The element must be part of the DOM tree to have a region.

Returns:
a region containing top, left, bottom, right

getRight

public final int getRight(boolean local)
Returns the right X coordinate of the element (element X position + element width).

Parameters:
local - true to get the local css position instead of page coordinate
Returns:
the right value

getScroll

public final Scroll getScroll()
Returns the body elements current scroll position.

Returns:
the scroll position

getSize

public final Size getSize()
Returns the size of the element.

Returns:
the size

getSize

public final Size getSize(boolean content)
Returns the element's size.

Parameters:
content - true to get the size minus borders and padding
Returns:
the size

getStyleSize

public final Size getStyleSize()
Returns the element's size (excluding padding and borders), using style attribute before offsets.

Returns:
the size

getStyleSize

public final Size getStyleSize(boolean contentOnly)
Returns the element's size, using style attribute before offsets.

Parameters:
contentOnly - true to exclude padding and borders
Returns:
the size

getSubChild

public final Element getSubChild(int depth)
Returns the element's sub child.

Parameters:
depth - the child node depth
Returns:
the child element

getTextWidth

public final int getTextWidth()
Returns the measured width of the element's text.

Returns:
the width

getTop

public final int getTop()
Returns the top Y coordinate.

Returns:
the top value

getTop

public final int getTop(boolean local)
Gets the top Y coordinate.

Parameters:
local - true to get the local css position instead of page coordinate
Returns:
the top value

getVisMode

public final XElement.VisMode getVisMode()
Returns the vis mode.

Returns:
the vis mode

getWidth

public final int getWidth(boolean content)
Returns the element's width.

Parameters:
content - true to get the width minus borders and padding
Returns:
the width

getX

public final int getX()
Gets the current X position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates.

Returns:
the x position of the element

getXY

public final Point getXY()
Gets the current position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates.

Returns:
the location

getY

public final int getY()
Gets the current Y position of the element based on page coordinates.

Returns:
the y position of the element

getZIndex

public final int getZIndex()
Returns the element's z-index.

Returns:
the z-index

hasClassName

public final boolean hasClassName(String test)
Checks if the specified class name exists on this element.

Parameters:
test - the test class name
Returns:
true if the class name is present, else false

hide

public final void hide()
Hides this element.


indexOf

public final int indexOf(Element child)
Returns the index of the child.

Parameters:
child - the child
Returns:
the index or -1 of not a child

insertBefore

public final void insertBefore(Element element)
Inserts this element before the passed element.

Parameters:
element - the element to insert before

insertBefore

public final void insertBefore(NodeList<Element> elements)
Inserts the elements before this element.

Parameters:
elements - the elements to insert

insertChild

public final void insertChild(Element child,
                              int index)
Inserts an element at the specified index.

Parameters:
child - the child element
index - the insert location

insertFirst

public final XElement insertFirst(String html)
Creates and inserts a child element.

Parameters:
html - the HTML fragment
Returns:
the new child

insertHtml

public final XElement insertHtml(String where,
                                 String html)
Inserts an html fragment into this element

Parameters:
where - where to insert the html in relation to el - beforeBegin, afterBegin, beforeEnd, afterEnd.
html - the HTML fragment
Returns:
the inserted node (or nearest related if more than 1 inserted)

is

public final boolean is(String selector)
Returns true if this element matches the passed simple selector (e.g. div.some-class or span:first-child).

Parameters:
selector - selector
Returns:
true if the element matches the selector, else false

isBorderBox

public final boolean isBorderBox()
Returns true if the element is a border box.

Returns:
true for border box

isConnected

public final boolean isConnected()
Returns true if the element is part of the browser's DOM.

Returns:
the connected state

isStyleAttribute

public final boolean isStyleAttribute(String attr,
                                      String value)
Tests the style for the given value.

Parameters:
attr - the style name
value - the test value
Returns:
true if equal

isStyleProperty

public final boolean isStyleProperty(Map<String,String> map,
                                     boolean matchAll)
Tests style property values for matches.

Parameters:
map - the map of style property names and values
matchAll - true to match all properties
Returns:
true if a match is found, otherwise false

isVisible

public final boolean isVisible()
Returns whether the element is currently visible.

Returns:
true if visible

isVisible

public final boolean isVisible(boolean deep)
Returns whether the element is currently visible.

Parameters:
deep - true to deep test
Returns:
true if visible

load

public final Request load(RequestBuilder builder)
Retrieves the data using the request builder and updates the element's contents.

This method is subject to change.

Parameters:
builder - the request builder

makePositionable

public final void makePositionable()
Makes an element positionable.


makePositionable

public final void makePositionable(boolean absolute)
Makes an element positionable.

Parameters:
absolute - true to position absolutely

mask

public final void mask(String message)
Puts a mask over this element to disable user interaction.

Parameters:
message - a message to display in the mask

removeChildren

public final void removeChildren()
Removes all the elements children.


removeClassName

public final void removeClassName(String... classNames)
Removes the style names(s) from the element.

Parameters:
classNames - the style names

repaint

public final void repaint()
Forces the Browser to repaint this element.


replaceClassName

public final void replaceClassName(String oldClassName,
                                   String newClassName,
                                   boolean deep)
Replace one class name with another.

Parameters:
oldClassName - the class name to be replaced
newClassName - the class name to replace it
deep - true to class names on child elements

restoreVisible

public final void restoreVisible(List<FastMap<Object>> list)
Restores any elements made visible with ensureVisible().

Parameters:
list - the meta data list

scrollIntoView

public final void scrollIntoView(Element container,
                                 boolean hscroll)
Scrolls the element into view.

Parameters:
container - the container element
hscroll - false to disable horizontal scrolling.

scrollIntoView

public final void scrollIntoView(Element container,
                                 boolean hscroll,
                                 int[] offsets)
Scrolls the element into view.

Parameters:
container - the container element
hscroll - false to disable horizontal scrolling.
offsets - the offsets

scrollTo

public final void scrollTo(Style.ScrollDirection side,
                           int value)
Scrolls this element the specified scroll point.

Parameters:
side - the scroll direction
value - the new scroll value

select

public final NodeList<Element> select(String selector)
Selects child nodes based on the passed CSS selector (the selector should not contain an id).

Parameters:
selector - the selector/xpath query
Returns:
the matching elements

selectNode

public final XElement selectNode(String selector)
Selects a single element.

Parameters:
selector - the CSS selector
Returns:
the matching element or null if no match

setAttributeNS

public final void setAttributeNS(String nameSpace,
                                 String name,
                                 String value)
Sets the attribute, determined by it names, using the given name space and value.

Parameters:
nameSpace - the name space of the attribute
name - the attribute name
value - the value of the attribute

setBorders

public final void setBorders(boolean show)
Adds or removes a border.

Parameters:
show - the show state

setBounds

public final void setBounds(int x,
                            int y,
                            int width,
                            int height)
Sets the element's bounds.

Parameters:
x - the x coordinate
y - the y coordinate
width - the new width
height - the new height

setBounds

public final void setBounds(int x,
                            int y,
                            int width,
                            int height,
                            boolean adjust)
Sets the element's bounds.

Parameters:
x - the x coordinate
y - the y coordinate
width - the new width
height - the new height
adjust - true to adjust for box model issues

setBounds

public final void setBounds(Rectangle bounds)
Sets the element's bounds.

Parameters:
bounds - the new bounds

setBounds

public final void setBounds(Rectangle bounds,
                            boolean content)
Sets the element's bounds.

Parameters:
bounds - the new bounds
content - true to adjust for box model issues

setClassName

public final void setClassName(String cls,
                               boolean add)
Adds or removes the class name.

Parameters:
cls - the style name
add - true to add, false to remove

setDisplayed

public final void setDisplayed(boolean display)
Sets the CSS display property.

Parameters:
display - true to display the element using its default display

setHeight

public final void setHeight(int height)
Sets the elements height.

Parameters:
height - the height

setHeight

public final void setHeight(int height,
                            boolean adjust)
Sets the elements height.

Parameters:
height - the height
adjust - true to adjust for box model issues

setHeight

public final void setHeight(String height)
Sets the elements height.

Parameters:
height - the height

setLeft

public final void setLeft(int left)
Sets the element's left position directly using CSS style (instead of setX(int)).

Parameters:
left - the left value in pixels

setLeftTop

public final void setLeftTop(int left,
                             int top)
Quick set left and top adding default units.

Parameters:
left - the left value
top - the top value

setMargins

public final void setMargins(int margin)
Sets the elements's margin.

Parameters:
margin - the margin

setMargins

public final void setMargins(Margins margin)
Sets the elements's margin.

Parameters:
margin - the margin

setOpacity

public final void setOpacity(double opacity)
Cross-browser support for setting opacity.

Parameters:
opacity - the opacity

setPadding

public final void setPadding(Padding padding)
Sets the elements's padding.

Parameters:
padding - the padding

setSize

public final void setSize(int width,
                          int height)
Sets the element's size.

Parameters:
width - the new width
height - the new height

setSize

public final void setSize(int width,
                          int height,
                          boolean adjust)
Set the size of the element.

Parameters:
width - the new width
height - the new height
adjust - true to adjust for box model issues

setSize

public final void setSize(Size size)
Sets the element's size.

Parameters:
size - the size

setTop

public final void setTop(int top)
Sets the element's top position directly using CSS style (instead of setY(int)).

Parameters:
top - the top value in pixels

setVisibility

public final void setVisibility(boolean visible)
Sets the elements CSS visibility property.

Parameters:
visible - true for visible

setVisible

public final void setVisible(boolean visible)
Sets the visibility of the element using the getVisMode().

Parameters:
visible - whether the element is visible

setVisMode

public final void setVisMode(XElement.VisMode visMode)
Sets the vis mode (defaults to XElement.VisMode.DISPLAY.

Parameters:
visMode - the vis mode

setWidth

public final void setWidth(int width)
Sets the element's width.

Parameters:
width - the new width

setWidth

public final void setWidth(int width,
                           boolean adjust)
Sets the elements's width.

Parameters:
width - the new width
adjust - true to adjust for box model issues

setWidth

public final void setWidth(String width)
Sets the elements width.

Parameters:
width - the width

setX

public final void setX(int x)
Sets the X position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates.

Parameters:
x - the x coordinate

setXY

public final void setXY(int x,
                        int y)
Sets the elements position in page coordinates.

Parameters:
x - the x coordinate
y - the y coordinate

setXY

public final void setXY(Point p)
Sets the element's position in page coordinates.

Parameters:
p - the position

setY

public final void setY(int y)
Sets the Y position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates.

Parameters:
y - the y coordinate

setZIndex

public final void setZIndex(int zIndex)
Sets the element's z-index.

Parameters:
zIndex - the z-index value

show

public final void show()
Shows this element.


swapClassName

public final void swapClassName(String oldClassName,
                                String newClassName)
Replace one class name with another.

Parameters:
oldClassName - the class name to be replaced, empty strings allowed
newClassName - the class name to replace it, empty strings allowed

toggleClassName

public final void toggleClassName(String className)
Toggles the given class name, adding if not already present, removing if present.

Parameters:
className - the class name to toggle

translatePoints

public final Point translatePoints(Point p)
Translates the passed page coordinates into left/top css values for this element.

Parameters:
p - the coordinates
Returns:
the translated coordinates

unmask

public final void unmask()
Removes a previously applied mask.


unwrap

public final void unwrap(XElement child,
                         Rectangle bounds)
Unwraps the child element.

Parameters:
bounds - the original bounds

updateZIndex

public final void updateZIndex(int adj)
Sets the element's z-index using XDOM.getTopZIndex() to ensure it has the highest values.

Parameters:
adj - the adjustment to be applied to the z-index value

wrap

public final Rectangle wrap(Element wrapper)
Wraps the element with the specified wrapper. The wrapper will have the same size and position of the element. The original bounds can be used to 'unwrap' the element.

Parameters:
wrapper - the wrapper element
Returns:
the original bounds


Copyright © 2012. All Rights Reserved.