All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cz.vutbr.web.css.NodeData Maven / Gradle / Ivy

Go to download

jStyleParser is a CSS parser written in Java. It has its own application interface that is designed to allow an efficient CSS processing in Java and mapping the values to the Java data types. It parses CSS 2.1 style sheets into structures that can be efficiently assigned to DOM elements. It is intended be the primary CSS parser for the CSSBox library. While handling errors, it is user agent conforming according to the CSS specification.

There is a newer version: 1.20-p9
Show newest version
package cz.vutbr.web.css;

import java.util.Collection;

/**
 * Wrap of CSS properties defined for element. Enumeration values follows this
 * syntax:
 * 
 * 
  • * UPPERCASE terminal symbols, direct values present in stylesheet, such * as background-color: transparent;
  • * lowercase non-terminal symbols, just information that concrete value * is stored somewhere else
* * @author kapy */ public interface NodeData { /** * Returns property of given name and supposed type. Inherited properties * are included. * * @param * Type of property returned. Let compiler infer returning type * from left part of statement, otherwise return just CSSProperty * @param name * Name of property * @return Value of property of type T or null */ public T getProperty(String name); /** * Returns property of given name and supposed type. Inherited properties * can be avoided * * @param * Type of property returned. Let compiler infer returning type * from left part of statement, otherwise return just CSSProperty * @param name * Name of property * @param includeInherited * Whether to include inherited properties or not * @return Value of property of type T or null */ public T getProperty(String name, boolean includeInherited); /** * Returns value of property of given name as a generic type. Inherited * values can be avoided. * * @param name * Name of property * @param includeInherited * Whether to include inherited properties or not * @return Value of property or null */ public Term getValue(String name, boolean includeInherited); /** * Returns value of property of given name and supposed type. Inherited * values are included. * * @param * Type of value returned * @param clazz * Class of type * @param name * Name of property * @return Value of property of type T or null */ public > T getValue(Class clazz, String name); /** * Returns value of property of given name and supposed type. Inherited * values can be avoided. * * @param * Type of value returned * @param clazz * Class of type * @param name * Name of property * @param includeInherited * Whether to include inherited properties or not * @return Value of property of type T or null */ public > T getValue(Class clazz, String name, boolean includeInherited); /** * Accepts values from parent as its own. null parent is * allowed, than instance is returned unchanged. * * @param parent * Source of inheritance * @return Modified instance * @throws ClassCastException When parent implementation class is not the same */ public NodeData inheritFrom(NodeData parent) throws ClassCastException; /** * Replaces all inherit CSS properties either with values of * parent, or, if not present, with default values of user agent. * * @return Modified property */ public NodeData concretize(); /** * Adds data stored in declaration into current instance * * @param d * Declaration to be added * @return Modified instance * */ public NodeData push(Declaration d); /** * Returns the names of all the that are available in the current node. * * @return the name of the properties. */ public Collection getPropertyNames(); /** * Obtains the source declaration used for the given property. Inherited properties are included. * @param name The property name. * @return the source declaration */ public Declaration getSourceDeclaration(String name); /** * Obtains the source declaration used for the given property. * @param name The property name. * @param includeInherited whether to include the inherited properties. * @return the source declaration */ public Declaration getSourceDeclaration(String name, boolean includeInherited); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy