liblayout-0.2.10/0000755000175000017500000000000011636454157012256 5ustar renereneliblayout-0.2.10/source/0000755000175000017500000000000011305540552013542 5ustar renereneliblayout-0.2.10/source/loader.properties0000644000175000017500000000047711305540552017136 0ustar renereneorg.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/0000755000175000017500000000000011305540552014331 5ustar renereneliblayout-0.2.10/source/org/jfree/0000755000175000017500000000000011305540552015424 5ustar renereneliblayout-0.2.10/source/org/jfree/layouting/0000755000175000017500000000000011305540552017437 5ustar renereneliblayout-0.2.10/source/org/jfree/layouting/layouter/0000755000175000017500000000000011305540552021303 5ustar renereneliblayout-0.2.10/source/org/jfree/layouting/layouter/feed/0000755000175000017500000000000011305540552022206 5ustar renereneliblayout-0.2.10/source/org/jfree/layouting/layouter/feed/DefaultInputFeed.java0000644000175000017500000004201111305540552026237 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000371111305540552026615 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000001261011305540552024734 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552022403 5ustar renereneliblayout-0.2.10/source/org/jfree/layouting/layouter/model/LayoutElement.java0000644000175000017500000001702711305540552026044 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000414711305540552025337 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000341511305540552025373 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000354711305540552025400 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552023145 5ustar renereneliblayout-0.2.10/source/org/jfree/layouting/layouter/counters/glyph/0000755000175000017500000000000011305540552024270 5ustar renereneliblayout-0.2.10/source/org/jfree/layouting/layouter/counters/glyph/DiamondCounterStyle.java0000644000175000017500000000315011305540552031066 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000314511305540552030752 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000314611305540552030721 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000314211305540552030531 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000314411305540552030756 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000313411305540552030245 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000313711305540552030402 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552024266 5ustar renereneliblayout-0.2.10/source/org/jfree/layouting/layouter/counters/other/AsterisksCounterStyle.java0000644000175000017500000000335311305540552031466 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000313111305540552030407 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000601311305540552030000 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000263611305540552026457 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552024607 5ustar renereneliblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/DevanagariCounterStyle.java0000644000175000017500000000352011305540552032074 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000350711305540552031401 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000352311305540552032166 0ustar renerene/** * =========================================== * 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'); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/UppercaseHexadecimalCounterStyle.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/UppercaseHexadecimalCounterSty0000644000175000017500000000326211305540552032651 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000351511305540552031714 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000317511305540552031265 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000317011305540552031076 0ustar renerene/** * =========================================== * 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 ""; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/DecimalLeadingZeroCounterStyle.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/DecimalLeadingZeroCounterStyle0000644000175000017500000000354311305540552032602 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000655111305540552031444 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000317211305540552031374 0ustar renerene/** * =========================================== * 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 "."; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/LowercaseHexadecimalCounterStyle.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/counters/numeric/LowercaseHexadecimalCounterSty0000644000175000017500000000324411305540552032646 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552022062 5ustar renereneliblayout-0.2.10/source/org/jfree/layouting/layouter/i18n/DefaultLocalizationContext.java0000644000175000017500000000465311305540552030237 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000343711305540552026731 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552022755 5ustar renereneliblayout-0.2.10/source/org/jfree/layouting/layouter/content/computed/0000755000175000017500000000000011305540552024575 5ustar renereneliblayout-0.2.10/source/org/jfree/layouting/layouter/content/computed/PendingToken.java0000644000175000017500000000367111305540552030034 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000305711305540552030531 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000342511305540552030064 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000376411305540552030227 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000354511305540552030245 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000331411305540552030167 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000331511305540552030223 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000410711305540552030245 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000305411305540552030362 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552024427 5ustar renereneliblayout-0.2.10/source/org/jfree/layouting/layouter/content/statics/ResourceContentToken.java0000644000175000017500000000411611305540552031417 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000321311305540552027521 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000372611305540552030377 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000317011305540552031411 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000406311305540552031556 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552024600 5ustar renereneliblayout-0.2.10/source/org/jfree/layouting/layouter/content/resolved/ResolvedCounterToken.java0000644000175000017500000000430211305540552031566 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000504411305540552031755 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000316511305540552030234 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000402411305540552031416 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000276111305540552026241 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552023736 5ustar renereneliblayout-0.2.10/source/org/jfree/layouting/layouter/content/type/GenericType.java0000644000175000017500000000331111305540552027015 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000321411305540552027232 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000302511305540552030235 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000320311305540552026365 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552022443 5ustar renereneliblayout-0.2.10/source/org/jfree/layouting/layouter/style/CSSStyleRuleComparator.java0000644000175000017500000000723311305540552027644 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000003131111305540552030040 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000721011305540552026426 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552024304 5ustar renereneliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/0000755000175000017500000000000011305540552026604 5ustar renereneliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/text/0000755000175000017500000000000011305540552027570 5ustar renerene././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/text/LetterSpacingResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/text/LetterSpacingRe0000644000175000017500000001213311305540552032546 0ustar renerene/** * =========================================== * 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; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/text/TextIndentResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/text/TextIndentResol0000644000175000017500000000474611305540552032621 0ustar renerene/** * =========================================== * 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) { } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/text/WordSpacingResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/text/WordSpacingReso0000644000175000017500000001173511305540552032573 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552027533 5ustar renerene././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/line/LineHeightResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/line/LineHeightResol0000644000175000017500000001236411305540552032511 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552027735 5ustar renerene././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/fonts/FontSmoothResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/fonts/FontSmoothReso0000644000175000017500000000656111305540552032621 0ustar renerene/** * =========================================== * 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); } } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/fonts/FontSizeResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/fonts/FontSizeResolv0000644000175000017500000001542711305540552032625 0ustar renerene/** * =========================================== * 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)); } } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/fonts/MaxMinFontSizeResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/fonts/MaxMinFontSize0000644000175000017500000000573711305540552032547 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/fonts/FontSizeAdjustResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/percentages/fonts/FontSizeAdjust0000644000175000017500000001011411305540552032571 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552026124 5ustar renereneliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/0000755000175000017500000000000011305540552027110 5ustar renerene././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextTransformResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextTransformResol0000644000175000017500000000362411305540552032665 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/WordBreakResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/WordBreakResolveHa0000644000175000017500000000363611305540552032534 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextAlignResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextAlignResolveHa0000644000175000017500000000600611305540552032545 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextDecorationWidthResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextDecorationWidt0000644000175000017500000000651111305540552032622 0ustar renerene/** * =========================================== * 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; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextJustifyResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextJustifyResolve0000644000175000017500000000376311305540552032706 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextWrapResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextWrapResolveHan0000644000175000017500000000355011305540552032603 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/BlockProgressionResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/BlockProgressionRe0000644000175000017500000000355211305540552032614 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextOverflowModeResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextOverflowModeRe0000644000175000017500000000357711305540552032613 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextOverflowEllipsisResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextOverflowEllips0000644000175000017500000000746311305540552032666 0ustar renerene/** * =========================================== * 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; } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextKashidaSpaceResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextKashidaSpaceRe0000644000175000017500000000626511305540552032520 0ustar renerene/** * =========================================== * 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)); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/WhitespaceCollapseResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/WhitespaceCollapse0000644000175000017500000000371411305540552032617 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextAlignLastResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextAlignLastResol0000644000175000017500000000370111305540552032564 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextJustifyTrimResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/TextJustifyTrimRes0000644000175000017500000000360111305540552032643 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/WordWrapResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/WordWrapResolveHan0000644000175000017500000000342511305540552032573 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/DirectionResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/text/DirectionResolveHa0000644000175000017500000000342011305540552032563 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552027053 5ustar renerene././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/line/VerticalAlignResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/line/VerticalAlignResol0000644000175000017500000000413111305540552032526 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/line/TextHeightResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/line/TextHeightResolveH0000644000175000017500000000341211305540552032523 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/line/LineStackingStrategyResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/line/LineStackingStrate0000644000175000017500000000366511305540552032546 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552027401 5ustar renerene././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundBreakResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundBreakR0000644000175000017500000000353011305540552032473 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BorderWidthResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BorderWidthResol0000644000175000017500000001062511305540552032552 0ustar renerene/** * =========================================== * 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; } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundImageResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundImageR0000644000175000017500000001054511305540552032475 0ustar renerene/** * =========================================== * 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(); } } } } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundRepeatResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundRepeat0000644000175000017500000000704611305540552032553 0ustar renerene/** * =========================================== * 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); } } } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundClipResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundClipRe0000644000175000017500000000552711305540552032513 0ustar renerene/** * =========================================== * 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; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BorderStyleResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BorderStyleResol0000644000175000017500000000440411305540552032571 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundAttachmentResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundAttach0000644000175000017500000000566211305540552032541 0ustar renerene/** * =========================================== * 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; } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundOriginResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/border/BackgroundOrigin0000644000175000017500000000562611305540552032564 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552027040 5ustar renerene././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/page/PageSizeResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/page/PageSizeResolveHan0000644000175000017500000000727411305540552032473 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552030314 5ustar renerene././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/hyperlinks/TargetNameResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/hyperlinks/TargetNameRe0000644000175000017500000000565511305540552032570 0ustar renerene/** * =========================================== * 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()); } } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/hyperlinks/TargetPositionResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/hyperlinks/TargetPositi0000644000175000017500000000364011305540552032660 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/hyperlinks/TargetNewResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/hyperlinks/TargetNewRes0000644000175000017500000000351211305540552032612 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/ListOfConstantsResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/ListOfConstantsResolveH0000644000175000017500000000666511305540552032631 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552027242 5ustar renerene././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/color/ColorResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/color/ColorResolveHandl0000644000175000017500000001140011305540552032546 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/color/OtherColorResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/color/OtherColorResolve0000644000175000017500000000506111305540552032607 0ustar renerene/** * =========================================== * 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; } } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/ConstantsResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/ConstantsResolveHandler0000644000175000017500000001024311305540552032661 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552027576 5ustar renerene././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/QuotesResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/QuotesResolveHa0000644000175000017500000000721111305540552032613 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/CounterIncrementResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/CounterIncremen0000644000175000017500000001046711305540552032631 0ustar renerene/** * =========================================== * 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; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/MoveToResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/MoveToResolveHa0000644000175000017500000001345511305540552032553 0ustar renerene/** * =========================================== * 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); } } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/CounterResetResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/CounterResetRes0000644000175000017500000001144411305540552032621 0ustar renerene/** * =========================================== * 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; } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/XStringDefineResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/XStringDefineRe0000644000175000017500000000574311305540552032532 0ustar renerene/** * =========================================== * 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); } } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/ContentResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/ContentResolveH0000644000175000017500000003251011305540552032604 0ustar renerene/** * =========================================== * 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; } } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/XAlternateTextResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/XAlternateTextR0000644000175000017500000002114611305540552032563 0ustar renerene/** * =========================================== * 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; } } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/StringSetResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/content/StringSetResolv0000644000175000017500000002464011305540552032644 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552026714 5ustar renerene././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/BoxSizingResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/BoxSizingResolveHan0000644000175000017500000000333311305540552032544 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/IndentEdgeResetResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/IndentEdgeResetReso0000644000175000017500000000362611305540552032510 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/DisplayRoleResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/DisplayRoleResolveH0000644000175000017500000000474611305540552032551 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/DisplayModelResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/DisplayModelResolve0000644000175000017500000000351311305540552032567 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/FitResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/FitResolveHandler.j0000644000175000017500000000334111305540552032450 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/FloatResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/FloatResolveHandler0000644000175000017500000000760211305540552032547 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/FloatDisplaceResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/box/FloatDisplaceResolv0000644000175000017500000000351011305540552032543 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552027262 5ustar renerene././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/lists/ListStyleTypeResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/lists/ListStyleTypeReso0000644000175000017500000002313111305540552032634 0ustar renerene/** * =========================================== * 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)); } } } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/lists/ListStyleImageResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/lists/ListStyleImageRes0000644000175000017500000000434111305540552032560 0ustar renerene/** * =========================================== * 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 } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/lists/ListStylePositionResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/lists/ListStylePosition0000644000175000017500000000476111305540552032676 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552027770 5ustar renerene././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/position/PositionResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/position/PositionResolv0000644000175000017500000001173111305540552032715 0ustar renerene/** * =========================================== * 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/0000755000175000017500000000000011305540552027255 5ustar renerene././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontStyleResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontStyleResolveH0000644000175000017500000000416111305540552032601 0ustar renerene/** * =========================================== * 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]; } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontVariantResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontVariantResolv0000644000175000017500000000532411305540552032632 0ustar renerene/** * =========================================== * 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); } } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontSmoothResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontSmoothResolve0000644000175000017500000000555111305540552032646 0ustar renerene/** * =========================================== * 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); } } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontSizeResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontSizeResolveHa0000644000175000017500000001750611305540552032563 0ustar renerene/** * =========================================== * 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]; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/MinMaxFontSizeResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/MinMaxFontSizeRes0000644000175000017500000001725011305540552032532 0ustar renerene/** * =========================================== * 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]; } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontEmphasizeStyleResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontEmphasizeStyl0000644000175000017500000000367411305540552032642 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontEmphasizePositionResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontEmphasizePosi0000644000175000017500000000371611305540552032616 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontFamilyResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontFamilyResolve0000644000175000017500000001214011305540552032606 0ustar renerene/** * =========================================== * 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."); } } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontStretchResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontStretchResolv0000644000175000017500000001016311305540552032637 0ustar renerene/** * =========================================== * 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)); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontEffectResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontEffectResolve0000644000175000017500000000352511305540552032570 0ustar renerene/** * =========================================== * 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); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontWeightResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/computed/fonts/FontWeightResolve0000644000175000017500000001007711305540552032623 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000425211305540552030067 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000762111305540552030606 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000000514311305540552030406 0ustar renerene/** * =========================================== * 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.java0000644000175000017500000003613111305540552031302 0ustar renerene/** * =========================================== * 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.html0000644000175000017500000000033011305540552026561 0ustar renerene 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). liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/autovalue/0000755000175000017500000000000011305540552026311 5ustar renereneliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/autovalue/text/0000755000175000017500000000000011305540552027275 5ustar renerene././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/autovalue/text/TextDecorationWidthResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/autovalue/text/TextDecorationWid0000644000175000017500000000505211305540552032622 0ustar renerene/** * =========================================== * 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.autovalue.text; import org.jfree.layouting.LayoutProcess; 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.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; public class TextDecorationWidthResolveHandler implements ResolveHandler { public TextDecorationWidthResolveHandler () { } /** * 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(); layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PT, 1)); } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/autovalue/line/0000755000175000017500000000000011305540552027240 5ustar renerene././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/autovalue/line/TextHeightResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/autovalue/line/TextHeightResolve0000644000175000017500000000457011305540552032606 0ustar renerene/** * =========================================== * 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 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.autovalue.line; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.line.TextHeight; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; public class TextHeightResolveHandler implements ResolveHandler { public TextHeightResolveHandler () { } /** * 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 () { // right now, none, later maybe the script type ... return new StyleKey[0]; } /** * Resolves a single property. * * @param currentNode * @param style */ public void resolve (final LayoutProcess process, final LayoutElement currentNode, final StyleKey key) { currentNode.getLayoutContext().setValue(key, TextHeight.FONT_SIZE); } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/autovalue/page/0000755000175000017500000000000011305540552027225 5ustar renerene././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/autovalue/page/PageSizeResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/autovalue/page/PageSizeResolveHa0000644000175000017500000000552711305540552032501 0ustar renerene/** * =========================================== * 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.autovalue.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.PageStyleKeys; import org.jfree.layouting.input.style.values.CSSNumericValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.input.style.values.CSSValuePair; import org.jfree.layouting.layouter.model.LayoutElement; import org.jfree.layouting.layouter.style.resolver.ResolveHandler; /** * Creation-Date: 16.06.2006, 13:52:17 * * @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 PageSize ps = process.getOutputMetaData().getDefaultPageSize(); final CSSValue page = new CSSValuePair(CSSNumericValue.createPtValue(ps.getWidth()), CSSNumericValue.createPtValue(ps.getHeight())); currentNode.getLayoutContext().setValue(PageStyleKeys.SIZE, page); } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/autovalue/box/0000755000175000017500000000000011305540552027101 5ustar renerene././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/autovalue/box/FitPositionResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/autovalue/box/FitPositionResolve0000644000175000017500000001020111305540552032625 0ustar renerene/** * =========================================== * 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: FitPositionResolveHandler.java 3524 2007-10-16 11:26:31Z tmorgner $ * ------------ * (C) Copyright 2006-2007, by Pentaho Corporation. */ package org.jfree.layouting.layouter.style.resolver.autovalue.box; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.keys.text.BlockProgression; import org.jfree.layouting.input.style.keys.text.Direction; 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.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 FitPositionResolveHandler implements ResolveHandler { private static final CSSNumericValue LEFT_TOP = CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, 0); private static final CSSNumericValue RIGHT_BOTTOM = CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, 100); public FitPositionResolveHandler () { } /** * 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[] { TextStyleKeys.BLOCK_PROGRESSION, TextStyleKeys.DIRECTION }; } /** * 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 boolean rightToLeft = Direction.RTL.equals (layoutContext.getValue(TextStyleKeys.DIRECTION)); final CSSValue blockProgression = layoutContext.getValue(TextStyleKeys.BLOCK_PROGRESSION); // this might be invalid ... if (BlockProgression.TB.equals(blockProgression)) { if (rightToLeft) { layoutContext.setValue(key, new CSSValuePair(RIGHT_BOTTOM, LEFT_TOP)); } else { layoutContext.setValue(key, new CSSValuePair(LEFT_TOP, LEFT_TOP)); } } else if (BlockProgression.RL.equals(blockProgression)) { if (rightToLeft) { layoutContext.setValue(key, new CSSValuePair(LEFT_TOP, LEFT_TOP)); } else { layoutContext.setValue(key, new CSSValuePair(RIGHT_BOTTOM, LEFT_TOP)); } } else if (BlockProgression.LR.equals(blockProgression)) { if (rightToLeft) { layoutContext.setValue(key, new CSSValuePair(RIGHT_BOTTOM, RIGHT_BOTTOM)); } else { layoutContext.setValue(key, new CSSValuePair(LEFT_TOP, LEFT_TOP)); } } } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/autovalue/fonts/0000755000175000017500000000000011305540552027442 5ustar renerene././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/autovalue/fonts/FontSmoothResolveHandler.javaliblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/autovalue/fonts/FontSmoothResolv0000644000175000017500000000626611305540552032672 0ustar renerene/** * =========================================== * 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.autovalue.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.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.jfree.layouting.output.OutputProcessorFeature; /** * Creation-Date: 18.12.2005, 15:13:24 * * @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) { // as this is an 'auto' handler, we can assume that 'auto' is the // current value final LayoutContext layoutContext = currentNode.getLayoutContext(); final FontSpecification fs = layoutContext.getFontSpecification(); final double threshold = process.getOutputMetaData().getNumericFeatureValue (OutputProcessorFeature.FONT_SMOOTH_THRESHOLD); if (fs.getFontSize() < threshold) { layoutContext.setValue(FontStyleKeys.X_FONT_SMOOTH_FLAG, FontSmooth.NEVER); } else { layoutContext.setValue(FontStyleKeys.X_FONT_SMOOTH_FLAG, FontSmooth.ALWAYS); } } } liblayout-0.2.10/source/org/jfree/layouting/layouter/style/resolver/SimpleStyleRuleMatcher.java0000644000175000017500000005517011305540552031565 0ustar renerene/** * =========================================== * 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: SimpleStyleRuleMatcher.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.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Locale; import java.util.StringTokenizer; import org.jfree.layouting.DocumentContextUtility; import org.jfree.layouting.LayoutProcess; import org.jfree.layouting.input.style.CSSCounterRule; 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.StyleRule; import org.jfree.layouting.input.style.StyleSheet; import org.jfree.layouting.input.style.selectors.CSSSelector; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.layouter.context.DocumentContext; import org.jfree.layouting.layouter.context.DocumentMetaNode; import org.jfree.layouting.layouter.context.LayoutContext; import org.jfree.layouting.layouter.model.LayoutElement; 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.w3c.css.sac.AttributeCondition; import org.w3c.css.sac.CombinatorCondition; import org.w3c.css.sac.Condition; import org.w3c.css.sac.ConditionalSelector; import org.w3c.css.sac.DescendantSelector; import org.w3c.css.sac.ElementSelector; import org.w3c.css.sac.NegativeCondition; import org.w3c.css.sac.NegativeSelector; import org.w3c.css.sac.Selector; import org.w3c.css.sac.SiblingSelector; import org.w3c.css.sac.SimpleSelector; import org.pentaho.reporting.libraries.resourceloader.ResourceKey; import org.pentaho.reporting.libraries.resourceloader.ResourceManager; import org.pentaho.reporting.libraries.resourceloader.ResourceKeyCreationException; import org.pentaho.reporting.libraries.resourceloader.ResourceException; import org.pentaho.reporting.libraries.resourceloader.Resource; import org.pentaho.reporting.libraries.base.util.DebugLog; import org.pentaho.reporting.libraries.base.util.ObjectUtilities; /** * A stateless implementation of the style rule matching. This implementation is * stateless within the current layout process. * * @author Thomas Morgner */ public class SimpleStyleRuleMatcher implements StyleRuleMatcher { private LayoutProcess layoutProcess; private ResourceManager resourceManager; private CSSStyleRule[] activeStyleRules; private CSSStyleRule[] activePseudoStyleRules; private CSSPageRule[] pageRules; private CSSCounterRule[] counterRules; private NamespaceCollection namespaces; public SimpleStyleRuleMatcher() { } public void initialize(final LayoutProcess layoutProcess) { if (layoutProcess == null) { throw new NullPointerException(); } this.layoutProcess = layoutProcess; this.resourceManager = layoutProcess.getResourceManager(); final ArrayList pageRules = new ArrayList(); final ArrayList counterRules = new ArrayList(); final ArrayList styleRules = new ArrayList(); final DocumentContext dc = this.layoutProcess.getDocumentContext(); namespaces = dc.getNamespaces(); final String[] nsUri = namespaces.getNamespaces(); for (int i = 0; i < nsUri.length; i++) { final String uri = nsUri[i]; final NamespaceDefinition nsDef = namespaces.getDefinition(uri); final ResourceKey rawKey = nsDef.getDefaultStyleSheetLocation(); if (rawKey == null) { // there is no default stylesheet for that namespace. continue; } final ResourceKey baseKey = DocumentContextUtility.getBaseResource (layoutProcess.getDocumentContext()); final StyleSheet styleSheet = parseStyleSheet(rawKey, baseKey); if (styleSheet == null) { continue; } addStyleRules(styleSheet, styleRules); addPageRules(styleSheet, pageRules); addCounterRules(styleSheet, counterRules); } final int metaNodeCount = dc.getMetaNodeCount(); for (int i = 0; i < metaNodeCount; i++) { final DocumentMetaNode dmn = dc.getMetaNode(i); final String type = (String) dmn.getMetaAttribute("type"); if ("link".equals(type)) { handleLinkNode(dmn, styleRules, pageRules, counterRules); } else if ("style".equals(type)) { handleStyleNode(dmn, styleRules, pageRules, counterRules); } } activeStyleRules = (CSSStyleRule[]) styleRules.toArray(new CSSStyleRule[styleRules.size()]); this.pageRules = (CSSPageRule[]) pageRules.toArray(new CSSPageRule[pageRules.size()]); this.counterRules = (CSSCounterRule[]) counterRules.toArray(new CSSCounterRule[counterRules.size()]); styleRules.clear(); for (int i = 0; i < activeStyleRules.length; i++) { final CSSStyleRule activeStyleRule = activeStyleRules[i]; if (isPseudoElementRule(activeStyleRule) == false) { continue; } styleRules.add(activeStyleRule); } activePseudoStyleRules = (CSSStyleRule[]) styleRules.toArray(new CSSStyleRule[styleRules.size()]); } private void handleLinkNode(final DocumentMetaNode node, final ArrayList styleRules, final ArrayList pageRules, final ArrayList counterRules) { // do some external parsing // (Same as the element of HTML) try { final Object href = node.getMetaAttribute("href"); final ResourceKey baseKey = DocumentContextUtility.getBaseResource (layoutProcess.getDocumentContext()); final ResourceKey derivedKey; if (baseKey == null) { derivedKey = resourceManager.createKey(href); } else { derivedKey = resourceManager.deriveKey(baseKey, String.valueOf(href)); } final StyleSheet styleSheet = parseStyleSheet(derivedKey, null); if (styleSheet == null) { return; } addStyleRules(styleSheet, styleRules); addPageRules(styleSheet, pageRules); addCounterRules(styleSheet, counterRules); } catch (ResourceKeyCreationException e) { e.printStackTrace(); } } private void handleStyleNode(final DocumentMetaNode node, final ArrayList styleRules, final ArrayList pageRules, final ArrayList counterRules) { // do some inline parsing // (Same as the

What do you want?

Denker

Blah

Some text
liblayout-0.2.10/styletest/floating-content.html0000644000175000017500000000204511305540552020444 0ustar renerene

A LAYER 1 LAYER 2 B

Some long text, divided by some more text, divided by some more text, divided by some more text, divided by some more text, divided by some more text,

I am floating ...
divided by some more text, divided by some more text, divided by some more text, divided by some more text, divided by some more text, divided by some more text.

Blah

liblayout-0.2.10/styletest/border-radius.html0000644000175000017500000000661611305540552017743 0ustar renerene CSS3 border-radius examples

Border-radius examples

Introduction

This document contains some examples of use of the CSS3 border-radius properties, and is a supplemental document for the entry CSS rounded corners without images at Arve Bersvendsen's Virtuelvis. To view this document correctly, you will need a CSS3 capable browser (none of which exist at the time of writing, or a browser using the Gecko rendering engine from the Mozilla foundation. Please note that parts of the demonstration breaks in Mozilla. These parts are commented specially.

The border-radius property

The border-radius property will round all four corners of a corner.

One length value

If the second length value is omitted, it is interpreted as being equal to the first, meaning that border-radius: 5px 5px is equal to border-radius: 5px;. Example:

#ex1 {
  -moz-border-radius: 1em;
  border-radius: 1em;
}

Different length values

When the length values are different, the first length value will be interpreted as horizontal length, and the second one as vertical length, for left to right scripts. Examples

#ex2 {
  -moz-border-radius: 2em 1em;
  border-radius: 2em 1em;



  
}

Note that Mozilla breaks horribly, and makes the top-left and bottom-right corners circles with radius 2em, and the bottom-left and top-right corners are circles with radius 1em, instead of making all four corners ellipses with horizontal radius 2em and vertical radius 1em.

Individual corners

All of the following properties do not have mozilla equivalent properties.

Example:

#ex3 {
  border-top-left-radius: 1em;
}
#ex3 {
  border-top-right-radius: 1em;
}
#ex3 {
  border-bottom-right-radius: 1em;
}
#ex3 {
  border-bottom-left-radius: 1em;
}
liblayout-0.2.10/styletest/pagination.html0000644000175000017500000000411011305540552017315 0ustar renerene Example of inline flow on several lines

Several emphasized words

Block aa
a appear here.

Several aa emphasized words

Block
a appear here.

Several emphasized words

Block
a aa appear here.

  1. item
  2. item
    1. item
    2. item
    3. item
      1. item
      2. item
      1. item
      2. item
      3. item
    4. item
  3. item
  4. item
  1. item
  2. item
liblayout-0.2.10/styletest/li.html0000644000175000017500000000157211305540552015601 0ustar renerene

Testing the list item behaviour

  1. Test
  2. Test
  3. dasd
    1. Test
    2. Test
    3. Test
    4. Test
    5. Test
  4. Test
  5. Test

The following test will only work, if the renderer supports inline-boxes. Opera does.

aaTest Some leadingtext

  1. Test
Sometrailing text

liblayout-0.2.10/styletest/image-breaks.html0000644000175000017500000000016711305540552017523 0ustar renerene
Denker
liblayout-0.2.10/styletest/more.html0000644000175000017500000000100311305540552016124 0ustar renerene
Blah

The lazy fox Johntheoneandonly is not as lazy as it may seem.

Ågggggg
ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ

liblayout-0.2.10/styletest/clear.html0000644000175000017500000000045711305540552016264 0ustar renerene

A simple test file.

Some text one the first line asd
A tale of a table Once there was a table with many spanned cells
But that table was very depressed as it had no margins, paddings or borders to paint
A tale of a table II But one day, a mage came a long, and offered to help the little table. But as we know magicans, each gift has a price attached.
The table did not listen to the warnings, all it wanted were some borders. and so it promised to do anything as long as it gets some fancy borders for its cells.
liblayout-0.2.10/styletest/br.html0000644000175000017500000000067511305540552015603 0ustar renerene

Testing whether styles can be applied to a BR tag

Some text one the first line
And some more on the next line.

Testing how elements affect the linebreaking of large words.

A verylongreallyincrediblylongwordwithnobreaksinside

liblayout-0.2.10/styletest/inline-whitespace.html0000644000175000017500000000167211305540552020606 0ustar renerene

Testing how the whitespace removeal works.

a b a


And I'm an Inline Element

And I'm an Inline Block Element
All content here is layouted as block content.
And this is still inline

And I'm an Inline Block Element
All content here is layouted as block content.
liblayout-0.2.10/styletest/fontsize.html0000644000175000017500000000237011305540552017033 0ustar renerene

Some Text More text to come text to come text to come text to come text to come text to come text to come text to come text to come text to come text to come text to come text to come text to come text to come text to come text to come text to come text to come text to come text to come text to come text to come More text to come

The car is THE CAR in arabic.

A
liblayout-0.2.10/styletest/tables.html0000644000175000017500000001124511305540552016445 0ustar renerene asd What makes a table a table?
A simple table.
Now how do we render this? Test
Test Test

This table will have the collapsing border-model.
Data More data
dasdasd
asdasd

A table with background images and a colspan definition

Test Test

A table with background images and a spanned column definition

Test Test

A table with background images and two column definitions

Test Test

Testing, whether and how width applies to colgroups.

Test Test

Testing, how the system resolves the complicated and buggy definitions.

Test Test Test
test
overlapping

Testing, how cells deal with margins..

Margins are not supported on table-sections, table-rows and table-cells.
No margins Test Test
test
overlapping

Testing, how borders are handled in the separate column model.

Borders are not supported on table-rows or table-sections.
TR-Border green > Test Test
test
overlapping

Testing, how paddings are handled in the separate column model.

Paddings are not supported on table-rows or table-sections.
TR-Border green > Test Test
test
overlapping

Testing, how content in rows or sections is handled.

Paddings are not supported on table-rows or table-sections. In Table In Table-Body In TableRow
TR-Border green > Test Test
test
Content
liblayout-0.2.10/styletest/simple.html0000644000175000017500000000330411305540552016461 0ustar renerene

A simple test file.

aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa
aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa
aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa
aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa
liblayout-0.2.10/styletest/floating-images.html0000644000175000017500000000171311305540552020240 0ustar renerene Text des Titels

Woran der Denker denkt

Denkt der Denker Denker an das Oben?


Denkt der Denker Denker an die Mitte?


Denkt der Denker Denker an das Unten?


Text?Oder denkt er an ...?

Manche Texte erschließen sich nur aus der nötigen Distanz. Aber das hier, das ist richtiger Text. Und er fließt sogar, nämlich um die Grafik.

liblayout-0.2.10/styletest/content.html0000644000175000017500000000125111305540552016641 0ustar renerene Example of inline flow on several lines

Severalemphasizedwordsaappearhereinalonglinewithnopossiblebreakpositions.

liblayout-0.2.10/styletest/test.xml0000644000175000017500000000131111305540552015777 0ustar renerene asd What makes a table a table?
Now how do we render this?

Data More data
dasdasd
asdasd
asdasd
asdasd
liblayout-0.2.10/styletest/margins.html0000644000175000017500000000457311305540552016641 0ustar renerene

The first working margins test

test

Testing nested margins

Test

Testing how borders affect the nested margins

Testing, how margins in Inline-Elements affect the system.

A long line that can be broken down. A line with margin-top: 10pt. Does that line have any effect?

A long line that can be broken down. A inline-block with margin-top: 10pt. Does that line have any effect?

A long line that can be broken down. A inline-block with margin-top: 10pt. Does that line have any effect?

Testing nested margins

Test
The Green area in the left and right is 50pt, as inline-level margins never collapse. The distance between the red box and the top and bottom edge is 50pt. The distance between the left/right edge and the border of the box is 10pt.

Testing nested margins (collapsing at the root)

Test
The Green area in the left and right is 50pt, as inline-level margins never collapse. The distance between the red box and the top and bottom edge is 50pt. The distance between the left/right edge and the border of the box is 10pt.
Test
liblayout-0.2.10/styletest/tables3.html0000644000175000017500000000164311305540552016531 0ustar renerene asd

Testing, how the collapsing table model works

Cell 3 Cell 1
Cell 1 Cell 2 Cell 1
Cell 3 Cell 1
liblayout-0.2.10/styletest/i18n.html0000644000175000017500000000034011305540552015744 0ustar renerene

A simple test file.

A simple test file. (DE)

A simple test file. (EN)

A simple test file. (FR)

liblayout-0.2.10/styletest/position.html0000644000175000017500000000177211305540552017043 0ustar renerene ada asdasdasd asd ads
a asd asd asd adsasd a
asd asd asd
Test test
T2
Test
ads asda asda sd
A test width
some asd
asd lakjwelkr
alskdfa weir
asdlkfa welkadsfalwwwwwkdfh alsdf adfk s
lk lkj lklk lkjl
lk kj lkjlkj lk
l lkjoii lk i l
Inner stacking context?
asd asd asd
Some more text, and more and more and more
Some more text, and more and more and more
Some more text, and more and more and more
liblayout-0.2.10/styletest/alignment.html0000644000175000017500000000124611305540552017151 0ustar renerene

Test

test
XxxxTorin
test
XxxxTorin
XxxxTorin

liblayout-0.2.10/styletest/inline-valign.html0000644000175000017500000000353511305540552017732 0ustar renerene

Testing how the whitespace removeal works.

a b a


Some inline textSomething else else

XxxxTorin

xxxXTorin

xy xa

Text more text Top more text

Text Bottom more text

Text Bottom more text Top more text

Text Bottom more text Bottom more text

liblayout-0.2.10/styletest/gorilla.jpg0000644000175000017500000001306511305540552016442 0ustar renereneJFIFHHC     C  dd"  j@͆)@gau|LMc2d5n#&2%i&d׻:4RC+ }) y/K/) &inMG mB[wu7z6FtJ?ydoV3q4%[oEBѭ*r_QX1 eesJh7Qѱ011c::u[Dz}c $>#Թ+Kİv2+ӛOr3ϸ bSO5!E_]jl371 iƨ6mb"/)1&!"Q 1A23R?]悄1F_XYO.ܙxXm$Afш!ȕ%5x{Wp=iΠ0e][8`c:kS)v5}k?%!1AQ"R?ຌ&\wfT{H{3S3bHXQf$KEGw.^:NN#3z%It\/w+jzl`j~2$<7sL, 0i: !1A"2Qaq #3BR$%br?铹% O*E6ߔMb\2?A8k-u-aRNbnGBѕJoptuk=I\ĸiYKύ9Ѽcbq$ ;/#bh\-)͵Rn+/%V5(rIWD1qЮծO+,6>c.d4C*<ʈMliS){ЗM'Bn#_axpMȑ(,lK}FiBxSIC9>z9o̼X֯{kiR1F)~ [Bz~BcvLИWny;ƊJ2-j`lBtG.AJ ("rUQlҫo{W*"JrՓZRYu~SĆTf旁¥ 4ҐtD)S: U]UaT0Ykx'eÞqYG1Y]otHTuZE3eҰo DtGPDf8qOC]flp 0v0l É*:=o'%Y&ʱ5y:JnƦ[ud O Jm>)Rx'JJӗ;`p})]3jGq^VR#"d<ڙp>:|jeJpnG$ Mwdv76s7g}}7֟~4d},>zCo(xEM2Dƶ9EnEL㏛=[}'Z^@\ K !ġM_siN4dgVU xskW;r4^EWi?-#e^mzӛCCηo)EkVMYy/fӸ-ye YmmPR{˚yR~\w31J83rULA2j:GjJzڱ9cO)o*4Գu Av‡T25]R~D)#lZ꼴y*r'8+zZי['!#۝ww{3Zq,7l%,ZsHw-B: ƮlA̶}0;U,MF92 ˇME&h BT۸Lbb@/-+%ʶtjZFW+a_^*H:RT~Tǘ58Bxg,W@Jw؀h-u$ iWkMgey}NC[Eƴ4UVV}n_1Qu@ϺQqާ\teb~00_P 8e|Yjp9d7 򇵱t-INKZ|9j^O0] #!1AaQq?E*֧0Yy+ ]^1z&R|˺ eiIr&q^g{LQbp.֫RU:XqPkfD0u, ۱gWCN4&E;[: }M)D$!1AaQq? A^n0-5_3tĩpkUnD?2)8=#D.3^(]#_i4ڊ2+JD&yVp{|HWyh77藙xȝhi27g$!1AQaq?wN)atdžasei%uˎCCt(죊rlnP] Sߛ ]*@b9kBoҖ..-)qeV.Fؖց JPJĀE|Ņ0 \1n&i{48m O @ (ޒkҚYvuVqqRGQ&4NqZ'cNo">bstߜ5 h]hmPTj:a(Wn gZ܊kQ= mz.Pc)|aGdA~pvBJ|X^!z..>~3A|*6V?t D|j4 Jjq8_I͂Q&BG",qs\*8(%] Hawbmm6 7!9!wb˧P1HͅWnG>H%DqkQ":l8ZF,F@SV6p]*tkRXQI}*7*8=bܿ\a~9Suwak-#νAд3@(zd,tDӋIBF |[|H\8Avl8cOC^q#FOX&7ÁH:LeOx2ॉh5cn \(! DCH(d m/IA8ZAtEq.^6+yH I!)N=@I<cVJD@pc4@؏) Qyd_x5Yl(_!,QOq*CY 1@|`!_,}{'+N8G2KyEHx@)T[AkFNPj%v!I9nOIlȼ `qxBzk$*6ߌ6tY1ùM0ÏͻzZωjZ"wJyWw?liblayout-0.2.10/styletest/borders.html0000644000175000017500000000201411305540552016625 0ustar renerene
Blah

The lazy fox Johntheoneandonly is not as lazy as it may seem.

Testing, how percentage-borders work

This div has 10% border. (Variable)
This div also has 10% border. (Fixed to 50px)
This div has a width of auto
There should be no border
(You should not see any borders in Mozilla, as that doesnt seem to be implemented.)