Package javascript.swing
Class JSComponent
- java.lang.Object
-
- javascript.swing.JSComponent
-
- Direct Known Subclasses:
AbstractButton
,Filler
,JSDialog
,JSDropDown
,JSFrame
,JSLabel
,JSPanel
,JSProgressBar
,JSSlider
,JSSpinner
,JSTextField
public class JSComponent extends java.lang.Object
The 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 void
addChildEventListenerByQuery(java.lang.String query, java.lang.String event, def.dom.EventListener listener)
Adds an event listener to a child of the HTML elementvoid
addEventListener(java.lang.String event, def.dom.EventListener listener)
Adds an event listenervoid
appendChild(JSComponent component)
Adds a child to the HTML elementvoid
appendChildInTree(java.lang.String query, JSComponent component)
Adds a child to the HTML elementvoid
appendInBody()
Adds the HTML element to the BODY elementvoid
appendNodeChild(def.dom.Node node)
Adds a child to the HTML elementvoid
appendNodeChildInTree(java.lang.String query, def.dom.Node node)
Adds a child to the HTML elementvoid
clearChildContentByQuery(java.lang.String query)
Clears the text content of a child of the HTML elementvoid
clearContent()
Clears the text content of the HTML elementvoid
cssAddClass(java.lang.String cl)
Adds a CSS class to the class list of the HTML elementdef.dom.DOMTokenList
cssClassList()
Returns the class list of the HTML elementvoid
cssRemoveClass(java.lang.String cl)
Removes a CSS class from the class list of the HTML elementvoid
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)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)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)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)double
getChildCount()
Returns the child count of the HTML elementjava.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)def.dom.CSSStyleDeclaration
getChilStyleByIndex(int index)
Returns the style of a child of the HTML elementdef.dom.CSSStyleDeclaration
getChilStyleByQuery(java.lang.String query)
Returns the style of a child of the HTML elementjava.lang.String
getID()
Returns the ID of the HTML elementjava.lang.String
getProperty(java.lang.String key)
Returns a property of the HTML element (for example value is a property, readonly is an attribute)def.dom.CSSStyleDeclaration
getStyle()
Returns the style of the HTML elementvoid
insertBefore(JSComponent component, java.lang.String query)
insert a child to the HTML element before another childvoid
insertBeforeInTree(java.lang.String queryInTree, JSComponent component, java.lang.String query)
insert a child to the HTML element before another childvoid
insertNodeBefore(def.dom.Node node, java.lang.String query)
insert a child to the HTML element before another childvoid
insertNodeBeforeInTree(java.lang.String queryInTree, def.dom.Node node, java.lang.String query)
insert a child to the HTML element before another child<T> T
invoke(java.lang.String method)
Invokes a method of the HTML element<T> T
invokeInTree(java.lang.String query, java.lang.String method)
Invokes a method of an child of the HTML elementvoid
prependChild(JSComponent component)
Prepends a child to the HTML elementvoid
prependChildInTree(java.lang.String query, JSComponent component)
Prepends a child to the HTML elementvoid
prependNodeChild(def.dom.Node node)
Prepends a child to the HTML elementvoid
prependNodeChildInTree(java.lang.String query, def.dom.Node node)
Prepends a child to the HTML elementvoid
removeAttribute(java.lang.String key)
Removes an attribute of the HTML element (for example value is a property, readonly is an attribute)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)void
removeFromBody()
Removes the HTML element from the BODY elementvoid
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)void
setBackground(Color color)
Clone of javax.swing.JComponent.setBackgroundvoid
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)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)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)void
setContent(java.lang.String content)
Sets the text content of the HTML elementvoid
setEnabled(boolean b)
Clone of javax.swing.JComponent.setEnabledvoid
setID(java.lang.String id)
Sets the ID of the HTML elementvoid
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)
-
-
-
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
-
-