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

cz.vutbr.web.domassign.decode.BorderSideVariator 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: 4.0.1
Show newest version
/**
 * 
 */
package cz.vutbr.web.domassign.decode;

import java.util.Map;

import cz.vutbr.web.css.CSSProperty;
import cz.vutbr.web.css.Term;
import cz.vutbr.web.css.CSSProperty.BorderColor;
import cz.vutbr.web.css.CSSProperty.BorderStyle;
import cz.vutbr.web.css.CSSProperty.BorderWidth;

/**
 * Variator for border side.
 * Grammar:
 * 
 * [  ||  || <'border-top-color'> ] 
 * | inherit
 * 
* * @author kapy * */ public class BorderSideVariator extends Variator { public static final int COLOR = 0; public static final int STYLE = 1; public static final int WIDTH = 2; public BorderSideVariator(String side) { super(3); names.add("border-" + side + "-color"); types.add(BorderColor.class); names.add("border-" + side + "-style"); types.add(BorderStyle.class); names.add("border-" + side + "-width"); types.add(BorderWidth.class); } @Override protected boolean variant(int v, IntegerRef iteration, Map properties, Map> values) { // we won't use multivalue functionallity int i = iteration.get(); switch (v) { case COLOR: // process color return genericTermIdent(types.get(COLOR), terms.get(i), AVOID_INH, names.get(COLOR), properties) || genericTermColor(terms.get(i), names.get(COLOR), BorderColor.color, properties, values); case STYLE: // process style return genericTermIdent(types.get(STYLE), terms.get(i), AVOID_INH, names.get(STYLE), properties); case WIDTH: // process width return genericTermIdent(types.get(WIDTH), terms.get(i), AVOID_INH, names.get(WIDTH), properties) || genericTermLength(terms.get(i), names.get(WIDTH), BorderWidth.length, ValueRange.DISALLOW_NEGATIVE, properties, values); default: return false; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy