Interface CSSEngine

All Known Implementing Classes:
AbstractCSSEngine, AbstractCSSSWTEngineImpl, CSSEngineImpl, CSSSWTEngineImpl

public interface CSSEngine
CSS Engine interface used to parse style sheet and apply styles to something (UI SWT, UI Swing...).
  • Method Details

    • parseStyleSheet

      StyleSheet parseStyleSheet(Reader reader) throws IOException
      Parse style sheet from Reader reader.
      Throws:
      IOException
    • parseStyleSheet

      StyleSheet parseStyleSheet(InputStream stream) throws IOException
      Parse style sheet from InputStream stream.
      Throws:
      IOException
    • parseStyleSheet

      StyleSheet parseStyleSheet(org.w3c.css.sac.InputSource source) throws IOException
      Parse style sheet from InputSource source.
      Throws:
      IOException
    • parseStyleDeclaration

      CSSStyleDeclaration parseStyleDeclaration(String style) throws IOException
      Parse style declaration from String style.
      Throws:
      IOException
    • parseStyleDeclaration

      CSSStyleDeclaration parseStyleDeclaration(Reader reader) throws IOException
      Parse style declaration from Reader reader.
      Throws:
      IOException
    • parseStyleDeclaration

      CSSStyleDeclaration parseStyleDeclaration(InputStream stream) throws IOException
      Parse style declaration from InputStream stream.
      Throws:
      IOException
    • parseStyleDeclaration

      CSSStyleDeclaration parseStyleDeclaration(org.w3c.css.sac.InputSource source) throws IOException
      Parse style declaration from InputSource source.
      Throws:
      IOException
    • parsePropertyValue

      CSSValue parsePropertyValue(String value) throws IOException
      Parse CSSValue from String value.
      Throws:
      IOException
    • parsePropertyValue

      CSSValue parsePropertyValue(InputStream stream) throws IOException
      Parse CSSValue from InputStream stream.
      Throws:
      IOException
    • parsePropertyValue

      CSSValue parsePropertyValue(Reader reader) throws IOException
      Parse CSSValue from Reader reader.
      Throws:
      IOException
    • parsePropertyValue

      CSSValue parsePropertyValue(org.w3c.css.sac.InputSource source) throws IOException
      Parse CSSValue from InputSource source.
      Throws:
      IOException
    • parseSelectors

      org.w3c.css.sac.SelectorList parseSelectors(String text) throws IOException
      Parse Selectors from String value.
      Throws:
      IOException
    • parseSelectors

      org.w3c.css.sac.SelectorList parseSelectors(org.w3c.css.sac.InputSource source) throws IOException
      Parse Selectors from InputSource value.
      Throws:
      IOException
    • parseSelectors

      org.w3c.css.sac.SelectorList parseSelectors(InputStream stream) throws IOException
      Parse Selectors from InputStream.
      Throws:
      IOException
    • parseSelectors

      org.w3c.css.sac.SelectorList parseSelectors(Reader reader) throws IOException
      Parse Selectors from String value.
      Throws:
      IOException
    • matches

      boolean matches(org.w3c.css.sac.Selector selector, Object node, String pseudo)
      Check if the selector matches the object node.
    • applyStyles

      void applyStyles(Object node, boolean applyStylesToChildNodes)
      Apply styles to the Object node (SWT Text,...). If applyStylesToChildNodes is true, apply styles to the child nodes (ex : if node is SWT Composite, styles are applied to the child controls too).
    • applyStyles

      void applyStyles(Object node, boolean applyStylesToChildNodes, boolean computeDefaultStyle)
      Apply styles to the Object node (SWT Text,...). If applyStylesToChildNodes is true, apply styles to the child nodes (ex : if node is SWT Composite, styles are applied to the child controls too). If computeDefaultStyle is true, default style is computed before apply styles.
    • applyStyleDeclaration

      void applyStyleDeclaration(Object node, CSSStyleDeclaration style, String pseudo)
      Apply style declaration to the object node.
    • parseAndApplyStyleDeclaration

      CSSStyleDeclaration parseAndApplyStyleDeclaration(Object node, Reader reader) throws IOException
      Parse and apply style declaration from Reader reader.
      Throws:
      IOException
    • parseAndApplyStyleDeclaration

      CSSStyleDeclaration parseAndApplyStyleDeclaration(Object node, InputStream stream) throws IOException
      Parse and apply style declaration from InputStream stream.
      Throws:
      IOException
    • parseAndApplyStyleDeclaration

      CSSStyleDeclaration parseAndApplyStyleDeclaration(Object node, org.w3c.css.sac.InputSource sourcee) throws IOException
      Parse and apply style declaration from InputSource source.
      Throws:
      IOException
    • parseAndApplyStyleDeclaration

      CSSStyleDeclaration parseAndApplyStyleDeclaration(Object node, String style) throws IOException
      Parse and apply style declaration from String style.
      Throws:
      IOException
    • applyInlineStyle

      void applyInlineStyle(Object node, boolean applyStylesToChildNodes) throws IOException
      Apply inline style of the object node. If applyStylesToChildNodes is true, apply style inline to the child nodes (ex : if node is SWT Composite, styles are applied to the child controls too).
      Throws:
      IOException
    • getErrorHandler

      CSSErrorHandler getErrorHandler()
      Return CSSErrorHandler used to handles exception error.
    • setErrorHandler

      void setErrorHandler(CSSErrorHandler errorHandler)
      Register the CSSErrorHandler used to handles exception error.
    • setResourcesLocatorManager

      void setResourcesLocatorManager(IResourcesLocatorManager resourcesLocatorManager)
      Set the IResourcesLocatorManager to use manage resources.
    • getResourcesLocatorManager

      IResourcesLocatorManager getResourcesLocatorManager()
      Get the IResourcesLocatorManager to use manage resources.
    • getDocumentCSS

      DocumentCSS getDocumentCSS()
      Return the DocumentCSS used to store CSSStyleSheet.
    • getViewCSS

      ViewCSS getViewCSS()
      Return the ViewCSS used to compute CSSStyleDeclaration.
    • getElementProvider

      IElementProvider getElementProvider()
      Get IElementProvider registered used to retrieve w3c Element which wrap native widget.
    • setElementProvider

      void setElementProvider(IElementProvider elementProvider)
      Set IElementProvider registered used to retrieve w3c Element which wrap native widget.
    • applyCSSProperty

      ICSSPropertyHandler applyCSSProperty(Object node, String property, CSSValue value, String pseudo) throws Exception
      Apply CSS property property to the node with value.
      Throws:
      Exception
    • retrieveCSSProperty

      String retrieveCSSProperty(Object node, String property, String pseudo)
      Retrieve String of CSSValue of the CSS property of the node.
    • applyDefaultStyleDeclaration

      void applyDefaultStyleDeclaration(Object node, boolean applyStylesToChildNodes)
      Apply initial style of the object node. If applyStylesToChildNodes is true, apply style inline to the child nodes (ex : if node is SWT Composite, styles are applied to the child controls too).
    • getDefaultStyleDeclaration

      CSSStyleDeclaration getDefaultStyleDeclaration(Object node, String pseudoE)
      Get default CSSStyleDeclaration of the node for pseudo element pseudoE which can be null.
    • dispose

      void dispose()
      Call reset and dispose all resources
    • reset

      void reset()
      Reset 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

      IResourcesRegistry getResourcesRegistry()
      Get the IResourcesRegistry registered used to cache/dispose resources.
    • setResourcesRegistry

      void setResourcesRegistry(IResourcesRegistry resourcesRegistry)
      Register IResourcesRegistry used to cache/dispose resources.
    • registerCSSValueConverter

      void registerCSSValueConverter(ICSSValueConverter converter)
      Register CSSValue converter ICSSValueConverter.
    • unregisterCSSValueConverter

      void unregisterCSSValueConverter(ICSSValueConverter converter)
      Unregister CSSValue converter ICSSValueConverter.
    • getCSSValueConverter

      ICSSValueConverter getCSSValueConverter(Object toType)
      Get CSSValue converter ICSSValueConverter which is enable to convert toType Object.
    • convert

      Object convert(CSSValue value, Object toType, Object context) throws Exception
      Convert CSSValue into Object type of toType. (ex : convert CSSValue color:red into java.awt.Color). If IResourcesRegistry is registered into CSSEngine this method search before into cache of IResourcesRegistry if the Object was already converted.
      Parameters:
      context - can be null. For SWT context is org.eclipse.swt.widgets.Display.
      Throws:
      Exception
    • convert

      String convert(Object value, Object toType, Object context) throws Exception
      Convert Object type of toType into CSSValue String.
      Throws:
      Exception
    • getElement

      Element getElement(Object node)
      Get the w3c Element which wrap Object node.
    • getCSSElementContext

      CSSElementContext getCSSElementContext(Object node)
      Get the CSSElementContext context of the object node.
    • getCSSProperties

      Collection<String> getCSSProperties(Object node)
      Return the set of property names applicable to the provided node.
      Parameters:
      node - the DOM node or an element
      Returns:
      the property names
    • getCSSCompositePropertiesNames

      String[] getCSSCompositePropertiesNames(String property)
      Return array of CSS property name of the CSS property.
    • handleExceptions

      void handleExceptions(Exception e)
      Handle exceptions.
    • reapply

      void reapply()
      Reapply the styles to the objects managed by this engine.
    • handleWidgetDisposed

      default void handleWidgetDisposed(Object widget)
      Handle disposal of a styled widget.
      Parameters:
      widget - The widget that gets disposed.