Package org.eclipse.e4.ui.css.swt.dom
Class WidgetElement
java.lang.Object
org.eclipse.e4.ui.css.core.dom.ElementAdapter
org.eclipse.e4.ui.css.swt.dom.WidgetElement
- All Implemented Interfaces:
CSSStylableElement
,Element
,Node
,NodeList
- Direct Known Subclasses:
ControlElement
,ItemElement
,SWTHTMLElement
CSSStylableElement
implementation which wrap SWT Widget
.-
Field Summary
Fields inherited from class org.eclipse.e4.ui.css.core.dom.ElementAdapter
engine
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
applyStyles
(Widget widget, boolean applyStylesToChildNodes) Convenience method for requesting the CSS engine to re-apply styles to a widget.protected String
Compute attribute SWT style.protected String
Compute local name.protected String
Compute namespaceURI.protected void
Compute static pseudo instances.final String
getAttribute
(String attr) Return the class of the native widget.static String
getCSSClass
(Widget widget) Convenience method for getting the CSS class of a widget.getCSSId()
Return the id of the native widget.Return the inline style of the native widget.static CSSEngine
Convenience method for getting the CSS engine responsible for a widget.static CSSEngine
Convenience method for getting the CSS engine responsible for a widget.static String
Convenience method for getting the CSS ID of a widget.int
protected Widget
final boolean
hasAttribute
(String attr) internalGetAttribute
(String attr) The goal forinternalGetAttribute(String)
is to share the code ofhasAttribute(String)
andgetAttribute(String)
and to keep the performance footprint forhasAttribute(String)
small.item
(int index) void
reset()
Called by the CSS engine upon a CSS theme switch.static void
setCSSClass
(Widget widget, String className) Convenience method for setting the CSS class of a widget.static void
Convenience method for setting the CSS engine responsible for a display.static void
Convenience method for setting the CSS ID of a widget.toString()
Methods inherited from class org.eclipse.e4.ui.css.core.dom.ElementAdapter
addStaticPseudoInstance, appendChild, cloneNode, compareDocumentPosition, copyDefaultStyleDeclarations, dispose, doApplyStyles, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getBaseURI, getDefaultStyleDeclaration, getElement, getElementsByTagName, getElementsByTagNameNS, getFeature, getFirstChild, getLastChild, getNativeWidget, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getPrefix, getPreviousSibling, getSchemaTypeInfo, getStaticPseudoInstances, getStyle, getTagName, getTextContent, getUserData, hasAttributeNS, hasAttributes, hasChildNodes, initialize, insertBefore, isDefaultNamespace, isEqualNode, isPseudoInstanceOf, isSameNode, isStaticPseudoInstance, isSupported, lookupNamespaceURI, lookupPrefix, normalize, onStylesApplied, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, replaceChild, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setDefaultStyleDeclaration, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setNodeValue, setPrefix, setTextContent, setUserData
-
Field Details
-
localName
-
namespaceURI
-
swtStyles
-
-
Constructor Details
-
WidgetElement
-
-
Method Details
-
getCSSClass
Convenience method for getting the CSS class of a widget.- Parameters:
widget
- SWT widget with associated CSS class name- Returns:
- CSS class name
-
getID
Convenience method for getting the CSS ID of a widget.- Parameters:
widget
- SWT widget with associated CSS id- Returns:
- CSS ID
-
setCSSClass
Convenience method for setting the CSS class of a widget.- Parameters:
widget
- SWT widget with associated CSS class nameclassName
- class name to set
-
setID
Convenience method for setting the CSS ID of a widget.- Parameters:
widget
- SWT widget with associated CSS idid
- CSS id to set
-
getEngine
Convenience method for getting the CSS engine responsible for a widget.- Parameters:
widget
- SWT widget which is styled by an engine
-
getEngine
Convenience method for getting the CSS engine responsible for a widget.- Parameters:
display
- SWT display which is styled by an engine
-
applyStyles
Convenience method for requesting the CSS engine to re-apply styles to a widget.- Parameters:
widget
- widget to be restyledapplyStylesToChildNodes
- if true, apply styles to the child nodes
-
setEngine
Convenience method for setting the CSS engine responsible for a display.- Parameters:
display
- SWT display which is styled by an engineengine
- Engine to be associated with the display
-
computeLocalName
Compute local name. -
computeNamespaceURI
Compute namespaceURI. -
computeStaticPseudoInstances
protected void computeStaticPseudoInstances()Compute static pseudo instances. -
computeAttributeSWTStyle
Compute attribute SWT style. -
getAttribute
- Specified by:
getAttribute
in interfaceElement
- Specified by:
getAttribute
in classElementAdapter
-
hasAttribute
- Specified by:
hasAttribute
in interfaceElement
- Overrides:
hasAttribute
in classElementAdapter
-
internalGetAttribute
The goal forinternalGetAttribute(String)
is to share the code ofhasAttribute(String)
andgetAttribute(String)
and to keep the performance footprint forhasAttribute(String)
small. This shall be accomplished by:- The method shall only be a lookup for a supplier, no actual computation shall be made.
- The result of the supplier must hold the requirements of the result
of
getAttribute(String)
. Especially it must not returnnull
. - If the attribute isn't set on the widget, the method must return
null
.
- Parameters:
attr
- the name of the attribute to look for.- Returns:
- a supplier which will return the actual attribute value or
null
if the attribute isn't set for the widget.
-
getLocalName
- Specified by:
getLocalName
in interfaceNode
- Specified by:
getLocalName
in classElementAdapter
-
getNamespaceURI
- Specified by:
getNamespaceURI
in interfaceNode
-
getParentNode
- Specified by:
getParentNode
in interfaceNode
-
getChildNodes
- Specified by:
getChildNodes
in interfaceNode
-
getLength
public int getLength() -
item
-
getWidget
-
getCSSId
Description copied from interface:CSSStylableElement
Return the id of the native widget. This method is used to manage CSS style like this input#MyId{....}.- Specified by:
getCSSId
in interfaceCSSStylableElement
-
getCSSClass
Description copied from interface:CSSStylableElement
Return the class of the native widget. This method is used to manage CSS style like this .blueClass {...}.- Specified by:
getCSSClass
in interfaceCSSStylableElement
-
getCSSStyle
Description copied from interface:CSSStylableElement
Return the inline style of the native widget.- Specified by:
getCSSStyle
in interfaceCSSStylableElement
-
reset
public void reset()Called by the CSS engine upon a CSS theme switch. Implementations should restore the default value so that the new theme can be applied to the application without restart -
toString
-