Package org.xhtmlrenderer.css.parser

Examples of org.xhtmlrenderer.css.parser.CounterData


            _parent = (LayoutContext.CounterContext) _counterContextMap.get(style.getParent());
            if (_parent == null) _parent = new CounterContext();//top-level context, above root element
            //first the explicitly named counters
            List resets = style.getCounterReset();
            if (resets != null) for (Iterator i = resets.iterator(); i.hasNext();) {
                CounterData cd = (CounterData) i.next();
                _parent.resetCounter(cd);
            }

            List increments = style.getCounterIncrement();
            if (increments != null) for (Iterator i = increments.iterator(); i.hasNext();) {
                CounterData cd = (CounterData) i.next();
                if (!_parent.incrementCounter(cd)) {
                    _parent.resetCounter(new CounterData(cd.getName(), 0));
                    _parent.incrementCounter(cd);
                }
            }

            //then the implicit list-item counter
View Full Code Here


        public int getCurrentCounterValue(String name) {
            //only the counters of the parent are in scope
            //_parent is never null for a publicly accessible CounterContext
            Integer value = _parent.getCounter(name);
            if (value == null) {
                _parent.resetCounter(new CounterData(name, 0));
                return 0;
            } else {
                return value.intValue();
            }
        }
View Full Code Here

            //only the counters of the parent are in scope
            //_parent is never null for a publicly accessible CounterContext
            List values = new ArrayList();
            _parent.getCounterValues(name, values);
            if (values.size() == 0) {
                _parent.resetCounter(new CounterData(name, 0));
                values.add(new Integer(0));
            }
            return values;
        }
View Full Code Here

                return Collections.singletonList(new PropertyDeclaration(cssName, value, important, origin));
            } else if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
                if (value.getCssText().equals("none")) {
                    return Collections.singletonList(new PropertyDeclaration(cssName, value, important, origin));
                } else {
                    CounterData data = new CounterData(
                            value.getStringValue(),
                            getDefaultValue());
                   
                    return Collections.singletonList(
                            new PropertyDeclaration(cssName, new PropertyValue(
                                    Collections.singletonList(data)), important, origin));
                }
            }
           
            throw new CSSParseException("The syntax of the " + cssName + " property is invalid", -1);
        } else {
            List result = new ArrayList();
            for (int i = 0; i < values.size(); i++) {
                PropertyValue value = (PropertyValue)values.get(i);
               
                if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
                    String name = value.getStringValue();
                    int cValue = getDefaultValue();
                   
                    if (i < values.size() - 1) {
                        PropertyValue next = (PropertyValue)values.get(i+1);
                        if (next.getPrimitiveType() == CSSPrimitiveValue.CSS_NUMBER) {
                            checkNumberIsInteger(cssName, next);
                           
                            cValue = (int)next.getFloatValue();
                        }
                       
                        i++;
                    }
                    result.add(new CounterData(name, cValue));
                } else {
                    throw new CSSParseException("The syntax of the " + cssName + " property is invalid", -1);
                }
            }
           
View Full Code Here

            _parent = (LayoutContext.CounterContext) _counterContextMap.get(style.getParent());
            if (_parent == null) _parent = new CounterContext();//top-level context, above root element
            //first the explicitly named counters
            List resets = style.getCounterReset();
            if (resets != null) for (Iterator i = resets.iterator(); i.hasNext();) {
                CounterData cd = (CounterData) i.next();
                _parent.resetCounter(cd);
            }

            List increments = style.getCounterIncrement();
            if (increments != null) for (Iterator i = increments.iterator(); i.hasNext();) {
                CounterData cd = (CounterData) i.next();
                if (!_parent.incrementCounter(cd)) {
                    _parent.resetCounter(new CounterData(cd.getName(), 0));
                    _parent.incrementCounter(cd);
                }
            }

            //then the implicit list-item counter
View Full Code Here

        public int getCurrentCounterValue(String name) {
            //only the counters of the parent are in scope
            //_parent is never null for a publicly accessible CounterContext
            Integer value = _parent.getCounter(name);
            if (value == null) {
                _parent.resetCounter(new CounterData(name, 0));
                return 0;
            } else {
                return value.intValue();
            }
        }
View Full Code Here

            //only the counters of the parent are in scope
            //_parent is never null for a publicly accessible CounterContext
            List values = new ArrayList();
            _parent.getCounterValues(name, values);
            if (values.size() == 0) {
                _parent.resetCounter(new CounterData(name, 0));
                values.add(new Integer(0));
            }
            return values;
        }
View Full Code Here

TOP

Related Classes of org.xhtmlrenderer.css.parser.CounterData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.