liblayout-0.2.10/ 0000755 0001750 0001750 00000000000 11636454157 012256 5 ustar rene rene liblayout-0.2.10/source/ 0000755 0001750 0001750 00000000000 11305540552 013542 5 ustar rene rene liblayout-0.2.10/source/loader.properties 0000644 0001750 0001750 00000000477 11305540552 017136 0 ustar rene rene org.pentaho.reporting.libraries.resourceloader.factory.type.org.jfree.layouting.input.style.StyleSheet=org.jfree.layouting.input.style.parser.StyleSheetFactory org.pentaho.reporting.libraries.resourceloader.factory.type.org.jfree.layouting.input.style.StyleRule=org.jfree.layouting.input.style.parser.StyleRuleFactory liblayout-0.2.10/source/org/ 0000755 0001750 0001750 00000000000 11305540552 014331 5 ustar rene rene liblayout-0.2.10/source/org/jfree/ 0000755 0001750 0001750 00000000000 11305540552 015424 5 ustar rene rene liblayout-0.2.10/source/org/jfree/layouting/ 0000755 0001750 0001750 00000000000 11305540552 017437 5 ustar rene rene liblayout-0.2.10/source/org/jfree/layouting/layouter/ 0000755 0001750 0001750 00000000000 11305540552 021303 5 ustar rene rene liblayout-0.2.10/source/org/jfree/layouting/layouter/feed/ 0000755 0001750 0001750 00000000000 11305540552 022206 5 ustar rene rene liblayout-0.2.10/source/org/jfree/layouting/layouter/feed/DefaultInputFeed.java 0000644 0001750 0001750 00000042011 11305540552 026237 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: DefaultInputFeed.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.feed; import java.io.IOException; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.State; import org.jfree.layouting.StateException; import org.jfree.layouting.StatefullComponent; import org.jfree.layouting.input.style.PseudoPage; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.DefaultDocumentMetaNode; import org.jfree.layouting.layouter.context.DocumentContext; import org.jfree.layouting.layouter.context.DocumentMetaNode; import org.jfree.layouting.namespace.NamespaceCollection; import org.jfree.layouting.normalizer.content.NormalizationException; import org.jfree.layouting.normalizer.content.Normalizer; import org.jfree.layouting.util.AttributeMap; /** * Creation-Date: 05.12.2005, 18:19:03 * * @author Thomas Morgner */ public class DefaultInputFeed implements InputFeed { public static final int DOCUMENT_STARTING = 0; public static final int META_EXPECTED = 1; public static final int META_PROCESSING = 2; public static final int META_NODE_START = 3; public static final int META_NODE_ATTRIBUTES = 4; public static final int ELEMENT_EXPECTED = 5; public static final int ELEMENT_STARTED = 6; public static final int ELEMENT_ATTRIBUTES = 7; public static final int ELEMENT_CONTENT = 8; public static final int DOCUMENT_FINISHED = 9; private static final String[] STATE_NAMES = new String[]{ "DOCUMENT_STARTING", "META_EXPECTED", "META_PROCESSING", "META_NODE_START", "META_NODE_ATTRIBUTES", "ELEMENT_EXPECTED", "ELEMENT_STARTED", "ELEMENT_ATTRIBUTES", "ELEMENT_CONTENT", "DOCUMENT_FINISHED" }; private static class DefaultInputFeedState implements State { private boolean initialized; private int state; private DocumentMetaNode metaNode; private State normalizerState; private boolean pagebreakEncountered; private int treeDepth; private AttributeMap currentAttributes; private String namespace; private String tagName; private DefaultInputFeedState() { } public int getTreeDepth() { return treeDepth; } public void setTreeDepth(final int treeDepth) { this.treeDepth = treeDepth; } public AttributeMap getCurrentAttributes() { return currentAttributes; } public void setCurrentAttributes(final AttributeMap currentAttributes) { this.currentAttributes = currentAttributes; } public String getNamespace() { return namespace; } public void setNamespace(final String namespace) { this.namespace = namespace; } public String getTagName() { return tagName; } public void setTagName(final String tagName) { this.tagName = tagName; } public boolean isPagebreakEncountered() { return pagebreakEncountered; } public void setPagebreakEncountered(final boolean pagebreakEncountered) { this.pagebreakEncountered = pagebreakEncountered; } public boolean isInitialized() { return initialized; } public void setInitialized(final boolean initialized) { this.initialized = initialized; } public int getState() { return state; } public void setState(final int state) { this.state = state; } public DocumentMetaNode getMetaNode() { return metaNode; } public void setMetaNode(final DocumentMetaNode metaNode) { this.metaNode = metaNode; } public State getNormalizerState() { return normalizerState; } public void setNormalizerState(final State normalizerState) { this.normalizerState = normalizerState; } /** * Creates a restored instance of the saved component. *
* By using this factory-like approach, we gain independence from having to * know the actual implementation. This makes things a lot easier. * * @param layoutProcess the layout process that controls it all * @return the saved state * @throws StateException */ public StatefullComponent restore(final LayoutProcess layoutProcess) throws StateException { final DefaultInputFeed inputFeed = new DefaultInputFeed(layoutProcess, false); inputFeed.initialized = initialized; inputFeed.state = state; inputFeed.metaNode = metaNode; inputFeed.normalizer = (Normalizer) normalizerState.restore(layoutProcess); inputFeed.pagebreakEncountered = pagebreakEncountered; inputFeed.treeDepth = treeDepth; inputFeed.currentAttributes = currentAttributes; inputFeed.namespace = namespace; inputFeed.tagName = tagName; return inputFeed; } } private static boolean [][] validStateTransitions; static { validStateTransitions = new boolean[10][]; // after startDocument we expect metadata... validStateTransitions[DOCUMENT_STARTING] = new boolean[]{ false, true, false, false, false, false, false, false, false, false, false }; // either we get meta-data or the first element validStateTransitions[META_EXPECTED] = new boolean[]{ false, false, true, false, false, false, true, false, false, false }; // we either get more meta-data or proceed to the element processing validStateTransitions[META_PROCESSING] = new boolean[]{ false, false, true, true, false, true, false, false, false, false, false }; // now, either we get attributes or the meta-node is finished validStateTransitions[META_NODE_START] = new boolean[]{ false, false, false, false, true, false, false, false, false, false }; // we expect more attributes or the end of the node validStateTransitions[META_NODE_ATTRIBUTES] = new boolean[]{ false, false, true, false, true, false, false, false, false, false }; validStateTransitions[ELEMENT_EXPECTED] = new boolean[]{ false, false, false, false, false, true, true, false, true, true }; validStateTransitions[ELEMENT_STARTED] = new boolean[]{ false, false, false, false, false, true, true, true, true, true }; validStateTransitions[ELEMENT_ATTRIBUTES] = new boolean[]{ false, false, false, false, false, true, true, true, true, true }; validStateTransitions[ELEMENT_CONTENT] = new boolean[]{ false, false, false, false, false, true, true, false, true, true }; validStateTransitions[DOCUMENT_FINISHED] = new boolean[]{ false, false, false, false, false, false, false, false, false, false }; } private boolean initialized; private int state; // private Stack elements; private LayoutProcess process; private DocumentMetaNode metaNode; private DocumentContext documentContext; private Normalizer normalizer; private boolean pagebreakEncountered; private int treeDepth; private AttributeMap currentAttributes; private String namespace; private String tagName; public DefaultInputFeed(final LayoutProcess process) { this(process, true); } protected DefaultInputFeed(final LayoutProcess process, final boolean init) { this.process = process; this.documentContext = process.getDocumentContext(); if (init) { this.normalizer = process.getOutputProcessor().createNormalizer(process); this.state = DOCUMENT_STARTING; } } public void resetPageBreakFlag() { this.pagebreakEncountered = false; } public void handlePageBreakEncountered(final CSSValue pageName, final PseudoPage[] pseudoPages) throws NormalizationException { this.pagebreakEncountered = true; // OK, we got a pagebreak. (We should get only one, but who knows ... // lets save the states anyway .. normalizer.handlePageBreak (pageName, pseudoPages); } public boolean isPagebreakEncountered() { return this.pagebreakEncountered; } private int checkState(final int newState) { if (validStateTransitions[state][newState] == false) { throw new IllegalStateException ("illegal transition from " + STATE_NAMES[state] + " to " + STATE_NAMES[newState]); } final int oldState = this.state; this.state = newState; return oldState; } public final void startDocument() { checkState(META_EXPECTED); // resetPageBreakFlag(); performStartDocument(); } protected void performStartDocument() { // todo do nothing? } public final void startMetaInfo() { checkState(META_PROCESSING); performStartMetaInfo(); } protected void performStartMetaInfo() { } public final void addDocumentAttribute(final String name, final Object attr) { checkState(META_PROCESSING); performAddDocumentAttribute(name, attr); } protected void performAddDocumentAttribute(final String name, final Object attr) { documentContext.setMetaAttribute(name, attr); } public void startMetaNode() { checkState(META_NODE_START); performStartMetaNode(); } protected void performStartMetaNode() { metaNode = new DefaultDocumentMetaNode();// create new DocumentMetaNode(type) documentContext.addMetaNode(metaNode); } public final void setMetaNodeAttribute(final String name, final Object attr) { checkState(META_NODE_ATTRIBUTES); performSetMetaNodeAttribute(name, attr); } protected void performSetMetaNodeAttribute(final String name, final Object attr) { metaNode.setMetaAttribute(name, attr); } public void endMetaNode() { checkState(META_PROCESSING); performEndMetaNode(); } protected void performEndMetaNode() { metaNode = null; } public final void endMetaInfo() throws InputFeedException { checkState(ELEMENT_EXPECTED); performEndMetaInfo(); } public NamespaceCollection getNamespaceCollection() { if (initialized == false) { throw new IllegalStateException("Not yet!"); } return documentContext.getNamespaces(); } protected void performEndMetaInfo() throws InputFeedException { try { initializeDocument(); } catch (Exception e) { throw new InputFeedException("Failed to normalize element", e); } } public final void startElement(final String namespace, final String name) throws InputFeedException { final int oldState = checkState(ELEMENT_STARTED); // resetPageBreakFlag(); if (oldState == META_EXPECTED || oldState == ELEMENT_EXPECTED) { try { initializeDocument(); } catch (Exception e) { throw new InputFeedException("Failed to normalize element", e); } } else if (oldState == ELEMENT_ATTRIBUTES || oldState == ELEMENT_STARTED) { try { getNormalizer().startElement (this.namespace, tagName, currentAttributes); currentAttributes = null; } catch (NormalizationException e) { throw new InputFeedException("Failed to normalize element", e); } catch (IOException e) { throw new InputFeedException("IOError: Failed to normalize element", e); } } performStartElement(namespace, name); } private void initializeDocument() throws IOException, NormalizationException { if (initialized) { return; } // initialize all factories from the given meta-data. // the execution order here is important! documentContext.initialize(); getNormalizer().startDocument(); initialized = true; } protected void performStartElement(final String namespace, final String name) { this.namespace = namespace; this.tagName = name; this.currentAttributes = new AttributeMap(); } public final void setAttribute(final String namespace, final String name, final Object attr) { checkState(ELEMENT_ATTRIBUTES); performSetAttribute(namespace, name, attr); } protected void performSetAttribute(final String namespace, final String name, final Object attr) { this.currentAttributes.setAttribute(namespace, name, attr); } public final void addContent(final String text) throws InputFeedException { try { final int oldState = checkState(ELEMENT_CONTENT); // resetPageBreakFlag(); if (oldState == ELEMENT_ATTRIBUTES || oldState == ELEMENT_STARTED) { getNormalizer().startElement (this.namespace, tagName, currentAttributes); currentAttributes = null; } else if (oldState == ELEMENT_EXPECTED || oldState == META_EXPECTED) { initializeDocument(); } performAddContent(text); } catch (NormalizationException ne) { throw new InputFeedException("Failed to normalize element", ne); } catch (IOException ioe) { throw new InputFeedException("Failed to normalize element", ioe); } } protected void performAddContent(final String text) throws InputFeedException, IOException, NormalizationException { getNormalizer().addText(text); } public final void endElement() throws InputFeedException { try { final int oldState = checkState(ELEMENT_EXPECTED); // resetPageBreakFlag(); if (oldState == ELEMENT_ATTRIBUTES || oldState == ELEMENT_STARTED) { getNormalizer().startElement (this.namespace, tagName, currentAttributes); currentAttributes = null; } performEndElement(); } catch (NormalizationException e) { throw new InputFeedException("Failed to normalize element", e); } catch (IOException e) { throw new InputFeedException("Failed to normalize element", e); } } protected void performEndElement() throws IOException, NormalizationException { this.namespace = null; this.tagName = null; this.currentAttributes = null; getNormalizer().endElement(); } public final void endDocument() throws InputFeedException { checkState(DOCUMENT_FINISHED); // resetPageBreakFlag(); try { performEndDocument(); } catch (NormalizationException e) { throw new InputFeedException("Failed to normalize element", e); } catch (IOException e) { throw new InputFeedException("Failed to normalize element", e); } } protected void performEndDocument() throws IOException, NormalizationException { // //elements.pop(); // if (elements.isEmpty() == false) // { // throw new IllegalStateException("Stack is not yet empty: " + elements); // } getNormalizer().endDocument(); } protected LayoutProcess getProcess() { return process; } protected int getState() { return state; } public Normalizer getNormalizer() { return normalizer; } public State saveState() throws StateException { final DefaultInputFeedState state = new DefaultInputFeedState(); state.setTreeDepth(treeDepth); state.setCurrentAttributes(currentAttributes); state.setNamespace(namespace); state.setTagName(tagName); state.setInitialized(initialized); state.setMetaNode(metaNode); state.setNormalizerState(normalizer.saveState()); state.setState(this.state); state.setPagebreakEncountered(pagebreakEncountered); return state; } /** * Warning; This method is needed internally, mess with it from the outside * and you will run into trouble. The normalizer is a statefull component and * any call to it may mess up the state. From there on, 'Abandon every hope, * ye who enter here'. * * @return */ public Normalizer getCurrentNormalizer() { return normalizer; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/feed/InputFeedException.java 0000644 0001750 0001750 00000003711 11305540552 026615 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: InputFeedException.java 6489 2008-11-28 14:53:40Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.feed; import org.pentaho.reporting.libraries.base.util.StackableException; public class InputFeedException extends StackableException { /** * Creates a StackableRuntimeException with no message and no parent. */ public InputFeedException () { } /** * Creates an exception. * * @param message the exception message. */ public InputFeedException (final String message) { super(message); } /** * Creates an exception. * * @param message the exception message. * @param ex the parent exception. */ public InputFeedException (final String message, final Exception ex) { super(message, ex); } } liblayout-0.2.10/source/org/jfree/layouting/layouter/feed/InputFeed.java 0000644 0001750 0001750 00000012610 11305540552 024734 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: InputFeed.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.feed; import org.jfree.layouting.StatefullComponent; import org.jfree.layouting.input.style.PseudoPage; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.namespace.NamespaceCollection; import org.jfree.layouting.normalizer.content.NormalizationException; import org.jfree.layouting.normalizer.content.Normalizer; /** * The input feed shields the internal processing from users errors. It * implements a state maschine, which checks that all documents are well formed * and which does not allow users to manipulate the resulting document tree * directly. * * An input feed collects all data for elements and other nodes and forwards * them to the normalizer. The normalizer is the first stage of the content * layouting and processing. * * Pagination ability is not propagated back to the caller. A caller will not * normaly know whether a certain input caused a pagebreak. However, especially * in the cases where only one page should be processed, we allow the detection * of page breaks using a boolean flag. (Which is also used to detect loops.) * * The flag is reset on each call to 'startElement', 'startDocument', * 'endElement', 'endDocument' and 'addText'. Attribute modifications have no * effect on that flag (as these calls are accumulated into one big supercall * before passing them to the normalizer.) * * Processing the meta-info also has no effect on the page-break flag, as meta- * info is processed before the content is processed. * * @author Thomas Morgner */ public interface InputFeed extends StatefullComponent { /** * Starts the document processing. This is the first method to call. After * calling this method, the meta-data should be fed into the inputfeed. */ public void startDocument() throws InputFeedException; /** * Signals, that meta-data follows. Calling this method is only valid directly * after startDocument has been called. */ public void startMetaInfo() throws InputFeedException; /** * Adds document attributes. Document attributes hold object factories and * document wide resources which appear only once. * * @param name * @param attr */ public void addDocumentAttribute(String name, Object attr) throws InputFeedException; /** * Starts a new meta-node structure. Meta-Nodes are used to hold content that * can appear more than once (like stylesheet declarations). * * For now, only stylesheet declarations are defined as meta-node content; * more content types will surely arise in the future. * * Calling this method is only valid after 'startMetaInfo' has been called. */ public void startMetaNode() throws InputFeedException; /** * Defines an attribute for the meta-nodes. For each meta node, at least the * 'type' attribute (namespace: LibLayout) should be defined. * * @param name * @param attr */ public void setMetaNodeAttribute(String name, Object attr) throws InputFeedException; public void endMetaNode() throws InputFeedException; public void endMetaInfo() throws InputFeedException; public void startElement(String namespace, String name) throws InputFeedException; public void setAttribute(String namespace, String name, Object attr) throws InputFeedException; public void addContent(String text) throws InputFeedException; public void endElement() throws InputFeedException; public void endDocument() throws InputFeedException; public NamespaceCollection getNamespaceCollection(); public void handlePageBreakEncountered(final CSSValue pageName, final PseudoPage[] pseudoPages) throws NormalizationException; public boolean isPagebreakEncountered(); public void resetPageBreakFlag(); /** * Warning; This method is needed internally, mess with it from the outside * and you will run into trouble. The normalizer is a statefull component and * any call to it may mess up the state. From there on, 'Abandon every hope, * ye who enter here'. * * @return */ public Normalizer getCurrentNormalizer(); } liblayout-0.2.10/source/org/jfree/layouting/layouter/model/ 0000755 0001750 0001750 00000000000 11305540552 022403 5 ustar rene rene liblayout-0.2.10/source/org/jfree/layouting/layouter/model/LayoutElement.java 0000644 0001750 0001750 00000017027 11305540552 026044 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: LayoutElement.java 6489 2008-11-28 14:53:40Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.model; import java.util.HashMap; import org.jfree.layouting.layouter.context.LayoutContext; /** * Represents a DOM element. The tree is only backward-traversable; non-element * nodes are not traversable at all. * * All nodes hold a reference to their parent and all elements also hold a * reference to their preceeding silbling nodes. This structure guarantees a * minimal memory footprint, as nodes automaticly get garbage collected as soon * as they have been fully processed. Manual cleaning is not needed. * * This theory vanishes as soon as we enter the 'pinned' mode. In that mode, * each element holds strong references to all of its childs. These childs do * not go out of context unless the first pinned element does. * * @author Thomas Morgner */ public class LayoutElement extends LayoutNode { private LayoutElement previous; private LayoutContext layoutContext; private HashMap strings; private HashMap counters; private boolean contentsConsumed; private int alternateOpen; public LayoutElement(final LayoutElement parent, final LayoutElement previous, final LayoutContext layoutContext) { super(parent); if (layoutContext == null) { throw new NullPointerException(); } this.previous = previous; this.layoutContext = layoutContext; } public LayoutElement getPrevious() { return previous; } public LayoutContext getLayoutContext() { return layoutContext; } public LayoutContext detachLayoutContext() { // LayoutElement parent = getParent(); // final FastStack list = new FastStack(); // list.push(this); // while (parent != null) // { // list.push(parent); // parent = parent.getParent(); // } // // final HashMap allCounters = new HashMap(); // final HashMap allStrings = new HashMap(); // while (list.isEmpty() == false) // { // final LayoutElement element = (LayoutElement) list.pop(); // allCounters.putAll(element.counters); // allStrings.putAll(element.strings); // } return layoutContext.detach(counters, strings); } public boolean isContentsConsumed() { if (isPseudoElement()) { final LayoutElement parent = getParent(); if (parent != null) { return parent.isContentsConsumed(); } } return contentsConsumed; } private boolean isPseudoElement() { if (layoutContext == null) { return false; } return layoutContext.isPseudoElement(); } public void setContentsConsumed(final boolean contentsConsumed) { if (isPseudoElement()) { final LayoutElement parent = getParent(); if (parent != null) { parent.setContentsConsumed(contentsConsumed); return; } } this.contentsConsumed = contentsConsumed; } /** * Returns the value for the given counter. If no counter exists under that * name, this method returns 0. * * @param counterName * @return the value for the given counter. */ public int getCounterValue(final String counterName) { if (counters != null) { final Integer counterValue = (Integer) counters.get(counterName); if (counterValue != null) { return counterValue.intValue(); } } if (getParent() != null) { return getParent().getCounterValue(counterName); } return 0; } /** * Increments the counter with the given name. If no counter is known under * that name, the root node will create one. * * @param name * @param value */ public void incrementCounter(final String name, final int value) { // Step 1: Check if the counter is locally defined. if (counters != null) { if (counters.containsKey(name)) { final int oldValue = getCounterValue(name); counters.put(name, new Integer(oldValue + value)); return; } } // check if we have a parent, which may know that counter ... if (getParent() != null) { getParent().incrementCounter(name, value); return; } // ok, being desperate: Create a new one .. final int oldValue = getCounterValue(name); if (counters == null) { counters = new HashMap(); } counters.put(name, new Integer(oldValue + value)); } /** * Reseting an counter creates a new Counter-Instance. Counters from parent * elements are not affected and remain unchanged. All further operations * issued by all sub-elements will now work with this counter. * * @param name * @param value */ public void resetCounter(final String name, final int value) { if (counters == null) { counters = new HashMap(); } counters.put(name, new Integer(value)); } public boolean isCounterDefined(final String counterName) { if (counters == null) { return false; } return counters.containsKey(counterName); } /** * Sets a named string. * * @param name the name * @param value the value * @param define if set to true, this defines a new nesting context. */ public void setString(final String name, final String value, final boolean define) { if (!define) { // not define ... if (getParent() != null) { getParent().setString(name, value, define); return; } } if (value == null) { if (strings != null) { strings.remove(name); } // else ignore the request } else { if (strings == null) { strings = new HashMap(); } strings.put(name, value); } } /** * Retrieves the value for a given string. The value returned always * represents the *actual* value, ignoring any possibly defined * page-policies. * * @param name * @return */ public String getString(final String name) { if (strings != null) { final String value = (String) strings.get(name); if (value != null) { return value; } } if (getParent() != null) { return getParent().getString(name); } else { return null; } } public void openAlternate() { this.alternateOpen += 1; } public boolean isAlternateOpen() { return alternateOpen != 0; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/model/LayoutNode.java 0000644 0001750 0001750 00000004147 11305540552 025337 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: LayoutNode.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.model; import java.io.Serializable; /** * Creation-Date: 27.05.2006, 16:02:15 * * @author Thomas Morgner */ public abstract class LayoutNode implements Serializable { private LayoutElement parent; // private boolean pinned; protected LayoutNode(final LayoutElement parent) { this.parent = parent; } // // protected void addPinnedToParent() // { // if (parent != null) // { // if (parent.isPinned()) // { // // this construct is a bit unsafe as the object has not been // // fully constructed yet -- but good enough anyway. // parent.addPinned(this); // } // } // } // // public boolean isPinned() // { // return pinned; // } // // public void markPinned() // { // this.pinned = true; // } public LayoutElement getParent() { return parent; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/model/LayoutText.java 0000644 0001750 0001750 00000003415 11305540552 025373 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: LayoutText.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.model; import org.jfree.layouting.layouter.content.ContentToken; /** * A simple CData node. Not much to say about it. * * @author Thomas Morgner */ public class LayoutText extends LayoutNode { private ContentToken text; public LayoutText(final LayoutElement parent, final ContentToken text) { super(parent); if (text == null) { throw new NullPointerException(); } this.text = text; } public ContentToken getContent() { return text; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/model/LayoutRoot.java 0000644 0001750 0001750 00000003547 11305540552 025400 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: LayoutRoot.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.model; /** * The layout root is the document/page representation in the DOM model. * It holds the page-wide settings. It is initialized with the document * context and will hold all undeclared counters. * * Unlike all other elements, this root has no layout-context. Any call * to this method will result in a Null-value to be returned. On pagebreaks, * no new instance needs to be generated - the layout root exists only once. * * @author Thomas Morgner */ public class LayoutRoot extends LayoutElement { public LayoutRoot() { super(null, null, null); } } liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/ 0000755 0001750 0001750 00000000000 11305540552 023145 5 ustar rene rene liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/glyph/ 0000755 0001750 0001750 00000000000 11305540552 024270 5 ustar rene rene liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/glyph/DiamondCounterStyle.java 0000644 0001750 0001750 00000003150 11305540552 031066 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: DiamondCounterStyle.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters.glyph; import org.jfree.layouting.layouter.counters.CounterStyle; public class DiamondCounterStyle implements CounterStyle { public DiamondCounterStyle () { } public String getCounterValue (final int index) { return "\u25c6"; } public String getSuffix() { return ""; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/glyph/HyphenCounterStyle.java 0000644 0001750 0001750 00000003145 11305540552 030752 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: HyphenCounterStyle.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters.glyph; import org.jfree.layouting.layouter.counters.CounterStyle; public class HyphenCounterStyle implements CounterStyle { public HyphenCounterStyle () { } public String getCounterValue (final int index) { return "\u2013"; } public String getSuffix() { return ""; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/glyph/CircleCounterStyle.java 0000644 0001750 0001750 00000003146 11305540552 030721 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: CircleCounterStyle.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters.glyph; import org.jfree.layouting.layouter.counters.CounterStyle; public class CircleCounterStyle implements CounterStyle { public CircleCounterStyle () { } public String getCounterValue (final int index) { return "\u25e6"; } public String getSuffix() { return ""; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/glyph/CheckCounterStyle.java 0000644 0001750 0001750 00000003142 11305540552 030531 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: CheckCounterStyle.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters.glyph; import org.jfree.layouting.layouter.counters.CounterStyle; public class CheckCounterStyle implements CounterStyle { public CheckCounterStyle () { } public String getCounterValue (final int index) { return "\u2713"; } public String getSuffix() { return ""; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/glyph/SquareCounterStyle.java 0000644 0001750 0001750 00000003144 11305540552 030756 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: SquareCounterStyle.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters.glyph; import org.jfree.layouting.layouter.counters.CounterStyle; public class SquareCounterStyle implements CounterStyle { public SquareCounterStyle() { } public String getCounterValue(final int index) { return "\u25fc"; } public String getSuffix() { return ""; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/glyph/BoxCounterStyle.java 0000644 0001750 0001750 00000003134 11305540552 030245 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: BoxCounterStyle.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters.glyph; import org.jfree.layouting.layouter.counters.CounterStyle; public class BoxCounterStyle implements CounterStyle { public BoxCounterStyle () { } public String getCounterValue (final int index) { return "\u25a1"; } public String getSuffix() { return ""; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/glyph/DiscCounterStyle.java 0000644 0001750 0001750 00000003137 11305540552 030402 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: DiscCounterStyle.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters.glyph; import org.jfree.layouting.layouter.counters.CounterStyle; public class DiscCounterStyle implements CounterStyle { public DiscCounterStyle () { } public String getCounterValue (final int index) { return "\u2022"; } public String getSuffix() { return ""; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/other/ 0000755 0001750 0001750 00000000000 11305540552 024266 5 ustar rene rene liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/other/AsterisksCounterStyle.java 0000644 0001750 0001750 00000003353 11305540552 031466 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: AsterisksCounterStyle.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters.other; import org.jfree.layouting.layouter.counters.CounterStyle; public class AsterisksCounterStyle implements CounterStyle { public AsterisksCounterStyle () { } public String getCounterValue (final int index) { final StringBuffer b = new StringBuffer(index); for (int i = 0; i < index; i++) { b.append('*'); } return b.toString(); } public String getSuffix() { return ""; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/other/NoneCounterStyle.java 0000644 0001750 0001750 00000003131 11305540552 030407 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: NoneCounterStyle.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters.other; import org.jfree.layouting.layouter.counters.CounterStyle; public class NoneCounterStyle implements CounterStyle { public NoneCounterStyle () { } public String getCounterValue (final int index) { return ""; } public String getSuffix() { return ""; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/CounterStyleFactory.java 0000644 0001750 0001750 00000006013 11305540552 030000 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: CounterStyleFactory.java 6489 2008-11-28 14:53:40Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters; import java.util.HashMap; import java.util.Iterator; import org.jfree.layouting.LibLayoutBoot; import org.jfree.layouting.layouter.counters.numeric.DecimalCounterStyle; import org.pentaho.reporting.libraries.base.config.Configuration; import org.pentaho.reporting.libraries.base.util.ObjectUtilities; public class CounterStyleFactory { private static final CounterStyle DEFAULTCOUNTER = new DecimalCounterStyle(); private static CounterStyleFactory factory; public static final String PREFIX = "org.jfree.layouting.numbering."; public static synchronized CounterStyleFactory getInstance () { if (factory == null) { factory = new CounterStyleFactory(); factory.registerDefaults(); } return factory; } private HashMap knownCounters; private CounterStyleFactory () { knownCounters = new HashMap(); } public void registerDefaults () { final Configuration config = LibLayoutBoot.getInstance().getGlobalConfig(); final Iterator it = config.findPropertyKeys(PREFIX); while (it.hasNext()) { final String key = (String) it.next(); final String counterClass = config.getConfigProperty(key); if (counterClass == null) { continue; } final Object o = ObjectUtilities.loadAndInstantiate (counterClass, CounterStyleFactory.class, CounterStyle.class); if (o instanceof CounterStyle) { final String name = key.substring(PREFIX.length()); knownCounters.put (name, o); } } } public CounterStyle getCounterStyle (final String name) { final CounterStyle cs = (CounterStyle) knownCounters.get(name); if (cs != null) { return cs; } return DEFAULTCOUNTER; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/CounterStyle.java 0000644 0001750 0001750 00000002636 11305540552 026457 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: CounterStyle.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters; public interface CounterStyle { public String getCounterValue(int index); public String getSuffix(); } liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/ 0000755 0001750 0001750 00000000000 11305540552 024607 5 ustar rene rene liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/DevanagariCounterStyle.java 0000644 0001750 0001750 00000003520 11305540552 032074 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: DevanagariCounterStyle.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters.numeric; public class DevanagariCounterStyle extends NumericCounterStyle { public DevanagariCounterStyle () { super(10, "."); setReplacementChar('0', '\u0966'); setReplacementChar('1', '\u0967'); setReplacementChar('2', '\u0968'); setReplacementChar('3', '\u0969'); setReplacementChar('4', '\u096A'); setReplacementChar('5', '\u096b'); setReplacementChar('6', '\u096c'); setReplacementChar('7', '\u096d'); setReplacementChar('8', '\u096e'); setReplacementChar('9', '\u096f'); } } liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/BengaliCounterStyle.java 0000644 0001750 0001750 00000003507 11305540552 031401 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: BengaliCounterStyle.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters.numeric; public class BengaliCounterStyle extends NumericCounterStyle { public BengaliCounterStyle () { super(10, "."); setReplacementChar('0', '\u09e6'); setReplacementChar('1', '\u09e7'); setReplacementChar('2', '\u09e8'); setReplacementChar('3', '\u09e9'); setReplacementChar('4', '\u09ea'); setReplacementChar('5', '\u09eb'); setReplacementChar('6', '\u09ec'); setReplacementChar('7', '\u09ed'); setReplacementChar('8', '\u09ee'); setReplacementChar('9', '\u09ef'); } } liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/ArabicIndicCounterStyle.java 0000644 0001750 0001750 00000003523 11305540552 032166 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: ArabicIndicCounterStyle.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters.numeric; public class ArabicIndicCounterStyle extends NumericCounterStyle { public ArabicIndicCounterStyle () { super(10, "."); setReplacementChar('0', '\u0660'); setReplacementChar('1', '\u0661'); setReplacementChar('2', '\u0662'); setReplacementChar('3', '\u0663'); setReplacementChar('4', '\u0664'); setReplacementChar('5', '\u0665'); setReplacementChar('6', '\u0666'); setReplacementChar('7', '\u0667'); setReplacementChar('8', '\u0668'); setReplacementChar('9', '\u0669'); } } ././@LongLink 0000000 0000000 0000000 00000000154 00000000000 011565 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/UppercaseHexadecimalCounterStyle.java liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/UppercaseHexadecimalCounterSty0000644 0001750 0001750 00000003262 11305540552 032651 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: UppercaseHexadecimalCounterStyle.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters.numeric; import org.jfree.layouting.layouter.counters.CounterStyle; public class UppercaseHexadecimalCounterStyle implements CounterStyle { public UppercaseHexadecimalCounterStyle () { } public String getCounterValue (final int index) { return Integer.toHexString(index).toUpperCase(); } public String getSuffix() { return "."; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/CambodianCounterStyle.java 0000644 0001750 0001750 00000003515 11305540552 031714 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: CambodianCounterStyle.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters.numeric; public class CambodianCounterStyle extends NumericCounterStyle { public CambodianCounterStyle () { super(10, "."); setReplacementChar('0', '\u17e0'); setReplacementChar('1', '\u17e1'); setReplacementChar('2', '\u17e2'); setReplacementChar('3', '\u17e3'); setReplacementChar('4', '\u17e4'); setReplacementChar('5', '\u17e5'); setReplacementChar('6', '\u17e6'); setReplacementChar('7', '\u17e7'); setReplacementChar('8', '\u17e8'); setReplacementChar('9', '\u17e9'); } } liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/BinaryCounterStyle.java 0000644 0001750 0001750 00000003175 11305540552 031265 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: BinaryCounterStyle.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters.numeric; import org.jfree.layouting.layouter.counters.CounterStyle; public class BinaryCounterStyle implements CounterStyle { public BinaryCounterStyle () { } public String getCounterValue (final int index) { return Integer.toBinaryString(index); } public String getSuffix() { return "."; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/OctalCounterStyle.java 0000644 0001750 0001750 00000003170 11305540552 031076 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: OctalCounterStyle.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters.numeric; import org.jfree.layouting.layouter.counters.CounterStyle; public class OctalCounterStyle implements CounterStyle { public OctalCounterStyle () { } public String getCounterValue (final int index) { return Integer.toOctalString(index); } public String getSuffix() { return ""; } } ././@LongLink 0000000 0000000 0000000 00000000152 00000000000 011563 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/DecimalLeadingZeroCounterStyle.java liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/DecimalLeadingZeroCounterStyle0000644 0001750 0001750 00000003543 11305540552 032602 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: DecimalLeadingZeroCounterStyle.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters.numeric; import org.jfree.layouting.layouter.counters.CounterStyle; public class DecimalLeadingZeroCounterStyle implements CounterStyle { public DecimalLeadingZeroCounterStyle () { } public String getCounterValue (final int index) { if (Math.abs(index) < 10) { if (index < 0) { return "-0" + Integer.toString(-index); } else { return '0' + Integer.toString(index); } } return Integer.toString(index); } public String getSuffix() { return "."; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/NumericCounterStyle.java 0000644 0001750 0001750 00000006551 11305540552 031444 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: NumericCounterStyle.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters.numeric; import java.util.HashSet; import org.jfree.layouting.layouter.counters.CounterStyle; public abstract class NumericCounterStyle implements CounterStyle { private static final class ReplacementDefinition { private char original; private char replacement; private ReplacementDefinition (final char original, final char replacement) { this.original = original; this.replacement = replacement; } public char getOriginal () { return original; } public char getReplacement () { return replacement; } public boolean equals (final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final ReplacementDefinition that = (ReplacementDefinition) o; if (original != that.original) { return false; } return true; } public int hashCode () { return (int) original; } } private HashSet replacements; private int base; private transient ReplacementDefinition[] cachedDefinitions; private String suffix; protected NumericCounterStyle (final int base, final String suffix) { this.base = base; this.suffix = suffix; this.replacements = new HashSet(); } public final void setReplacementChar (final char org, final char other) { this.replacements.add (new ReplacementDefinition(org, other)); this.cachedDefinitions = null; } public final String getCounterValue (final int index) { if (cachedDefinitions == null) { cachedDefinitions = (ReplacementDefinition[]) replacements.toArray(new ReplacementDefinition[replacements.size()]); } String numeric = Integer.toString(index, base); for (int i = 0; i < cachedDefinitions.length; i++) { final ReplacementDefinition def = cachedDefinitions[i]; numeric = numeric.replace(def.getOriginal(), def.getReplacement()); } return numeric; } public String getSuffix() { return suffix; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/DecimalCounterStyle.java 0000644 0001750 0001750 00000003172 11305540552 031374 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: DecimalCounterStyle.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters.numeric; import org.jfree.layouting.layouter.counters.CounterStyle; public class DecimalCounterStyle implements CounterStyle { public DecimalCounterStyle () { } public String getCounterValue (final int index) { return Integer.toString(index); } public String getSuffix() { return "."; } } ././@LongLink 0000000 0000000 0000000 00000000154 00000000000 011565 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/LowercaseHexadecimalCounterStyle.java liblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/LowercaseHexadecimalCounterSty0000644 0001750 0001750 00000003244 11305540552 032646 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: LowercaseHexadecimalCounterStyle.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.counters.numeric; import org.jfree.layouting.layouter.counters.CounterStyle; public class LowercaseHexadecimalCounterStyle implements CounterStyle { public LowercaseHexadecimalCounterStyle () { } public String getCounterValue (final int index) { return Integer.toHexString(index); } public String getSuffix() { return "."; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/i18n/ 0000755 0001750 0001750 00000000000 11305540552 022062 5 ustar rene rene liblayout-0.2.10/source/org/jfree/layouting/layouter/i18n/DefaultLocalizationContext.java 0000644 0001750 0001750 00000004653 11305540552 030237 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: DefaultLocalizationContext.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.i18n; import java.text.DateFormat; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.util.Locale; public class DefaultLocalizationContext implements LocalizationContext { public DefaultLocalizationContext() { } public DateFormat getDateFormat (final Locale language) { return DateFormat.getDateInstance(DateFormat.MEDIUM, language); } public NumberFormat getIntegerFormat (final Locale language) { return NumberFormat.getInstance(language); } public NumberFormat getNumberFormat (final Locale language) { return NumberFormat.getNumberInstance(language); } public DateFormat getTimeFormat (final Locale language) { return DateFormat.getTimeInstance(DateFormat.MEDIUM, language); } public DateFormat getDateFormat (final String format, final Locale language) { return new SimpleDateFormat(format, language); } public NumberFormat getNumberFormat(final String format, final Locale language) { return new DecimalFormat (format, new DecimalFormatSymbols(language)); } } liblayout-0.2.10/source/org/jfree/layouting/layouter/i18n/LocalizationContext.java 0000644 0001750 0001750 00000003437 11305540552 026731 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: LocalizationContext.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.i18n; import java.text.DateFormat; import java.text.NumberFormat; import java.util.Locale; public interface LocalizationContext { public DateFormat getDateFormat (String format, Locale language); public DateFormat getDateFormat (Locale language); public DateFormat getTimeFormat (Locale language); public NumberFormat getIntegerFormat (Locale language); public NumberFormat getNumberFormat (Locale language); public NumberFormat getNumberFormat (String format, Locale language); } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/ 0000755 0001750 0001750 00000000000 11305540552 022755 5 ustar rene rene liblayout-0.2.10/source/org/jfree/layouting/layouter/content/computed/ 0000755 0001750 0001750 00000000000 11305540552 024575 5 ustar rene rene liblayout-0.2.10/source/org/jfree/layouting/layouter/content/computed/PendingToken.java 0000644 0001750 0001750 00000003671 11305540552 030034 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: PendingToken.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.computed; /** * The pending function. This is a lookup to the current pending context. * If the pending context is empty, the element is not displayed (as if it * had been declared 'display: none'. * * The elements get removed from the normal flow and get added to the pending * flow. Due to the highly volatile nature of that step, no - I repeat - no * validation is done to normalize inline and block elements. * * @author Thomas Morgner */ public class PendingToken extends ComputedToken { private String key; public PendingToken(final String key) { this.key = key; } public String getKey() { return key; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/computed/CloseQuoteToken.java 0000644 0001750 0001750 00000003057 11305540552 030531 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: CloseQuoteToken.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.computed; public class CloseQuoteToken extends ComputedToken { private boolean surpress; public CloseQuoteToken(final boolean surpress) { this.surpress = surpress; } public boolean isSurpressQuoteText () { return surpress; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/computed/CounterToken.java 0000644 0001750 0001750 00000003425 11305540552 030064 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: CounterToken.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.computed; import org.jfree.layouting.layouter.counters.CounterStyle; /** * Creation-Date: 25.05.2006, 17:16:40 * * @author Thomas Morgner */ public class CounterToken extends ComputedToken { private String name; private CounterStyle style; public CounterToken(final String name, final CounterStyle style) { this.name = name; this.style = style; } public String getName() { return name; } public CounterStyle getStyle() { return style; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/computed/ElementsToken.java 0000644 0001750 0001750 00000003764 11305540552 030227 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: ElementsToken.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.computed; /** * The elemnts function. This is a lookup to the current pending context. * The elements function grabs the last value from the pending context and * drops all previous elements. If the pending context is empty, it preserves * its content. * * The elements get removed from the normal flow and get added to the pending * flow. Due to the highly volatile nature of that step, no - I repeat - no * validation is done to normalize inline and block elements. * * @author Thomas Morgner */ public class ElementsToken extends ComputedToken { private String key; public ElementsToken(final String key) { this.key = key; } public String getKey() { return key; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/computed/ContentsToken.java 0000644 0001750 0001750 00000003545 11305540552 030245 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: ContentsToken.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.computed; import org.jfree.layouting.layouter.content.ContentToken; /** * This is a simple placeholder to mark the location where * the DOM content should be inserted. ** On 'string(..)' functions, this is the place holder where * the PCDATA of that element is copied into the string. *
* Todo: Maybe we should allow to copy the whole contents, * as we would for the move-to function. */ public class ContentsToken extends ComputedToken { public static final ContentToken CONTENTS = new ContentsToken(); private ContentsToken () { } } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/computed/VariableToken.java 0000644 0001750 0001750 00000003314 11305540552 030167 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: VariableToken.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.computed; /** * The variable token resolves the given 'string' reference. * * @author Thomas Morgner */ public class VariableToken extends ComputedToken { private String variable; public VariableToken(final String variable) { if (variable == null) { throw new NullPointerException(); } this.variable = variable; } public String getVariable() { return variable; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/computed/ComputedToken.java 0000644 0001750 0001750 00000003315 11305540552 030223 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: ComputedToken.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.computed; import org.jfree.layouting.layouter.content.ContentToken; /** * A computed token is a placeholder for content that *must* be resolved during * the layouting phase. Usually, this deals with compound counters (which need * to be split into resolved single counters). * * @author Thomas Morgner */ public abstract class ComputedToken implements ContentToken { protected ComputedToken() { } } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/computed/CountersToken.java 0000644 0001750 0001750 00000004107 11305540552 030245 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: CountersToken.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.computed; import org.jfree.layouting.layouter.counters.CounterStyle; /** * This is a meta-token. It must be completly resolved during the * ContentNormalization, and must be replaced by a sequence of 'Counter' * tokens. * * @author Thomas Morgner */ public class CountersToken extends ComputedToken { private String name; private String separator; private CounterStyle style; public CountersToken(final String name, final String separator, final CounterStyle style) { this.name = name; this.separator = separator; this.style = style; } public String getSeparator() { return separator; } public String getName() { return name; } public CounterStyle getStyle() { return style; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/computed/OpenQuoteToken.java 0000644 0001750 0001750 00000003054 11305540552 030362 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: OpenQuoteToken.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.computed; public class OpenQuoteToken extends ComputedToken { private boolean surpress; public OpenQuoteToken(final boolean surpress) { this.surpress = surpress; } public boolean isSurpressQuoteText () { return surpress; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/statics/ 0000755 0001750 0001750 00000000000 11305540552 024427 5 ustar rene rene liblayout-0.2.10/source/org/jfree/layouting/layouter/content/statics/ResourceContentToken.java 0000644 0001750 0001750 00000004116 11305540552 031417 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: ResourceContentToken.java 6489 2008-11-28 14:53:40Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.statics; import org.jfree.layouting.layouter.content.type.GenericType; import org.jfree.layouting.layouter.content.type.ResourceType; import org.pentaho.reporting.libraries.resourceloader.Resource; import org.pentaho.reporting.libraries.resourceloader.ResourceException; public class ResourceContentToken extends StaticToken implements ResourceType, GenericType { private Resource content; public ResourceContentToken (final Resource content) { if (content == null) { throw new NullPointerException(); } this.content = content; } public Object getRaw() { try { return content.getResource(); } catch (ResourceException e) { return null; } } public Resource getContent () { return content; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/statics/StaticToken.java 0000644 0001750 0001750 00000003213 11305540552 027521 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: StaticToken.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.statics; import org.jfree.layouting.layouter.content.ContentToken; /** * A static content token always defines a fixed textual content. Static tokens * hold no reference to any parent, as they have no parent at all. * * @author Thomas Morgner */ public abstract class StaticToken implements ContentToken { protected StaticToken() { } } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/statics/StaticTextToken.java 0000644 0001750 0001750 00000003726 11305540552 030377 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: StaticTextToken.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.statics; import org.jfree.layouting.layouter.content.type.TextType; /** * Static text. All CDATA and all constant strings from the 'content' * style-definition result in StaticTextTokens. * * @author Thomas Morgner */ public class StaticTextToken extends StaticToken implements TextType { private String text; public StaticTextToken(final String text) { if (text == null) { throw new NullPointerException(); } this.text = text; } public String getText() { return text; } public String toString () { return "org.jfree.layouting.layouter.content.statics.StaticTextToken=" + "{text='" + text + "'}"; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/statics/ExternalContentToken.java 0000644 0001750 0001750 00000003170 11305540552 031411 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: ExternalContentToken.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.statics; import org.jfree.layouting.layouter.content.type.GenericType; public class ExternalContentToken extends StaticToken implements GenericType { private Object data; public ExternalContentToken (final Object data) { this.data = data; } public Object getRaw() { return data; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/statics/FormattedContentToken.java 0000644 0001750 0001750 00000004063 11305540552 031556 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: FormattedContentToken.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.statics; import java.text.Format; import org.jfree.layouting.layouter.content.type.FormattedTextType; /** * Creation-Date: 04.07.2006, 20:16:16 * * @author Thomas Morgner */ public class FormattedContentToken extends StaticToken implements FormattedTextType { private Object original; private Format format; private String text; public FormattedContentToken(final Object original, final Format format, final String text) { this.format = format; this.original = original; this.text = text; } public Object getOriginal() { return original; } public Format getFormat() { return format; } public String getText() { return text; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/resolved/ 0000755 0001750 0001750 00000000000 11305540552 024600 5 ustar rene rene liblayout-0.2.10/source/org/jfree/layouting/layouter/content/resolved/ResolvedCounterToken.java 0000644 0001750 0001750 00000004302 11305540552 031566 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: ResolvedCounterToken.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.resolved; import org.jfree.layouting.layouter.content.computed.CounterToken; import org.jfree.layouting.layouter.content.type.TextType; import org.jfree.layouting.layouter.counters.CounterStyle; /** * Creation-Date: 12.06.2006, 14:38:29 * * @author Thomas Morgner */ public class ResolvedCounterToken implements ResolvedToken, TextType { private CounterToken parent; private int counterValue; public ResolvedCounterToken(final CounterToken parent, final int counterValue) { this.parent = parent; this.counterValue = counterValue; } public CounterToken getParent() { return parent; } public String getText() { final CounterToken counterToken = getParent(); final CounterStyle style = counterToken.getStyle(); return style.getCounterValue(counterValue); } public int getCounterValue() { return counterValue; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/resolved/ResolvedCountersToken.java 0000644 0001750 0001750 00000005044 11305540552 031755 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: ResolvedCountersToken.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.resolved; import org.jfree.layouting.layouter.content.computed.CountersToken; import org.jfree.layouting.layouter.content.type.TextType; import org.jfree.layouting.layouter.counters.CounterStyle; /** * Creation-Date: 12.06.2006, 14:38:29 * * @author Thomas Morgner */ public class ResolvedCountersToken implements ResolvedToken, TextType { private CountersToken parent; private int[] counterValues; public ResolvedCountersToken(final CountersToken parent, final int[] counterValues) { this.parent = parent; this.counterValues = counterValues; } public CountersToken getParent() { return parent; } public String getText() { final CountersToken counterToken = getParent(); final CounterStyle style = counterToken.getStyle(); final String separator = counterToken.getSeparator(); final StringBuffer buffer = new StringBuffer(); for (int i = 0; i < counterValues.length; i++) { if (i != 0) { buffer.append(separator); } final int value = counterValues[i]; buffer.append(style.getCounterValue(value)); } return buffer.toString(); } public int[] getCounterValue() { return (int[]) counterValues.clone(); } } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/resolved/ResolvedToken.java 0000644 0001750 0001750 00000003165 11305540552 030234 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: ResolvedToken.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.resolved; import org.jfree.layouting.layouter.content.ContentToken; /** * A resolved token is a token, that has been computed. Resolved tokens hold a * reference to their anchestor content-token. * * @author Thomas Morgner */ public interface ResolvedToken extends ContentToken { public abstract String getText(); } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/resolved/ResolvedStringToken.java 0000644 0001750 0001750 00000004024 11305540552 031416 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: ResolvedStringToken.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.resolved; import org.jfree.layouting.layouter.content.computed.ComputedToken; import org.jfree.layouting.layouter.content.computed.VariableToken; import org.jfree.layouting.layouter.content.type.TextType; /** * Creation-Date: 12.06.2006, 14:38:29 * * @author Thomas Morgner */ public class ResolvedStringToken implements ResolvedToken, TextType { private ComputedToken parent; private String text; public ResolvedStringToken(final ComputedToken parent, final String text) { if (parent == null) { throw new NullPointerException(); } this.parent = parent; this.text = text; } public ComputedToken getParent() { return parent; } public String getText() { return text; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/ContentToken.java 0000644 0001750 0001750 00000002761 11305540552 026241 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: ContentToken.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content; /** * This is the base for all specified content in CSS files. * This both may lookup content from elsewhere or may hold * static content as string. */ public interface ContentToken { } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/type/ 0000755 0001750 0001750 00000000000 11305540552 023736 5 ustar rene rene liblayout-0.2.10/source/org/jfree/layouting/layouter/content/type/GenericType.java 0000644 0001750 0001750 00000003311 11305540552 027015 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: GenericType.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.type; import org.jfree.layouting.layouter.content.ContentToken; /** * This is raw data. Whether or not the raw-data is interpreted is up to the * output target. However, it is suggested, that at least Images, Drawables * and Strings should be implemented (if the output format supports that). * * @author Thomas Morgner */ public interface GenericType extends ContentToken { public Object getRaw(); } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/type/ResourceType.java 0000644 0001750 0001750 00000003214 11305540552 027232 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: ResourceType.java 6489 2008-11-28 14:53:40Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.type; import org.jfree.layouting.layouter.content.ContentToken; import org.pentaho.reporting.libraries.resourceloader.Resource; /** * Content, that has been loaded from a resource-key. This is always something * binary. * * @author Thomas Morgner */ public interface ResourceType extends ContentToken { public Resource getContent (); } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/type/FormattedTextType.java 0000644 0001750 0001750 00000003025 11305540552 030235 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: FormattedTextType.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.type; import java.text.Format; /** * Creation-Date: 04.07.2006, 20:17:37 * * @author Thomas Morgner */ public interface FormattedTextType extends TextType { public Object getOriginal(); public Format getFormat(); } liblayout-0.2.10/source/org/jfree/layouting/layouter/content/type/TextType.java 0000644 0001750 0001750 00000003203 11305540552 026365 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: TextType.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.content.type; import org.jfree.layouting.layouter.content.ContentToken; /** * A content type, that has an textual representation. It may be no surprise, * that string content is text; images with an alt-description have text * as well. * * @author Thomas Morgner */ public interface TextType extends ContentToken { public String getText(); } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/ 0000755 0001750 0001750 00000000000 11305540552 022443 5 ustar rene rene liblayout-0.2.10/source/org/jfree/layouting/layouter/style/CSSStyleRuleComparator.java 0000644 0001750 0001750 00000007233 11305540552 027644 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: CSSStyleRuleComparator.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style; import java.util.Comparator; import org.jfree.layouting.input.style.CSSStyleRule; import org.jfree.layouting.input.style.selectors.CSSSelector; import org.jfree.layouting.input.style.selectors.SelectorWeight; /** * Creation-Date: 08.12.2005, 21:31:51 * * @author Thomas Morgner */ public class CSSStyleRuleComparator implements Comparator { public CSSStyleRuleComparator() { } /** * Compares its two arguments for order. Returns a negative integer, zero, or * a positive integer as the first argument is less than, equal to, or greater * than the second.
*
* The implementor must ensure that sgn(compare(x, y)) == -sgn(compare(y, * x)) for all x and y. (This implies that * compare(x, y) must throw an exception if and only if * compare(y, x) throws an exception.)*
* The implementor must also ensure that the relation is transitive: * ((compare(x, y)>0) && (compare(y, z)>0)) implies * compare(x, z)>0.*
* Finally, the implementer must ensure that compare(x, y)==0 implies * that sgn(compare(x, z))==sgn(compare(y, z)) for all * z.*
* It is generally the case, but not strictly required that * (compare(x, y)==0) == (x.equals(y)). Generally speaking, any * comparator that violates this condition should clearly indicate this fact. * The recommended language is "Note: this comparator imposes orderings that * are inconsistent with equals." * * @param o1 the first object to be compared. * @param o2 the second object to be compared. * @return a negative integer, zero, or a positive integer as the first * argument is less than, equal to, or greater than the second. * @throws ClassCastException if the arguments' types prevent them from being * compared by this Comparator. */ public int compare(final Object o1, final Object o2) { final CSSStyleRule r1 = (CSSStyleRule) o1; final CSSStyleRule r2 = (CSSStyleRule) o2; final CSSSelector selector1 = r1.getSelector(); final CSSSelector selector2 = r2.getSelector(); final SelectorWeight weight1 = selector1.getWeight(); final SelectorWeight weight2 = selector2.getWeight(); return weight1.compareTo(weight2); } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/CSSValueResolverUtility.java 0000644 0001750 0001750 00000031311 11305540552 030040 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: CSSValueResolverUtility.java 6489 2008-11-28 14:53:40Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style; import org.jfree.layouting.input.style.values.CSSNumericType; import org.jfree.layouting.input.style.values.CSSNumericValue; import org.jfree.layouting.input.style.values.CSSStringType; import org.jfree.layouting.input.style.values.CSSStringValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.FontSpecification; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.output.OutputProcessorFeature; import org.jfree.layouting.output.OutputProcessorMetaData; import org.jfree.layouting.util.geom.StrictGeomUtility; import org.pentaho.reporting.libraries.fonts.registry.FontMetrics; /** * Creation-Date: 15.12.2005, 11:29:22 * * @author Thomas Morgner */ public class CSSValueResolverUtility { public static final double DEFAULT_X_HEIGHT_FACTOR = 0.58; public static boolean isAbsoluteValue(final CSSNumericValue value) { if (CSSNumericType.PT.equals(value.getType())) { return true; } if (CSSNumericType.PC.equals(value.getType())) { return true; } if (CSSNumericType.INCH.equals(value.getType())) { return true; } if (CSSNumericType.CM.equals(value.getType())) { return true; } if (CSSNumericType.MM.equals(value.getType())) { return true; } // PX is relative to the device, so during a layouting process, it can // be considered absolute return CSSNumericType.PX.equals(value.getType()); } public static boolean isLengthValue(final CSSNumericValue value) { if (CSSNumericType.PT.equals(value.getType())) { return true; } if (CSSNumericType.PC.equals(value.getType())) { return true; } if (CSSNumericType.INCH.equals(value.getType())) { return true; } if (CSSNumericType.CM.equals(value.getType())) { return true; } if (CSSNumericType.MM.equals(value.getType())) { return true; } if (CSSNumericType.EM.equals(value.getType())) { return true; } if (CSSNumericType.EX.equals(value.getType())) { return true; } // PX is relative to the device, so during a layouting process, it can // be considered absolute return CSSNumericType.PX.equals(value.getType()); } public static double convertLengthToDouble(final CSSValue rawValue) { return convertLengthToDouble(rawValue, null, null); } /** * Returns the length in point as a double primitive value. * Be aware that using double-values is not very accurate. * * @param rawValue * @param context * @param metaData * @return */ public static strictfp double convertLengthToDouble(final CSSValue rawValue, final LayoutContext context, final OutputProcessorMetaData metaData) { if (rawValue instanceof CSSNumericValue == false) { return 0; } final CSSNumericValue value = (CSSNumericValue) rawValue; if (CSSNumericType.PT.equals(value.getType())) { return value.getValue(); } if (CSSNumericType.PC.equals(value.getType())) { return (value.getValue() / 12.0d); } if (CSSNumericType.INCH.equals(value.getType())) { return (value.getValue() / 72.0d); } if (CSSNumericType.CM.equals(value.getType())) { return ((value.getValue() * 100 * 72.0d) / 254.0d); } if (CSSNumericType.MM.equals(value.getType())) { return ((value.getValue() * 10 * 72.0d) / 254.0d); } if (CSSNumericType.PX.equals(value.getType())) { final int pixelPerInch; if (metaData != null) { pixelPerInch = (int) metaData.getNumericFeatureValue(OutputProcessorFeature.DEVICE_RESOLUTION); } else { pixelPerInch = 96; } if (pixelPerInch <= 0) { // we assume 72 pixel per inch ... return value.getValue(); } return value.getValue() * 72d / pixelPerInch; } if (metaData == null) { return 0; } if (context != null) { if (CSSNumericType.EM.equals(value.getType())) { final FontSpecification fspec = context.getFontSpecification(); final double fontSize = fspec.getFontSize(); return (fontSize * value.getValue()); } if (CSSNumericType.EX.equals(value.getType())) { final FontSpecification fspec = context.getFontSpecification(); final FontMetrics fontMetrics = metaData.getFontMetrics(fspec); if (fontMetrics == null) { final long fontSize = (long) (fspec.getFontSize() * DEFAULT_X_HEIGHT_FACTOR); return StrictGeomUtility.toExternalValue((long) (value.getValue() * fontSize)); } else { return StrictGeomUtility.toExternalValue((long) (value.getValue() * fontMetrics.getXHeight())); } } } return 0; } /** * Returns the length in point as a double primitive value. * * @param rawValue * @param context * @param metaData * @return */ public static strictfp long convertLengthToLong(final CSSValue rawValue, final LayoutContext context, final OutputProcessorMetaData metaData) { if (rawValue instanceof CSSNumericValue == false) { return 0; } final CSSNumericValue value = (CSSNumericValue) rawValue; final long internal = StrictGeomUtility.toInternalValue(value.getValue()); if (CSSNumericType.PT.equals(value.getType())) { return internal; } if (CSSNumericType.PC.equals(value.getType())) { return (internal / 12); } if (CSSNumericType.INCH.equals(value.getType())) { return (internal / 72); } if (CSSNumericType.CM.equals(value.getType())) { return (internal * 100 * 72 / 254); } if (CSSNumericType.MM.equals(value.getType())) { return (internal * 10 * 72 / 254); } if (CSSNumericType.PX.equals(value.getType())) { final int pixelPerInch; if (metaData != null) { pixelPerInch = (int) metaData.getNumericFeatureValue(OutputProcessorFeature.DEVICE_RESOLUTION); } else { pixelPerInch = 96; } if (pixelPerInch <= 0) { // we assume 72 pixel per inch ... return internal; } return internal * 72 / pixelPerInch; } if (metaData == null) { return 0; } if (context != null) { if (CSSNumericType.EM.equals(value.getType())) { final FontSpecification fspec = context.getFontSpecification(); final double fontSize = fspec.getFontSize(); return (long) (fontSize * internal); } if (CSSNumericType.EX.equals(value.getType())) { final FontSpecification fspec = context.getFontSpecification(); final FontMetrics fontMetrics = metaData.getFontMetrics(fspec); if (fontMetrics == null) { final long fontSize = (long) (fspec.getFontSize() * DEFAULT_X_HEIGHT_FACTOR); return StrictGeomUtility.multiply (internal, fontSize); } else { return StrictGeomUtility.multiply (internal, fontMetrics.getXHeight()); } } } return 0; } public static CSSNumericValue convertLength(final CSSValue rawValue, final LayoutContext context, final OutputProcessorMetaData metaData) { return CSSNumericValue.createValue(CSSNumericType.PT, convertLengthToDouble(rawValue, context, metaData)); } public static CSSNumericValue getLength(final CSSValue value) { if (value instanceof CSSNumericValue == false) { return null; } final CSSNumericValue nval = (CSSNumericValue) value; if (isNumericType(CSSNumericType.PERCENTAGE, nval)) { return null; } return nval; } private static boolean isNumericType(final CSSNumericType type, final CSSValue value) { if (value instanceof CSSNumericValue == false) { return false; } final CSSNumericValue nval = (CSSNumericValue) value; return nval.getType().equals(type); } public static CSSNumericValue getLength(final CSSValue value, final CSSNumericValue percentageBase) { if (value instanceof CSSNumericValue == false) { return null; } final CSSNumericValue nval = (CSSNumericValue) value; if (isNumericType(CSSNumericType.PERCENTAGE, nval)) { if (percentageBase == null) { return null; } final double percentage = nval.getValue(); return CSSNumericValue.createValue(percentageBase.getType(), percentageBase.getValue() * percentage / 100.0d); } return nval; } // // public static CSSNumericValue getParentFontSize(final LayoutElement node) // { // final LayoutElement parent = node.getParent(); // if (parent == null) // { // return null; // } // final long fs = // parent.getLayoutContext().getFontSpecification().getFontSize(); // return CSSNumericValue.createInternalValue(CSSNumericType.PT, fs); // } // public static boolean isURI(final CSSValue value) { if (value instanceof CSSStringValue == false) { return false; } final CSSStringValue sval = (CSSStringValue) value; return sval.getType().equals(CSSStringType.URI); } public static double getNumericValue(final CSSValue value, final double defaultValue) { if (value instanceof CSSNumericValue) { final CSSNumericValue nval = (CSSNumericValue) value; if (CSSNumericType.NUMBER.equals(nval.getType())) { return nval.getValue(); } } return defaultValue; } public static CSSNumericValue convertLength(final CSSNumericValue value, final CSSNumericType type) { if (type == CSSNumericType.NUMBER || type == CSSNumericType.PERCENTAGE || type == CSSNumericType.DEG) { throw new IllegalArgumentException(); } final CSSNumericType valueType = value.getType(); if (valueType == CSSNumericType.NUMBER || valueType == CSSNumericType.PERCENTAGE || valueType == CSSNumericType.DEG) { throw new IllegalArgumentException(); } if (valueType == type) { return value; } final double targetFactor = getFactor(type); final double sourceFactor = getFactor(valueType); final double unitvalue = value.getValue() * targetFactor / sourceFactor; return CSSNumericValue.createValue(type, unitvalue); } private static double getFactor (final CSSNumericType type) { for (int i = 0; i < types.length; i++) { final CSSNumericType numericType = types[i]; if (type == numericType) { return vals[i]; } } throw new IllegalArgumentException(); } private static CSSNumericType[] types = new CSSNumericType[]{ CSSNumericType.CM, CSSNumericType.MM, CSSNumericType.PX, CSSNumericType.PT, CSSNumericType.PC, CSSNumericType.INCH }; private static double[] vals = new double[]{ 254, // CM 2540, //MM 9600, // PX 7200, // PT 600, // PC 100 // Inch }; private CSSValueResolverUtility() { } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/LayoutStyleImpl.java 0000644 0001750 0001750 00000007210 11305540552 026426 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: LayoutStyleImpl.java 6489 2008-11-28 14:53:40Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.StyleKeyRegistry; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.LayoutStyle; /** * Unlike the old JFreeReport stylesheet, this implementation has no inheritance * at all. It needs to be resolved manually, which is no bad thing, as we have * to do this anyway during the computation. * * @author Thomas Morgner */ public final class LayoutStyleImpl implements LayoutStyle { private CSSValue[] values; private Object reference; public LayoutStyleImpl() { } public Object getReference() { return reference; } public void setReference(final Object reference) { this.reference = reference; } public synchronized CSSValue getValue(final StyleKey key) { if (values == null) { return null; } return values[key.getIndex()]; } public synchronized void setValue(final StyleKey key, final CSSValue value) { if (values == null) { values = new CSSValue[StyleKeyRegistry.getRegistry().getKeyCount()]; } values[key.getIndex()] = value; } // todo: Make sure we call dispose once the layout style goes out of context public synchronized void dispose() { } public synchronized LayoutStyleImpl createCopy() { final LayoutStyleImpl style = new LayoutStyleImpl(); if (values == null) { style.values = null; return style; } style.values = (CSSValue[]) values.clone(); return style; } public boolean isClean() { if (values == null) { return true; } for (int i = 0; i < values.length; i++) { if (values[i] != null) { return false; } } return true; } public boolean copyFrom(final LayoutStyle style) { if (style instanceof LayoutStyleImpl == false) { return false; } final LayoutStyleImpl rawstyle = (LayoutStyleImpl) style; if (rawstyle.values == null) { return true; } if (values == null) { values = (CSSValue[]) rawstyle.values.clone(); return true; } final int length = rawstyle.values.length; for (int i = 0; i < length; i++) { final CSSValue o = rawstyle.values[i]; if (o != null) { values[i] = o; } } return true; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/ 0000755 0001750 0001750 00000000000 11305540552 024304 5 ustar rene rene liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/ 0000755 0001750 0001750 00000000000 11305540552 026604 5 ustar rene rene liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/text/ 0000755 0001750 0001750 00000000000 11305540552 027570 5 ustar rene rene ././@LongLink 0000000 0000000 0000000 00000000166 00000000000 011570 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/text/LetterSpacingResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/text/LetterSpacingRe0000644 0001750 0001750 00000012133 11305540552 032546 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: LetterSpacingResolveHandler.java 6489 2008-11-28 14:53:40Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.percentages.text; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.util.geom.StrictGeomUtility; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.font.FontStyleKeys; import org.jfree.layouting.input.style.keys.text.TextStyleKeys; import org.jfree.layouting.input.style.values.CSSNumericType; import org.jfree.layouting.input.style.values.CSSNumericValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.FontSpecification; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.CSSValueResolverUtility; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; import org.pentaho.reporting.libraries.fonts.registry.FontMetrics; /** * Creation-Date: 21.12.2005, 15:12:04 * * @author Thomas Morgner */ public class LetterSpacingResolveHandler implements ResolveHandler { public LetterSpacingResolveHandler() { } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[] { FontStyleKeys.FONT_SIZE, FontStyleKeys.FONT_FAMILY, FontStyleKeys.FONT_EFFECT, FontStyleKeys.FONT_SMOOTH, FontStyleKeys.FONT_STRETCH, FontStyleKeys.FONT_VARIANT, FontStyleKeys.FONT_WEIGHT, }; } /** * Resolves a single property. * * @param currentNode */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { // Percentages get resolved against the width of a standard space (0x20) // character. final LayoutContext layoutContext = currentNode.getLayoutContext(); final FontSpecification fontSpecification = layoutContext.getFontSpecification(); final FontMetrics fm = process.getOutputMetaData().getFontMetrics(fontSpecification); if (fm == null) { // we have no font family, so return. layoutContext.setValue(TextStyleKeys.X_MIN_LETTER_SPACING, CSSNumericValue.ZERO_LENGTH); layoutContext.setValue(TextStyleKeys.X_MAX_LETTER_SPACING, CSSNumericValue.ZERO_LENGTH); layoutContext.setValue(TextStyleKeys.X_OPTIMUM_LETTER_SPACING, CSSNumericValue.ZERO_LENGTH); return; } final double width = StrictGeomUtility.toExternalValue(fm.getCharWidth(0x20)); final CSSNumericValue percentageBase = CSSNumericValue.createValue(CSSNumericType.PT, width); final CSSNumericValue min = CSSValueResolverUtility.getLength (resolveValue(layoutContext, TextStyleKeys.X_MIN_LETTER_SPACING), percentageBase); final CSSNumericValue max = CSSValueResolverUtility.getLength (resolveValue(layoutContext, TextStyleKeys.X_MAX_LETTER_SPACING), percentageBase); final CSSNumericValue opt = CSSValueResolverUtility.getLength (resolveValue(layoutContext, TextStyleKeys.X_OPTIMUM_LETTER_SPACING), percentageBase); layoutContext.setValue(TextStyleKeys.X_MIN_LETTER_SPACING, min); layoutContext.setValue(TextStyleKeys.X_MAX_LETTER_SPACING, max); layoutContext.setValue(TextStyleKeys.X_OPTIMUM_LETTER_SPACING, opt); } private CSSNumericValue resolveValue (final LayoutContext style, final StyleKey key) { final CSSValue value = style.getValue(key); if (value instanceof CSSNumericValue == false) { // this also covers the valid 'normal' property. // it simply means, dont add extra space to the already existing spaces return CSSNumericValue.ZERO_LENGTH; } return (CSSNumericValue) value; } } ././@LongLink 0000000 0000000 0000000 00000000163 00000000000 011565 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/text/TextIndentResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/text/TextIndentResol0000644 0001750 0001750 00000004746 11305540552 032621 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: TextIndentResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.percentages.text; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.font.FontStyleKeys; import org.jfree.layouting.input.style.keys.text.TextStyleKeys; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; /** * Creation-Date: 21.12.2005, 16:05:25 * * @author Thomas Morgner */ public class TextIndentResolveHandler implements ResolveHandler { public TextIndentResolveHandler() { } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[] { FontStyleKeys.FONT_SIZE_ADJUST, TextStyleKeys.BLOCK_PROGRESSION, FontStyleKeys.FONT_SIZE }; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { } } ././@LongLink 0000000 0000000 0000000 00000000164 00000000000 011566 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/text/WordSpacingResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/text/WordSpacingReso0000644 0001750 0001750 00000011735 11305540552 032573 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: WordSpacingResolveHandler.java 6489 2008-11-28 14:53:40Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.percentages.text; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.util.geom.StrictGeomUtility; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.font.FontStyleKeys; import org.jfree.layouting.input.style.keys.text.TextStyleKeys; import org.jfree.layouting.input.style.values.CSSNumericType; import org.jfree.layouting.input.style.values.CSSNumericValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.FontSpecification; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.CSSValueResolverUtility; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; import org.pentaho.reporting.libraries.fonts.registry.FontMetrics; import org.pentaho.reporting.libraries.base.util.DebugLog; /** * Creation-Date: 21.12.2005, 15:12:04 * * @author Thomas Morgner */ public class WordSpacingResolveHandler implements ResolveHandler { public WordSpacingResolveHandler() { } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[] { FontStyleKeys.FONT_SIZE, FontStyleKeys.FONT_FAMILY, FontStyleKeys.FONT_EFFECT, FontStyleKeys.FONT_SMOOTH, FontStyleKeys.FONT_STRETCH, FontStyleKeys.FONT_VARIANT, FontStyleKeys.FONT_WEIGHT, }; } /** * Resolves a single property. * * @param currentNode */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { // Percentages get resolved against the width of a standard space (0x20) // character. final LayoutContext layoutContext = currentNode.getLayoutContext(); final FontSpecification fontSpecification = layoutContext.getFontSpecification(); final FontMetrics fm = process.getOutputMetaData().getFontMetrics(fontSpecification); if (fm == null) { final CSSValue value = layoutContext.getValue(FontStyleKeys.FONT_FAMILY); DebugLog.log("FontFamily is " + value + " but has not been set?" + currentNode); return; } final double width = StrictGeomUtility.toExternalValue(fm.getCharWidth(0x20)); final CSSNumericValue percentageBase = CSSNumericValue.createValue(CSSNumericType.PT, width); final CSSNumericValue min = CSSValueResolverUtility.getLength (resolveValue(layoutContext, TextStyleKeys.X_MIN_WORD_SPACING), percentageBase); final CSSNumericValue max = CSSValueResolverUtility.getLength (resolveValue(layoutContext, TextStyleKeys.X_MAX_WORD_SPACING), percentageBase); final CSSNumericValue opt = CSSValueResolverUtility.getLength (resolveValue(layoutContext, TextStyleKeys.X_OPTIMUM_WORD_SPACING), percentageBase); layoutContext.setValue(TextStyleKeys.X_MIN_WORD_SPACING, min); layoutContext.setValue(TextStyleKeys.X_MAX_WORD_SPACING, max); layoutContext.setValue(TextStyleKeys.X_OPTIMUM_WORD_SPACING, opt); } private CSSNumericValue resolveValue (final LayoutContext style, final StyleKey key) { final CSSValue value = style.getValue(key); if (value instanceof CSSNumericValue == false) { // this also covers the valid 'normal' property. // it simply means, dont add extra space to the already existing spaces return CSSNumericValue.ZERO_LENGTH; } return (CSSNumericValue) value; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/line/ 0000755 0001750 0001750 00000000000 11305540552 027533 5 ustar rene rene ././@LongLink 0000000 0000000 0000000 00000000163 00000000000 011565 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/line/LineHeightResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/line/LineHeightResol0000644 0001750 0001750 00000012364 11305540552 032511 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: LineHeightResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.percentages.line; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.font.FontStyleKeys; import org.jfree.layouting.input.style.keys.line.LineHeight; import org.jfree.layouting.input.style.keys.line.LineStyleKeys; import org.jfree.layouting.input.style.values.CSSNumericType; import org.jfree.layouting.input.style.values.CSSNumericValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.CSSValueResolverUtility; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; public class LineHeightResolveHandler implements ResolveHandler { public LineHeightResolveHandler () { } /** * This indirectly defines the resolve order. The higher the order, the more dependent * is the resolver on other resolvers to be complete. * * @return the array of required style keys. */ public StyleKey[] getRequiredStyles () { return new StyleKey[] { FontStyleKeys.FONT_SIZE, FontStyleKeys.FONT_SIZE_ADJUST, }; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve (final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue value = layoutContext.getValue(key); if (LineHeight.NONE.equals(value)) { // query the anchestor, if there's one .. handleNone(currentNode); return; } if (LineHeight.NORMAL.equals(value)) { handleNormal(currentNode); return; } if (value instanceof CSSNumericValue == false) { // fall back to normal .. handleNormal(currentNode); return; } final CSSNumericValue nval = (CSSNumericValue) value; if (CSSValueResolverUtility.isLengthValue(nval)) { layoutContext.setValue(LineStyleKeys.LINE_HEIGHT, nval); return; } final double factor; if (nval.getType().equals(CSSNumericType.PERCENTAGE)) { factor = nval.getValue() / 100d; } else if (nval.getType().equals(CSSNumericType.NUMBER)) { factor = nval.getValue(); } else { handleNormal(currentNode); return; } final double fontSize = layoutContext.getFontSpecification().getFontSize(); layoutContext.setValue(LineStyleKeys.LINE_HEIGHT, CSSNumericValue.createValue(CSSNumericType.PT, fontSize * factor)); } private void handleNormal (final LayoutElement currentNode) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final double fontSize = layoutContext.getFontSpecification().getFontSize(); if (fontSize < 10) { layoutContext.setValue(LineStyleKeys.LINE_HEIGHT, CSSNumericValue.createValue(CSSNumericType.PT, fontSize * 1.2)); } else if (fontSize < 24) { layoutContext.setValue(LineStyleKeys.LINE_HEIGHT, CSSNumericValue.createValue(CSSNumericType.PT, fontSize * 1.1)); } else { layoutContext.setValue(LineStyleKeys.LINE_HEIGHT, CSSNumericValue.createValue(CSSNumericType.PT, fontSize * 1.05)); } } private void handleNone (final LayoutElement currentNode) { final double fontSize; final LayoutElement parent = currentNode.getParent(); final LayoutContext layoutContext = currentNode.getLayoutContext(); if (parent == null) { // fall back to normal; fontSize = layoutContext.getFontSpecification().getFontSize(); } else { fontSize = parent.getLayoutContext().getFontSpecification().getFontSize(); } layoutContext.setValue(LineStyleKeys.LINE_HEIGHT, CSSNumericValue.createValue(CSSNumericType.PT, fontSize)); } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/fonts/ 0000755 0001750 0001750 00000000000 11305540552 027735 5 ustar rene rene ././@LongLink 0000000 0000000 0000000 00000000164 00000000000 011566 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/fonts/FontSmoothResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/fonts/FontSmoothReso0000644 0001750 0001750 00000006561 11305540552 032621 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: FontSmoothResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.percentages.fonts; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.util.geom.StrictGeomUtility; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.font.FontSmooth; import org.jfree.layouting.input.style.keys.font.FontStyleKeys; import org.jfree.layouting.input.style.values.CSSNumericValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.CSSValueResolverUtility; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; /** * Creation-Date: 18.12.2005, 20:29:20 * * @author Thomas Morgner */ public class FontSmoothResolveHandler implements ResolveHandler { public FontSmoothResolveHandler() { } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[] { FontStyleKeys.FONT_SIZE }; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue value = layoutContext.getValue(key); if (value instanceof CSSNumericValue == false) { return; } final double fontSize = (currentNode.getLayoutContext().getFontSpecification().getFontSize()); final double length = CSSValueResolverUtility.convertLengthToDouble (value, currentNode.getLayoutContext(), process.getOutputMetaData()); if (fontSize < length) { layoutContext.setValue(FontStyleKeys.X_FONT_SMOOTH_FLAG, FontSmooth.NEVER); } else { layoutContext.setValue(FontStyleKeys.X_FONT_SMOOTH_FLAG, FontSmooth.ALWAYS); } } } ././@LongLink 0000000 0000000 0000000 00000000162 00000000000 011564 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/fonts/FontSizeResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/fonts/FontSizeResolv0000644 0001750 0001750 00000015427 11305540552 032625 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: FontSizeResolveHandler.java 6489 2008-11-28 14:53:40Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.percentages.fonts; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.LibLayoutBoot; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.values.CSSNumericType; import org.jfree.layouting.input.style.values.CSSNumericValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.FontSpecification; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.CSSValueResolverUtility; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; import org.pentaho.reporting.libraries.fonts.LibFontsDefaults; /** * Creation-Date: 18.12.2005, 18:06:23 * * @author Thomas Morgner */ public class FontSizeResolveHandler implements ResolveHandler { private double baseFontSize; public FontSizeResolveHandler() { baseFontSize = parseDouble ("org.jfree.layouting.defaults.FontSize", 12); } private double parseDouble(final String configKey, final double defaultValue) { final LibLayoutBoot boot = LibLayoutBoot.getInstance(); final String value = boot.getGlobalConfig().getConfigProperty(configKey); if (value == null) { return defaultValue; } try { return Double.parseDouble(value); } catch (final NumberFormatException nfe) { return defaultValue; } } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[0]; } public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue value = layoutContext.getValue(key); final LayoutElement parent = currentNode.getParent(); final FontSpecification fontSpecification = currentNode.getLayoutContext().getFontSpecification(); if (value instanceof CSSNumericValue == false) { if (parent == null) { fontSpecification.setFontSize(this.baseFontSize); layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PT, baseFontSize)); } else { final LayoutContext parentContext = parent.getLayoutContext(); final FontSpecification parentFont = parentContext.getFontSpecification(); final double fontSize = parentFont.getFontSize(); fontSpecification.setFontSize(fontSize); layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PT, fontSize)); } return; } final CSSNumericValue nval = (CSSNumericValue) value; if (CSSValueResolverUtility.isAbsoluteValue(nval)) { final CSSNumericValue fsize = CSSValueResolverUtility.convertLength (nval, currentNode.getLayoutContext(), process.getOutputMetaData()); final double fontSize = fsize.getValue(); fontSpecification.setFontSize(fontSize); layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PT, fontSize)); } // we encountered one of the relative values. else if (CSSNumericType.EM.equals(nval.getType())) { final double parentSize; if (parent == null) { parentSize = this.baseFontSize; } else { final LayoutContext parentContext = parent.getLayoutContext(); final FontSpecification parentFont = parentContext.getFontSpecification(); parentSize = parentFont.getFontSize(); } final double fontSize = parentSize * nval.getValue(); fontSpecification.setFontSize(fontSize); layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PT, fontSize)); } else if (CSSNumericType.EX.equals(nval.getType())) { final double parentSize; if (parent == null) { // if we have no parent, we create a fixed default value. parentSize = this.baseFontSize * LibFontsDefaults.DEFAULT_XHEIGHT_SIZE / LibFontsDefaults.DEFAULT_ASCENT_SIZE; } else { final LayoutContext parentContext = parent.getLayoutContext(); final FontSpecification parentFont = parentContext.getFontSpecification(); parentSize = parentFont.getFontSize(); } final double fontSize = parentSize * nval.getValue(); layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PT, fontSize)); fontSpecification.setFontSize(fontSize); } else if (CSSNumericType.PERCENTAGE.equals(nval.getType())) { final double parentSize; if (parent == null) { // if we have no parent, we create a fixed default value. parentSize = this.baseFontSize; } else { final LayoutContext parentContext = parent.getLayoutContext(); final FontSpecification parentFont = parentContext.getFontSpecification(); parentSize = parentFont.getFontSize(); } final double fontSize = parentSize * nval.getValue() / 100.0d; fontSpecification.setFontSize(fontSize); layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PT, fontSize)); } else { fontSpecification.setFontSize(this.baseFontSize); layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PT, this.baseFontSize)); } } } ././@LongLink 0000000 0000000 0000000 00000000170 00000000000 011563 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/fonts/MaxMinFontSizeResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/fonts/MaxMinFontSize0000644 0001750 0001750 00000005737 11305540552 032547 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: MaxMinFontSizeResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.percentages.fonts; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.font.FontStyleKeys; import org.jfree.layouting.input.style.values.CSSNumericValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.CSSValueResolverUtility; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; /** * Creation-Date: 21.12.2005, 12:53:36 * * @author Thomas Morgner */ public class MaxMinFontSizeResolveHandler implements ResolveHandler { public MaxMinFontSizeResolveHandler() { } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[] { FontStyleKeys.FONT_SIZE }; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue value = layoutContext.getValue(key); if (value instanceof CSSNumericValue == false) { // no limit .. return; } final CSSNumericValue size = CSSValueResolverUtility.convertLength (value, layoutContext, process.getOutputMetaData()); layoutContext.setValue(key, size); } } ././@LongLink 0000000 0000000 0000000 00000000170 00000000000 011563 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/fonts/FontSizeAdjustResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/fonts/FontSizeAdjust0000644 0001750 0001750 00000010114 11305540552 032571 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: FontSizeAdjustResolveHandler.java 6489 2008-11-28 14:53:40Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.percentages.fonts; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.util.geom.StrictGeomUtility; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.font.FontStyleKeys; import org.jfree.layouting.input.style.values.CSSNumericType; import org.jfree.layouting.input.style.values.CSSNumericValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.FontSpecification; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; import org.pentaho.reporting.libraries.fonts.registry.FontMetrics; /** * Creation-Date: 18.12.2005, 19:46:43 * * @author Thomas Morgner */ public class FontSizeAdjustResolveHandler implements ResolveHandler { public FontSizeAdjustResolveHandler() { } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[]{ FontStyleKeys.FONT_SIZE, FontStyleKeys.FONT_FAMILY, FontStyleKeys.FONT_EFFECT, FontStyleKeys.FONT_SMOOTH, FontStyleKeys.FONT_STRETCH, FontStyleKeys.FONT_VARIANT, FontStyleKeys.FONT_WEIGHT, }; } public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue value = layoutContext.getValue(key); if (value instanceof CSSNumericValue == false) { return; // do nothing } final CSSNumericValue nval = (CSSNumericValue) value; if (CSSNumericType.NUMBER.equals(nval.getType()) == false) { return; // syntax error, do nothing } final LayoutElement parent = currentNode.getParent(); if (parent == null) { return; // no parent to resolve against ... } final double adjustFactor = nval.getValue(); final FontSpecification fontSpecification = currentNode.getLayoutContext().getFontSpecification(); final FontMetrics fontMetrics = process.getOutputMetaData().getFontMetrics(fontSpecification); if (fontMetrics == null) { return; // no font metrics means no valid font... } final double actualFontXHeight = StrictGeomUtility.toExternalValue(fontMetrics.getXHeight()); final double fontSize = fontSpecification.getFontSize(); final double aspectRatio = actualFontXHeight / fontSize; final double result = (fontSize * (adjustFactor / aspectRatio)); fontSpecification.setFontSize(result); } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/ 0000755 0001750 0001750 00000000000 11305540552 026124 5 ustar rene rene liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/ 0000755 0001750 0001750 00000000000 11305540552 027110 5 ustar rene rene ././@LongLink 0000000 0000000 0000000 00000000163 00000000000 011565 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextTransformResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextTransformResol0000644 0001750 0001750 00000003624 11305540552 032665 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: TextTransformResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.text; import org.jfree.layouting.input.style.keys.text.TextTransform; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 21.12.2005, 15:12:04 * * @author Thomas Morgner */ public class TextTransformResolveHandler extends ConstantsResolveHandler { public TextTransformResolveHandler() { addNormalizeValue(TextTransform.CAPITALIZE); addNormalizeValue(TextTransform.LOWERCASE); addNormalizeValue(TextTransform.NONE); addNormalizeValue(TextTransform.UPPERCASE); setFallback(TextTransform.NONE); } } ././@LongLink 0000000 0000000 0000000 00000000157 00000000000 011570 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/WordBreakResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/WordBreakResolveHa0000644 0001750 0001750 00000003636 11305540552 032534 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: WordBreakResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.text; import org.jfree.layouting.input.style.keys.text.WordBreak; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 21.12.2005, 15:12:04 * * @author Thomas Morgner */ public class WordBreakResolveHandler extends ConstantsResolveHandler { public WordBreakResolveHandler() { addNormalizeValue(WordBreak.BREAK_ALL); addNormalizeValue(WordBreak.BREAK_STRICT); addNormalizeValue(WordBreak.KEEP_ALL); addNormalizeValue(WordBreak.LOOSE); addNormalizeValue(WordBreak.NORMAL); setFallback(WordBreak.NORMAL); } } ././@LongLink 0000000 0000000 0000000 00000000157 00000000000 011570 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextAlignResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextAlignResolveHa0000644 0001750 0001750 00000006006 11305540552 032545 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: TextAlignResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.text; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.text.TextAlign; import org.jfree.layouting.input.style.keys.text.TextStyleKeys; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.input.style.values.CSSStringValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 21.12.2005, 14:17:42 * * @author Thomas Morgner */ public class TextAlignResolveHandler extends ConstantsResolveHandler { public TextAlignResolveHandler() { addNormalizeValue(TextAlign.CENTER); addNormalizeValue(TextAlign.END); addNormalizeValue(TextAlign.JUSTIFY); addNormalizeValue(TextAlign.LEFT); addNormalizeValue(TextAlign.RIGHT); addNormalizeValue(TextAlign.START); setFallback(TextAlign.START); } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue value = layoutContext.getValue(key); if (value instanceof CSSStringValue) { // this is a sub-string alignment. return; } final CSSConstant alignValue = (CSSConstant) resolveValue(process, currentNode, key); layoutContext.setValue(TextStyleKeys.TEXT_ALIGN, alignValue); } } ././@LongLink 0000000 0000000 0000000 00000000171 00000000000 011564 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextDecorationWidthResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextDecorationWidt0000644 0001750 0001750 00000006511 11305540552 032622 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: TextDecorationWidthResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.text; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.border.BorderWidth; import org.jfree.layouting.input.style.keys.font.FontStyleKeys; import org.jfree.layouting.input.style.keys.text.TextDecorationWidth; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.input.style.values.CSSNumericType; import org.jfree.layouting.input.style.values.CSSNumericValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; public class TextDecorationWidthResolveHandler extends ConstantsResolveHandler { public TextDecorationWidthResolveHandler () { addValue(BorderWidth.THIN, CSSNumericValue.createValue(CSSNumericType.PT, 0.5)); addValue(BorderWidth.MEDIUM, CSSNumericValue.createValue(CSSNumericType.PT, 1)); addValue(BorderWidth.THICK, CSSNumericValue.createValue(CSSNumericType.PT, 1.5)); addValue(TextDecorationWidth.DASH, CSSNumericValue.createValue(CSSNumericType.PT, 0.75)); addValue(TextDecorationWidth.BOLD, CSSNumericValue.createValue(CSSNumericType.PT, 1.25)); setFallback(CSSNumericValue.ZERO_LENGTH); } /** * This indirectly defines the resolve order. The higher the order, the more dependent * is the resolver on other resolvers to be complete. * * @return the array of required style keys. */ public StyleKey[] getRequiredStyles () { return new StyleKey[] { FontStyleKeys.FONT_SIZE }; } protected CSSValue resolveValue (final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final CSSValue value = currentNode.getLayoutContext().getValue(key); if (value instanceof CSSConstant) { return super.resolveValue(process, currentNode, key); } return value; } } ././@LongLink 0000000 0000000 0000000 00000000161 00000000000 011563 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextJustifyResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextJustifyResolve0000644 0001750 0001750 00000003763 11305540552 032706 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: TextJustifyResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.text; import org.jfree.layouting.input.style.keys.text.TextJustify; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 21.12.2005, 14:54:02 * * @author Thomas Morgner */ public class TextJustifyResolveHandler extends ConstantsResolveHandler { public TextJustifyResolveHandler() { addNormalizeValue(TextJustify.INTER_CHARACTER); addNormalizeValue(TextJustify.INTER_CLUSTER); addNormalizeValue(TextJustify.INTER_IDEOGRAPH); addNormalizeValue(TextJustify.INTER_WORD); addNormalizeValue(TextJustify.KASHIDA); addNormalizeValue(TextJustify.SIZE); setFallback(TextJustify.INTER_WORD); } } ././@LongLink 0000000 0000000 0000000 00000000156 00000000000 011567 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextWrapResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextWrapResolveHan0000644 0001750 0001750 00000003550 11305540552 032603 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: TextWrapResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.text; import org.jfree.layouting.input.style.keys.text.TextWrap; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 21.12.2005, 15:12:04 * * @author Thomas Morgner */ public class TextWrapResolveHandler extends ConstantsResolveHandler { public TextWrapResolveHandler() { addNormalizeValue(TextWrap.NONE); addNormalizeValue(TextWrap.NORMAL); addNormalizeValue(TextWrap.SUPPRESS); addNormalizeValue(TextWrap.UNRESTRICTED); setFallback(TextWrap.NORMAL); } } ././@LongLink 0000000 0000000 0000000 00000000166 00000000000 011570 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/BlockProgressionResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/BlockProgressionRe0000644 0001750 0001750 00000003552 11305540552 032614 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: BlockProgressionResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.text; import org.jfree.layouting.input.style.keys.text.BlockProgression; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 21.12.2005, 15:07:34 * * @author Thomas Morgner */ public class BlockProgressionResolveHandler extends ConstantsResolveHandler { public BlockProgressionResolveHandler() { addNormalizeValue(BlockProgression.LR); addNormalizeValue(BlockProgression.RL); addNormalizeValue(BlockProgression.TB); setFallback(BlockProgression.TB); } } ././@LongLink 0000000 0000000 0000000 00000000166 00000000000 011570 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextOverflowModeResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextOverflowModeRe0000644 0001750 0001750 00000003577 11305540552 032613 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: TextOverflowModeResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.text; import org.jfree.layouting.input.style.keys.text.TextOverflowMode; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 21.12.2005, 16:48:23 * * @author Thomas Morgner */ public class TextOverflowModeResolveHandler extends ConstantsResolveHandler { public TextOverflowModeResolveHandler() { addNormalizeValue(TextOverflowMode.CLIP); addNormalizeValue(TextOverflowMode.ELLIPSIS); addNormalizeValue(TextOverflowMode.ELLIPSIS_WORD); setFallback(TextOverflowMode.CLIP); } } ././@LongLink 0000000 0000000 0000000 00000000172 00000000000 011565 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextOverflowEllipsisResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextOverflowEllips0000644 0001750 0001750 00000007463 11305540552 032666 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: TextOverflowEllipsisResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.text; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.text.TextStyleKeys; import org.jfree.layouting.input.style.values.CSSStringType; import org.jfree.layouting.input.style.values.CSSStringValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.input.style.values.CSSValueList; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; /** * Creation-Date: 21.12.2005, 16:48:23 * * @author Thomas Morgner */ public class TextOverflowEllipsisResolveHandler implements ResolveHandler { public TextOverflowEllipsisResolveHandler() { } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[0]; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue value = layoutContext.getValue(key); CSSStringValue lineEllipsis = null; CSSStringValue blockEllipsis = null; if (value instanceof CSSValueList) { final CSSValueList vlist = (CSSValueList) value; if (vlist.getLength() == 2) { lineEllipsis = filterString(vlist.getItem(0)); blockEllipsis = filterString(vlist.getItem(1)); } else if (vlist.getLength() == 1) { lineEllipsis = filterString(vlist.getItem(0)); blockEllipsis = filterString(vlist.getItem(0)); } } if (lineEllipsis == null) { lineEllipsis = new CSSStringValue(CSSStringType.STRING, ".."); } if (blockEllipsis == null) { blockEllipsis = new CSSStringValue(CSSStringType.STRING, ".."); } layoutContext.setValue(TextStyleKeys.X_BLOCK_TEXT_OVERFLOW_ELLIPSIS, blockEllipsis); layoutContext.setValue(TextStyleKeys.X_LINE_TEXT_OVERFLOW_ELLIPSIS, lineEllipsis); } private CSSStringValue filterString (final CSSValue value) { if (value instanceof CSSStringValue == false) { return null; } return (CSSStringValue) value; } } ././@LongLink 0000000 0000000 0000000 00000000166 00000000000 011570 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextKashidaSpaceResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextKashidaSpaceRe0000644 0001750 0001750 00000006265 11305540552 032520 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: TextKashidaSpaceResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.text; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.text.TextStyleKeys; import org.jfree.layouting.input.style.values.CSSNumericType; import org.jfree.layouting.input.style.values.CSSNumericValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; /** * Creation-Date: 21.12.2005, 15:00:43 * * @author Thomas Morgner */ public class TextKashidaSpaceResolveHandler implements ResolveHandler { public TextKashidaSpaceResolveHandler() { } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[0]; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue value = layoutContext.getValue(key); if ((value instanceof CSSNumericValue) == false) { return; } final CSSNumericValue nval = (CSSNumericValue) value; if (CSSNumericType.PERCENTAGE.equals(nval.getType()) == false) { return; } double percentage = nval.getValue(); if (percentage < 0) { percentage = 0; } if (percentage > 100) { percentage = 100; } layoutContext.setValue(TextStyleKeys.TEXT_KASHIDA_SPACE, CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, percentage)); } } ././@LongLink 0000000 0000000 0000000 00000000170 00000000000 011563 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/WhitespaceCollapseResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/WhitespaceCollapse0000644 0001750 0001750 00000003714 11305540552 032617 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: WhitespaceCollapseResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.text; import org.jfree.layouting.input.style.keys.text.WhitespaceCollapse; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 21.12.2005, 15:12:04 * * @author Thomas Morgner */ public class WhitespaceCollapseResolveHandler extends ConstantsResolveHandler { public WhitespaceCollapseResolveHandler() { addNormalizeValue(WhitespaceCollapse.COLLAPSE); addNormalizeValue(WhitespaceCollapse.DISCARD); addNormalizeValue(WhitespaceCollapse.PRESERVE); addNormalizeValue(WhitespaceCollapse.PRESERVE_BREAKS); setFallback(WhitespaceCollapse.COLLAPSE); } } ././@LongLink 0000000 0000000 0000000 00000000163 00000000000 011565 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextAlignLastResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextAlignLastResol0000644 0001750 0001750 00000003701 11305540552 032564 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: TextAlignLastResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.text; import org.jfree.layouting.input.style.keys.text.TextAlign; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 21.12.2005, 14:17:42 * * @author Thomas Morgner */ public class TextAlignLastResolveHandler extends ConstantsResolveHandler { public TextAlignLastResolveHandler() { addNormalizeValue(TextAlign.CENTER); addNormalizeValue(TextAlign.END); addNormalizeValue(TextAlign.JUSTIFY); addNormalizeValue(TextAlign.LEFT); addNormalizeValue(TextAlign.RIGHT); addNormalizeValue(TextAlign.START); setFallback(TextAlign.START); } } ././@LongLink 0000000 0000000 0000000 00000000165 00000000000 011567 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextJustifyTrimResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextJustifyTrimRes0000644 0001750 0001750 00000003601 11305540552 032643 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: TextJustifyTrimResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.text; import org.jfree.layouting.input.style.keys.text.TextJustifyTrim; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 21.12.2005, 14:54:02 * * @author Thomas Morgner */ public class TextJustifyTrimResolveHandler extends ConstantsResolveHandler { public TextJustifyTrimResolveHandler() { addNormalizeValue(TextJustifyTrim.NONE); addNormalizeValue(TextJustifyTrim.PUNCTUATION); addNormalizeValue(TextJustifyTrim.PUNCTUATION_AND_KANA); setFallback(TextJustifyTrim.NONE); } } ././@LongLink 0000000 0000000 0000000 00000000156 00000000000 011567 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/WordWrapResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/WordWrapResolveHan0000644 0001750 0001750 00000003425 11305540552 032573 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: WordWrapResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.text; import org.jfree.layouting.input.style.keys.text.WordWrap; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 21.12.2005, 15:12:04 * * @author Thomas Morgner */ public class WordWrapResolveHandler extends ConstantsResolveHandler { public WordWrapResolveHandler() { addNormalizeValue(WordWrap.BREAK_WORD); addNormalizeValue(WordWrap.NORMAL); setFallback(WordWrap.NORMAL); } } ././@LongLink 0000000 0000000 0000000 00000000157 00000000000 011570 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/DirectionResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/DirectionResolveHa0000644 0001750 0001750 00000003420 11305540552 032563 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: DirectionResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.text; import org.jfree.layouting.input.style.keys.text.Direction; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 21.12.2005, 15:07:34 * * @author Thomas Morgner */ public class DirectionResolveHandler extends ConstantsResolveHandler { public DirectionResolveHandler() { addNormalizeValue(Direction.LTR); addNormalizeValue(Direction.RTL); setFallback(Direction.LTR); } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/line/ 0000755 0001750 0001750 00000000000 11305540552 027053 5 ustar rene rene ././@LongLink 0000000 0000000 0000000 00000000163 00000000000 011565 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/line/VerticalAlignResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/line/VerticalAlignResol0000644 0001750 0001750 00000004131 11305540552 032526 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: VerticalAlignResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.line; import org.jfree.layouting.input.style.keys.line.VerticalAlign; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; public class VerticalAlignResolveHandler extends ConstantsResolveHandler { public VerticalAlignResolveHandler () { addNormalizeValue(VerticalAlign.BASELINE); addNormalizeValue(VerticalAlign.BOTTOM); addNormalizeValue(VerticalAlign.CENTRAL); addNormalizeValue(VerticalAlign.MIDDLE); addNormalizeValue(VerticalAlign.SUB); addNormalizeValue(VerticalAlign.SUPER); addNormalizeValue(VerticalAlign.TEXT_BOTTOM); addNormalizeValue(VerticalAlign.TEXT_TOP); addNormalizeValue(VerticalAlign.TOP); // we do not detect scripts right now ... setFallback(VerticalAlign.BASELINE); } } ././@LongLink 0000000 0000000 0000000 00000000160 00000000000 011562 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/line/TextHeightResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/line/TextHeightResolveH0000644 0001750 0001750 00000003412 11305540552 032523 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: TextHeightResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.line; import org.jfree.layouting.input.style.keys.line.TextHeight; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; public class TextHeightResolveHandler extends ConstantsResolveHandler { public TextHeightResolveHandler () { addNormalizeValue(TextHeight.FONT_SIZE); addNormalizeValue(TextHeight.MAX_SIZE); addNormalizeValue(TextHeight.TEXT_SIZE); setFallback(TextHeight.FONT_SIZE); } } ././@LongLink 0000000 0000000 0000000 00000000172 00000000000 011565 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/line/LineStackingStrategyResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/line/LineStackingStrate0000644 0001750 0001750 00000003665 11305540552 032546 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: LineStackingStrategyResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.line; import org.jfree.layouting.input.style.keys.line.LineStackingStrategy; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; public class LineStackingStrategyResolveHandler extends ConstantsResolveHandler { public LineStackingStrategyResolveHandler () { addNormalizeValue(LineStackingStrategy.BLOCK_LINE_HEIGHT); addNormalizeValue(LineStackingStrategy.GRID_HEIGHT); addNormalizeValue(LineStackingStrategy.INLINE_LINE_HEIGHT); addNormalizeValue(LineStackingStrategy.MAX_LINE_HEIGHT); setFallback(LineStackingStrategy.INLINE_LINE_HEIGHT); } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/ 0000755 0001750 0001750 00000000000 11305540552 027401 5 ustar rene rene ././@LongLink 0000000 0000000 0000000 00000000167 00000000000 011571 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundBreakResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundBreakR0000644 0001750 0001750 00000003530 11305540552 032473 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: BackgroundBreakResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.border; import org.jfree.layouting.input.style.keys.border.BackgroundBreak; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 14.12.2005, 23:24:55 * * @author Thomas Morgner */ public class BackgroundBreakResolveHandler extends ConstantsResolveHandler { public BackgroundBreakResolveHandler() { addNormalizeValue(BackgroundBreak.BOUNDING_BOX); addNormalizeValue(BackgroundBreak.CONTINUOUS); addNormalizeValue(BackgroundBreak.EACH_BOX); } } ././@LongLink 0000000 0000000 0000000 00000000163 00000000000 011565 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BorderWidthResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BorderWidthResol0000644 0001750 0001750 00000010625 11305540552 032552 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: BorderWidthResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.border; import java.util.HashMap; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.border.BorderStyle; import org.jfree.layouting.input.style.keys.border.BorderStyleKeys; import org.jfree.layouting.input.style.keys.border.BorderWidth; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.input.style.values.CSSNumericType; import org.jfree.layouting.input.style.values.CSSNumericValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 11.12.2005, 22:20:16 * * @author Thomas Morgner */ public class BorderWidthResolveHandler extends ConstantsResolveHandler { private HashMap keyMapping; public BorderWidthResolveHandler() { keyMapping = new HashMap(); keyMapping.put(BorderStyleKeys.BORDER_TOP_WIDTH, BorderStyleKeys.BORDER_TOP_STYLE); keyMapping.put(BorderStyleKeys.BORDER_LEFT_WIDTH, BorderStyleKeys.BORDER_LEFT_STYLE); keyMapping.put(BorderStyleKeys.BORDER_BOTTOM_WIDTH, BorderStyleKeys.BORDER_BOTTOM_STYLE); keyMapping.put(BorderStyleKeys.BORDER_RIGHT_WIDTH, BorderStyleKeys.BORDER_RIGHT_STYLE); keyMapping.put(BorderStyleKeys.BORDER_BREAK_WIDTH, BorderStyleKeys.BORDER_BREAK_STYLE); addValue(BorderWidth.THIN, CSSNumericValue.createValue(CSSNumericType.PT, 1)); addValue(BorderWidth.MEDIUM, CSSNumericValue.createValue(CSSNumericType.PT, 3)); addValue(BorderWidth.THICK, CSSNumericValue.createValue(CSSNumericType.PT, 5)); setFallback(CSSNumericValue.ZERO_LENGTH); } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return the array of required style keys. */ public StyleKey[] getRequiredStyles() { return new StyleKey[] { BorderStyleKeys.BORDER_TOP_STYLE, BorderStyleKeys.BORDER_LEFT_STYLE, BorderStyleKeys.BORDER_BOTTOM_STYLE, BorderStyleKeys.BORDER_RIGHT_STYLE, BorderStyleKeys.BORDER_BREAK_STYLE }; } protected CSSValue resolveValue (final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final StyleKey borderStyleKey = (StyleKey) keyMapping.get(key); if (borderStyleKey == null) { // invalid throw new IllegalArgumentException("This is not a valid key: " + key); } final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue borderStyle = layoutContext.getValue(borderStyleKey); if (BorderStyle.NONE.equals(borderStyle)) { return CSSNumericValue.ZERO_LENGTH; } final CSSValue value = layoutContext.getValue(key); if (value instanceof CSSConstant) { return super.resolveValue(process, currentNode, key); } return value; } } ././@LongLink 0000000 0000000 0000000 00000000167 00000000000 011571 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundImageResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundImageR0000644 0001750 0001750 00000010545 11305540552 032475 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: BackgroundImageResolveHandler.java 6489 2008-11-28 14:53:40Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.border; import org.jfree.layouting.DocumentContextUtility; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.values.CSSStringValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.input.style.values.CSSValueList; import org.jfree.layouting.layouter.context.BackgroundSpecification; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.CSSValueResolverUtility; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; import org.jfree.layouting.output.OutputProcessorFeature; import org.pentaho.reporting.libraries.resourceloader.ResourceKey; import org.pentaho.reporting.libraries.resourceloader.ResourceKeyCreationException; /** * Creation-Date: 14.12.2005, 13:17:40 * * @author Thomas Morgner */ public class BackgroundImageResolveHandler implements ResolveHandler { public BackgroundImageResolveHandler() { } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[0]; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { // start loading all images, assume that they are found and include them // in the list. if (process.getOutputMetaData().isFeatureSupported (OutputProcessorFeature.BACKGROUND_IMAGE) == false) { return; } final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue value = layoutContext.getValue(key); if (value == null) { return; } if (value instanceof CSSValueList == false) { return; } final CSSValueList list = (CSSValueList) value; final int length = list.getLength(); if (length == 0) { return; } final BackgroundSpecification backgroundSpecification = layoutContext.getBackgroundSpecification(); final ResourceKey baseURL = DocumentContextUtility.getBaseResource (process.getDocumentContext()); for (int i = 0; i < length; i++) { final CSSValue item = list.getItem(i); if (CSSValueResolverUtility.isURI(item)) { final CSSStringValue svalue = (CSSStringValue) item; try { final ResourceKey sourceURL = process.getResourceManager().deriveKey (baseURL, svalue.getValue()); // todo: We have to rethink the image feeding .. // backgroundSpecification.setBackgroundImage // (i, new URLLayoutImageData(sourceURL, svalue.getValue())); } catch (ResourceKeyCreationException e) { e.printStackTrace(); } } } } } ././@LongLink 0000000 0000000 0000000 00000000170 00000000000 011563 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundRepeatResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundRepeat0000644 0001750 0001750 00000007046 11305540552 032553 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: BackgroundRepeatResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.border; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.border.BackgroundRepeat; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.input.style.values.CSSValueList; import org.jfree.layouting.input.style.values.CSSValuePair; import org.jfree.layouting.layouter.context.BackgroundSpecification; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; /** * Creation-Date: 11.12.2005, 23:46:01 * * @author Thomas Morgner */ public class BackgroundRepeatResolveHandler implements ResolveHandler { private static final CSSValuePair EMPTY_BACKGROUND_REPEAT = new CSSValuePair(BackgroundRepeat.REPEAT, BackgroundRepeat.REPEAT); public BackgroundRepeatResolveHandler() { } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[0]; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final CSSValue value = currentNode.getLayoutContext().getValue(key); if (value == null) { return; } if (value instanceof CSSValueList == false) { return; } final CSSValueList list = (CSSValueList) value; final int length = list.getLength(); if (length == 0) { return; } final BackgroundSpecification backgroundSpecification = currentNode.getLayoutContext().getBackgroundSpecification(); for (int i = 0; i < length; i++) { final CSSValue item = list.getItem(i); if (item instanceof CSSValuePair == false) { backgroundSpecification.setBackgroundRepeat (i, EMPTY_BACKGROUND_REPEAT); } else { final CSSValuePair bvalue = (CSSValuePair) item; backgroundSpecification.setBackgroundRepeat(i, bvalue); } } } } ././@LongLink 0000000 0000000 0000000 00000000166 00000000000 011570 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundClipResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundClipRe0000644 0001750 0001750 00000005527 11305540552 032513 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: BackgroundClipResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.border; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.border.BackgroundClip; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.layouter.context.BackgroundSpecification; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.computed.ListOfConstantsResolveHandler; /** * Creation-Date: 11.12.2005, 23:46:01 * * @author Thomas Morgner */ public class BackgroundClipResolveHandler extends ListOfConstantsResolveHandler { public BackgroundClipResolveHandler() { addNormalizeValue(BackgroundClip.BORDER); addNormalizeValue(BackgroundClip.PADDING); } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[0]; } protected boolean resolveItem(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key, final int index, final CSSConstant item) { final CSSConstant bvalue = (CSSConstant) lookupValue(item); final BackgroundSpecification backgroundSpecification = currentNode.getLayoutContext().getBackgroundSpecification(); backgroundSpecification.setBackgroundClip(index, bvalue); return true; } } ././@LongLink 0000000 0000000 0000000 00000000163 00000000000 011565 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BorderStyleResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BorderStyleResol0000644 0001750 0001750 00000004404 11305540552 032571 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: BorderStyleResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.border; import org.jfree.layouting.input.style.keys.border.BorderStyle; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 14.12.2005, 23:27:55 * * @author Thomas Morgner */ public class BorderStyleResolveHandler extends ConstantsResolveHandler { public BorderStyleResolveHandler() { addNormalizeValue(BorderStyle.DASHED); addNormalizeValue(BorderStyle.DOT_DASH); addNormalizeValue(BorderStyle.DOT_DOT_DASH); addNormalizeValue(BorderStyle.DOTTED); addNormalizeValue(BorderStyle.DOUBLE); addNormalizeValue(BorderStyle.GROOVE); addNormalizeValue(BorderStyle.HIDDEN); addNormalizeValue(BorderStyle.INSET); addNormalizeValue(BorderStyle.NONE); addNormalizeValue(BorderStyle.OUTSET); addNormalizeValue(BorderStyle.RIDGE); addNormalizeValue(BorderStyle.SOLID); addNormalizeValue(BorderStyle.WAVE); setFallback(BorderStyle.NONE); } } ././@LongLink 0000000 0000000 0000000 00000000174 00000000000 011567 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundAttachmentResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundAttach0000644 0001750 0001750 00000005662 11305540552 032541 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: BackgroundAttachmentResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.border; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.border.BackgroundAttachment; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.layouter.context.BackgroundSpecification; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.computed.ListOfConstantsResolveHandler; /** * Creation-Date: 11.12.2005, 23:46:01 * * @author Thomas Morgner */ public class BackgroundAttachmentResolveHandler extends ListOfConstantsResolveHandler { public BackgroundAttachmentResolveHandler() { addNormalizeValue(BackgroundAttachment.FIXED); addNormalizeValue(BackgroundAttachment.LOCAL); addNormalizeValue(BackgroundAttachment.SCROLL); } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[0]; } protected boolean resolveItem(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key, final int index, final CSSConstant item) { final CSSConstant bvalue = (CSSConstant) lookupValue(item); final BackgroundSpecification backgroundSpecification = currentNode.getLayoutContext().getBackgroundSpecification(); backgroundSpecification.setBackgroundAttachment(index, bvalue); return true; } } ././@LongLink 0000000 0000000 0000000 00000000170 00000000000 011563 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundOriginResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundOrigin0000644 0001750 0001750 00000005626 11305540552 032564 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: BackgroundOriginResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.border; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.border.BackgroundOrigin; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.layouter.context.BackgroundSpecification; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.computed.ListOfConstantsResolveHandler; /** * Creation-Date: 11.12.2005, 23:46:01 * * @author Thomas Morgner */ public class BackgroundOriginResolveHandler extends ListOfConstantsResolveHandler { public BackgroundOriginResolveHandler() { addNormalizeValue(BackgroundOrigin.BORDER); addNormalizeValue(BackgroundOrigin.PADDING); addNormalizeValue(BackgroundOrigin.CONTENT); } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[0]; } protected boolean resolveItem(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key, final int index, final CSSConstant item) { final CSSConstant bvalue = (CSSConstant) lookupValue(item); final BackgroundSpecification backgroundSpecification = currentNode.getLayoutContext().getBackgroundSpecification(); backgroundSpecification.setBackgroundOrigin(index, bvalue); return true; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/page/ 0000755 0001750 0001750 00000000000 11305540552 027040 5 ustar rene rene ././@LongLink 0000000 0000000 0000000 00000000156 00000000000 011567 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/page/PageSizeResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/page/PageSizeResolveHan0000644 0001750 0001750 00000007274 11305540552 032473 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: PageSizeResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.page; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.page.PageSize; import org.jfree.layouting.input.style.keys.page.PageSizeFactory; import org.jfree.layouting.input.style.keys.page.PageStyleKeys; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.input.style.values.CSSNumericValue; import org.jfree.layouting.input.style.values.CSSStringValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.input.style.values.CSSValuePair; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; /** * Creation-Date: 16.06.2006, 13:56:31 * * @author Thomas Morgner */ public class PageSizeResolveHandler implements ResolveHandler { public PageSizeResolveHandler() { } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return the array of required style keys. */ public StyleKey[] getRequiredStyles() { return new StyleKey[0]; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue value = layoutContext.getValue(PageStyleKeys.SIZE); String name = null; if (value instanceof CSSStringValue) { final CSSStringValue sval = (CSSStringValue) value; name = sval.getValue(); } else if (value instanceof CSSConstant) { name = value.toString(); } PageSize ps = null; if (name != null) { ps = PageSizeFactory.getInstance().getPageSizeByName(name); } if (ps == null) { ps = process.getOutputMetaData().getDefaultPageSize(); } // if it is stll null, then the output target is not valid. // We will crash in that case .. final CSSValue page = new CSSValuePair(CSSNumericValue.createPtValue(ps.getWidth()), CSSNumericValue.createPtValue(ps.getHeight())); layoutContext.setValue(PageStyleKeys.SIZE, page); } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/hyperlinks/ 0000755 0001750 0001750 00000000000 11305540552 030314 5 ustar rene rene ././@LongLink 0000000 0000000 0000000 00000000166 00000000000 011570 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/hyperlinks/TargetNameResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/hyperlinks/TargetNameRe0000644 0001750 0001750 00000005655 11305540552 032570 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: TargetNameResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.hyperlinks; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.hyperlinks.TargetName; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.input.style.values.CSSStringValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 21.12.2005, 11:32:33 * * @author Thomas Morgner */ public class TargetNameResolveHandler extends ConstantsResolveHandler { public TargetNameResolveHandler() { addNormalizeValue(TargetName.CURRENT); addNormalizeValue(TargetName.MODAL); addNormalizeValue(TargetName.NEW); addNormalizeValue(TargetName.PARENT); addNormalizeValue(TargetName.ROOT); setFallback(TargetName.CURRENT); } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue value = layoutContext.getValue(key); if (value instanceof CSSConstant) { super.resolve(process, currentNode, key); } else if (value instanceof CSSStringValue) { // do nothing, accept it as is... } else { layoutContext.setValue(key, getFallback()); } } } ././@LongLink 0000000 0000000 0000000 00000000172 00000000000 011565 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/hyperlinks/TargetPositionResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/hyperlinks/TargetPositi0000644 0001750 0001750 00000003640 11305540552 032660 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: TargetPositionResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.hyperlinks; import org.jfree.layouting.input.style.keys.hyperlinks.TargetPosition; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 21.12.2005, 11:36:34 * * @author Thomas Morgner */ public class TargetPositionResolveHandler extends ConstantsResolveHandler { public TargetPositionResolveHandler() { addNormalizeValue(TargetPosition.ABOVE); addNormalizeValue(TargetPosition.BACK); addNormalizeValue(TargetPosition.BEHIND); addNormalizeValue(TargetPosition.FRONT); setFallback(TargetPosition.ABOVE); } } ././@LongLink 0000000 0000000 0000000 00000000165 00000000000 011567 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/hyperlinks/TargetNewResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/hyperlinks/TargetNewRes0000644 0001750 0001750 00000003512 11305540552 032612 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: TargetNewResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.hyperlinks; import org.jfree.layouting.input.style.keys.hyperlinks.TargetNew; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 21.12.2005, 11:36:34 * * @author Thomas Morgner */ public class TargetNewResolveHandler extends ConstantsResolveHandler { public TargetNewResolveHandler() { addNormalizeValue(TargetNew.NONE); addNormalizeValue(TargetNew.TAB); addNormalizeValue(TargetNew.WINDOW); setFallback(TargetNew.WINDOW); } } ././@LongLink 0000000 0000000 0000000 00000000160 00000000000 011562 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/ListOfConstantsResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/ListOfConstantsResolveH0000644 0001750 0001750 00000006665 11305540552 032631 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: ListOfConstantsResolveHandler.java 6489 2008-11-28 14:53:40Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.input.style.values.CSSValueList; import org.jfree.layouting.layouter.model.LayoutElement; import org.pentaho.reporting.libraries.base.util.DebugLog; /** * Creation-Date: 14.12.2005, 23:08:14 * * @author Thomas Morgner */ public abstract class ListOfConstantsResolveHandler extends ConstantsResolveHandler { public ListOfConstantsResolveHandler() { } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final CSSValue value = currentNode.getLayoutContext().getValue(key); if (value == null) { return; } if (value instanceof CSSValueList == false) { return; } final CSSValueList list = (CSSValueList) value; final int length = list.getLength(); if (length == 0) { return; } for (int i = 0; i < length; i++) { final CSSValue item = list.getItem(i); if (item instanceof CSSConstant == false) { resolveInvalidItem(process, currentNode, key, i); } else { resolveItem(process, currentNode, key, i, (CSSConstant) item); } } } protected void resolveInvalidItem (final LayoutProcess process, final LayoutElement currentNode, final StyleKey key, final int index) { DebugLog.log("Encountered invalid item in Style " + key + " at index " + index); } protected abstract boolean resolveItem(final LayoutProcess process, LayoutElement currentNode, StyleKey key, int index, CSSConstant item); } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/color/ 0000755 0001750 0001750 00000000000 11305540552 027242 5 ustar rene rene ././@LongLink 0000000 0000000 0000000 00000000154 00000000000 011565 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/color/ColorResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/color/ColorResolveHandl0000644 0001750 0001750 00000011400 11305540552 032546 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: ColorResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.color; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.color.CSSSystemColors; import org.jfree.layouting.input.style.keys.color.ColorStyleKeys; import org.jfree.layouting.input.style.keys.color.HtmlColors; import org.jfree.layouting.input.style.values.CSSColorValue; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.input.style.values.CSSFunctionValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.functions.FunctionEvaluationException; import org.jfree.layouting.layouter.style.functions.FunctionFactory; import org.jfree.layouting.layouter.style.functions.values.StyleValueFunction; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; import org.jfree.layouting.util.ColorUtil; /** * Creation-Date: 11.12.2005, 23:28:29 * * @author Thomas Morgner */ public class ColorResolveHandler implements ResolveHandler { public ColorResolveHandler() { } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[0]; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext style = currentNode.getLayoutContext(); CSSValue value = style.getValue(key); if (value instanceof CSSColorValue) { return; } // it might as well be a RGB- or HSL- function. if (value instanceof CSSFunctionValue) { final CSSFunctionValue functionValue = (CSSFunctionValue) value; final StyleValueFunction function = FunctionFactory.getInstance().getStyleFunction (functionValue.getFunctionName()); if (function == null) { value = HtmlColors.BLACK; } else { try { value = function.evaluate(process, currentNode, functionValue); } catch (FunctionEvaluationException e) { value = HtmlColors.BLACK; } } if (value instanceof CSSColorValue) { style.setValue(key, value); return; } } if (value instanceof CSSConstant == false) { style.setValue(key, HtmlColors.BLACK); return; } if (CSSSystemColors.CURRENT_COLOR.equals(value)) { style.setValue(key, getCurrentColor(currentNode)); return; } final CSSValue c = ColorUtil.parseIdentColor(value.getCSSText()); if (c != null) { style.setValue(key, c); } else { style.setValue(key, HtmlColors.BLACK); } } protected CSSColorValue getCurrentColor (final LayoutElement currentNode) { final LayoutElement parent = currentNode.getParent(); if (parent != null) { final LayoutContext layoutContext = parent.getLayoutContext(); final CSSValue value = layoutContext.getValue(ColorStyleKeys.COLOR); if (value instanceof CSSColorValue) { return (CSSColorValue) value; } } return (HtmlColors.BLACK); } } ././@LongLink 0000000 0000000 0000000 00000000161 00000000000 011563 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/color/OtherColorResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/color/OtherColorResolve0000644 0001750 0001750 00000005061 11305540552 032607 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: OtherColorResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.color; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.color.ColorStyleKeys; import org.jfree.layouting.input.style.keys.color.HtmlColors; import org.jfree.layouting.input.style.values.CSSColorValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; /** * Creation-Date: 11.12.2005, 23:28:29 * * @author Thomas Morgner */ public class OtherColorResolveHandler extends ColorResolveHandler { public OtherColorResolveHandler() { } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[]{ColorStyleKeys.COLOR}; } protected CSSColorValue getCurrentColor(final LayoutElement currentNode) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue value = layoutContext.getValue(ColorStyleKeys.COLOR); if (value instanceof CSSColorValue) { return (CSSColorValue) value; } else { return HtmlColors.BLACK; } } } ././@LongLink 0000000 0000000 0000000 00000000152 00000000000 011563 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/ConstantsResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/ConstantsResolveHandler0000644 0001750 0001750 00000010243 11305540552 032661 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: ConstantsResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed; import java.util.HashMap; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; /** * Creation-Date: 11.12.2005, 23:15:57 * * @author Thomas Morgner */ public abstract class ConstantsResolveHandler implements ResolveHandler { private static final StyleKey[] EMPTY_STYLE_KEYS = new StyleKey[0]; private HashMap constants; private CSSValue fallback; protected ConstantsResolveHandler() { constants = new HashMap(); } public CSSValue getFallback() { return fallback; } protected void setFallback(final CSSValue fallback) { this.fallback = fallback; } protected CSSValue lookupValue(final CSSConstant value) { return (CSSValue) constants.get(value); } protected void addValue(final CSSConstant constant, final CSSValue value) { constants.put(constant, value); } protected void addNormalizeValue(final CSSConstant constant) { constants.put(constant, constant); } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return the array of required style keys. */ public StyleKey[] getRequiredStyles() { return EMPTY_STYLE_KEYS; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final CSSValue value = resolveValue(process, currentNode, key); if (value != null) { currentNode.getLayoutContext().setValue(key, value); } } protected CSSValue resolveValue (final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue value = layoutContext.getValue(key); if (value instanceof CSSConstant == false) { final CSSValue fallback = getFallback(); if (fallback != null) { return fallback; } return null; } final CSSConstant constant = (CSSConstant) value; final CSSValue resolvedValue = lookupValue(constant); if (resolvedValue != null) { // layoutContext.setValue(key, resolvedValue); return resolvedValue; } final CSSValue fallback = getFallback(); if (fallback != null) { // layoutContext.setValue(key, fallback); return fallback; } return null; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/ 0000755 0001750 0001750 00000000000 11305540552 027576 5 ustar rene rene ././@LongLink 0000000 0000000 0000000 00000000157 00000000000 011570 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/QuotesResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/QuotesResolveHa0000644 0001750 0001750 00000007211 11305540552 032613 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: QuotesResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.content; import java.util.ArrayList; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.values.CSSStringValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.input.style.values.CSSValueList; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.context.QuotesPair; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; public class QuotesResolveHandler extends ConstantsResolveHandler { public QuotesResolveHandler () { } /** * This indirectly defines the resolve order. The higher the order, the more dependent * is the resolver on other resolvers to be complete. * * @return the array of required style keys. */ public StyleKey[] getRequiredStyles () { return new StyleKey[0]; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve (final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue rawValue = layoutContext.getValue(key); if (rawValue instanceof CSSValueList == false) { return; } final ArrayList quotes = new ArrayList(); final CSSValueList list = (CSSValueList) rawValue; final int length = (list.getLength() % 2); for (int i = 0; i < length; i++) { final CSSValue openValue = list.getItem(i * 2); final CSSValue closeValue = list.getItem(i * 2 + 1); if (openValue instanceof CSSStringValue == false) { continue; } if (closeValue instanceof CSSStringValue == false) { continue; } final CSSStringValue openQuote = (CSSStringValue) openValue; final CSSStringValue closeQuote = (CSSStringValue) closeValue; quotes.add(new QuotesPair(openQuote.getValue(), closeQuote.getValue())); } if (quotes.isEmpty()) { return; } final QuotesPair[] quotesArray = (QuotesPair[]) quotes.toArray(new QuotesPair[quotes.size()]); layoutContext.getContentSpecification().setQuotes(quotesArray); } } ././@LongLink 0000000 0000000 0000000 00000000171 00000000000 011564 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/CounterIncrementResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/CounterIncremen0000644 0001750 0001750 00000010467 11305540552 032631 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: CounterIncrementResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.content; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.content.ContentStyleKeys; import org.jfree.layouting.input.style.values.CSSAttrFunction; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.input.style.values.CSSNumericValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.input.style.values.CSSValueList; import org.jfree.layouting.input.style.values.CSSValuePair; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; public class CounterIncrementResolveHandler implements ResolveHandler { public CounterIncrementResolveHandler () { } /** * This indirectly defines the resolve order. The higher the order, the more dependent * is the resolver on other resolvers to be complete. * * @return the array of required style keys. */ public StyleKey[] getRequiredStyles () { return new StyleKey[] { ContentStyleKeys.COUNTER_RESET, }; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve (final LayoutProcess process, final LayoutElement element, final StyleKey key) { final CSSValue value = element.getLayoutContext().getValue(key); if (value instanceof CSSValueList == false) { return; // do nothing. } final CSSValueList valueList = (CSSValueList) value; for (int i = 0; i < valueList.getLength(); i++) { final CSSValue item = valueList.getItem(i); if (item instanceof CSSValuePair == false) { continue; } final CSSValuePair counter = (CSSValuePair) item; final CSSValue counterName = counter.getFirstValue(); if (counterName instanceof CSSConstant == false) { continue; } final CSSValue counterValue = counter.getSecondValue(); final int counterIntValue = parseCounterValue(counterValue, element); element.incrementCounter(counterName.getCSSText(), counterIntValue); } } private int parseCounterValue (final CSSValue rawValue, final LayoutElement element) { if (rawValue instanceof CSSNumericValue) { final CSSNumericValue nval = (CSSNumericValue) rawValue; return (int) nval.getValue(); } if (rawValue instanceof CSSAttrFunction) { final CSSAttrFunction attrFunction = (CSSAttrFunction) rawValue; final String attrName = attrFunction.getName(); final String attrNamespace = attrFunction.getNamespace(); final Object rawAttribute = element.getLayoutContext().getAttributes().getAttribute (attrNamespace, attrName); if (rawAttribute instanceof Number) { final Number nAttr = (Number) rawAttribute; return nAttr.intValue(); } } return 0; } } ././@LongLink 0000000 0000000 0000000 00000000157 00000000000 011570 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/MoveToResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/MoveToResolveHa0000644 0001750 0001750 00000013455 11305540552 032553 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: MoveToResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.content; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.content.ContentStyleKeys; import org.jfree.layouting.input.style.keys.content.MoveToValues; import org.jfree.layouting.input.style.values.CSSStringType; import org.jfree.layouting.input.style.values.CSSStringValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.content.ContentToken; import org.jfree.layouting.layouter.content.computed.CounterToken; import org.jfree.layouting.layouter.content.computed.CountersToken; import org.jfree.layouting.layouter.content.resolved.ResolvedCounterToken; import org.jfree.layouting.layouter.context.ContentSpecification; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; public class MoveToResolveHandler implements ResolveHandler { public MoveToResolveHandler () { } /** * This indirectly defines the resolve order. The higher the order, the more dependent * is the resolver on other resolvers to be complete. * * @return the array of required style keys. */ public StyleKey[] getRequiredStyles () { // no further dependecies. (We depend on the parent, not the current element) return new StyleKey[0]; } private boolean isCounterUsed (final LayoutElement element, final String counter) { final LayoutContext layoutContext = element.getLayoutContext(); final ContentSpecification contentSpecification = layoutContext.getContentSpecification(); final ContentToken[] contents = contentSpecification.getContents(); for (int i = 0; i < contents.length; i++) { ContentToken content = contents[i]; if (content instanceof ResolvedCounterToken) { // this should not happen, as the resolving of content-tokens happens // after the style resolving process .. final ResolvedCounterToken computedToken = (ResolvedCounterToken) content; content = computedToken.getParent(); } if (content instanceof CounterToken) { final CounterToken counterToken = (CounterToken) content; if (counterToken.getName().equals(counter)) { return true; } } else if (content instanceof CountersToken) { final CountersToken counterToken = (CountersToken) content; if (counterToken.getName().equals(counter)) { return true; } } } return false; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve (final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue value = layoutContext.getValue(ContentStyleKeys.MOVE_TO); // Maybe this is a 'normal'. if (MoveToValues.NORMAL.equals(value)) { if ("alternate".equals(layoutContext.getPseudoElement())) { // For '::alternate' pseudo-elements, if the superior parent uses // the 'footnote' counter in its 'content' property then the computed // value of 'move-to' is 'footnotes'. if (isCounterUsed(currentNode.getParent(), "footnote")) { layoutContext.setValue(ContentStyleKeys.MOVE_TO, new CSSStringValue(CSSStringType.STRING, "footnotes")); return; } // For '::alternate' pseudo-elements, if the superior parent uses // the 'endnote' counter in its 'content' property then the computed // value of 'move-to' is 'endnotes'. if (isCounterUsed(currentNode.getParent(), "endnote")) { layoutContext.setValue(ContentStyleKeys.MOVE_TO, new CSSStringValue(CSSStringType.STRING, "endnotes")); return; } // For '::alternate' pseudo-elements, if the superior parent uses // the 'section-note' counter in its 'content' property then the // computed value of 'move-to' is 'section-notes'. if (isCounterUsed(currentNode.getParent(), "section-note")) { layoutContext.setValue(ContentStyleKeys.MOVE_TO, new CSSStringValue(CSSStringType.STRING, "section-notes")); return; } } layoutContext.setValue(ContentStyleKeys.MOVE_TO, MoveToValues.HERE); } } } ././@LongLink 0000000 0000000 0000000 00000000165 00000000000 011567 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/CounterResetResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/CounterResetRes0000644 0001750 0001750 00000011444 11305540552 032621 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: CounterResetResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.content; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.box.BoxStyleKeys; import org.jfree.layouting.input.style.keys.box.DisplayRole; import org.jfree.layouting.input.style.values.CSSAttrFunction; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.input.style.values.CSSNumericValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.input.style.values.CSSValueList; import org.jfree.layouting.input.style.values.CSSValuePair; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; public class CounterResetResolveHandler implements ResolveHandler { public CounterResetResolveHandler () { } /** * This indirectly defines the resolve order. The higher the order, the more dependent * is the resolver on other resolvers to be complete. * * @return the array of required style keys. */ public StyleKey[] getRequiredStyles () { return new StyleKey[] { BoxStyleKeys.DISPLAY_ROLE }; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve (final LayoutProcess process, final LayoutElement element, final StyleKey key) { final LayoutContext layoutContext = element.getLayoutContext(); final CSSValue displayRole = layoutContext.getValue(BoxStyleKeys.DISPLAY_ROLE); if (DisplayRole.NONE.equals(displayRole)) { // [GENERATED] 8.3. Counters in elements with 'display: none' // // An element that is not displayed ('display' set to 'none') cannot // increment or reset a counter. return; } final CSSValue value = layoutContext.getValue(key); if (value instanceof CSSValueList == false) { return; // do nothing. } final CSSValueList valueList = (CSSValueList) value; for (int i = 0; i < valueList.getLength(); i++) { final CSSValue item = valueList.getItem(i); if (item instanceof CSSValuePair == false) { continue; } final CSSValuePair counter = (CSSValuePair) item; final CSSValue counterName = counter.getFirstValue(); if (counterName instanceof CSSConstant == false) { continue; } final CSSValue counterValue = counter.getSecondValue(); final int counterIntValue = parseCounterValue(counterValue, element); element.resetCounter(counterName.getCSSText(), counterIntValue); } } private int parseCounterValue (final CSSValue rawValue, final LayoutElement element) { if (rawValue instanceof CSSNumericValue) { final CSSNumericValue nval = (CSSNumericValue) rawValue; return (int) nval.getValue(); } if (rawValue instanceof CSSAttrFunction) { final CSSAttrFunction attrFunction = (CSSAttrFunction) rawValue; final String attrName = attrFunction.getName(); final String attrNamespace = attrFunction.getNamespace(); final Object rawAttribute = element.getLayoutContext().getAttributes().getAttribute (attrNamespace, attrName); if (rawAttribute instanceof Number) { final Number nAttr = (Number) rawAttribute; return nAttr.intValue(); } } return 0; } } ././@LongLink 0000000 0000000 0000000 00000000166 00000000000 011570 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/XStringDefineResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/XStringDefineRe0000644 0001750 0001750 00000005743 11305540552 032532 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: XStringDefineResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.content; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.input.style.values.CSSValueList; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; public class XStringDefineResolveHandler implements ResolveHandler { public XStringDefineResolveHandler () { } /** * This indirectly defines the resolve order. The higher the order, the more dependent * is the resolver on other resolvers to be complete. * * @return the array of required style keys. */ public StyleKey[] getRequiredStyles () { return new StyleKey[0]; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve (final LayoutProcess process, final LayoutElement element, final StyleKey key) { final LayoutContext layoutContext = element.getLayoutContext(); final CSSValue value = layoutContext.getValue(key); if (value instanceof CSSValueList == false) { return; // do nothing. } final CSSValueList valueList = (CSSValueList) value; for (int i = 0; i < valueList.getLength(); i++) { final CSSValue item = valueList.getItem(i); if (item instanceof CSSConstant == false) { continue; } element.setString (item.getCSSText(), element.getString(item.getCSSText()), true); } } } ././@LongLink 0000000 0000000 0000000 00000000160 00000000000 011562 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/ContentResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/ContentResolveH0000644 0001750 0001750 00000032510 11305540552 032604 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: ContentResolveHandler.java 6489 2008-11-28 14:53:40Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.content; import java.util.ArrayList; import java.util.HashMap; import java.net.URL; import org.jfree.layouting.DocumentContextUtility; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.box.BoxStyleKeys; import org.jfree.layouting.input.style.keys.box.DisplayRole; import org.jfree.layouting.input.style.keys.content.ContentStyleKeys; import org.jfree.layouting.input.style.keys.content.ContentValues; import org.jfree.layouting.input.style.keys.list.ListStyleKeys; import org.jfree.layouting.input.style.values.CSSAttrFunction; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.input.style.values.CSSFunctionValue; import org.jfree.layouting.input.style.values.CSSStringType; import org.jfree.layouting.input.style.values.CSSStringValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.input.style.values.CSSValueList; import org.jfree.layouting.layouter.content.ContentToken; import org.jfree.layouting.layouter.content.computed.CloseQuoteToken; import org.jfree.layouting.layouter.content.computed.ContentsToken; import org.jfree.layouting.layouter.content.computed.CounterToken; import org.jfree.layouting.layouter.content.computed.OpenQuoteToken; import org.jfree.layouting.layouter.content.statics.StaticTextToken; import org.jfree.layouting.layouter.context.ContentSpecification; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.counters.CounterStyle; import org.jfree.layouting.layouter.counters.CounterStyleFactory; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.functions.FunctionEvaluationException; import org.jfree.layouting.layouter.style.functions.FunctionFactory; import org.jfree.layouting.layouter.style.functions.content.ContentFunction; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; import org.pentaho.reporting.libraries.resourceloader.ResourceManager; import org.pentaho.reporting.libraries.resourceloader.ResourceKey; import org.pentaho.reporting.libraries.base.util.DebugLog; public class ContentResolveHandler implements ResolveHandler { private static final ContentToken[] DEFAULT_CONTENT = new ContentToken[]{ContentsToken.CONTENTS}; private static final ContentToken[] PSEUDO_CONTENT = new ContentToken[]{}; private CSSValue listCounter; private HashMap tokenMapping; public ContentResolveHandler() { tokenMapping = new HashMap(); tokenMapping.put(ContentValues.CONTENTS, ContentsToken.CONTENTS); tokenMapping.put(ContentValues.OPEN_QUOTE, new OpenQuoteToken(false)); tokenMapping.put(ContentValues.NO_OPEN_QUOTE, new OpenQuoteToken(true)); tokenMapping.put(ContentValues.CLOSE_QUOTE, new CloseQuoteToken(false)); tokenMapping.put(ContentValues.NO_CLOSE_QUOTE, new CloseQuoteToken(true)); final CSSStringValue param = new CSSStringValue(CSSStringType.STRING, "list-item"); listCounter = new CSSFunctionValue("counter", new CSSValue[]{param}); } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return the array of required style keys. */ public StyleKey[] getRequiredStyles() { return new StyleKey[]{ ContentStyleKeys.COUNTER_RESET, ContentStyleKeys.COUNTER_INCREMENT, ContentStyleKeys.QUOTES, ContentStyleKeys.STRING_SET }; } /** * Resolves a single property. * * @param process the current layout process controlling everyting * @param element the current layout element that is processed * @param key the style key that is computed. */ public void resolve(final LayoutProcess process, final LayoutElement element, final StyleKey key) { final LayoutContext layoutContext = element.getLayoutContext(); final ContentSpecification contentSpecification = layoutContext.getContentSpecification(); final CSSValue value = layoutContext.getValue(key); if (value instanceof CSSConstant) { if (ContentValues.NONE.equals(value)) { contentSpecification.setAllowContentProcessing(false); contentSpecification.setInhibitContent(false); contentSpecification.setContents(PSEUDO_CONTENT); return; } else if (ContentValues.INHIBIT.equals(value)) { contentSpecification.setAllowContentProcessing(false); contentSpecification.setInhibitContent(true); contentSpecification.setContents(PSEUDO_CONTENT); return; } else if (ContentValues.NORMAL.equals(value)) { if (layoutContext.isPseudoElement()) { if (isListMarker(element)) { processListItem(process, element, contentSpecification); return; } else { // a pseudo-element does not have content by default. contentSpecification.setAllowContentProcessing(false); contentSpecification.setInhibitContent(true); contentSpecification.setContents(PSEUDO_CONTENT); return; } } } } contentSpecification.setInhibitContent(false); contentSpecification.setAllowContentProcessing(true); contentSpecification.setContents(DEFAULT_CONTENT); if (value instanceof CSSAttrFunction) { final ContentToken token = evaluateFunction((CSSFunctionValue) value, process, element); if (token == null) { return; } contentSpecification.setContents(new ContentToken[]{token}); } if (value instanceof CSSValueList == false) { return; // cant handle that one } final ArrayList tokens = new ArrayList(); final CSSValueList list = (CSSValueList) value; final int size = list.getLength(); for (int i = 0; i < size; i++) { final CSSValueList sequence = (CSSValueList) list.getItem(i); for (int j = 0; j < sequence.getLength(); j++) { final CSSValue content = sequence.getItem(j); final ContentToken token = createToken(process, element, content); if (token == null) { // ok, a failure. Skip to the next content spec ... tokens.clear(); break; } tokens.add(token); } if (tokens.isEmpty() == false) { final ContentToken[] contents = (ContentToken[]) tokens.toArray (new ContentToken[tokens.size()]); contentSpecification.setContents(contents); return; } } } private void processListItem(final LayoutProcess process, final LayoutElement element, final ContentSpecification contentSpecification) { contentSpecification.setAllowContentProcessing(false); contentSpecification.setInhibitContent(false); final LayoutContext layoutContext = element.getLayoutContext(); final CSSValue value = layoutContext.getValue(ListStyleKeys.LIST_STYLE_IMAGE); if (value != null) { final ContentToken token = createToken(process, element, value); if (token != null) { contentSpecification.setContents(new ContentToken[]{ token }); return; } } final ContentToken token = createToken (process, element, listCounter); if (token instanceof CounterToken) { final CounterToken counterToken = (CounterToken) token; final CounterStyle style = counterToken.getStyle(); final String suffix = style.getSuffix(); if (suffix == null || suffix.length() == 0) { contentSpecification.setContents(new ContentToken[]{ token }); } else { contentSpecification.setContents (new ContentToken[]{ counterToken, new StaticTextToken(suffix)}); } } else { contentSpecification.setContents(new ContentToken[]{ token }); } } private boolean isListMarker (final LayoutElement element) { final LayoutContext layoutContext = element.getLayoutContext(); if ("marker".equals(layoutContext.getPseudoElement()) == false) { return false; } final LayoutElement parent = element.getParent(); if (parent == null) { return false; } final CSSValue parentDisplayRole = parent.getLayoutContext().getValue(BoxStyleKeys.DISPLAY_ROLE); if (DisplayRole.LIST_ITEM.equals(parentDisplayRole)) { return true; } return false; } private ContentToken createToken(final LayoutProcess process, final LayoutElement element, final CSSValue content) { try { if (content instanceof CSSStringValue) { final CSSStringValue sval = (CSSStringValue) content; if (CSSStringType.STRING.equals(sval.getType())) { return new StaticTextToken(sval.getValue()); } else { // this is an external URL, so try to load it. final CSSFunctionValue function = new CSSFunctionValue ("url", new CSSValue[]{sval}); return evaluateFunction(function, process, element); } } if (content instanceof CSSConstant) { if (ContentValues.DOCUMENT_URL.equals(content)) { final Object docUrl = process.getDocumentContext().getMetaAttribute ("document-url"); if (docUrl != null) { return new StaticTextToken(String.valueOf(docUrl)); } final ResourceKey baseKey = DocumentContextUtility.getBaseResource(process.getDocumentContext()); final ResourceManager resourceManager = DocumentContextUtility.getResourceManager(process.getDocumentContext()); final URL url = resourceManager.toURL(baseKey); if (url != null) { return new StaticTextToken(url.toExternalForm()); } return null; } final ContentToken token = (ContentToken) tokenMapping.get(content); if (token != null) { return token; } return resolveContentAlias(content); } if (content instanceof CSSFunctionValue) { return evaluateFunction((CSSFunctionValue) content, process, element); } } catch (Exception e) { DebugLog.log("Content-Resolver: Failed to evaluate " + content); } return null; } private ContentToken resolveContentAlias(final CSSValue content) { if (ContentValues.FOOTNOTE.equals(content)) { final CounterStyle style = CounterStyleFactory.getInstance().getCounterStyle("normal"); return new CounterToken("footnote", style); } if (ContentValues.ENDNOTE.equals(content)) { final CounterStyle style = CounterStyleFactory.getInstance().getCounterStyle("normal"); return new CounterToken("endnote", style); } if (ContentValues.SECTIONNOTE.equals(content)) { final CounterStyle style = CounterStyleFactory.getInstance().getCounterStyle("normal"); return new CounterToken("section-note", style); } if (ContentValues.LISTITEM.equals(content)) { final CounterStyle style = CounterStyleFactory.getInstance().getCounterStyle("normal"); return new CounterToken("list-item", style); } return null; } private ContentToken evaluateFunction(final CSSFunctionValue function, final LayoutProcess process, final LayoutElement element) { final ContentFunction styleFunction = FunctionFactory.getInstance().getContentFunction(function.getFunctionName()); if (styleFunction == null) { return null; } try { return styleFunction.evaluate(process, element, function); } catch (FunctionEvaluationException e) { DebugLog.log("Evaluation failed " + e); return null; } } } ././@LongLink 0000000 0000000 0000000 00000000167 00000000000 011571 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/XAlternateTextResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/XAlternateTextR0000644 0001750 0001750 00000021146 11305540552 032563 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: XAlternateTextResolveHandler.java 6489 2008-11-28 14:53:40Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.content; import java.util.ArrayList; import java.net.URL; import org.jfree.layouting.DocumentContextUtility; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.content.ContentStyleKeys; import org.jfree.layouting.input.style.keys.content.ContentValues; import org.jfree.layouting.input.style.values.CSSAttrFunction; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.input.style.values.CSSFunctionValue; import org.jfree.layouting.input.style.values.CSSStringType; import org.jfree.layouting.input.style.values.CSSStringValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.input.style.values.CSSValueList; import org.jfree.layouting.layouter.content.ContentToken; import org.jfree.layouting.layouter.content.statics.ExternalContentToken; import org.jfree.layouting.layouter.content.statics.ResourceContentToken; import org.jfree.layouting.layouter.content.statics.StaticTextToken; import org.jfree.layouting.layouter.context.ContentSpecification; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.functions.FunctionEvaluationException; import org.jfree.layouting.layouter.style.functions.FunctionFactory; import org.jfree.layouting.layouter.style.functions.values.StyleValueFunction; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; import org.jfree.layouting.layouter.style.values.CSSRawValue; import org.jfree.layouting.layouter.style.values.CSSResourceValue; import org.pentaho.reporting.libraries.resourceloader.ResourceKey; import org.pentaho.reporting.libraries.resourceloader.ResourceManager; import org.pentaho.reporting.libraries.base.util.DebugLog; public class XAlternateTextResolveHandler implements ResolveHandler { private static final ContentToken[] DEFAULT_CONTENT = new ContentToken[0]; public XAlternateTextResolveHandler () { } /** * This indirectly defines the resolve order. The higher the order, the more dependent * is the resolver on other resolvers to be complete. * * @return the array of required style keys. */ public StyleKey[] getRequiredStyles () { return new StyleKey[] { ContentStyleKeys.COUNTER_RESET, ContentStyleKeys.COUNTER_INCREMENT, ContentStyleKeys.QUOTES, ContentStyleKeys.STRING_DEFINE }; } /** * Resolves a String. As the string may contain the 'contents' property, it * is not resolvable here. The ContentNormalizer needs to handle this property * instead. (But this code prepares everything ..) * * @param currentNode * @param style */ public void resolve (final LayoutProcess process, final LayoutElement element, final StyleKey key) { final LayoutContext layoutContext = element.getLayoutContext(); final ContentSpecification contentSpecification = layoutContext.getContentSpecification(); final CSSValue value = layoutContext.getValue(key); if (value instanceof CSSConstant) { if (ContentValues.NONE.equals(value)) { contentSpecification.setStrings(XAlternateTextResolveHandler.DEFAULT_CONTENT); return; } } contentSpecification.setStrings(XAlternateTextResolveHandler.DEFAULT_CONTENT); if (value instanceof CSSAttrFunction) { final ContentToken token = evaluateFunction((CSSFunctionValue) value, process, element); if (token == null) { return; } contentSpecification.setStrings(new ContentToken[]{token}); } if (value instanceof CSSValueList == false) { return; // cant handle that one } final ArrayList tokens = new ArrayList(); final CSSValueList list = (CSSValueList) value; final int size = list.getLength(); for (int i = 0; i < size; i++) { final CSSValueList sequence = (CSSValueList) list.getItem(i); for (int j = 0; j < sequence.getLength(); j++) { final CSSValue content = sequence.getItem(j); final ContentToken token = createToken(process, element, content); if (token == null) { // ok, a failure. Skip to the next content spec ... tokens.clear(); break; } tokens.add(token); } } final ContentToken[] contents = (ContentToken[]) tokens.toArray (new ContentToken[tokens.size()]); contentSpecification.setStrings(contents); } private ContentToken createToken (final LayoutProcess process, final LayoutElement element, final CSSValue content) { if (content instanceof CSSStringValue) { final CSSStringValue sval = (CSSStringValue) content; if (CSSStringType.STRING.equals(sval.getType())) { return new StaticTextToken(sval.getValue()); } else { // this is an external URL, so try to load it. final CSSFunctionValue function = new CSSFunctionValue ("url", new CSSValue[]{sval}); return evaluateFunction(function, process, element); } } if (content instanceof CSSFunctionValue) { return evaluateFunction((CSSFunctionValue) content, process, element); } if (content instanceof CSSConstant) { if (ContentValues.DOCUMENT_URL.equals(content)) { final Object docUrl = process.getDocumentContext().getMetaAttribute ("document-url"); if (docUrl != null) { return new StaticTextToken(String.valueOf(docUrl)); } final ResourceKey baseKey = DocumentContextUtility.getBaseResource(process.getDocumentContext()); final ResourceManager resourceManager = DocumentContextUtility.getResourceManager(process.getDocumentContext()); final URL url = resourceManager.toURL(baseKey); if (url != null) { return new StaticTextToken(url.toExternalForm()); } return null; } } return null; } private ContentToken evaluateFunction(final CSSFunctionValue function, final LayoutProcess process, final LayoutElement element) { final StyleValueFunction styleFunction = FunctionFactory.getInstance().getStyleFunction(function.getFunctionName()); try { final CSSValue value = styleFunction.evaluate(process, element, function); if (value instanceof CSSResourceValue) { final CSSResourceValue refValue = (CSSResourceValue) value; return new ResourceContentToken(refValue.getValue()); } else if (value instanceof CSSStringValue) { final CSSStringValue strval = (CSSStringValue) value; return new StaticTextToken(strval.getValue()); } else if (value instanceof CSSRawValue) { final CSSRawValue rawValue = (CSSRawValue) value; return new ExternalContentToken(rawValue.getValue()); } return new StaticTextToken(value.getCSSText()); } catch (FunctionEvaluationException e) { DebugLog.log ("Evaluation failed " + e); return null; } } } ././@LongLink 0000000 0000000 0000000 00000000162 00000000000 011564 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/StringSetResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/StringSetResolv0000644 0001750 0001750 00000024640 11305540552 032644 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: StringSetResolveHandler.java 6489 2008-11-28 14:53:40Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.content; import java.util.ArrayList; import java.util.HashMap; import java.net.URL; import org.jfree.layouting.DocumentContextUtility; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.content.ContentStyleKeys; import org.jfree.layouting.input.style.keys.content.ContentValues; import org.jfree.layouting.input.style.values.CSSAttrFunction; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.input.style.values.CSSFunctionValue; import org.jfree.layouting.input.style.values.CSSStringType; import org.jfree.layouting.input.style.values.CSSStringValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.input.style.values.CSSValueList; import org.jfree.layouting.layouter.content.ContentToken; import org.jfree.layouting.layouter.content.computed.CloseQuoteToken; import org.jfree.layouting.layouter.content.computed.ContentsToken; import org.jfree.layouting.layouter.content.computed.CounterToken; import org.jfree.layouting.layouter.content.computed.OpenQuoteToken; import org.jfree.layouting.layouter.content.statics.ExternalContentToken; import org.jfree.layouting.layouter.content.statics.ResourceContentToken; import org.jfree.layouting.layouter.content.statics.StaticTextToken; import org.jfree.layouting.layouter.context.ContentSpecification; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.counters.CounterStyle; import org.jfree.layouting.layouter.counters.CounterStyleFactory; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.functions.FunctionEvaluationException; import org.jfree.layouting.layouter.style.functions.FunctionFactory; import org.jfree.layouting.layouter.style.functions.values.StyleValueFunction; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; import org.jfree.layouting.layouter.style.values.CSSRawValue; import org.jfree.layouting.layouter.style.values.CSSResourceValue; import org.pentaho.reporting.libraries.resourceloader.ResourceManager; import org.pentaho.reporting.libraries.resourceloader.ResourceKey; public class StringSetResolveHandler implements ResolveHandler { private static final ContentToken[] DEFAULT_CONTENT = new ContentToken[0]; private HashMap tokenMapping; public StringSetResolveHandler () { tokenMapping = new HashMap(); tokenMapping.put(ContentValues.CONTENTS, ContentsToken.CONTENTS); tokenMapping.put(ContentValues.OPEN_QUOTE, new OpenQuoteToken(false)); tokenMapping.put(ContentValues.NO_OPEN_QUOTE, new OpenQuoteToken(true)); tokenMapping.put(ContentValues.CLOSE_QUOTE, new CloseQuoteToken(false)); tokenMapping.put(ContentValues.NO_CLOSE_QUOTE, new CloseQuoteToken(true)); } /** * This indirectly defines the resolve order. The higher the order, the more dependent * is the resolver on other resolvers to be complete. * * @return the array of required style keys. */ public StyleKey[] getRequiredStyles () { return new StyleKey[] { ContentStyleKeys.COUNTER_RESET, ContentStyleKeys.COUNTER_INCREMENT, ContentStyleKeys.QUOTES, ContentStyleKeys.STRING_DEFINE }; } /** * Resolves a String. As the string may contain the 'contents' property, it * is not resolvable here. The ContentNormalizer needs to handle this property * instead. (But this code prepares everything ..) * * @param currentNode * @param style */ public void resolve (final LayoutProcess process, final LayoutElement element, final StyleKey key) { final LayoutContext layoutContext = element.getLayoutContext(); final ContentSpecification contentSpecification = layoutContext.getContentSpecification(); final CSSValue value = layoutContext.getValue(key); if (value instanceof CSSConstant) { if (ContentValues.NONE.equals(value)) { contentSpecification.setStrings(DEFAULT_CONTENT); return; } } contentSpecification.setStrings(DEFAULT_CONTENT); if (value instanceof CSSAttrFunction) { final ContentToken token = evaluateFunction((CSSFunctionValue) value, process, element); if (token == null) { return; } contentSpecification.setStrings(new ContentToken[]{token}); } if (value instanceof CSSValueList == false) { return; // cant handle that one } final ArrayList tokens = new ArrayList(); final CSSValueList list = (CSSValueList) value; final int size = list.getLength(); for (int i = 0; i < size; i++) { final CSSValueList sequence = (CSSValueList) list.getItem(i); for (int j = 0; j < sequence.getLength(); j++) { final CSSValue content = sequence.getItem(j); final ContentToken token = createToken(process, element, content); if (token == null) { // ok, a failure. Skip to the next content spec ... tokens.clear(); break; } tokens.add(token); } } final ContentToken[] contents = (ContentToken[]) tokens.toArray (new ContentToken[tokens.size()]); contentSpecification.setStrings(contents); } private ContentToken createToken (final LayoutProcess process, final LayoutElement element, final CSSValue content) { if (content instanceof CSSStringValue) { final CSSStringValue sval = (CSSStringValue) content; if (CSSStringType.STRING.equals(sval.getType())) { return new StaticTextToken(sval.getValue()); } else { // this is an external URL, so try to load it. final CSSFunctionValue function = new CSSFunctionValue ("url", new CSSValue[]{sval}); return evaluateFunction(function, process, element); } } if (content instanceof CSSFunctionValue) { return evaluateFunction((CSSFunctionValue) content, process, element); } if (content instanceof CSSConstant) { if (ContentValues.DOCUMENT_URL.equals(content)) { final Object docUrl = process.getDocumentContext().getMetaAttribute ("document-url"); if (docUrl != null) { return new StaticTextToken(String.valueOf(docUrl)); } final ResourceKey baseKey = DocumentContextUtility.getBaseResource(process.getDocumentContext()); final ResourceManager resourceManager = DocumentContextUtility.getResourceManager(process.getDocumentContext()); final URL url = resourceManager.toURL(baseKey); if (url != null) { return new StaticTextToken(url.toExternalForm()); } return null; } final ContentToken token = (ContentToken) tokenMapping.get(content); if (token != null) { return token; } return resolveContentAlias(content); } return null; } private ContentToken resolveContentAlias (final CSSValue content) { if (ContentValues.FOOTNOTE.equals(content)) { final CounterStyle style = CounterStyleFactory.getInstance().getCounterStyle("normal"); return new CounterToken("footnote", style); } if (ContentValues.ENDNOTE.equals(content)) { final CounterStyle style = CounterStyleFactory.getInstance().getCounterStyle("normal"); return new CounterToken("endnote", style); } if (ContentValues.SECTIONNOTE.equals(content)) { final CounterStyle style = CounterStyleFactory.getInstance().getCounterStyle("normal"); return new CounterToken("section-note", style); } if (ContentValues.LISTITEM.equals(content)) { final CounterStyle style = CounterStyleFactory.getInstance().getCounterStyle("normal"); return new CounterToken("list-item", style); } return null; } private ContentToken evaluateFunction(final CSSFunctionValue function, final LayoutProcess process, final LayoutElement element) { final StyleValueFunction styleFunction = FunctionFactory.getInstance().getStyleFunction(function.getFunctionName()); try { final CSSValue value = styleFunction.evaluate(process, element, function); if (value instanceof CSSResourceValue) { final CSSResourceValue refValue = (CSSResourceValue) value; return new ResourceContentToken(refValue.getValue()); } else if (value instanceof CSSStringValue) { final CSSStringValue strval = (CSSStringValue) value; return new StaticTextToken(strval.getValue()); } else if (value instanceof CSSRawValue) { final CSSRawValue rawValue = (CSSRawValue) value; return new ExternalContentToken(rawValue.getValue()); } return new StaticTextToken(value.getCSSText()); } catch (FunctionEvaluationException e) { return null; } } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/ 0000755 0001750 0001750 00000000000 11305540552 026714 5 ustar rene rene ././@LongLink 0000000 0000000 0000000 00000000156 00000000000 011567 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/BoxSizingResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/BoxSizingResolveHan0000644 0001750 0001750 00000003333 11305540552 032544 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: BoxSizingResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.box; import org.jfree.layouting.input.style.keys.box.BoxSizing; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; public class BoxSizingResolveHandler extends ConstantsResolveHandler { public BoxSizingResolveHandler () { addNormalizeValue(BoxSizing.BORDER_BOX); addNormalizeValue(BoxSizing.CONTENT_BOX); setFallback(BoxSizing.CONTENT_BOX); } } ././@LongLink 0000000 0000000 0000000 00000000164 00000000000 011566 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/IndentEdgeResetResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/IndentEdgeResetReso0000644 0001750 0001750 00000003626 11305540552 032510 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: IndentEdgeResetResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.box; import org.jfree.layouting.input.style.keys.box.IndentEdgeReset; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; public class IndentEdgeResetResolveHandler extends ConstantsResolveHandler { public IndentEdgeResetResolveHandler () { addNormalizeValue(IndentEdgeReset.BORDER_EDGE); addNormalizeValue(IndentEdgeReset.CONTENT_EDGE); addNormalizeValue(IndentEdgeReset.MARGIN_EDGE); addNormalizeValue(IndentEdgeReset.NONE); addNormalizeValue(IndentEdgeReset.PADDING_EDGE); setFallback(IndentEdgeReset.NONE); } } ././@LongLink 0000000 0000000 0000000 00000000160 00000000000 011562 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/DisplayRoleResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/DisplayRoleResolveH0000644 0001750 0001750 00000004746 11305540552 032551 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: DisplayRoleResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.box; import org.jfree.layouting.input.style.keys.box.DisplayRole; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; public class DisplayRoleResolveHandler extends ConstantsResolveHandler { public DisplayRoleResolveHandler () { addNormalizeValue(DisplayRole.BLOCK); addNormalizeValue(DisplayRole.COMPACT); addNormalizeValue(DisplayRole.INLINE); addNormalizeValue(DisplayRole.LIST_ITEM); addNormalizeValue(DisplayRole.NONE); addNormalizeValue(DisplayRole.RUBY_BASE); addNormalizeValue(DisplayRole.RUBY_BASE_GROUP); addNormalizeValue(DisplayRole.RUBY_TEXT); addNormalizeValue(DisplayRole.RUBY_TEXT_GROUP); addNormalizeValue(DisplayRole.RUN_IN); addNormalizeValue(DisplayRole.TABLE_CAPTION); addNormalizeValue(DisplayRole.TABLE_CELL); addNormalizeValue(DisplayRole.TABLE_COLUMN); addNormalizeValue(DisplayRole.TABLE_COLUMN_GROUP); addNormalizeValue(DisplayRole.TABLE_FOOTER_GROUP); addNormalizeValue(DisplayRole.TABLE_HEADER_GROUP); addNormalizeValue(DisplayRole.TABLE_ROW); addNormalizeValue(DisplayRole.TABLE_ROW_GROUP); setFallback(DisplayRole.INLINE); } } ././@LongLink 0000000 0000000 0000000 00000000161 00000000000 011563 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/DisplayModelResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/DisplayModelResolve0000644 0001750 0001750 00000003513 11305540552 032567 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: DisplayModelResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.box; import org.jfree.layouting.input.style.keys.box.DisplayModel; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; public class DisplayModelResolveHandler extends ConstantsResolveHandler { public DisplayModelResolveHandler () { addNormalizeValue(DisplayModel.BLOCK_INSIDE); addNormalizeValue(DisplayModel.INLINE_INSIDE); addNormalizeValue(DisplayModel.RUBY); addNormalizeValue(DisplayModel.TABLE); setFallback(DisplayModel.INLINE_INSIDE); } } ././@LongLink 0000000 0000000 0000000 00000000150 00000000000 011561 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/FitResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/FitResolveHandler.j0000644 0001750 0001750 00000003341 11305540552 032450 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: FitResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.box; import org.jfree.layouting.input.style.keys.box.Fit; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; public class FitResolveHandler extends ConstantsResolveHandler { public FitResolveHandler () { addNormalizeValue(Fit.FILL); addNormalizeValue(Fit.MEET); addNormalizeValue(Fit.NONE); addNormalizeValue(Fit.SLICE); setFallback(Fit.FILL); } } ././@LongLink 0000000 0000000 0000000 00000000152 00000000000 011563 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/FloatResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/FloatResolveHandler0000644 0001750 0001750 00000007602 11305540552 032547 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: FloatResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.box; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.box.BoxStyleKeys; import org.jfree.layouting.input.style.keys.box.DisplayModel; import org.jfree.layouting.input.style.keys.box.DisplayRole; import org.jfree.layouting.input.style.keys.box.Floating; import org.jfree.layouting.input.style.keys.positioning.PositioningStyleKeys; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; public class FloatResolveHandler extends ConstantsResolveHandler { public FloatResolveHandler() { addNormalizeValue(Floating.BOTTOM); addNormalizeValue(Floating.LEFT); addNormalizeValue(Floating.END); addNormalizeValue(Floating.INSIDE); addNormalizeValue(Floating.IN_COLUMN); addNormalizeValue(Floating.MID_COLUMN); addNormalizeValue(Floating.NONE); addNormalizeValue(Floating.OUTSIDE); addNormalizeValue(Floating.RIGHT); addNormalizeValue(Floating.START); addNormalizeValue(Floating.TOP); setFallback(Floating.NONE); } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return the array of required style keys. */ public StyleKey[] getRequiredStyles() { return new StyleKey[]{ BoxStyleKeys.DISPLAY_ROLE, PositioningStyleKeys.POSITION }; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue displayRole = layoutContext.getValue(BoxStyleKeys.DISPLAY_ROLE); final CSSValue floating; if (DisplayRole.NONE.equals(displayRole)) { floating = Floating.NONE; } else { floating = resolveValue(process, currentNode, key); } if (Floating.NONE.equals(floating) == false) { // Otherwise, if 'float' has a value other than 'none', 'display' // is set to 'block' and the box is floated. layoutContext.setValue(BoxStyleKeys.DISPLAY_MODEL, DisplayModel.BLOCK_INSIDE); layoutContext.setValue(BoxStyleKeys.DISPLAY_ROLE, DisplayRole.BLOCK); } layoutContext.setValue(key, Floating.NONE); } } ././@LongLink 0000000 0000000 0000000 00000000162 00000000000 011564 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/FloatDisplaceResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/FloatDisplaceResolv0000644 0001750 0001750 00000003510 11305540552 032543 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: FloatDisplaceResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.box; import org.jfree.layouting.input.style.keys.box.FloatDisplace; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; public class FloatDisplaceResolveHandler extends ConstantsResolveHandler { public FloatDisplaceResolveHandler () { addNormalizeValue(FloatDisplace.BLOCK); addNormalizeValue(FloatDisplace.BLOCK_WITHIN_PAGE); addNormalizeValue(FloatDisplace.INDENT); addNormalizeValue(FloatDisplace.LINE); setFallback(FloatDisplace.LINE); } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/lists/ 0000755 0001750 0001750 00000000000 11305540552 027262 5 ustar rene rene ././@LongLink 0000000 0000000 0000000 00000000164 00000000000 011566 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/lists/ListStyleTypeResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/lists/ListStyleTypeReso0000644 0001750 0001750 00000023131 11305540552 032634 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: ListStyleTypeResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.lists; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.list.ListStyleTypeAlgorithmic; import org.jfree.layouting.input.style.keys.list.ListStyleTypeAlphabetic; import org.jfree.layouting.input.style.keys.list.ListStyleTypeGlyphs; import org.jfree.layouting.input.style.keys.list.ListStyleTypeNumeric; import org.jfree.layouting.input.style.keys.list.ListStyleTypeOther; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.context.ListSpecification; import org.jfree.layouting.layouter.counters.CounterStyle; import org.jfree.layouting.layouter.counters.CounterStyleFactory; import org.jfree.layouting.layouter.counters.numeric.DecimalCounterStyle; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; public class ListStyleTypeResolveHandler extends ConstantsResolveHandler { public ListStyleTypeResolveHandler () { addNormalizeValue(ListStyleTypeOther.ASTERISKS); addNormalizeValue(ListStyleTypeOther.CIRCLED_DECIMAL); addNormalizeValue(ListStyleTypeOther.CIRCLED_LOWER_LATIN); addNormalizeValue(ListStyleTypeOther.CIRCLED_UPPER_LATIN); addNormalizeValue(ListStyleTypeOther.DOTTED_DECIMAL); addNormalizeValue(ListStyleTypeOther.DOUBLE_CIRCLED_DECIMAL); addNormalizeValue(ListStyleTypeOther.FILLED_CIRCLED_DECIMAL); addNormalizeValue(ListStyleTypeOther.FOOTNOTES); addNormalizeValue(ListStyleTypeOther.PARANTHESISED_DECIMAL); addNormalizeValue(ListStyleTypeOther.PARANTHESISED_LOWER_LATIN); addNormalizeValue(ListStyleTypeNumeric.ARABIC_INDIC); addNormalizeValue(ListStyleTypeNumeric.BENGALI); addNormalizeValue(ListStyleTypeNumeric.BINARY); addNormalizeValue(ListStyleTypeNumeric.CAMBODIAN); addNormalizeValue(ListStyleTypeNumeric.DECIMAL); addNormalizeValue(ListStyleTypeNumeric.DECIMAL_LEADING_ZERO); addNormalizeValue(ListStyleTypeNumeric.DEVANAGARI); addNormalizeValue(ListStyleTypeNumeric.GUJARATI); addNormalizeValue(ListStyleTypeNumeric.GUJARATI); addNormalizeValue(ListStyleTypeNumeric.GURMUKHI); addNormalizeValue(ListStyleTypeNumeric.KANNADA); addNormalizeValue(ListStyleTypeNumeric.KHMER); addNormalizeValue(ListStyleTypeNumeric.LAO); addNormalizeValue(ListStyleTypeNumeric.LOWER_HEXADECIMAL); addNormalizeValue(ListStyleTypeNumeric.MALAYALAM); addNormalizeValue(ListStyleTypeNumeric.MONGOLIAN); addNormalizeValue(ListStyleTypeNumeric.MYANMAR); addNormalizeValue(ListStyleTypeNumeric.OCTAL); addNormalizeValue(ListStyleTypeNumeric.ORIYA); addNormalizeValue(ListStyleTypeNumeric.PERSIAN); addNormalizeValue(ListStyleTypeNumeric.TELUGU); addNormalizeValue(ListStyleTypeNumeric.THAI); addNormalizeValue(ListStyleTypeNumeric.TIBETIAN); addNormalizeValue(ListStyleTypeNumeric.UPPER_HEXADECIMAL); addNormalizeValue(ListStyleTypeNumeric.URDU); addNormalizeValue(ListStyleTypeGlyphs.BOX); addNormalizeValue(ListStyleTypeGlyphs.CHECK); addNormalizeValue(ListStyleTypeGlyphs.CIRCLE); addNormalizeValue(ListStyleTypeGlyphs.DIAMOND); addNormalizeValue(ListStyleTypeGlyphs.DISC); addNormalizeValue(ListStyleTypeGlyphs.HYPHEN); addNormalizeValue(ListStyleTypeGlyphs.SQUARE); addNormalizeValue(ListStyleTypeAlphabetic.AFAR); addNormalizeValue(ListStyleTypeAlphabetic.AMHARIC); addNormalizeValue(ListStyleTypeAlphabetic.AMHARIC_ABEGEDE); addNormalizeValue(ListStyleTypeAlphabetic.AMHARIC_ABEGEDE); addNormalizeValue(ListStyleTypeAlphabetic.CJK_EARTHLY_BRANCH); addNormalizeValue(ListStyleTypeAlphabetic.CJK_HEAVENLY_STEM); addNormalizeValue(ListStyleTypeAlphabetic.ETHIOPIC); addNormalizeValue(ListStyleTypeAlphabetic.ETHIOPIC_ABEGEDE); addNormalizeValue(ListStyleTypeAlphabetic.ETHIOPIC_ABEGEDE_AM_ET); addNormalizeValue(ListStyleTypeAlphabetic.ETHIOPIC_ABEGEDE_GEZ); addNormalizeValue(ListStyleTypeAlphabetic.ETHIOPIC_ABEGEDE_TI_ER); addNormalizeValue(ListStyleTypeAlphabetic.ETHIOPIC_ABEGEDE_TI_ER); addNormalizeValue(ListStyleTypeAlphabetic.ETHIOPIC_ABEGEDE_TI_ET); addNormalizeValue(ListStyleTypeAlphabetic.ETHIOPIC_HALEHAME_AA_ER); addNormalizeValue(ListStyleTypeAlphabetic.ETHIOPIC_HALEHAME_AA_ET); addNormalizeValue(ListStyleTypeAlphabetic.ETHIOPIC_HALEHAME_AM_ET); addNormalizeValue(ListStyleTypeAlphabetic.ETHIOPIC_HALEHAME_GEZ); addNormalizeValue(ListStyleTypeAlphabetic.ETHIOPIC_HALEHAME_OM_ET); addNormalizeValue(ListStyleTypeAlphabetic.ETHIOPIC_HALEHAME_SID_ET); addNormalizeValue(ListStyleTypeAlphabetic.ETHIOPIC_HALEHAME_SO_ET); addNormalizeValue(ListStyleTypeAlphabetic.ETHIOPIC_HALEHAME_TI_ER); addNormalizeValue(ListStyleTypeAlphabetic.ETHIOPIC_HALEHAME_TI_ET); addNormalizeValue(ListStyleTypeAlphabetic.ETHIOPIC_HALEHAME_TIG); addNormalizeValue(ListStyleTypeAlphabetic.HANGUL); addNormalizeValue(ListStyleTypeAlphabetic.HANGUL_CONSONANT); addNormalizeValue(ListStyleTypeAlphabetic.HIRAGANA); addNormalizeValue(ListStyleTypeAlphabetic.HIRAGANA_IROHA); addNormalizeValue(ListStyleTypeAlphabetic.KATAKANA); addNormalizeValue(ListStyleTypeAlphabetic.KATAKANA_IROHA); addNormalizeValue(ListStyleTypeAlphabetic.LOWER_ALPHA); addNormalizeValue(ListStyleTypeAlphabetic.LOWER_GREEK); addNormalizeValue(ListStyleTypeAlphabetic.LOWER_LATIN); addNormalizeValue(ListStyleTypeAlphabetic.LOWER_NORWEGIAN); addNormalizeValue(ListStyleTypeAlphabetic.OROMO); addNormalizeValue(ListStyleTypeAlphabetic.SIDAMA); addNormalizeValue(ListStyleTypeAlphabetic.SOMALI); addNormalizeValue(ListStyleTypeAlphabetic.TIGRE); addNormalizeValue(ListStyleTypeAlphabetic.TIGRINYA_ER); addNormalizeValue(ListStyleTypeAlphabetic.TIGRINYA_ER_ABEGEDE); addNormalizeValue(ListStyleTypeAlphabetic.TIGRINYA_ET); addNormalizeValue(ListStyleTypeAlphabetic.TIGRINYA_ET_ABEGEDE); addNormalizeValue(ListStyleTypeAlphabetic.UPPER_ALPHA); addNormalizeValue(ListStyleTypeAlphabetic.UPPER_GREEK); addNormalizeValue(ListStyleTypeAlphabetic.UPPER_LATIN); addNormalizeValue(ListStyleTypeAlphabetic.UPPER_NORWEGIAN); addNormalizeValue(ListStyleTypeAlgorithmic.ARMENIAN); addNormalizeValue(ListStyleTypeAlgorithmic.CJK_IDEOGRAPHIC); addNormalizeValue(ListStyleTypeAlgorithmic.ETHIOPIC_NUMERIC); addNormalizeValue(ListStyleTypeAlgorithmic.GEORGIAN); addNormalizeValue(ListStyleTypeAlgorithmic.HEBREW); addNormalizeValue(ListStyleTypeAlgorithmic.JAPANESE_FORMAL); addNormalizeValue(ListStyleTypeAlgorithmic.JAPANESE_INFORMAL); addNormalizeValue(ListStyleTypeAlgorithmic.LOWER_ARMENIAN); addNormalizeValue(ListStyleTypeAlgorithmic.LOWER_ROMAN); addNormalizeValue(ListStyleTypeAlgorithmic.SIMP_CHINESE_FORMAL); addNormalizeValue(ListStyleTypeAlgorithmic.SIMP_CHINESE_INFORMAL); addNormalizeValue(ListStyleTypeAlgorithmic.SYRIAC); addNormalizeValue(ListStyleTypeAlgorithmic.TAMIL); addNormalizeValue(ListStyleTypeAlgorithmic.TRAD_CHINESE_FORMAL); addNormalizeValue(ListStyleTypeAlgorithmic.TRAD_CHINESE_INFORMAL); addNormalizeValue(ListStyleTypeAlgorithmic.UPPER_ARMENIAN); addNormalizeValue(ListStyleTypeAlgorithmic.UPPER_ROMAN); } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve (final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue value = layoutContext.getValue(key); final ListSpecification lspec = currentNode.getLayoutContext().getListSpecification(); if (ListStyleTypeOther.NORMAL.equals(value)) { final CounterStyle cstyle = process.getDocumentContext().getCounterStyle ("list-item"); lspec.setCounterStyle(cstyle); } else { final CSSValue resolvedValue = resolveValue(process, currentNode, key); if (resolvedValue == null) { lspec.setCounterStyle(new DecimalCounterStyle()); } else { final String name = resolvedValue.getCSSText(); lspec.setCounterStyle(CounterStyleFactory.getInstance().getCounterStyle(name)); } } } } ././@LongLink 0000000 0000000 0000000 00000000165 00000000000 011567 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/lists/ListStyleImageResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/lists/ListStyleImageRes0000644 0001750 0001750 00000004341 11305540552 032560 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: ListStyleImageResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.lists; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; public class ListStyleImageResolveHandler implements ResolveHandler { public ListStyleImageResolveHandler () { } /** * This indirectly defines the resolve order. The higher the order, the more dependent * is the resolver on other resolvers to be complete. * * @return the array of required style keys. */ public StyleKey[] getRequiredStyles () { return new StyleKey[0]; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve (final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { // todo implement me } } ././@LongLink 0000000 0000000 0000000 00000000170 00000000000 011563 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/lists/ListStylePositionResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/lists/ListStylePosition0000644 0001750 0001750 00000004761 11305540552 032676 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: ListStylePositionResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.lists; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.list.ListStylePosition; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.ListSpecification; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; public class ListStylePositionResolveHandler extends ConstantsResolveHandler { public ListStylePositionResolveHandler () { addNormalizeValue(ListStylePosition.INSIDE); addNormalizeValue(ListStylePosition.OUTSIDE); setFallback(ListStylePosition.OUTSIDE); } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve (final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final CSSValue value = resolveValue(process, currentNode, key); final ListSpecification listSpecification = currentNode.getLayoutContext().getListSpecification(); listSpecification.setPosition((ListStylePosition) value); } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/position/ 0000755 0001750 0001750 00000000000 11305540552 027770 5 ustar rene rene ././@LongLink 0000000 0000000 0000000 00000000162 00000000000 011564 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/position/PositionResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/position/PositionResolv0000644 0001750 0001750 00000011731 11305540552 032715 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: PositionResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.position; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.box.BoxStyleKeys; import org.jfree.layouting.input.style.keys.box.DisplayModel; import org.jfree.layouting.input.style.keys.box.DisplayRole; import org.jfree.layouting.input.style.keys.box.Floating; import org.jfree.layouting.input.style.keys.positioning.Position; import org.jfree.layouting.input.style.keys.positioning.PositioningStyleKeys; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.input.style.values.CSSFunctionValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; public class PositionResolveHandler extends ConstantsResolveHandler { public PositionResolveHandler () { addNormalizeValue(Position.ABSOLUTE); addNormalizeValue(Position.FIXED); addNormalizeValue(Position.RELATIVE); addNormalizeValue(Position.STATIC); setFallback(Position.STATIC); } /** * This indirectly defines the resolve order. The higher the order, the more dependent * is the resolver on other resolvers to be complete. * * @return the array of required style keys. */ public StyleKey[] getRequiredStyles () { return new StyleKey[]{ BoxStyleKeys.DISPLAY_MODEL, }; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve (final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue displayModel = layoutContext.getValue(BoxStyleKeys.DISPLAY_MODEL); if (DisplayRole.NONE.equals(displayModel)) { // skip ... the element will not be displayed ... layoutContext.setValue(PositioningStyleKeys.POSITION, Position.STATIC); return; } final CSSValue rawValue = layoutContext.getValue(key); if (rawValue instanceof CSSFunctionValue) { // OK; check for pending .. final CSSFunctionValue function = (CSSFunctionValue) rawValue; if ("running".equals(function.getFunctionName())) { // The element will be inside a block-context (same behaviour as // for floats) layoutContext.setValue(BoxStyleKeys.DISPLAY_MODEL, DisplayModel.BLOCK_INSIDE); layoutContext.setValue(BoxStyleKeys.DISPLAY_ROLE, DisplayRole.BLOCK); return; } layoutContext.setValue(PositioningStyleKeys.POSITION, Position.STATIC); return; } final CSSConstant value = (CSSConstant) resolveValue(process, currentNode, key); layoutContext.setValue(PositioningStyleKeys.POSITION, value); if (Position.ABSOLUTE.equals(value) || Position.FIXED.equals(value)) { // http://www.w3.org/TR/REC-CSS2/visuren.html#propdef-float // this is specified in 9.7: Relationships between 'display', // 'position', and 'float': // Quote: Otherwise, 'position' has the value 'absolute' or 'fixed', // 'display' is set to 'block' and 'float' is set to 'none'. The position // of the box will be determined by the 'top', 'right', 'bottom' and // 'left' properties and the box's containing block. layoutContext.setValue(BoxStyleKeys.DISPLAY_MODEL, DisplayModel.BLOCK_INSIDE); layoutContext.setValue(BoxStyleKeys.DISPLAY_ROLE, DisplayRole.BLOCK); layoutContext.setValue(BoxStyleKeys.FLOAT, Floating.NONE); } } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/ 0000755 0001750 0001750 00000000000 11305540552 027255 5 ustar rene rene ././@LongLink 0000000 0000000 0000000 00000000160 00000000000 011562 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontStyleResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontStyleResolveH0000644 0001750 0001750 00000004161 11305540552 032601 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: FontStyleResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.fonts; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.font.FontStyle; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 18.12.2005, 20:55:31 * * @author Thomas Morgner */ public class FontStyleResolveHandler extends ConstantsResolveHandler { public FontStyleResolveHandler() { addNormalizeValue(FontStyle.ITALIC); addNormalizeValue(FontStyle.NORMAL); addNormalizeValue(FontStyle.OBLIQUE); setFallback(FontStyle.NORMAL); } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[0]; } } ././@LongLink 0000000 0000000 0000000 00000000162 00000000000 011564 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontVariantResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontVariantResolv0000644 0001750 0001750 00000005324 11305540552 032632 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: FontVariantResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.fonts; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.font.FontVariant; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; /** * Creation-Date: 18.12.2005, 20:55:31 * * @author Thomas Morgner */ public class FontVariantResolveHandler implements ResolveHandler { public FontVariantResolveHandler() { } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[0]; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue value = layoutContext.getValue(key); if (FontVariant.SMALL_CAPS.equals(value)) { layoutContext.setValue(key, FontVariant.SMALL_CAPS); } else { layoutContext.setValue(key, FontVariant.NORMAL); } } } ././@LongLink 0000000 0000000 0000000 00000000161 00000000000 011563 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontSmoothResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontSmoothResolve0000644 0001750 0001750 00000005551 11305540552 032646 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: FontSmoothResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.fonts; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.font.FontSmooth; import org.jfree.layouting.input.style.keys.font.FontStyleKeys; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; /** * Creation-Date: 18.12.2005, 15:26:56 * * @author Thomas Morgner */ public class FontSmoothResolveHandler implements ResolveHandler { public FontSmoothResolveHandler() { } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[] { }; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue value = layoutContext.getValue(key); if (FontSmooth.ALWAYS.equals(value)) { layoutContext.setValue(FontStyleKeys.X_FONT_SMOOTH_FLAG, FontSmooth.ALWAYS); } else if (FontSmooth.NEVER.equals(value)) { layoutContext.setValue(FontStyleKeys.X_FONT_SMOOTH_FLAG, FontSmooth.NEVER); } } } ././@LongLink 0000000 0000000 0000000 00000000157 00000000000 011570 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontSizeResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontSizeResolveHa0000644 0001750 0001750 00000017506 11305540552 032563 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: FontSizeResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.fonts; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.LibLayoutBoot; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.font.FontSizeConstant; import org.jfree.layouting.input.style.keys.font.RelativeFontSize; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.input.style.values.CSSNumericType; import org.jfree.layouting.input.style.values.CSSNumericValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 18.12.2005, 17:03:15 * * @author Thomas Morgner */ public class FontSizeResolveHandler extends ConstantsResolveHandler { private static final String SIZE_FACTOR_PREFIX = "org.jfree.layouting.defaults.FontSizeFactor."; private double fontSize; private CSSNumericValue[] predefinedSizes; private double[] predefinedScalingFactors; public FontSizeResolveHandler() { fontSize = parseDouble("org.jfree.layouting.defaults.FontSize", 12); predefinedSizes = new CSSNumericValue[7]; predefinedSizes[0] = computePredefinedSize(FontSizeConstant.XX_SMALL); predefinedSizes[1] = computePredefinedSize(FontSizeConstant.X_SMALL); predefinedSizes[2] = computePredefinedSize(FontSizeConstant.SMALL); predefinedSizes[3] = computePredefinedSize(FontSizeConstant.MEDIUM); predefinedSizes[4] = computePredefinedSize(FontSizeConstant.LARGE); predefinedSizes[5] = computePredefinedSize(FontSizeConstant.X_LARGE); predefinedSizes[6] = computePredefinedSize(FontSizeConstant.XX_LARGE); predefinedScalingFactors = new double[7]; predefinedScalingFactors[0] = computePredefinedScalingFactor(FontSizeConstant.XX_SMALL); predefinedScalingFactors[1] = computePredefinedScalingFactor(FontSizeConstant.X_SMALL); predefinedScalingFactors[2] = computePredefinedScalingFactor(FontSizeConstant.SMALL); predefinedScalingFactors[3] = computePredefinedScalingFactor(FontSizeConstant.MEDIUM); predefinedScalingFactors[4] = computePredefinedScalingFactor(FontSizeConstant.LARGE); predefinedScalingFactors[5] = computePredefinedScalingFactor(FontSizeConstant.X_LARGE); predefinedScalingFactors[6] = computePredefinedScalingFactor(FontSizeConstant.XX_LARGE); addValue(FontSizeConstant.XX_SMALL, predefinedSizes[0]); addValue(FontSizeConstant.X_SMALL, predefinedSizes[1]); addValue(FontSizeConstant.SMALL, predefinedSizes[2]); addValue(FontSizeConstant.MEDIUM, predefinedSizes[3]); addValue(FontSizeConstant.LARGE, predefinedSizes[4]); addValue(FontSizeConstant.X_LARGE, predefinedSizes[5]); addValue(FontSizeConstant.XX_LARGE, predefinedSizes[6]); } private CSSNumericValue computePredefinedSize(final CSSConstant c) { final String key = SIZE_FACTOR_PREFIX + c.getCSSText(); final double scaling = parseDouble(key, 100); return CSSNumericValue.createValue(CSSNumericType.PT, fontSize * scaling / 100d); } private double computePredefinedScalingFactor(final CSSConstant c) { final String key = SIZE_FACTOR_PREFIX + c.getCSSText(); return parseDouble(key, 100); } private double parseDouble(final String configKey, final double defaultValue) { final String value = LibLayoutBoot.getInstance().getGlobalConfig() .getConfigProperty(configKey); if (value == null) { return defaultValue; } try { return Double.parseDouble(value); } catch (NumberFormatException nfe) { return defaultValue; } } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[0]; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue value = layoutContext.getValue(key); if (value instanceof CSSConstant == false) { // fine, we're done here ... return; } final CSSConstant constant = (CSSConstant) value; final LayoutElement parent = currentNode.getParent(); if (parent != null) { final double parentFontSize = parent.getLayoutContext().getFontSpecification().getFontSize(); if (RelativeFontSize.LARGER.equals(value)) { final double scaleFactor = getScaleLargerFactor(parentFontSize); layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, scaleFactor)); return; } if (RelativeFontSize.SMALLER.equals(value)) { final double scaleFactor = getScaleSmallerFactor(parentFontSize); layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, scaleFactor)); return; } } else { // we might not have a parent, but that won't stop us .. if (RelativeFontSize.LARGER.equals(value)) { layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, 120)); return ; } if (RelativeFontSize.SMALLER.equals(value)) { layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, 85)); return; } } final CSSValue resolvedValue = lookupValue(constant); if (resolvedValue != null) { layoutContext.setValue(key, resolvedValue); return; } // do not change the font size.. layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, 100)); } public double getScaleLargerFactor(final double parentSize) { for (int i = 0; i < predefinedSizes.length; i++) { final CSSNumericValue size = predefinedSizes[i]; if (parentSize < size.getValue()) { return predefinedScalingFactors[i]; } } return predefinedScalingFactors[6]; } public double getScaleSmallerFactor(final double parentSize) { for (int i = predefinedSizes.length; i >= 0; i--) { final CSSNumericValue size = predefinedSizes[i]; if (parentSize > size.getValue()) { return predefinedScalingFactors[i]; } } return predefinedScalingFactors[0]; } } ././@LongLink 0000000 0000000 0000000 00000000165 00000000000 011567 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/MinMaxFontSizeResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/MinMaxFontSizeRes0000644 0001750 0001750 00000017250 11305540552 032532 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: MinMaxFontSizeResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.fonts; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.LibLayoutBoot; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.font.FontSizeConstant; import org.jfree.layouting.input.style.keys.font.FontStyleKeys; import org.jfree.layouting.input.style.keys.font.RelativeFontSize; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.input.style.values.CSSNumericType; import org.jfree.layouting.input.style.values.CSSNumericValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; // todo apply built in defaults instead ... /** * Creation-Date: 21.12.2005, 12:47:43 * * @author Thomas Morgner */ public class MinMaxFontSizeResolveHandler extends ConstantsResolveHandler { private static final String SIZE_FACTOR_PREFIX = "org.jfree.layouting.defaults.FontSizeFactor."; private double fontSize; private CSSNumericValue[] predefinedSizes; private double[] predefinedScalingFactors; public MinMaxFontSizeResolveHandler() { fontSize = parseDouble("org.jfree.layouting.defaults.FontSize", 12); predefinedSizes = new CSSNumericValue[7]; predefinedSizes[0] = computePredefinedSize(FontSizeConstant.XX_SMALL); predefinedSizes[1] = computePredefinedSize(FontSizeConstant.X_SMALL); predefinedSizes[2] = computePredefinedSize(FontSizeConstant.SMALL); predefinedSizes[3] = computePredefinedSize(FontSizeConstant.MEDIUM); predefinedSizes[4] = computePredefinedSize(FontSizeConstant.LARGE); predefinedSizes[5] = computePredefinedSize(FontSizeConstant.X_LARGE); predefinedSizes[6] = computePredefinedSize(FontSizeConstant.XX_LARGE); predefinedScalingFactors = new double[7]; predefinedScalingFactors[0] = computePredefinedScalingFactor(FontSizeConstant.XX_SMALL); predefinedScalingFactors[1] = computePredefinedScalingFactor(FontSizeConstant.X_SMALL); predefinedScalingFactors[2] = computePredefinedScalingFactor(FontSizeConstant.SMALL); predefinedScalingFactors[3] = computePredefinedScalingFactor(FontSizeConstant.MEDIUM); predefinedScalingFactors[4] = computePredefinedScalingFactor(FontSizeConstant.LARGE); predefinedScalingFactors[5] = computePredefinedScalingFactor(FontSizeConstant.X_LARGE); predefinedScalingFactors[6] = computePredefinedScalingFactor(FontSizeConstant.XX_LARGE); addValue(FontSizeConstant.XX_SMALL, predefinedSizes[0]); addValue(FontSizeConstant.X_SMALL, predefinedSizes[1]); addValue(FontSizeConstant.SMALL, predefinedSizes[2]); addValue(FontSizeConstant.MEDIUM, predefinedSizes[3]); addValue(FontSizeConstant.LARGE, predefinedSizes[4]); addValue(FontSizeConstant.X_LARGE, predefinedSizes[5]); addValue(FontSizeConstant.XX_LARGE, predefinedSizes[6]); } private CSSNumericValue computePredefinedSize(final CSSConstant c) { final String key = SIZE_FACTOR_PREFIX + c.getCSSText(); final double scaling = parseDouble(key, 100); return CSSNumericValue.createValue(CSSNumericType.PT, fontSize * scaling / 100d); } private double computePredefinedScalingFactor(final CSSConstant c) { final String key = SIZE_FACTOR_PREFIX + c.getCSSText(); return parseDouble(key, 100); } private double parseDouble(final String configKey, final double defaultValue) { final String value = LibLayoutBoot.getInstance().getGlobalConfig() .getConfigProperty(configKey); if (value == null) { return defaultValue; } try { return Double.parseDouble(value); } catch (NumberFormatException nfe) { return defaultValue; } } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[] { FontStyleKeys.FONT_SIZE }; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue value = layoutContext.getValue(key); if (value instanceof CSSConstant == false) { // fine, we're done here ... return ; } final CSSConstant constant = (CSSConstant) value; final double parentFontSize = currentNode.getLayoutContext().getFontSpecification().getFontSize(); if (RelativeFontSize.LARGER.equals(value)) { final double scaleFactor = getScaleLargerFactor(parentFontSize); layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, scaleFactor)); } else if (RelativeFontSize.SMALLER.equals(value)) { final double scaleFactor = getScaleSmallerFactor(parentFontSize); layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, scaleFactor)); } final CSSValue resolvedValue = lookupValue(constant); if (resolvedValue != null) { layoutContext.setValue(key, resolvedValue); return; } if (key.equals(FontStyleKeys.MAX_FONT_SIZE)) { // there is no upper limit if the value is invalid layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PT, Short.MAX_VALUE)); } else { // there is no lower limit if the value is invalid layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PT, 0)); } } public double getScaleLargerFactor(final double parentSize) { for (int i = 0; i < predefinedSizes.length; i++) { final CSSNumericValue size = predefinedSizes[i]; if (parentSize < size.getValue()) { return predefinedScalingFactors[i]; } } return predefinedScalingFactors[6]; } public double getScaleSmallerFactor(final double parentSize) { for (int i = predefinedSizes.length; i >= 0; i--) { final CSSNumericValue size = predefinedSizes[i]; if (parentSize > size.getValue()) { return predefinedScalingFactors[i]; } } return predefinedScalingFactors[0]; } } ././@LongLink 0000000 0000000 0000000 00000000171 00000000000 011564 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontEmphasizeStyleResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontEmphasizeStyl0000644 0001750 0001750 00000003674 11305540552 032642 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: FontEmphasizeStyleResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.fonts; import org.jfree.layouting.input.style.keys.font.FontEmphasizeStyle; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 18.12.2005, 16:32:08 * * @author Thomas Morgner */ public class FontEmphasizeStyleResolveHandler extends ConstantsResolveHandler { public FontEmphasizeStyleResolveHandler() { addNormalizeValue(FontEmphasizeStyle.ACCENT); addNormalizeValue(FontEmphasizeStyle.CIRCLE); addNormalizeValue(FontEmphasizeStyle.DISC); addNormalizeValue(FontEmphasizeStyle.DOT); addNormalizeValue(FontEmphasizeStyle.NONE); } } ././@LongLink 0000000 0000000 0000000 00000000174 00000000000 011567 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontEmphasizePositionResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontEmphasizePosi0000644 0001750 0001750 00000003716 11305540552 032616 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: FontEmphasizePositionResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.fonts; import org.jfree.layouting.input.style.keys.font.FontEmphasizePosition; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 18.12.2005, 16:31:08 * * @author Thomas Morgner */ public class FontEmphasizePositionResolveHandler extends ConstantsResolveHandler { public FontEmphasizePositionResolveHandler() { addNormalizeValue(FontEmphasizePosition.AFTER); addNormalizeValue(FontEmphasizePosition.BEFORE); addValue(FontEmphasizePosition.ABOVE, FontEmphasizePosition.BEFORE); addValue(FontEmphasizePosition.BELOW, FontEmphasizePosition.AFTER); } } ././@LongLink 0000000 0000000 0000000 00000000161 00000000000 011563 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontFamilyResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontFamilyResolve0000644 0001750 0001750 00000012140 11305540552 032606 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: FontFamilyResolveHandler.java 6489 2008-11-28 14:53:40Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.fonts; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.font.FontFamilyValues; import org.jfree.layouting.input.style.keys.font.FontStyleKeys; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.input.style.values.CSSStringValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.input.style.values.CSSValueList; import org.jfree.layouting.layouter.context.FontSpecification; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; import org.jfree.layouting.output.OutputProcessorMetaData; import org.pentaho.reporting.libraries.base.util.DebugLog; import org.pentaho.reporting.libraries.fonts.registry.FontFamily; /** * Creation-Date: 18.12.2005, 16:35:28 * * @author Thomas Morgner */ public class FontFamilyResolveHandler extends ConstantsResolveHandler { public FontFamilyResolveHandler() { addNormalizeValue(FontFamilyValues.CURSIVE); addNormalizeValue(FontFamilyValues.FANTASY); addNormalizeValue(FontFamilyValues.MONOSPACE); addNormalizeValue(FontFamilyValues.SANS_SERIF); addNormalizeValue(FontFamilyValues.SERIF); } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[] { FontStyleKeys.FONT_WEIGHT, FontStyleKeys.FONT_VARIANT, FontStyleKeys.FONT_SMOOTH, FontStyleKeys.FONT_STRETCH }; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { //Log.debug ("Processing: " + currentNode); final LayoutContext layoutContext = currentNode.getLayoutContext(); final FontSpecification fs = layoutContext.getFontSpecification(); final OutputProcessorMetaData outputMetaData = process.getOutputMetaData(); final CSSValue cssValue = layoutContext.getValue(key); if (cssValue instanceof CSSValueList) { final CSSValueList list = (CSSValueList) cssValue; for (int i = 0; i < list.getLength(); i++) { final CSSValue item = list.getItem(i); if (item instanceof CSSConstant) { final CSSConstant c = (CSSConstant) lookupValue((CSSConstant) item); final FontFamily family = outputMetaData.getFontFamilyForGenericName(c); fs.setFontFamily(family.getFamilyName()); if (process.getOutputMetaData().isValid(fs)) { return; } // Ignore, although this is not ok. DebugLog.log ("Invalid state after setting predefined font family."); } else if (item instanceof CSSStringValue) { final CSSStringValue sval = (CSSStringValue) item; final String fontName = sval.getValue(); fs.setFontFamily(fontName); if (process.getOutputMetaData().isValid(fs)) { return; } } } } else if (cssValue instanceof CSSConstant) { if (FontFamilyValues.NONE.equals(cssValue)) { fs.setFontFamily(null); return; } } final FontFamily family = outputMetaData.getDefaultFontFamily(); fs.setFontFamily(family.getFamilyName()); if (process.getOutputMetaData().isValid(fs) == false) { throw new IllegalStateException ("Invalid state after setting the default font family."); } } } ././@LongLink 0000000 0000000 0000000 00000000162 00000000000 011564 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontStretchResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontStretchResolv0000644 0001750 0001750 00000010163 11305540552 032637 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: FontStretchResolveHandler.java 6489 2008-11-28 14:53:40Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.fonts; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.font.FontStretch; import org.jfree.layouting.input.style.keys.font.FontStyleKeys; import org.jfree.layouting.input.style.values.CSSConstant; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 18.12.2005, 20:33:42 * * @author Thomas Morgner */ public class FontStretchResolveHandler extends ConstantsResolveHandler { public FontStretchResolveHandler() { addNormalizeValue(FontStretch.CONDENSED); addNormalizeValue(FontStretch.EXPANDED); addNormalizeValue(FontStretch.EXTRA_CONDENSED); addNormalizeValue(FontStretch.EXTRA_EXPANDED); addNormalizeValue(FontStretch.NORMAL); addNormalizeValue(FontStretch.SEMI_CONDENSED); addNormalizeValue(FontStretch.SEMI_EXPANDED); addNormalizeValue(FontStretch.ULTRA_CONDENSED); addNormalizeValue(FontStretch.ULTRA_EXPANDED); } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue value = layoutContext.getValue(key); final CSSConstant result; if (FontStretch.WIDER.equals(value)) { // ask the parent ... final CSSConstant parentStretch = queryParent(currentNode.getParent()); result = FontStretch.getByOrder(FontStretch.getOrder(parentStretch) + 1); } else if (FontStretch.NARROWER.equals(value)) { // ask the parent ... final CSSConstant parentStretch = queryParent(currentNode.getParent()); result = FontStretch.getByOrder(FontStretch.getOrder(parentStretch) - 1); } else if (value instanceof CSSConstant) { final CSSConstant stretch = (CSSConstant) lookupValue((CSSConstant) value); if (stretch != null) { result = stretch; } else { result = FontStretch.NORMAL; } } else { result = FontStretch.NORMAL; } layoutContext.setValue(key, result); } private CSSConstant queryParent(final LayoutElement parent) { if (parent == null) { return FontStretch.NORMAL; } final CSSValue parentValue = parent.getLayoutContext().getValue(FontStyleKeys.FONT_STRETCH); if (parentValue == null) { return FontStretch.NORMAL; } // normalize .. return FontStretch.getByOrder(FontStretch.getOrder(parentValue)); } } ././@LongLink 0000000 0000000 0000000 00000000161 00000000000 011563 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontEffectResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontEffectResolve0000644 0001750 0001750 00000003525 11305540552 032570 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: FontEffectResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.fonts; import org.jfree.layouting.input.style.keys.font.FontEffects; import org.jfree.layouting.layouter.style.resolver.computed.ConstantsResolveHandler; /** * Creation-Date: 18.12.2005, 15:30:36 * * @author Thomas Morgner */ public class FontEffectResolveHandler extends ConstantsResolveHandler { public FontEffectResolveHandler() { addNormalizeValue(FontEffects.EMBOSS); addNormalizeValue(FontEffects.ENGRAVE); addNormalizeValue(FontEffects.NONE); addNormalizeValue(FontEffects.OUTLINE); } } ././@LongLink 0000000 0000000 0000000 00000000161 00000000000 011563 L ustar root root liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontWeightResolveHandler.java liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontWeightResolve0000644 0001750 0001750 00000010077 11305540552 032623 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: FontWeightResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.computed.fonts; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.font.FontStyleKeys; import org.jfree.layouting.input.style.keys.font.FontWeight; import org.jfree.layouting.input.style.values.CSSNumericType; import org.jfree.layouting.input.style.values.CSSNumericValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; /** * Creation-Date: 18.12.2005, 20:33:42 * * @author Thomas Morgner */ public class FontWeightResolveHandler implements ResolveHandler { public FontWeightResolveHandler() { } /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return */ public StyleKey[] getRequiredStyles() { return new StyleKey[0]; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve(final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { final LayoutContext layoutContext = currentNode.getLayoutContext(); final CSSValue value = layoutContext.getValue(key); final int fontWeight; if (FontWeight.BOLD.equals(value)) { // ask the parent ... fontWeight = 700; } else if (FontWeight.NORMAL.equals(value)) { // ask the parent ... fontWeight = 400; } else if (FontWeight.BOLDER.equals(value)) { final int parentFontWeight = queryParent(currentNode.getParent()); fontWeight = Math.max (900, parentFontWeight + 100); } else if (FontWeight.LIGHTER.equals(value)) { final int parentFontWeight = queryParent(currentNode.getParent()); fontWeight = Math.min (100, parentFontWeight - 100); } else if (value instanceof CSSNumericValue) { final CSSNumericValue nval = (CSSNumericValue) value; if (CSSNumericType.NUMBER.equals(nval.getType()) == false) { // preserve the parent's weight... fontWeight = queryParent(currentNode.getParent()); } else { fontWeight = (int) nval.getValue(); } } else { fontWeight = queryParent(currentNode.getParent()); } layoutContext.setValue(FontStyleKeys.FONT_WEIGHT, CSSNumericValue.createValue(CSSNumericType.NUMBER, fontWeight)); } private int queryParent(final LayoutElement parent) { if (parent == null) { return 400; // Normal } return parent.getLayoutContext().getFontSpecification().getFontWeight(); } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/ResolveHandler.java 0000644 0001750 0001750 00000004252 11305540552 030067 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: ResolveHandler.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.layouter.model.LayoutElement; /** * Creation-Date: 11.12.2005, 14:43:15 * * @author Thomas Morgner */ public interface ResolveHandler { /** * This indirectly defines the resolve order. The higher the order, the more * dependent is the resolver on other resolvers to be complete. * * @return the array of required style keys. */ public StyleKey[] getRequiredStyles(); /** * Resolves a single property. * * @param process the current layout process controlling everyting * @param currentNode the current layout element that is processed * @param key the style key that is computed. */ public void resolve(LayoutProcess process, LayoutElement currentNode, StyleKey key); } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/FlatStyleResolver.java 0000644 0001750 0001750 00000007621 11305540552 030606 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: FlatStyleResolver.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.State; import org.jfree.layouting.StateException; import org.jfree.layouting.input.style.PageAreaType; import org.jfree.layouting.input.style.PseudoPage; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.context.LayoutStyle; import org.jfree.layouting.layouter.model.LayoutElement; /** * Not yet used. Needs to be implemented. Its my fast resolver, but that * one needs more thinking and more tweaking. */ public class FlatStyleResolver extends AbstractStyleResolver { public FlatStyleResolver () { } public StyleResolver deriveInstance () { return this; } public void initialize (final LayoutProcess layoutProcess) { super.initialize(layoutProcess); } protected void resolveOutOfContext(final LayoutElement element) { } public LayoutStyle resolvePageStyle(final CSSValue pageName, final PseudoPage[] pseudoPages, final PageAreaType pageArea) { return null; } /** * Performs tests, whether there is a pseudo-element definition for the given * element. The element itself can be a pseudo-element as well. * * @param element * @param pseudo * @return */ public boolean isPseudoElementStyleResolvable(final LayoutElement element, final String pseudo) { return false; } /** * Resolves the style. This is guaranteed to be called in the order of the document * elements traversing the document tree using the 'deepest-node-first' strategy. * * @param node */ public void resolveStyle (final LayoutElement node) { // this is a three stage process final LayoutContext layoutContext = node.getLayoutContext(); final StyleKey[] keys = getKeys(); // Stage 0: Initialize with the built-in defaults // Stage 1a: Add the parent styles (but only the one marked as inheritable). final LayoutStyle initialStyle = getInitialStyle(); // initialize the style ... for (int i = 0; i < keys.length; i++) { final StyleKey key = keys[i]; layoutContext.setValue(key, initialStyle.getValue(key)); } // Stage 2: Search for all class attributes, and lookup the corresponding // style. The sty } public State saveState() throws StateException { return null; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/StyleRuleMatcher.java 0000644 0001750 0001750 00000005143 11305540552 030406 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: StyleRuleMatcher.java 2739 2007-04-02 11:41:22Z taqua $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.CSSPageRule; import org.jfree.layouting.input.style.CSSStyleRule; import org.jfree.layouting.input.style.PseudoPage; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.model.LayoutElement; /** * A (possibly statefull) style matcher. This class is responsible for * checking which style rule applies to the given document. * * It is guaranteed, that the matcher receives the elements in the order * in which they appear in the document. * * Although the style rule matcher does not receive explicit element-opened * and element-closed events, these events can be derived from the layout element * and its relation to the parent (and possibly previously received element and * its parent). * * @author Thomas Morgner */ public interface StyleRuleMatcher { public void initialize (final LayoutProcess layoutProcess); /** * Creates an independent copy of this style rule matcher. * * @return */ public StyleRuleMatcher deriveInstance(); public CSSStyleRule[] getMatchingRules (LayoutElement element); public boolean isMatchingPseudoElement (LayoutElement element, String pseudo); public CSSPageRule[] getPageRule (CSSValue pageName, PseudoPage[] pseudoPages); } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/DefaultStyleResolver.java 0000644 0001750 0001750 00000036131 11305540552 031302 0 ustar rene rene /** * =========================================== * LibLayout : a free Java layouting library * =========================================== * * Project Info: http://reporting.pentaho.org/liblayout/ * * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ------------ * $Id: DefaultStyleResolver.java 6489 2008-11-28 14:53:40Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver; import java.util.Arrays; import java.util.ArrayList; import org.jfree.layouting.DocumentContextUtility; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.State; import org.jfree.layouting.StateException; import org.jfree.layouting.input.style.CSSDeclarationRule; import org.jfree.layouting.input.style.CSSPageAreaRule; import org.jfree.layouting.input.style.CSSPageRule; import org.jfree.layouting.input.style.CSSStyleRule; import org.jfree.layouting.input.style.PageAreaType; import org.jfree.layouting.input.style.PseudoPage; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.StyleRule; import org.jfree.layouting.input.style.selectors.CSSSelector; import org.jfree.layouting.input.style.selectors.SelectorWeight; import org.jfree.layouting.input.style.values.CSSInheritValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.DocumentContext; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.context.LayoutStyle; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.CSSStyleRuleComparator; import org.jfree.layouting.layouter.style.LayoutStyleImpl; import org.jfree.layouting.namespace.NamespaceCollection; import org.jfree.layouting.namespace.NamespaceDefinition; import org.jfree.layouting.namespace.Namespaces; import org.jfree.layouting.util.AttributeMap; import org.pentaho.reporting.libraries.base.util.DebugLog; import org.pentaho.reporting.libraries.resourceloader.Resource; import org.pentaho.reporting.libraries.resourceloader.ResourceKey; import org.pentaho.reporting.libraries.resourceloader.ResourceManager; /** * A cascading style resolver. This resolver follows the cascading rules * as outlined by the Cascading Stylesheet Standard. * * @author Thomas Morgner */ public class DefaultStyleResolver extends AbstractStyleResolver { private static class DefaultStyleResolverState extends AbstractStyleResolverState { private boolean strictStyleMode; private StyleRuleMatcher ruleMatcher; private DefaultStyleResolverState() { } public boolean isStrictStyleMode() { return strictStyleMode; } public void setStrictStyleMode(final boolean strictStyleMode) { this.strictStyleMode = strictStyleMode; } public StyleRuleMatcher getRuleMatcher() { return ruleMatcher; } public void setRuleMatcher(final StyleRuleMatcher ruleMatcher) { this.ruleMatcher = ruleMatcher; } protected AbstractStyleResolver create() { return new DefaultStyleResolver(); } protected void fill(final AbstractStyleResolver resolver, final LayoutProcess layoutProcess) { super.fill(resolver, layoutProcess); final DefaultStyleResolver res = (DefaultStyleResolver) resolver; res.styleRuleMatcher = ruleMatcher; res.strictStyleMode = strictStyleMode; } } private boolean strictStyleMode; private StyleRuleMatcher styleRuleMatcher; private StyleKey[] inheritedKeys; public DefaultStyleResolver () { } public void initialize (final LayoutProcess layoutProcess) { super.initialize(layoutProcess); final DocumentContext documentContext = layoutProcess.getDocumentContext(); this.styleRuleMatcher = DocumentContextUtility.getStyleRuleMatcher(documentContext); this.styleRuleMatcher.initialize(layoutProcess); this.strictStyleMode = Boolean.TRUE.equals (documentContext.getMetaAttribute(DocumentContext.STRICT_STYLE_MODE)); loadInitialStyle(); } // This one is expensive too: 6% protected void resolveOutOfContext (final LayoutElement element) { // as this styleresolver is not statefull, we can safely call the resolve // style method. A statefull resolver would have to find other means. resolveStyle(element); } /** * Performs tests, whether there is a pseudo-element definition for the given * element. The element itself can be a pseudo-element as well. * * @param element * @param pseudo * @return */ public boolean isPseudoElementStyleResolvable(final LayoutElement element, final String pseudo) { return styleRuleMatcher.isMatchingPseudoElement(element, pseudo); } /** * Resolves the style. This is guaranteed to be called in the order of the * document elements traversing the document tree using the * 'deepest-node-first' strategy. * (8% just for the first class calls (not counting the calls comming from * resolveAnonymous (which is another 6%)) * @param element the elemen that should be resolved. */ public void resolveStyle(final LayoutElement element) { // this is a three stage process final LayoutContext layoutContext = element.getLayoutContext(); final StyleKey[] keys = getKeys(); // Log.debug ("Resolving style for " + // layoutContext.getTagName() + ":" + // layoutContext.getPseudoElement()); // Stage 0: Initialize with the built-in defaults // Stage 1a: Add the parent styles (but only the one marked as inheritable). final LayoutElement parent = element.getParent(); final LayoutStyle initialStyle = getInitialStyle(); if (layoutContext.copyFrom(initialStyle) == false) { // ok, manual copy .. DebugLog.log("Failed to use fast-copy"); for (int i = 0; i < keys.length; i++) { final StyleKey key = keys[i]; layoutContext.setValue(key, initialStyle.getValue(key)); } } final LayoutStyle parentStyle; if (parent != null) { parentStyle = parent.getLayoutContext(); final StyleKey[] inheritedKeys = getInheritedKeys(); for (int i = 0; i < inheritedKeys.length; i++) { final StyleKey key = inheritedKeys[i]; layoutContext.setValue(key, parentStyle.getValue(key)); } } else { parentStyle = initialStyle; } // Stage 1b: Find all matching stylesheets for the given element performSelectionStep(element, layoutContext); // Stage 1c: Add the contents of the style attribute, if there is one .. // the libLayout style is always added: This is a computed style and the hook // for a element neutral user defined tweaking .. final AttributeMap attributes = layoutContext.getAttributes(); final Object libLayoutStyleValue = attributes.getAttribute (Namespaces.LIBLAYOUT_NAMESPACE, "style"); // You cannot override element specific styles with that. So an HTML-style // attribute has move value than a LibLayout-style attribute. addStyleFromAttribute(element, libLayoutStyleValue); if (strictStyleMode) { performStrictStyleAttr(element); } else { performCompleteStyleAttr(element); } // Stage 2: Compute the 'specified' set of values. // Find all explicitly inherited styles and add them from the parent. final CSSInheritValue inheritInstance = CSSInheritValue.getInstance(); for (int i = 0; i < keys.length; i++) { final StyleKey key = keys[i]; final Object value = layoutContext.getValue(key); if (inheritInstance.equals(value)) { layoutContext.setValue(key, parentStyle.getValue(key)); } } // Stage 3: Compute the computed value set. ResolverFactory.getInstance().performResolve (getLayoutProcess(), element); } private StyleKey[] getInheritedKeys() { if (inheritedKeys == null) { final StyleKey[] keys = getKeys(); final ArrayList inheritedKeysList = new ArrayList(); for (int i = 0; i < keys.length; i++) { final StyleKey key = keys[i]; if (key.isInherited()) { inheritedKeysList.add(key); } } inheritedKeys = (StyleKey[]) inheritedKeysList.toArray(new StyleKey[inheritedKeysList.size()]); } return inheritedKeys; } /** * Check, whether there is a known style attribute for the element's namespace * and if so, grab its value. This method uses strict conformance to the XML * rules and thus it does not evaluate foreign styles. * * * @param node * @param style */ private void performStrictStyleAttr (final LayoutElement node) { final LayoutContext layoutContext = node.getLayoutContext(); final String namespace = layoutContext.getNamespace(); if (namespace == null) { return; } final NamespaceCollection namespaces = getNamespaces(); final NamespaceDefinition ndef = namespaces.getDefinition(namespace); if (ndef == null) { return; } final AttributeMap attributes = layoutContext.getAttributes(); final String[] styleAttrs = ndef.getStyleAttribute (layoutContext.getTagName()); for (int i = 0; i < styleAttrs.length; i++) { final String attr = styleAttrs[i]; final Object styleValue = attributes.getAttribute(namespace, attr); addStyleFromAttribute(node, styleValue); } } /** * Check, whether there are known style attributes and if so, import them. * This method uses a relaxed syntax and imports all known style attributes * ignoring the element's defined namespace. This allows to add styles to * elements which would not support styles otherwise, but may have .. * chaotic .. side effects. * * * @param node * @param style */ private void performCompleteStyleAttr (final LayoutElement node) { final NamespaceCollection namespaces = getNamespaces(); final String[] namespaceNames = namespaces.getNamespaces(); final LayoutContext layoutContext = node.getLayoutContext(); final AttributeMap attributes = layoutContext.getAttributes(); for (int i = 0; i < namespaceNames.length; i++) { final String namespace = namespaceNames[i]; final NamespaceDefinition ndef = namespaces.getDefinition(namespace); if (ndef == null) { continue; } final String[] styleAttrs = ndef.getStyleAttribute(layoutContext.getTagName()); for (int x = 0; x < styleAttrs.length; x++) { final String attr = styleAttrs[x]; final Object styleValue = attributes.getAttribute(namespace, attr); addStyleFromAttribute(node, styleValue); } } } private void addStyleFromAttribute(final LayoutElement node, final Object styleValue) { if (styleValue == null) { return; } if (styleValue instanceof String) { final String styleText = (String) styleValue; try { final LayoutProcess layoutProcess = getLayoutProcess(); final byte[] bytes = styleText.getBytes("UTF-8"); final ResourceKey baseKey = DocumentContextUtility.getBaseResource (layoutProcess.getDocumentContext()); final ResourceManager manager = layoutProcess.getResourceManager(); final ResourceKey key = manager.createKey(bytes); final Resource resource = manager.create(key, baseKey, StyleRule.class); final CSSDeclarationRule rule = (CSSDeclarationRule) resource.getResource(); if (rule != null) { copyStyleInformation(node.getLayoutContext(), rule, node); } } catch (Exception e) { DebugLog.log("Unable to handle style attribute value.", e); } } else if (styleValue instanceof CSSDeclarationRule) { final CSSDeclarationRule rule = (CSSDeclarationRule) styleValue; copyStyleInformation(node.getLayoutContext(), rule, node); } } /** * Todo: Make sure that the 'activeStyles' are sorted and then apply them with the * lowest style first. All Matching styles have to be added. * * @param node * @param style */ private void performSelectionStep (final LayoutElement element, final LayoutStyle style) { final CSSStyleRule[] activeStyleRules = styleRuleMatcher.getMatchingRules(element); // sort ... Arrays.sort(activeStyleRules, new CSSStyleRuleComparator()); SelectorWeight oldSelectorWeight = null; for (int i = 0; i < activeStyleRules.length; i++) { final CSSStyleRule activeStyleRule = activeStyleRules[i]; final CSSSelector selector = activeStyleRule.getSelector(); final SelectorWeight activeWeight = selector.getWeight(); if (oldSelectorWeight != null) { if (oldSelectorWeight.compareTo(activeWeight) > 0) { oldSelectorWeight = activeWeight; continue; } } oldSelectorWeight = activeWeight; copyStyleInformation(style, activeStyleRule, element); } } public StyleResolver deriveInstance () { return this; } public State saveState() throws StateException { final DefaultStyleResolverState state = new DefaultStyleResolverState(); fillState(state); state.setRuleMatcher(styleRuleMatcher); state.setStrictStyleMode(strictStyleMode); return state; } public LayoutStyle resolvePageStyle(final CSSValue pageName, final PseudoPage[] pseudoPages, final PageAreaType pageArea) { final LayoutStyleImpl style = new LayoutStyleImpl(); final CSSPageRule[] pageRule = styleRuleMatcher.getPageRule(pageName, pseudoPages); for (int i = 0; i < pageRule.length; i++) { final CSSPageRule cssPageRule = pageRule[i]; copyStyleInformation(style, cssPageRule, null); final int rc = cssPageRule.getRuleCount(); for (int r = 0; r < rc; r++) { final CSSPageAreaRule rule = cssPageRule.getRule(r); if (rule.getPageArea().equals(pageArea)) { copyStyleInformation(style, rule, null); } } } return style; } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/package.html 0000644 0001750 0001750 00000000330 11305540552 026561 0 ustar rene rene The style resolver resolves all non-positional and not-box-size properties. Font sizes are ok, as they do not depend on the box's width or height (or the box's parent's width or height).