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

cz.vutbr.web.css.Declaration 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.css;

import java.net.URL;

/**
 * Basic CSS declaration consisting of list of terms.
 * Implements comparable to allow set declaration with bigger priority,
 * either by its important! flag or by its selector's specificity
 * 
 * @author burgetr
 * @author kapy
 * @author Jan Svercl, VUT Brno, 2008
 */
public interface Declaration extends Rule>, PrettyOutput, Comparable {

    public boolean isImportant();
    
    public void setImportant(boolean important);
    
    /**
     * Obtains the property name.
     * @return The property name (always lowercase)
     */
    public String getProperty();

    /**
     * Sets the property name. Automatically converts the name to lowercase because
     * the CSS property names should be case-insensitive.
     * @param property the property to set
     */
    public void setProperty(String property);
    
    public Source getSource();
    
    public void setSource(Source src);
    
    //==================================================================================================
    
    /**
     * The declaration source information. 
     * @author burgetr
     */
    public static class Source {
        
        private URL url;
        private int line;
        private int position;
        
        public Source(URL url, int line, int position)
        {
            this.url = url;
            this.line = line;
            this.position = position;
        }
        
        public Source(Source other)
        {
            this.url = other.url;
            this.line = other.line;
            this.position = other.position;
        }
        
        public URL getUrl()
        {
            return url;
        }
        
        public void setUrl(URL url)
        {
            this.url = url;
        }
        
        public int getLine()
        {
            return line;
        }
        
        public void setLine(int line)
        {
            this.line = line;
        }
        
        public int getPosition()
        {
            return position;
        }

        public void setPosition(int position)
        {
            this.position = position;
        }

        @Override
        public String toString()
        {
            return ((url == null) ? "" : url.toString()) + ":" + line + ":" + position;
        }
    }
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy