|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sgx.j2s.html.HTMLUtils
public class HTMLUtils
usefull html utilities
Field Summary | |
---|---|
private static java.lang.String |
CHILDREN_ATTR_NAME
|
private static java.lang.String |
PARENT_ATTR_NAME
|
private static java.lang.String |
STYLE_ATTR_NAME
|
private static java.lang.String |
TAGNAME_ATTR_NAME
|
Constructor Summary | |
---|---|
HTMLUtils()
|
Method Summary | |
---|---|
static void |
addEventListener_(java.lang.Object element,
java.lang.String eventName,
java.lang.Runnable _handler,
java.lang.Object context)
|
static boolean |
addEventListener_simple(java.lang.Object object,
java.lang.String evt,
java.lang.Object func,
boolean capture)
Add an event listener to an object |
static void |
addEventListener(java.lang.Object element,
java.lang.String eventName,
java.lang.Runnable handler)
safe context and compatible way of register events with a runnable handler |
static Element |
createButton(Element parent,
java.lang.String label,
java.lang.Runnable clickHandler)
|
static Element |
createElement(Element parent,
java.lang.String tagname,
java.lang.Object... attrs)
|
static Element |
createElementRec(java.lang.Object obj)
recursively creates markup from js object like shown : |
static Element |
createLabel(Element parent,
java.lang.String text)
|
static HTMLTable |
createTable(java.lang.Object tableObj,
int rowCount,
int columnCount)
|
static java.lang.String |
getAttribute(Element el,
java.lang.String name)
|
static Element |
getChildren(Element parent,
int childindex)
|
static Document |
getDocument()
|
static Navigator |
getNavigator()
|
static boolean |
isBrowserIE()
|
static boolean |
isValidAttribute(java.lang.String name)
|
static Event |
normalizeJsEvent(java.lang.Object e)
Gets an event with all needed properties |
static java.lang.String |
printEvent(Event e)
prints a normalized event |
static void |
printIn(Element parent,
java.lang.String s)
|
static boolean |
removeEventListener(java.lang.Object object,
java.lang.String evt,
java.lang.Object func,
boolean capture)
Removes an event listener |
static boolean |
setAttribute(Element el,
java.lang.String name,
java.lang.Object val)
this is a slow but safe implementation. native setAttribute can throw very native exceptions (event uncacheable by firebug) when attr names are invalid |
static void |
setAttributes(Element el,
java.lang.Object... attrs)
|
static void |
setStyle(Element el,
java.lang.String name,
java.lang.String value)
|
static void |
setStyles(Element el,
java.lang.String... attrs)
you must pass the javascript property name instead the css name. |
static HTMLTableCell |
tableGetCell(Element table,
int row,
int column)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String CHILDREN_ATTR_NAME
private static final java.lang.String PARENT_ATTR_NAME
private static final java.lang.String TAGNAME_ATTR_NAME
private static final java.lang.String STYLE_ATTR_NAME
Constructor Detail |
---|
public HTMLUtils()
Method Detail |
---|
public static boolean isValidAttribute(java.lang.String name)
public static boolean setAttribute(Element el, java.lang.String name, java.lang.Object val)
public static java.lang.String getAttribute(Element el, java.lang.String name)
public static void setAttributes(Element el, java.lang.Object... attrs)
public static Element createElementRec(java.lang.Object obj)
org.sgx.j2s.htmlWidgets.test.HTMLUtilsTest.createElementRecTest()
public static Element createElement(Element parent, java.lang.String tagname, java.lang.Object... attrs)
public static Element getChildren(Element parent, int childindex)
public static HTMLTable createTable(java.lang.Object tableObj, int rowCount, int columnCount)
public static HTMLTableCell tableGetCell(Element table, int row, int column)
public static Element createLabel(Element parent, java.lang.String text)
public static void setStyles(Element el, java.lang.String... attrs)
public static void setStyle(Element el, java.lang.String name, java.lang.String value)
public static Element createButton(Element parent, java.lang.String label, java.lang.Runnable clickHandler)
public static java.lang.String printEvent(Event e)
public static boolean removeEventListener(java.lang.Object object, java.lang.String evt, java.lang.Object func, boolean capture)
object
- evt
- eventfunc
- functioncapture
-
public static void addEventListener_(java.lang.Object element, java.lang.String eventName, java.lang.Runnable _handler, java.lang.Object context)
element
- eventName
- handler,
- you can pass an AbstractRunnable and override AbstractRunnable:getParamCount() method for indicating runnable param count.context
- public static void addEventListener(java.lang.Object element, java.lang.String eventName, java.lang.Runnable handler)
element
- eventName
- handler
- public static boolean addEventListener_simple(java.lang.Object object, java.lang.String evt, java.lang.Object func, boolean capture)
object
- evt
- eventfunc
- functioncapture
-
public static Event normalizeJsEvent(java.lang.Object e)
e
- event
public static Document getDocument()
public static void printIn(Element parent, java.lang.String s)
public static boolean isBrowserIE()
public static Navigator getNavigator()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |