Package javascript.swing
Class JSComponent
- java.lang.Object
-
- javascript.swing.JSComponent
-
- Direct Known Subclasses:
AbstractButton,Filler,JSColorPreview,JSDialog,JSDropDown,JSFrame,JSLabel,JSPanel,JSProgressBar,JSSlider,JSSpinner,JSTextField
public class JSComponent extends java.lang.ObjectThe javax.swing.JComponent clone- Author:
- gianpiero.diblasi
-
-
Constructor Summary
Constructors Constructor Description JSComponent(def.dom.HTMLElement element)Creates the object
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChildEventListenerByQuery(java.lang.String query, java.lang.String event, def.dom.EventListener listener)Adds an event listener to a child of the HTML elementvoidaddEventListener(java.lang.String event, def.dom.EventListener listener)Adds an event listenervoidappendChild(JSComponent component)Adds a child to the HTML elementvoidappendChildInTree(java.lang.String query, JSComponent component)Adds a child to the HTML elementvoidappendInBody()Adds the HTML element to the BODY elementvoidappendNodeChild(def.dom.Node node)Adds a child to the HTML elementvoidappendNodeChildInTree(java.lang.String query, def.dom.Node node)Adds a child to the HTML elementvoidclearChildContentByQuery(java.lang.String query)Clears the text content of a child of the HTML elementvoidclearContent()Clears the text content of the HTML elementvoidcssAddClass(java.lang.String cl)Adds a CSS class to the class list of the HTML elementdef.dom.DOMTokenListcssClassList()Returns the class list of the HTML elementvoidcssRemoveClass(java.lang.String cl)Removes a CSS class from the class list of the HTML elementvoidcssToggleClass(java.lang.String cl)Toggles a CSS class in the class list of the HTML element (if the class is set removes it, otherwise adds it)java.lang.StringgetAttribute(java.lang.String key)Returns an attribute of the HTML element (for example value is a property, readonly is an attribute)java.lang.StringgetChildAttributeByIndex(int index, java.lang.String key)Returns an attribute of a child of the HTML element (for example value is a property, readonly is an attribute)java.lang.StringgetChildAttributeByQuery(java.lang.String query, java.lang.String key)Returns an attribute of a child of the HTML element (for example value is a property, readonly is an attribute)doublegetChildCount()Returns the child count of the HTML elementjava.lang.StringgetChildPropertyByQuery(java.lang.String query, java.lang.String key)Returns a property of a child of the HTML element (for example value is a property, readonly is an attribute)def.dom.CSSStyleDeclarationgetChilStyleByIndex(int index)Returns the style of a child of the HTML elementdef.dom.CSSStyleDeclarationgetChilStyleByQuery(java.lang.String query)Returns the style of a child of the HTML elementjava.lang.StringgetID()Returns the ID of the HTML elementjava.lang.StringgetProperty(java.lang.String key)Returns a property of the HTML element (for example value is a property, readonly is an attribute)def.dom.CSSStyleDeclarationgetStyle()Returns the style of the HTML elementvoidinsertBefore(JSComponent component, java.lang.String query)insert a child to the HTML element before another childvoidinsertBeforeInTree(java.lang.String queryInTree, JSComponent component, java.lang.String query)insert a child to the HTML element before another childvoidinsertNodeBefore(def.dom.Node node, java.lang.String query)insert a child to the HTML element before another childvoidinsertNodeBeforeInTree(java.lang.String queryInTree, def.dom.Node node, java.lang.String query)insert a child to the HTML element before another child<T> Tinvoke(java.lang.String method)Invokes a method of the HTML element<T> TinvokeInTree(java.lang.String query, java.lang.String method)Invokes a method of an child of the HTML elementvoidprependChild(JSComponent component)Prepends a child to the HTML elementvoidprependChildInTree(java.lang.String query, JSComponent component)Prepends a child to the HTML elementvoidprependNodeChild(def.dom.Node node)Prepends a child to the HTML elementvoidprependNodeChildInTree(java.lang.String query, def.dom.Node node)Prepends a child to the HTML elementvoidremoveAttribute(java.lang.String key)Removes an attribute of the HTML element (for example value is a property, readonly is an attribute)voidremoveChildAttributeByQuery(java.lang.String query, java.lang.String key)Removes an attribute of a child the HTML element (for example value is a property, readonly is an attribute)voidremoveFromBody()Removes the HTML element from the BODY elementvoidsetAttribute(java.lang.String key, java.lang.String value)Sets an attribute of the HTML element (for example value is a property, readonly is an attribute)voidsetBackground(Color color)Clone of javax.swing.JComponent.setBackgroundvoidsetChildAttributeByIndex(int index, java.lang.String key, java.lang.String value)Sets an attribute of a child of the HTML element (for example value is a property, readonly is an attribute)voidsetChildAttributeByQuery(java.lang.String query, java.lang.String key, java.lang.String value)Sets an attribute of a child of the HTML element (for example value is a property, readonly is an attribute)voidsetChildPropertyByQuery(java.lang.String query, java.lang.String key, java.lang.String value)Sets a property of a child of the HTML element (for example value is a property, readonly is an attribute)voidsetContent(java.lang.String content)Sets the text content of the HTML elementvoidsetEnabled(boolean b)Clone of javax.swing.JComponent.setEnabledvoidsetID(java.lang.String id)Sets the ID of the HTML elementvoidsetProperty(java.lang.String key, java.lang.String value)Sets a property of the HTML element (for example value is a property, readonly is an attribute)
-
-
-
Method Detail
-
setBackground
public void setBackground(Color color)
Clone of javax.swing.JComponent.setBackground- Parameters:
color- The color
-
setEnabled
public void setEnabled(boolean b)
Clone of javax.swing.JComponent.setEnabled- Parameters:
b- true to enable the button, false otherwise
-
invoke
public <T> T invoke(java.lang.String method)
Invokes a method of the HTML element- Type Parameters:
T- The type of the return value- Parameters:
method- The method name (with parenthesis)- Returns:
- The return value of the method
-
invokeInTree
public <T> T invokeInTree(java.lang.String query, java.lang.String method)Invokes a method of an child of the HTML element- Type Parameters:
T- The type of the return value- Parameters:
query- The query selectormethod- The method name (with parenthesis)- Returns:
- The return value of the method
-
setID
public void setID(java.lang.String id)
Sets the ID of the HTML element- Parameters:
id- The ID of the HTML element
-
getID
public java.lang.String getID()
Returns the ID of the HTML element- Returns:
- The ID of the HTML element
-
cssAddClass
public void cssAddClass(java.lang.String cl)
Adds a CSS class to the class list of the HTML element- Parameters:
cl- The class to add
-
cssRemoveClass
public void cssRemoveClass(java.lang.String cl)
Removes a CSS class from the class list of the HTML element- Parameters:
cl- The class to remove
-
cssToggleClass
public void cssToggleClass(java.lang.String cl)
Toggles a CSS class in the class list of the HTML element (if the class is set removes it, otherwise adds it)- Parameters:
cl- The class to toggle
-
cssClassList
public def.dom.DOMTokenList cssClassList()
Returns the class list of the HTML element- Returns:
- The class list of the HTML element
-
getStyle
public def.dom.CSSStyleDeclaration getStyle()
Returns the style of the HTML element- Returns:
- The style of the HTML element
-
setProperty
public void setProperty(java.lang.String key, java.lang.String value)Sets a property of the HTML element (for example value is a property, readonly is an attribute)- Parameters:
key- the property keyvalue- The property value
-
getProperty
public java.lang.String getProperty(java.lang.String key)
Returns a property of the HTML element (for example value is a property, readonly is an attribute)- Parameters:
key- The property key- Returns:
- The property value
-
setAttribute
public void setAttribute(java.lang.String key, java.lang.String value)Sets an attribute of the HTML element (for example value is a property, readonly is an attribute)- Parameters:
key- The attribute keyvalue- The attribute value
-
getAttribute
public java.lang.String getAttribute(java.lang.String key)
Returns an attribute of the HTML element (for example value is a property, readonly is an attribute)- Parameters:
key- The attribute key- Returns:
- The attribute value
-
removeAttribute
public void removeAttribute(java.lang.String key)
Removes an attribute of the HTML element (for example value is a property, readonly is an attribute)- Parameters:
key- The attribute key
-
clearContent
public void clearContent()
Clears the text content of the HTML element
-
setContent
public void setContent(java.lang.String content)
Sets the text content of the HTML element- Parameters:
content- The text content of this component
-
addEventListener
public void addEventListener(java.lang.String event, def.dom.EventListener listener)Adds an event listener- Parameters:
event- The eventlistener- The listener
-
appendInBody
public void appendInBody()
Adds the HTML element to the BODY element
-
removeFromBody
public void removeFromBody()
Removes the HTML element from the BODY element
-
appendChild
public void appendChild(JSComponent component)
Adds a child to the HTML element- Parameters:
component- The child component
-
appendNodeChild
public void appendNodeChild(def.dom.Node node)
Adds a child to the HTML element- Parameters:
node- The node
-
insertBefore
public void insertBefore(JSComponent component, java.lang.String query)
insert a child to the HTML element before another child- Parameters:
component- The child componentquery- The query selector
-
insertNodeBefore
public void insertNodeBefore(def.dom.Node node, java.lang.String query)insert a child to the HTML element before another child- Parameters:
node- The nodequery- The query selector
-
prependChild
public void prependChild(JSComponent component)
Prepends a child to the HTML element- Parameters:
component- The child component
-
prependNodeChild
public void prependNodeChild(def.dom.Node node)
Prepends a child to the HTML element- Parameters:
node- The node
-
appendChildInTree
public void appendChildInTree(java.lang.String query, JSComponent component)Adds a child to the HTML element- Parameters:
query- The query selectorcomponent- The child component
-
appendNodeChildInTree
public void appendNodeChildInTree(java.lang.String query, def.dom.Node node)Adds a child to the HTML element- Parameters:
query- The query selectornode- The node
-
insertBeforeInTree
public void insertBeforeInTree(java.lang.String queryInTree, JSComponent component, java.lang.String query)insert a child to the HTML element before another child- Parameters:
queryInTree- The query selector in treecomponent- The child componentquery- The query selector
-
insertNodeBeforeInTree
public void insertNodeBeforeInTree(java.lang.String queryInTree, def.dom.Node node, java.lang.String query)insert a child to the HTML element before another child- Parameters:
queryInTree- The query selector in treenode- The nodequery- The query selector
-
prependChildInTree
public void prependChildInTree(java.lang.String query, JSComponent component)Prepends a child to the HTML element- Parameters:
query- The query selectorcomponent- The child component
-
prependNodeChildInTree
public void prependNodeChildInTree(java.lang.String query, def.dom.Node node)Prepends a child to the HTML element- Parameters:
query- The query selectornode- The node
-
getChilStyleByIndex
public def.dom.CSSStyleDeclaration getChilStyleByIndex(int index)
Returns the style of a child of the HTML element- Parameters:
index- The child index- Returns:
- The style of a child of the HTML element
-
getChilStyleByQuery
public def.dom.CSSStyleDeclaration getChilStyleByQuery(java.lang.String query)
Returns the style of a child of the HTML element- Parameters:
query- The query selector- Returns:
- The style of a child of the HTML element
-
getChildPropertyByQuery
public java.lang.String getChildPropertyByQuery(java.lang.String query, java.lang.String key)Returns a property of a child of the HTML element (for example value is a property, readonly is an attribute)- Parameters:
query- The query selectorkey- The property key- Returns:
- The property value
-
setChildPropertyByQuery
public void setChildPropertyByQuery(java.lang.String query, java.lang.String key, java.lang.String value)Sets a property of a child of the HTML element (for example value is a property, readonly is an attribute)- Parameters:
query- The query selectorkey- The property keyvalue- The property value
-
setChildAttributeByIndex
public void setChildAttributeByIndex(int index, java.lang.String key, java.lang.String value)Sets an attribute of a child of the HTML element (for example value is a property, readonly is an attribute)- Parameters:
index- The child indexkey- The attribute keyvalue- The attribute value
-
setChildAttributeByQuery
public void setChildAttributeByQuery(java.lang.String query, java.lang.String key, java.lang.String value)Sets an attribute of a child of the HTML element (for example value is a property, readonly is an attribute)- Parameters:
query- The query selectorkey- The attribute keyvalue- The attribute value
-
getChildAttributeByIndex
public java.lang.String getChildAttributeByIndex(int index, java.lang.String key)Returns an attribute of a child of the HTML element (for example value is a property, readonly is an attribute)- Parameters:
index- The child indexkey- The attribute key- Returns:
- The attribute value
-
getChildAttributeByQuery
public java.lang.String getChildAttributeByQuery(java.lang.String query, java.lang.String key)Returns an attribute of a child of the HTML element (for example value is a property, readonly is an attribute)- Parameters:
query- The query selectorkey- The attribute key- Returns:
- The attribute value
-
removeChildAttributeByQuery
public void removeChildAttributeByQuery(java.lang.String query, java.lang.String key)Removes an attribute of a child the HTML element (for example value is a property, readonly is an attribute)- Parameters:
query- The query selectorkey- The attribute key
-
clearChildContentByQuery
public void clearChildContentByQuery(java.lang.String query)
Clears the text content of a child of the HTML element- Parameters:
query- The query selector
-
addChildEventListenerByQuery
public void addChildEventListenerByQuery(java.lang.String query, java.lang.String event, def.dom.EventListener listener)Adds an event listener to a child of the HTML element- Parameters:
query- The query selectorevent- The eventlistener- The listener
-
getChildCount
public double getChildCount()
Returns the child count of the HTML element- Returns:
- The child count of the HTML element
-
-