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
FieldsFields inherited from class org.eclipse.e4.ui.css.core.dom.ElementAdapter
engineFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyStyles(Widget widget, boolean applyStylesToChildNodes) Convenience method for requesting the CSS engine to re-apply styles to a widget.protected StringCompute attribute SWT style.protected StringCompute local name.protected StringCompute namespaceURI.protected voidCompute static pseudo instances.final StringgetAttribute(String attr) Return the class of the native widget.static StringgetCSSClass(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 CSSEngineConvenience method for getting the CSS engine responsible for a widget.static CSSEngineConvenience method for getting the CSS engine responsible for a widget.static StringConvenience method for getting the CSS ID of a widget.intprotected Widgetfinal booleanhasAttribute(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) voidreset()Called by the CSS engine upon a CSS theme switch.static voidsetCSSClass(Widget widget, String className) Convenience method for setting the CSS class of a widget.static voidConvenience method for setting the CSS engine responsible for a display.static voidConvenience 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:
getAttributein interfaceElement- Specified by:
getAttributein classElementAdapter
-
hasAttribute
- Specified by:
hasAttributein interfaceElement- Overrides:
hasAttributein 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
nullif the attribute isn't set for the widget.
-
getLocalName
- Specified by:
getLocalNamein interfaceNode- Specified by:
getLocalNamein classElementAdapter
-
getNamespaceURI
- Specified by:
getNamespaceURIin interfaceNode
-
getParentNode
- Specified by:
getParentNodein interfaceNode
-
getChildNodes
- Specified by:
getChildNodesin interfaceNode
-
getLength
public int getLength() -
item
-
getWidget
-
getCSSId
Description copied from interface:CSSStylableElementReturn the id of the native widget. This method is used to manage CSS style like this input#MyId{....}.- Specified by:
getCSSIdin interfaceCSSStylableElement
-
getCSSClass
Description copied from interface:CSSStylableElementReturn the class of the native widget. This method is used to manage CSS style like this .blueClass {...}.- Specified by:
getCSSClassin interfaceCSSStylableElement
-
getCSSStyle
Description copied from interface:CSSStylableElementReturn the inline style of the native widget.- Specified by:
getCSSStylein 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
-