|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object _global_.jqzk
public class jqzk
Represents the object returned by the zk
function, or by
jq.zk
.
For example, zk('#id');
Refer to jq
for more information.
jq
- the object returned by jq(...)
. The original jQuery API.jq
- DOM utilities (such as, jq.innerX()
Event
- the event object passed to the event listener
Field Summary | |
---|---|
jq |
jq
The associated instance of jq , the object returned by jq(...) |
Method Summary | |
---|---|
void |
$()
A short cut for looking up ZK Widget from jQuery object. |
jqzk |
absolutize()
Makes the position of the first selected element as absolute. |
void |
beforeHideOnUnbind()
Fixes DOM elements when a widget's unbind_ is called and it will hide the DOM element (display="none" or visibility="hidden"). |
int |
borderHeight()
Returns the summation of the border height of the first matched element. |
int |
borderWidth()
Returns the summation of the border width of the first matched element. |
int |
cellIndex()
Retrieves the index of the first selected (table) cell in the cells collection of a (table) row. |
jqzk |
center(Map flags)
Positions the first selected element at the particular location of the browser window. |
jq |
cleanVisibility()
Cleans, i.e., reset, the visibility (of the CSS style) for the matched elements. |
jqzk |
clearStyles()
Clears the CSS styles (excluding the inherited styles). |
Offset |
cmOffset()
Returns the cumulative offset of the first matched element from the top left corner of the document. |
jqzk |
defaultAnimaOpts(Widget wgt,
Map opts,
Array prop,
boolean visible)
Initializes the animation with the default effect, such as firing the onSize watch. |
Array |
detachChildren()
Detaches all child elements and return them as an array. |
Dimension |
dimension(boolean revised)
Returns the dimension of the specified element. |
jqzk |
disableSelection()
Disallows the user to select a portion of its content. |
jqzk |
enableSelection()
Allows the user to select a portion of its content. |
boolean |
focus(int timeout)
Sets the focus to the first matched element. |
Array |
getSelectionRange()
Returns the selection range of the specified input-type element. |
int |
hasHScroll()
Tests if the first matched DOM element has the horizontal scrollbar |
int |
hasVScroll()
Tests if the first matched DOM element has the vertical scrollbar |
boolean |
isInput()
Tests if all elements are input elements (including textarea). |
boolean |
isOverlapped(DOMElement el)
Tests if the first matched element is overlapped with the specified element. |
boolean |
isRealVisible(boolean strict)
Returns whether the first match element is really visible. |
boolean |
isVisible()
Returns whether the first matched element is visible. |
boolean |
isVisible(boolean strict)
Returns whether the first matched element is visible. |
jqzk |
makeVParent()
Creates a virtual parent for the specified element. |
int |
ncols(boolean visibleOnly)
Returns the number of columns of a row. |
int |
offsetHeight()
Returns the offset height. |
int |
offsetLeft()
Returns the offset left. |
int |
offsetTop()
Returns the offset top. |
int |
offsetWidth()
Returns the offset width. |
int |
padBorderHeight()
Returns the summation of the padding width and the border height of the first matched element. |
int |
padBorderWidth()
Returns the summation of the padding height and the border width of the first matched element. |
int |
paddingHeight()
Returns the summation of the padding height of the first matched element. |
int |
paddingWidth()
Returns the summation of the padding width of the first matched element. |
jqzk |
position(Dimension dim,
String where,
Map opts)
Position the first matched element to the specified location. |
jqzk |
position(DOMElement dim,
String where,
Map opts)
Position the first matched element to the specified location. |
jqzk |
redoCSS(int timeout)
Forces the browser to redo (re-apply) CSS of all matched elements. |
jqzk |
redoSrc()
Forces the browser to re-load the resource specified in the src
attribute for all matched elements. |
jqzk |
relativize()
Makes the position of the element as relative. |
int |
revisedHeight(int size,
boolean excludeMargin)
Returns the revised (calibrated) height, which subtracted the height of its CSS border or padding, for the first matched element. |
Offset |
revisedOffset()
Returns the revised (i.e., browser's coordinate) offset of the selected element. |
Offset |
revisedOffset(Offset ofs)
Converts the specified offset in the element's coordinate to to the browser window's coordinateReturns the revised (calibrated) offset, i.e., the offset of the element related to the screen. |
int |
revisedWidth(int size,
boolean excludeMargin)
Returns the revised (calibrated) width, which subtracted the width of its CSS border or padding, for the first matched element. |
jqzk |
scrollIntoView(DOMElement parent)
Causes the first matched element to scroll into view. |
Offset |
scrollOffset()
Calculates the cumulative scroll offset of the first matched element in nested scrolling containers. |
jqzk |
scrollTo()
Scrolls the browser window to make the first matched element visible. |
boolean |
select(int timeout)
Selects the first matched element. |
jqzk |
setOffsetHeight(int hgh)
Sets the offset height by specifying the inner height. |
jqzk |
setSelectionRange(int start,
int end)
Sets the selection range of the specified input-type element. |
jqzk |
setStyles()
Deprecated. As of release 5.0.2, use jq.css(map) instead |
jqzk |
slideDown(Widget wgt,
Map opts)
Slides down (show) of the matched DOM element(s). |
jqzk |
slideIn(Widget wgt,
Map opts)
Slides in (show) of the matched DOM element(s). |
jqzk |
slideOut(Widget wgt,
Map opts)
Slides out (hide) of the matched DOM element(s). |
jqzk |
slideUp(Widget wgt,
Map opts)
Slides up (hide) of the matched DOM element(s). |
jqzk |
submit()
Submit the selected form. |
int |
sumStyles(String areas,
Array styles)
Returns the summation of the specified styles. |
Size |
textSize(String text)
Returns the size of the text if it is placed inside the first matched element. |
Offset |
toStyleOffset(int x,
int y)
Converts an offset (x,y) from absolute coordination to the element's style coordination, such that you can assign them to the style (el.style). |
jqzk |
undoVParent()
Undoes the creation of a virtual parent of the first matched element. |
int |
vflexHeight()
Returns the maximal allowed height of the first matched element. |
Offset |
viewportOffset()
Returns the X/Y coordinates of the first matched element relative to the viewport. |
DOMElement |
vparentNode(boolean real)
Returns the virtual parent of the first matched element. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public jq jq
jq
, the object returned by jq(...)
.
Method Detail |
---|
public jq cleanVisibility()
public boolean isVisible(boolean strict)
strict
- whether the visibility property must not be hidden, too.
If false, only the style.display property is tested.
If true, both the style.display and style.visibility properties are tested.
public boolean isVisible()
public boolean isRealVisible(boolean strict)
strict
- whether the visibility property must not be hidden, too.
If false, only the style.display property is tested.
If true, both the style.display and style.visibility properties are tested.
public jqzk scrollTo()
Notice that it scrolls only the browser window. If the element is obscured by another element, it is still not visible. To really make it visible, use el.scrollIntoView() instead.
public jqzk scrollIntoView(DOMElement parent)
parent
- scrolls the first matched element into the parent's view,
if any. Otherwise, document.body is assumed.
public int hasVScroll()
public int hasHScroll()
public boolean isOverlapped(DOMElement el)
el
- the element to check with
public int sumStyles(String areas, Array styles)
jq(el).zk.sumStyles("lr", jq.paddings);
//sums the style values of jq.paddings['l'] and jq.paddings['r'].
areas
- the areas is abbreviation for left "l", right "r", top "t", and bottom "b". So you can specify to be "lr" or "tb" or more.styles
- an array of styles, such as jq.paddings()
, jq.margins()
or jq.borders()
.
public jqzk setOffsetHeight(int hgh)
hgh
- the height without margin and border
public Offset revisedOffset(Offset ofs)
It is calculated by subtracting the offset of the scrollbar
(scrollOffset()
and jq.innerX()
), for the first matched element.
ofs
- the offset to revise. If not specified, the first matched
element's bounding rectange is assumed.
public Offset revisedOffset()
cmOffset()
public int revisedWidth(int size, boolean excludeMargin)
It is usually used to assign the width to an element (since we have to subtract the padding).
el.style.width = jq(el).zk.revisedWidth(100);
size
- the width to be assigned to the specified element.excludeMargin
- whether to subtract the margins, too.
You rarely need this unless the width is specified in term of the parent's perspective.
public int revisedHeight(int size, boolean excludeMargin)
It is usually used to assign the height to an element (since we have to subtract the padding).
el.style.height = jq(el).zk.revisedHeight(100);
size
- # the height to be assigned to the first matched element.excludeMargin
- whether to subtract the margins, too.
You rarely need this unless the height is specified in term of the parent's perspective.
public int borderWidth()
public int borderHeight()
public int paddingWidth()
public int paddingHeight()
public int padBorderWidth()
public int padBorderHeight()
public int vflexHeight()
public int cellIndex()
Note: The function fixed the problem of IE that cell.cellIndex returns a wrong index if there is a hidden cell in the table.
ncols(boolean)
public int ncols(boolean visibleOnly)
visibleOnly
- whether not count invisible cells
cellIndex()
public Offset toStyleOffset(int x, int y)
x
- the X coordinatey
- the Y coordinate
public jqzk center(Map flags)
jq(el).zk.center('left top');
jq(el).zk.center('left center');
jq(el).zk.center('left'); //not to change the Y coordinate
jq(el).zk.center(); //same as 'center'
flags
- A combination of center, left, right, top and bottom. If omitted, center is assumed.
position(_global_.DOMElement, _global_.String, _global_.Map)
public jqzk position(DOMElement dim, String where, Map opts)
dim
- the element used to get the dimension of the achor location.
(by use of dimension(boolean)
)where
- where to position. Default: overlap
position(Dimension,String,Map)
.opts
- a map of addition options.position(Dimension,String,Map)
.
center(_global_.Map)
public jqzk position(Dimension dim, String where, Map opts)
dim
- the dimension of the anchor locationwhere
- where to position. Default: overlap
opts
- a map of addition options. Allowed values include
center(_global_.Map)
public Offset scrollOffset()
It is used for calculating the scroll offset of an element that is in more than one scroll container (e.g., a draggable in a scrolling container which is itself part of a scrolling document).
Note that all values are returned as numbers only although they are expressed in pixels.
cmOffset()
,
viewportOffset()
,
revisedOffset(_global_.Offset)
public Offset cmOffset()
It actually adds the cumulative offsetLeft and offsetTop of an element and all its parents.
Note that it ignores the scroll offset. If you want the element's coordinate,
use revisedOffset()
instead.
Note that all values are returned as numbers only although they are expressed in pixels.
scrollOffset()
,
viewportOffset()
,
revisedOffset(_global_.Offset)
public void $()
zk.Widget.$(jq("@listbox"))
could be replaced with zk("@listbox").$()
public jqzk absolutize()
relativize()
is called.
zk('abc').absolutize();
relativize()
public jqzk relativize()
absolutize()
.
absolutize()
public int offsetWidth()
public int offsetHeight()
public int offsetTop()
public int offsetLeft()
public Offset viewportOffset()
cmOffset()
,
scrollOffset()
public Size textSize(String text)
text
- the content text
public Dimension dimension(boolean revised)
If revised not specified (i.e., not to calibrate), the left and top are the offsetLeft and offsetTop of the element.
revised
- if revised is true, revisedOffset(_global_.Offset)
will be
used (i.e., the offset is calibrated).
public jqzk redoCSS(int timeout)
Notice that calling this method might introduce some performance penality.
timeout
- number of milliseconds to wait before really re-applying CSS.
100 is assumed if not specified , -1 means re-applying css right now.
public jqzk redoSrc()
src
attribute for all matched elements.
public DOMElement vparentNode(boolean real)
Refer to makeVParent()
for more information.
real
- whether to return DOM element's parentNode if
no virtual parent. In other words, zk(n).vparentNode(true)
is the same as zk(n).vparentNode()||n.parentNode
.
public jqzk makeVParent()
To undo the creation of the virtual parent, use undoVParent()
.
Notice that, due to browser's limitation, creating a virtual parent is still not enough to make an element appear on top of all others in all conditions. For example, it cannot in IE6 if there is a SELECT element underneath. To really solve this, you have to create a so-called stackup, which is actually an IFRAME element. By position the iframe right under the element, you can really want it appear on top.
Refer to jq.newStackup(_global_.DOMElement, _global_.String, _global_.DOMElement)
for more information.
This method actually moves the element to the topmost level in the DOM tree (i.e., as the child of document.body), and then the original parent (the parent before calling this method) becomes the virtual parent, which can be retrieved by vparentNode(boolean)
.
When you implement a widget that appears above others, such as an overlapped window, a menu popup and a dropdown list, you can invoke this method when Widget.bind_(zk.Desktop, zk.Skipper, _global_.Array)
is called. And then, restore it
by calling undoVParent()
when Widget.unbind_(zk.Skipper, _global_.Array)
is called.
public jqzk undoVParent()
Refer to makeVParent()
for more information.
public boolean focus(int timeout)
zk.currentFocus
.In general, it is suggested to use zk(n).focus(), unless n does not belong to any widget.
timeout
- the number of milliseconds to delay before setting the focus. If omitted or negative, the focus is set immediately.
select(int)
public boolean select(int timeout)
timeout
- the number of milliseconds to delay before setting the focus. If omitted or negative, the focus is set immediately.
getSelectionRange()
,
setSelectionRange(int, int)
,
focus(int)
public Array getSelectionRange()
If an exception occurs, [0, 0] is returned.
setSelectionRange(int, int)
,
select(int)
public jqzk setSelectionRange(int start, int end)
start
- the starting index of the selection rangeend
- the ending index of the selection rane (excluding). In other words, the text between start and (end-1) is selected.
public jqzk submit()
public jqzk disableSelection()
If you disable the selection in Widget.bind_(zk.Desktop, zk.Skipper, _global_.Array)
, you shall enable it back in Widget.unbind_(zk.Skipper, _global_.Array)
since this method will register a DOM-level listener for certain browsers.
public jqzk enableSelection()
disableSelection()
.
By default, all elements can be selected (unless disabled with CSS -- which not all browsers support).
public jqzk setStyles()
jq(el).css({width:'100px', paddingTop: "1px", "border-left": "2px"});
jq(el).css(jq.parseStyle(jq.filterTextStle('width:100px;font-size:10pt')));
To parse a style (e.g., 'width:10px;padding:2px') to a map of style names and values, use jq.parseStyle(_global_.String)
.
public jqzk clearStyles()
public Array detachChildren()
DOMElement
that are detached,
or null if no element is selected.public boolean isInput()
public void beforeHideOnUnbind()
For firefox, it has to reset the src attribute of iframe (Bug 3076384)
public jqzk slideDown(Widget wgt, Map opts)
wgt
- the widget that owns the DOM elementopts
- the options. Ignored if not specified.
t
, b
,
l
, and r
. Default: t
.public jqzk slideUp(Widget wgt, Map opts)
wgt
- the widget that owns the DOM elementopts
- the options. Ignored if not specified.
t
, b
,
l
, and r
. Default: t
.public jqzk slideOut(Widget wgt, Map opts)
wgt
- the widget that owns the DOM elementopts
- the options. Ignored if not specified.
t
, b
,
l
, and r
. Default: t
.public jqzk slideIn(Widget wgt, Map opts)
wgt
- the widget that owns the DOM elementopts
- the options. Ignored if not specified.
t
, b
,
l
, and r
. Default: t
.public jqzk defaultAnimaOpts(Widget wgt, Map opts, Array prop, boolean visible)
Example:
zk(n).defaultAnimaOpts(wgt, opts, prop, true).jq.css(css).show().animate(...);
wgt
- the widgetopts
- the options. Ignored if not specified.
It depends on the effect being takenprop
- an array of properties, such ['top', 'left', 'position'].visible
- whether the result of the animation will make
the DOM element visible
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |