JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.page
Class JCPageTemplate

java.lang.Object
  |
  +--com.klg.jclass.page.JCPageTemplate

public class JCPageTemplate
extends Object

This class contains the methods and schema necessary to convert an XML-described page template into a template JCPage.


Constructor Summary
JCPageTemplate()
           
 
Method Summary
protected static com.klg.jclass.page.JCPageTemplate.BorderDefinition getBorderSetup(Node parent_node, com.klg.jclass.page.JCUnit unit)
           
protected static JCUnit.Measure getBorderThickness(Node node, com.klg.jclass.page.JCUnit units)
           
protected static int getBorderType(Node node)
          Returns the border type specified for this node.
protected static Color getColorAttribute(Node node)
          Returns the color; null means transparent, no color.
protected static com.klg.jclass.page.JCPageTemplate.ColumnDefinition getColumnSetup(Node parent_node, com.klg.jclass.page.JCUnit unit)
           
protected static boolean getFirstAttribute(Node node)
          Returns whether the template is considered a starting point or not.
protected static com.klg.jclass.page.JCFrame getFrameFromListByName(List frames, String name)
           
protected static JCUnit.Point getLocation(Node parent_node, com.klg.jclass.page.JCUnit unit)
           
protected static JCUnit.Margins getMargins(Node parent_node, com.klg.jclass.page.JCUnit unit)
           
protected static double getMarginSide(NamedNodeMap attributes, String location)
           
protected static String getNameAttribute(Node node)
          Gets the name attribute of the current node.
protected static int getOrientationAttribute(Node node)
          Returns the orientation method for this node.
protected static JCUnit.Dimension getSize(Node parent_node, com.klg.jclass.page.JCUnit unit)
           
protected static com.klg.jclass.page.JCPage getTemplateByName(List templates, String name)
           
protected static com.klg.jclass.page.JCUnit getUnitAttribute(Node node)
          Returns the JCUnit specified for this node.
static void importTemplates(com.klg.jclass.page.JCDocument doc, File xmlfile)
          Loads and verifies a system of page templates from an XML file.
static void importTemplates(com.klg.jclass.page.JCDocument doc, InputSource input)
          Loads and verifies a system of page templates from an XML file.
static void importTemplates(com.klg.jclass.page.JCDocument doc, Reader reader)
          Loads and verifies a system of page templates from an XML file.
static List loadTemplates(File xmlfile)
          Loads and verifies a system of page templates from an XML file.
static List loadTemplates(InputSource input)
          Loads and verifies a system of page templates from an XML stream.
static List loadTemplates(Reader reader)
          Loads and verifies a system of page templates from an XML stream.
static void main(String[] args)
          Loads page templates from a file given as the first argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JCPageTemplate

public JCPageTemplate()
Method Detail

importTemplates

public static void importTemplates(com.klg.jclass.page.JCDocument doc,
                                   File xmlfile)
                            throws SAXException,
                                   IOException,
                                   ParserConfigurationException
Loads and verifies a system of page templates from an XML file.

Parameters:
doc - the document to store the templates in
xmlfile - the file from which to read the XML source
Throws:
IOException
SAXException
ParserConfigurationException

importTemplates

public static void importTemplates(com.klg.jclass.page.JCDocument doc,
                                   Reader reader)
                            throws SAXException,
                                   IOException,
                                   ParserConfigurationException
Loads and verifies a system of page templates from an XML file.

Parameters:
doc - the document to store the templates in
reader - the source from which to read the XML page template
Throws:
IOException
SAXException
ParserConfigurationException

importTemplates

public static void importTemplates(com.klg.jclass.page.JCDocument doc,
                                   InputSource input)
                            throws SAXException,
                                   IOException,
                                   ParserConfigurationException
Loads and verifies a system of page templates from an XML file.

Parameters:
doc - the document to store the templates in
input - the InputSource from which to read the XML page template
Throws:
IOException
SAXException
ParserConfigurationException

loadTemplates

public static List loadTemplates(File xmlfile)
                          throws SAXException,
                                 IOException,
                                 ParserConfigurationException
Loads and verifies a system of page templates from an XML file.

Parameters:
xmlfile - the file from which to read the XML source
Returns:
a List containing the template JCPages constructed from the XML
Throws:
IOException
SAXException
ParserConfigurationException

loadTemplates

public static List loadTemplates(Reader reader)
                          throws SAXException,
                                 IOException,
                                 ParserConfigurationException
Loads and verifies a system of page templates from an XML stream.

Parameters:
reader - the source from which to read the XML page template
Returns:
a List containing the template JCPages constructed from the XML
Throws:
IOException
SAXException
ParserConfigurationException

getNameAttribute

protected static String getNameAttribute(Node node)
Gets the name attribute of the current node.

Parameters:
node - the node whose name is to be retrieved
Returns:
the name of the node

getColorAttribute

protected static Color getColorAttribute(Node node)
Returns the color; null means transparent, no color.

Parameters:
node - the node whose color is to be retrieved
Returns:
the color of the node

getFirstAttribute

protected static boolean getFirstAttribute(Node node)
Returns whether the template is considered a starting point or not.

Parameters:
node - the node whose first marker attributed is to be checked
Returns:
true if the node is marked to be the first page used

getOrientationAttribute

protected static int getOrientationAttribute(Node node)
Returns the orientation method for this node. If a method was not specified, then the default "automatic" applies.

Parameters:
node - the node whose orientation method is to be retrieved
Returns:
the orientatiuon method used by this node

getUnitAttribute

protected static com.klg.jclass.page.JCUnit getUnitAttribute(Node node)
Returns the JCUnit specified for this node. If a unit was not specified this should still be passed a valid node with "inches" as the default value

Parameters:
node - the node whose units are to be retrieved
Returns:
the units used to measure the node

getLocation

protected static JCUnit.Point getLocation(Node parent_node,
                                          com.klg.jclass.page.JCUnit unit)

getSize

protected static JCUnit.Dimension getSize(Node parent_node,
                                          com.klg.jclass.page.JCUnit unit)

getColumnSetup

protected static com.klg.jclass.page.JCPageTemplate.ColumnDefinition getColumnSetup(Node parent_node,
                                                                                    com.klg.jclass.page.JCUnit unit)

getBorderType

protected static int getBorderType(Node node)
Returns the border type specified for this node.

Parameters:
node -
Returns:
border type specified for this node

getBorderThickness

protected static JCUnit.Measure getBorderThickness(Node node,
                                                   com.klg.jclass.page.JCUnit units)

getBorderSetup

protected static com.klg.jclass.page.JCPageTemplate.BorderDefinition getBorderSetup(Node parent_node,
                                                                                    com.klg.jclass.page.JCUnit unit)

getFrameFromListByName

protected static com.klg.jclass.page.JCFrame getFrameFromListByName(List frames,
                                                                    String name)

getMarginSide

protected static double getMarginSide(NamedNodeMap attributes,
                                      String location)

getMargins

protected static JCUnit.Margins getMargins(Node parent_node,
                                           com.klg.jclass.page.JCUnit unit)

getTemplateByName

protected static com.klg.jclass.page.JCPage getTemplateByName(List templates,
                                                              String name)

loadTemplates

public static List loadTemplates(InputSource input)
                          throws SAXException,
                                 IOException,
                                 ParserConfigurationException
Loads and verifies a system of page templates from an XML stream.

Parameters:
input - the source from which to read an XML-formatted page template
Returns:
a List containing the template JCPages constructed from the XML
Throws:
IOException
SAXException
ParserConfigurationException

main

public static void main(String[] args)
Loads page templates from a file given as the first argument.

Parameters:
args -

Copyright © 2004 Quest Software Inc..
All rights reserved.