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

cz.vutbr.web.csskit.fn.GenericLinearGradient 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!
/**
 * GenericLinearGradient.java
 *
 * Created on 17. 5. 2018, 13:10:28 by burgetr
 */
package cz.vutbr.web.csskit.fn;

import java.util.List;

import cz.vutbr.web.css.Term;
import cz.vutbr.web.css.TermAngle;
import cz.vutbr.web.css.TermList;

/**
 * Base class for both the linear and repating-linear gradient implementations.
 * 
 * @author burgetr
 */
public class GenericLinearGradient extends GenericGradient {
    
    private TermAngle angle;
    
    public TermAngle getAngle() {
        return angle;
    }
    
    @Override
    public TermList setValue(List> value) {
        super.setValue(value);
        List>> args = getSeparatedArgs(DEFAULT_ARG_SEP);
        if (args.size() > 1) {
            int firstStop = 0;
            //check for an angle
            List> aarg = args.get(0);
            if (aarg.size() == 1 && (angle = getAngleArg(aarg.get(0))) != null) {
                firstStop = 1;
            } else if ((angle = convertSideOrCorner(aarg)) != null) {
                firstStop = 1;
            }
            //check for stops
            loadColorStops(args, firstStop);
            if (getColorStops() != null)
                setValid(true);
        }
        return this;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy