W3C home > Mailing lists > Public > www-validator-cvs@w3.org > November 2012

2002/css-validator/org/w3c/css/properties/atsc CssDirection.java,NONE,1.1

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Mon, 05 Nov 2012 13:43:20 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1TVMxU-0005Sj-PE@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/properties/atsc
In directory hutz:/tmp/cvs-serv20880/atsc

Added Files:
	CssDirection.java 
Log Message:
direction - fix with @spec links, added css3 and atsc cleanup

--- NEW FILE: CssDirection.java ---
// $Id: CssDirection.java,v 1.1 2012/11/05 13:43:18 ylafon Exp $
// Author: Yves Lafon <ylafon@w3.org>
//
// (c) COPYRIGHT MIT, ERCIM and Keio University, 2011.
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.css.properties.atsc;

import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssTypes;
import org.w3c.css.values.CssValue;

/**
 * @spec http://www.w3.org/TR/2008/REC-CSS2-20080411/visuren.html#propdef-direction
 */
public class CssDirection extends org.w3c.css.properties.css.CssDirection {

    /**
     * Create a new CssDirection
     */
    public CssDirection() {
        value = ltr;
    }

    /**
     * Create a new CssDirection
     *
     * @param expression The expression for this property
     * @throws org.w3c.css.util.InvalidParamException The expression is incorrect
     */
    public CssDirection(ApplContext ac, CssExpression expression,
						boolean check) throws InvalidParamException {

        if (check && expression.getCount() > 1) {
            throw new InvalidParamException("unrecognize", ac);
        }

        CssValue val = expression.getValue();

		// same as CSS2plus a warning
		ac.getFrame().addWarning("atsc", val.toString());

		setByUser();
		if (val.getType() != CssTypes.CSS_IDENT) {
			throw new InvalidParamException("value", expression.getValue(),
					getPropertyName(), ac);
		}
        if (val.equals(inherit)) {
            value = inherit;
        } else if (val.equals(ltr)) {
            value = ltr;
        } else if (val.equals(rtl)) {
            value = rtl;
        } else {
            throw new InvalidParamException("value", expression.getValue(),
                    getPropertyName(), ac);
        }
		expression.next();
    }

    public CssDirection(ApplContext ac, CssExpression expression)
            throws InvalidParamException {
        this(ac, expression, false);
    }

    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */
    public boolean isDefault() {
        return value == ltr;
    }

}
Received on Monday, 5 November 2012 13:43:38 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:53 UTC