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

cz.vutbr.web.csskit.antlr4.Preparator 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.

The newest version!
package cz.vutbr.web.csskit.antlr4;

import java.util.List;

import cz.vutbr.web.css.CombinedSelector;
import cz.vutbr.web.css.Declaration;
import cz.vutbr.web.css.KeyframeBlock;
import cz.vutbr.web.css.MediaQuery;
import cz.vutbr.web.css.RuleBlock;
import cz.vutbr.web.css.RuleMargin;
import cz.vutbr.web.css.RuleSet;
import cz.vutbr.web.css.Selector;

/**
 * Prepares StyleSheet blocks in parser. Allows switching strategy in runtime,
 * for example modify behavior for embedded, file and inline rules
 * 
 * @author kapy
 *
 */
public interface Preparator {

	/**
	 * Creates base block of rules. Most usually, it will be RuleSet, but when
	 * parser is inside of imported file with medium and wrap condition is {@code true}, then
	 * RuleSet is wrapped by media into RuleMedia 
	 * @param cslist List of CombinedSelector for this rule block
	 * @param dlist List of Declaration for this rule block
	 * @param wrap Wrap condition, it {@code true}, rule set is wrapped into rule media
	 * @param media List of medias used to wrap 
	 * @return Either RuleSet containing selectors and declarations, or RuleMedia, wrapped
	 * version of RuleSet
	 */
	public RuleBlock prepareRuleSet(List cslist,
			List dlist, boolean wrap, List media);
	
	/**
	 * Creates block of rules as result of parsing in-line declaration.
	 * @param dlist List of Declaration
	 * @param pseudos List of pseudo page identifiers
	 * @return RuleSet
	 */
	public RuleBlock prepareInlineRuleSet(List dlist,
			List pseudos);
	
	/**
	 * Creates RuleMedia, block of rules with assigned medias. Uses mark to change priority of rules,
	 * that is priority of this rule is set to mark 
	 * @param rules Rules encapsulated by this RuleMedia
	 * @param media List of media assigned to rule
	 * @return RuleMedia 
	 */
	public RuleBlock prepareRuleMedia(List rules, List media);
	
	/**
	 * Creates RulePage, block of rules associated with specific page 
     * @param declarations List of declarations
     * @param marginRules List of margin rules
     * @param name Name of the page
     * @param pseudo Pseudo-class of the page
	 * @return RulePage
	 */
	public RuleBlock prepareRulePage(List declarations, List marginRules, String name, Selector.PseudoPage pseudo);
	
    /**
     * Creates RuleMargin, block of declarations associated with specific area in the page margin. 
     * @param area The margin area
     * @param declarations List of declarations
     * @return RuleMargin
     */
    public RuleMargin prepareRuleMargin(String area, List declarations);

    /**
     * Creates RuleViewport, block of rules associated with the viewport. 
     * @param decl List of declarations
     * @return RuleViewport
     */
    public RuleBlock prepareRuleViewport(List decl);
    
    /**
     * Creates RuleFontFace, block of rules associated with specific font 
     * @param decl List of declarations
     * @return RuleFontFace
     */
    public RuleBlock prepareRuleFontFace(List decl);
    
    /**
     * Creates RuleKeyframes, block of key frames with assigned name.
     * @param rules Rules encapsulated by this RuleKeyframes
     * @param name Keyframes name
     * @return RuleKeyframes
     */
    public RuleBlock prepareRuleKeyframes(List rules, String name);
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy