Package com.openhtmltopdf.layout.counter
Class CounterContext
- java.lang.Object
-
- com.openhtmltopdf.layout.counter.CounterContext
-
- All Implemented Interfaces:
AbstractCounterContext
public class CounterContext extends java.lang.Object implements AbstractCounterContext
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.Integer>_countersprivate CounterContext_parentThis is different because it needs to work even when the counter- properties cascade and it should also logically be redefined on each level (think list-items within list-items)
-
Constructor Summary
Constructors Modifier Constructor Description privateCounterContext()CounterContext(LayoutContext ctx, CalculatedStyle style, java.lang.Integer startIndex)A CounterContext should really be reflected in the element hierarchy, but CalculatedStyles reflect the ancestor hierarchy just as well and also handles pseudo-elements seamlessly.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.IntegergetCounter(java.lang.String name)private voidgetCounterValues(java.lang.String name, java.util.List<java.lang.Integer> values)intgetCurrentCounterValue(java.lang.String name)java.util.List<java.lang.Integer>getCurrentCounterValues(java.lang.String name)private booleanincrementCounter(CounterData cd)private voidincrementListItemCounter(int increment)private voidresetCounter(CounterData cd)
-
-
-
Field Detail
-
_counters
private final java.util.Map<java.lang.String,java.lang.Integer> _counters
-
_parent
private CounterContext _parent
This is different because it needs to work even when the counter- properties cascade and it should also logically be redefined on each level (think list-items within list-items)
-
-
Constructor Detail
-
CounterContext
public CounterContext(LayoutContext ctx, CalculatedStyle style, java.lang.Integer startIndex)
A CounterContext should really be reflected in the element hierarchy, but CalculatedStyles reflect the ancestor hierarchy just as well and also handles pseudo-elements seamlessly.
-
CounterContext
private CounterContext()
-
-
Method Detail
-
incrementCounter
private boolean incrementCounter(CounterData cd)
- Parameters:
cd-- Returns:
- true if a counter was found and incremented
-
incrementListItemCounter
private void incrementListItemCounter(int increment)
-
resetCounter
private void resetCounter(CounterData cd)
-
getCurrentCounterValue
public int getCurrentCounterValue(java.lang.String name)
- Specified by:
getCurrentCounterValuein interfaceAbstractCounterContext
-
getCounter
private java.lang.Integer getCounter(java.lang.String name)
-
getCurrentCounterValues
public java.util.List<java.lang.Integer> getCurrentCounterValues(java.lang.String name)
- Specified by:
getCurrentCounterValuesin interfaceAbstractCounterContext
-
getCounterValues
private void getCounterValues(java.lang.String name, java.util.List<java.lang.Integer> values)
-
-