Class AbstractCSSEngine
java.lang.Object
org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine
- All Implemented Interfaces:
CSSEngine
- Direct Known Subclasses:
CSSEngineImpl
Abstract CSS Engine manage style sheet parsing and store the
CSSStyleSheet into DocumentCSS.
To apply styles, call the applyStyles(Object, boolean, boolean)
method. This method check if ICSSPropertyHandler is registered for
apply the CSS property.- Version:
- 1.0.0
- Author:
- Angelo ZERR
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected List<ICSSPropertyHandlerProvider> An ordered list of ICSSPropertyHandlerProvider -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapplyCSSProperty(Object element, String property, CSSValue value, String pseudo) Delegates the handle method.voidapplyDefaultStyleDeclaration(Object element, boolean applyStylesToChildNodes) Apply initial style of the object node.voidapplyDefaultStyleDeclaration(Object element, boolean applyStylesToChildNodes, CSSStyleDeclaration newStyle, String pseudoE) voidapplyInlineStyle(Object node, boolean applyStylesToChildNodes) Apply inline style of the object node.voidapplyStyleDeclaration(Object element, CSSStyleDeclaration style, String pseudo) Apply style declaration to the object node.voidapplyStyles(Object element, boolean applyStylesToChildNodes) Apply styles to the Object node (SWT Text,...).voidapplyStyles(Object element, boolean applyStylesToChildNodes, boolean computeDefaultStyle) Apply styles to the Object node (SWT Text,...).Convert Object type oftoTypeinto CSSValue String.Convert CSSValue into Object type oftoType.voiddispose()Call reset and dispose all resourcesString[]getCSSCompositePropertiesNames(String property) Return array of CSS property name of the CSSproperty.getCSSElementContext(Object element) Get theCSSElementContextcontext of the objectnode.getCSSProperties(Object element) Return the set of property names and handlers for the provided node.protected Collection<ICSSPropertyHandler> getCSSPropertyHandlers(String property) getCSSValueConverter(Object toType) Get CSSValue converterICSSValueConverterwhich is enable to converttoTypeObject.getDefaultStyleDeclaration(Object element, String pseudoE) getDefaultStyleDeclaration(Object widget, CSSStyleDeclaration newStyle, String pseudoE) Return theDocumentCSSused to storeCSSStyleSheet.getElement(Object element) Return the w3c Element linked to the Object element.GetIElementProviderregistered used to retrieve w3cElementwhich wrap native widget.protected Map<Object, CSSElementContext> ReturnCSSErrorHandlerused to handles exception error.getNativeWidget(Object element) Get theIResourcesLocatorManagerto use manage resources.Get theIResourcesRegistryregistered used to cache/dispose resources.protected String[]getStaticPseudoInstances(Element element) Return theViewCSSused to computeCSSStyleDeclaration.voidHandle exceptions thrown while parsing, applying styles.voidhandleWidgetDisposed(Object widget) Called when a widget is disposed.protected voidhookNativeWidget(Object widget) Called when an element context is created for a native widget and registered with this engine.protected booleanAllow the CSS engine to skip particular elements if they are not visible.abstract CSSParserReturn instance of CSS Parser.booleanCheck if theselectormatches the objectnode.protected voidonStylesAppliedToChildNodes(Element element, NodeList nodes) Callback method called when styles applied ofnodeschildren of theelement.parseAndApplyStyleDeclaration(Object node, InputStream stream) Parse and apply style declaration from InputStream stream.parseAndApplyStyleDeclaration(Object node, Reader reader) Parse and apply style declaration from Reader reader.parseAndApplyStyleDeclaration(Object node, String style) Parse and apply style declaration from String style.parseAndApplyStyleDeclaration(Object node, org.w3c.css.sac.InputSource source) Parse and apply style declaration from InputSource source.parsePropertyValue(InputStream stream) Parse CSSValue from InputStream stream.parsePropertyValue(Reader reader) Parse CSSValue from Reader reader.parsePropertyValue(String value) Parse CSSValue from String value.parsePropertyValue(org.w3c.css.sac.InputSource source) Parse CSSValue from InputSource source.org.w3c.css.sac.SelectorListparseSelectors(InputStream stream) Parse Selectors from InputStream.org.w3c.css.sac.SelectorListparseSelectors(Reader reader) Parse Selectors from String value.org.w3c.css.sac.SelectorListparseSelectors(String selector) Parse Selectors from String value.org.w3c.css.sac.SelectorListparseSelectors(org.w3c.css.sac.InputSource source) Parse Selectors from InputSource value.parseStyleDeclaration(InputStream stream) Parse style declaration from InputStream stream.parseStyleDeclaration(Reader reader) Parse style declaration from Reader reader.parseStyleDeclaration(String style) Parse style declaration from String style.parseStyleDeclaration(org.w3c.css.sac.InputSource source) Parse style declaration from InputSource source.parseStyleSheet(InputStream stream) Parse style sheet from InputStream stream.parseStyleSheet(Reader reader) Parse style sheet from Reader reader.parseStyleSheet(org.w3c.css.sac.InputSource source) Parse style sheet from InputSource source.voidregisterCSSPropertyHandlerProvider(ICSSPropertyHandlerProvider handlerProvider) voidregisterCSSValueConverter(ICSSValueConverter converter) Register CSSValue converterICSSValueConverter.voidreset()Reset all style sheet registered into CSS Engine.retrieveCSSProperty(Object element, String property, String pseudo) voidsetElementProvider(IElementProvider elementProvider) SetIElementProviderregistered used to retrieve w3cElementwhich wrap native widget.voidsetErrorHandler(CSSErrorHandler errorHandler) Set the CSS Error Handler to manage exception.protected voidvoidsetResourcesLocatorManager(IResourcesLocatorManager resourcesLocatorManager) Set theIResourcesLocatorManagerto use manage resources.voidsetResourcesRegistry(IResourcesRegistry resourcesRegistry) RegisterIResourcesRegistryused to cache/dispose resources.voidunregisterCSSPropertyHandlerProvider(ICSSPropertyHandlerProvider handlerProvider) voidunregisterCSSValueConverter(ICSSValueConverter converter) Unregister CSSValue converterICSSValueConverter.
-
Field Details
-
computeDefaultStyle
protected boolean computeDefaultStyle -
propertyHandlerProviders
An ordered list of ICSSPropertyHandlerProvider
-
-
Constructor Details
-
AbstractCSSEngine
public AbstractCSSEngine() -
AbstractCSSEngine
-
-
Method Details
-
parseStyleSheet
Description copied from interface:CSSEngineParse style sheet from Reader reader.- Specified by:
parseStyleSheetin interfaceCSSEngine- Throws:
IOException
-
parseStyleSheet
Description copied from interface:CSSEngineParse style sheet from InputStream stream.- Specified by:
parseStyleSheetin interfaceCSSEngine- Throws:
IOException
-
parseStyleSheet
Description copied from interface:CSSEngineParse style sheet from InputSource source.- Specified by:
parseStyleSheetin interfaceCSSEngine- Throws:
IOException
-
parseStyleDeclaration
Description copied from interface:CSSEngineParse style declaration from String style.- Specified by:
parseStyleDeclarationin interfaceCSSEngine- Throws:
IOException
-
parseStyleDeclaration
Description copied from interface:CSSEngineParse style declaration from Reader reader.- Specified by:
parseStyleDeclarationin interfaceCSSEngine- Throws:
IOException
-
parseStyleDeclaration
Description copied from interface:CSSEngineParse style declaration from InputStream stream.- Specified by:
parseStyleDeclarationin interfaceCSSEngine- Throws:
IOException
-
parseStyleDeclaration
public CSSStyleDeclaration parseStyleDeclaration(org.w3c.css.sac.InputSource source) throws IOException Description copied from interface:CSSEngineParse style declaration from InputSource source.- Specified by:
parseStyleDeclarationin interfaceCSSEngine- Throws:
IOException
-
parseSelectors
Description copied from interface:CSSEngineParse Selectors from String value.- Specified by:
parseSelectorsin interfaceCSSEngine- Throws:
IOException
-
parseSelectors
Description copied from interface:CSSEngineParse Selectors from String value.- Specified by:
parseSelectorsin interfaceCSSEngine- Throws:
IOException
-
parseSelectors
Description copied from interface:CSSEngineParse Selectors from InputStream.- Specified by:
parseSelectorsin interfaceCSSEngine- Throws:
IOException
-
parseSelectors
public org.w3c.css.sac.SelectorList parseSelectors(org.w3c.css.sac.InputSource source) throws IOException Description copied from interface:CSSEngineParse Selectors from InputSource value.- Specified by:
parseSelectorsin interfaceCSSEngine- Throws:
IOException
-
parsePropertyValue
Description copied from interface:CSSEngineParse CSSValue from Reader reader.- Specified by:
parsePropertyValuein interfaceCSSEngine- Throws:
IOException
-
parsePropertyValue
Description copied from interface:CSSEngineParse CSSValue from InputStream stream.- Specified by:
parsePropertyValuein interfaceCSSEngine- Throws:
IOException
-
parsePropertyValue
Description copied from interface:CSSEngineParse CSSValue from String value.- Specified by:
parsePropertyValuein interfaceCSSEngine- Throws:
IOException
-
parsePropertyValue
Description copied from interface:CSSEngineParse CSSValue from InputSource source.- Specified by:
parsePropertyValuein interfaceCSSEngine- Throws:
IOException
-
applyStyles
Description copied from interface:CSSEngineApply styles to the Object node (SWT Text,...). IfapplyStylesToChildNodesis true, apply styles to the child nodes (ex : if node is SWT Composite, styles are applied to the child controls too).- Specified by:
applyStylesin interfaceCSSEngine
-
applyStyles
public void applyStyles(Object element, boolean applyStylesToChildNodes, boolean computeDefaultStyle) Description copied from interface:CSSEngineApply styles to the Object node (SWT Text,...). IfapplyStylesToChildNodesis true, apply styles to the child nodes (ex : if node is SWT Composite, styles are applied to the child controls too). IfcomputeDefaultStyleis true, default style is computed before apply styles.- Specified by:
applyStylesin interfaceCSSEngine
-
isVisible
Allow the CSS engine to skip particular elements if they are not visible. Elements need to be restyled when they become visible.- Returns:
- true if the element is visible, false if not visible.
-
getStaticPseudoInstances
-
onStylesAppliedToChildNodes
Callback method called when styles applied ofnodeschildren of theelement. -
applyStyleDeclaration
Description copied from interface:CSSEngineApply style declaration to the object node.- Specified by:
applyStyleDeclarationin interfaceCSSEngine
-
parseAndApplyStyleDeclaration
public CSSStyleDeclaration parseAndApplyStyleDeclaration(Object node, Reader reader) throws IOException Description copied from interface:CSSEngineParse and apply style declaration from Reader reader.- Specified by:
parseAndApplyStyleDeclarationin interfaceCSSEngine- Throws:
IOException
-
parseAndApplyStyleDeclaration
public CSSStyleDeclaration parseAndApplyStyleDeclaration(Object node, InputStream stream) throws IOException Description copied from interface:CSSEngineParse and apply style declaration from InputStream stream.- Specified by:
parseAndApplyStyleDeclarationin interfaceCSSEngine- Throws:
IOException
-
parseAndApplyStyleDeclaration
public CSSStyleDeclaration parseAndApplyStyleDeclaration(Object node, org.w3c.css.sac.InputSource source) throws IOException Description copied from interface:CSSEngineParse and apply style declaration from InputSource source.- Specified by:
parseAndApplyStyleDeclarationin interfaceCSSEngine- Throws:
IOException
-
parseAndApplyStyleDeclaration
public CSSStyleDeclaration parseAndApplyStyleDeclaration(Object node, String style) throws IOException Description copied from interface:CSSEngineParse and apply style declaration from String style.- Specified by:
parseAndApplyStyleDeclarationin interfaceCSSEngine- Throws:
IOException
-
applyInlineStyle
Description copied from interface:CSSEngineApply inline style of the object node. IfapplyStylesToChildNodesis true, apply style inline to the child nodes (ex : if node is SWT Composite, styles are applied to the child controls too).- Specified by:
applyInlineStylein interfaceCSSEngine
-
getDefaultStyleDeclaration
Description copied from interface:CSSEngine- Specified by:
getDefaultStyleDeclarationin interfaceCSSEngine
-
getDefaultStyleDeclaration
public CSSStyleDeclaration getDefaultStyleDeclaration(Object widget, CSSStyleDeclaration newStyle, String pseudoE) -
applyDefaultStyleDeclaration
Description copied from interface:CSSEngineApply initial style of the object node. IfapplyStylesToChildNodesis true, apply style inline to the child nodes (ex : if node is SWT Composite, styles are applied to the child controls too).- Specified by:
applyDefaultStyleDeclarationin interfaceCSSEngine
-
applyDefaultStyleDeclaration
public void applyDefaultStyleDeclaration(Object element, boolean applyStylesToChildNodes, CSSStyleDeclaration newStyle, String pseudoE) -
applyCSSProperty
public ICSSPropertyHandler applyCSSProperty(Object element, String property, CSSValue value, String pseudo) throws Exception Delegates the handle method.- Specified by:
applyCSSPropertyin interfaceCSSEngine- Parameters:
element- may be a widget or a node or some object- Throws:
Exception
-
retrieveCSSProperty
Description copied from interface:CSSEngine- Specified by:
retrieveCSSPropertyin interfaceCSSEngine
-
getCSSCompositePropertiesNames
Description copied from interface:CSSEngineReturn array of CSS property name of the CSSproperty.- Specified by:
getCSSCompositePropertiesNamesin interfaceCSSEngine
-
getCSSPropertyHandlers
- Throws:
Exception
-
getCSSProperties
Return the set of property names and handlers for the provided node.- Specified by:
getCSSPropertiesin interfaceCSSEngine- Parameters:
element- the DOM node or an element- Returns:
- the property names and handlers
-
getElementProvider
Description copied from interface:CSSEngineGetIElementProviderregistered used to retrieve w3cElementwhich wrap native widget.- Specified by:
getElementProviderin interfaceCSSEngine
-
setElementProvider
Description copied from interface:CSSEngineSetIElementProviderregistered used to retrieve w3cElementwhich wrap native widget.- Specified by:
setElementProviderin interfaceCSSEngine
-
getElement
Return the w3c Element linked to the Object element.- Specified by:
getElementin interfaceCSSEngine
-
hookNativeWidget
Called when an element context is created for a native widget and registered with this engine. Subclasses should override and install a listener on the widget that will callhandleWidgetDisposed(Object)when the widget is disposed.The default implementation of this method does nothing.
- Parameters:
widget- the native widget to hook
-
handleWidgetDisposed
Called when a widget is disposed. Removes the element context from the element contexts map and the widgets map. Overriding classes must call the super implementation.- Specified by:
handleWidgetDisposedin interfaceCSSEngine- Parameters:
widget- The widget that gets disposed.
-
getCSSElementContext
Description copied from interface:CSSEngineGet theCSSElementContextcontext of the objectnode.- Specified by:
getCSSElementContextin interfaceCSSEngine
-
getNativeWidget
-
getElementsContext
-
matches
Description copied from interface:CSSEngineCheck if theselectormatches the objectnode. -
handleExceptions
Handle exceptions thrown while parsing, applying styles. By default this method call CSS Error Handler if it is initialized.- Specified by:
handleExceptionsin interfaceCSSEngine
-
getErrorHandler
Description copied from interface:CSSEngineReturnCSSErrorHandlerused to handles exception error.- Specified by:
getErrorHandlerin interfaceCSSEngine
-
setErrorHandler
Set the CSS Error Handler to manage exception.- Specified by:
setErrorHandlerin interfaceCSSEngine
-
getResourcesLocatorManager
Description copied from interface:CSSEngineGet theIResourcesLocatorManagerto use manage resources.- Specified by:
getResourcesLocatorManagerin interfaceCSSEngine
-
setResourcesLocatorManager
Description copied from interface:CSSEngineSet theIResourcesLocatorManagerto use manage resources.- Specified by:
setResourcesLocatorManagerin interfaceCSSEngine
-
getDocumentCSS
Description copied from interface:CSSEngineReturn theDocumentCSSused to storeCSSStyleSheet.- Specified by:
getDocumentCSSin interfaceCSSEngine
-
getViewCSS
Description copied from interface:CSSEngineReturn theViewCSSused to computeCSSStyleDeclaration.- Specified by:
getViewCSSin interfaceCSSEngine
-
dispose
public void dispose()Description copied from interface:CSSEngineCall reset and dispose all resources -
reset
public void reset()Description copied from interface:CSSEngineReset all style sheet registered into CSS Engine. This method must be called if you want parse and apply new StyleSheet and remove the old StyleSheet parsed. -
getResourcesRegistry
Description copied from interface:CSSEngineGet theIResourcesRegistryregistered used to cache/dispose resources.- Specified by:
getResourcesRegistryin interfaceCSSEngine
-
setResourcesRegistry
Description copied from interface:CSSEngineRegisterIResourcesRegistryused to cache/dispose resources.- Specified by:
setResourcesRegistryin interfaceCSSEngine
-
registerCSSPropertyHandlerProvider
-
unregisterCSSPropertyHandlerProvider
-
registerCSSValueConverter
Description copied from interface:CSSEngineRegister CSSValue converterICSSValueConverter.- Specified by:
registerCSSValueConverterin interfaceCSSEngine
-
unregisterCSSValueConverter
Description copied from interface:CSSEngineUnregister CSSValue converterICSSValueConverter.- Specified by:
unregisterCSSValueConverterin interfaceCSSEngine
-
getCSSValueConverter
Description copied from interface:CSSEngineGet CSSValue converterICSSValueConverterwhich is enable to converttoTypeObject.- Specified by:
getCSSValueConverterin interfaceCSSEngine
-
convert
Description copied from interface:CSSEngineConvert CSSValue into Object type oftoType. (ex : convert CSSValue color:red into java.awt.Color). IfIResourcesRegistryis registered intoCSSEnginethis method search before into cache ofIResourcesRegistryif the Object was already converted. -
convert
Description copied from interface:CSSEngineConvert Object type oftoTypeinto CSSValue String. -
makeCSSParser
Return instance of CSS Parser. -
setResourceRegistryKeyFactory
-