![JAR search and dependency download from the Maven repository](/logo.png)
cz.vutbr.web.domassign.decode.ListStyleVariator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jstyleparser Show documentation
Show all versions of jstyleparser Show documentation
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.domassign.decode;
import java.util.Map;
import cz.vutbr.web.css.CSSProperty;
import cz.vutbr.web.css.Term;
import cz.vutbr.web.css.TermURI;
import cz.vutbr.web.css.CSSProperty.ListStyleImage;
import cz.vutbr.web.css.CSSProperty.ListStylePosition;
import cz.vutbr.web.css.CSSProperty.ListStyleType;
/**
* Variator for list style. Grammar:
*
*
* [ 'list-style-type' || 'list-style-position' || 'list-style-image' ]
* | inherit
*
* @author kapy
*/
public class ListStyleVariator extends Variator {
public static final int TYPE = 0;
public static final int POSITION = 1;
public static final int IMAGE = 2;
/*
* protected String[] names = { "list-style-image", "list-style-type",
* "list-style-position" };
*/
public ListStyleVariator() {
super(3);
names.add("list-style-type");
types.add(ListStyleType.class);
names.add("list-style-position");
types.add(ListStylePosition.class);
names.add("list-style-image");
types.add(ListStyleImage.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 TYPE:
// list style type
return genericTermIdent(ListStyleType.class, terms.get(i),
AVOID_INH, names.get(TYPE), properties);
case POSITION:
// list style position
return genericTermIdent(ListStylePosition.class, terms.get(i),
AVOID_INH, names.get(POSITION), properties);
case IMAGE:
// list style image
return genericTermIdent(types.get(IMAGE), terms.get(i),
AVOID_INH, names.get(IMAGE), properties)
|| genericTerm(TermURI.class, terms.get(i), names
.get(IMAGE), ListStyleImage.uri, ValueRange.ALLOW_ALL,
properties, values);
default:
return false;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy