EchoPoint API - 3.0.0b5
App Webcontainer

echopoint.util
Class StyleMerger

java.lang.Object
  extended by echopoint.util.StyleMerger

public class StyleMerger
extends Object

StyleMerger is an Component which alllows you to merge two xml style definitions into a single one, which can then be loaded by echo. We use it in the following way: Our application has a default style which is used for normal installations If we build special versions of our application to a customer, we then add a second stylesheet with only the modifications for that client. On system startup we then merge the two XML styles into one and then load the resulting one.

Author:
a.schild

Constructor Summary
StyleMerger()
           
 
Method Summary
protected static org.jdom.Element findStyleDefinition(org.jdom.Element rootNode, String styleName)
          Sear this tree for a matching style
protected static String makeStyleName(org.jdom.Element style)
          Make up a stylename which respects all attributes to uniquely identify a style.
protected static void mergeStyle(org.jdom.Element targetStyle, org.jdom.Element partialStyle)
          Merge two styles.
protected static org.jdom.Document mergeStyles(org.jdom.Document doc1, org.jdom.Document doc2)
          Merge the two docs and return the merged one.
static void mergeXMLStyles(InputStream mainStyles, InputStream patchStyles, OutputStream out)
           
static void mergeXMLStyles(Reader mainStyles, Reader patchStyles, Writer out)
           
static void mergeXMLStyles(String baseStylesFile, String patchStylesFile, String outFile)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StyleMerger

public StyleMerger()
Method Detail

mergeXMLStyles

public static void mergeXMLStyles(String baseStylesFile,
                                  String patchStylesFile,
                                  String outFile)
                           throws IOException,
                                  org.jdom.JDOMException
Parameters:
baseStylesFile - File with default styles
patchStylesFile - File which contains the styles to be added/patched
outFile - File with the merged styles
Throws:
IOException
org.jdom.JDOMException

mergeXMLStyles

public static void mergeXMLStyles(Reader mainStyles,
                                  Reader patchStyles,
                                  Writer out)
                           throws IOException,
                                  org.jdom.JDOMException
Parameters:
mainStyles - Reader with with default styles
patchStyles - Reader which contains the styles to be added/patched
out - Output with the merged styles
Throws:
IOException
org.jdom.JDOMException

mergeXMLStyles

public static void mergeXMLStyles(InputStream mainStyles,
                                  InputStream patchStyles,
                                  OutputStream out)
                           throws IOException,
                                  org.jdom.JDOMException
Parameters:
mainStyles - Stream with with default styles
patchStyles - Stream which contains the styles to be added/patched
out - Output with the merged styles
Throws:
IOException
org.jdom.JDOMException

mergeStyles

protected static org.jdom.Document mergeStyles(org.jdom.Document doc1,
                                               org.jdom.Document doc2)
Merge the two docs and return the merged one.

Parameters:
doc1 -
doc2 -
Returns:
doc1 is containing the merged document

makeStyleName

protected static String makeStyleName(org.jdom.Element style)
Make up a stylename which respects all attributes to uniquely identify a style.

Parameters:
style -
Returns:

findStyleDefinition

protected static org.jdom.Element findStyleDefinition(org.jdom.Element rootNode,
                                                      String styleName)
Sear this tree for a matching style

Parameters:
rootNode -
styleName -
Returns:

mergeStyle

protected static void mergeStyle(org.jdom.Element targetStyle,
                                 org.jdom.Element partialStyle)
Merge two styles. All attribuets/values found in partialStyle are replacing existing values in targetStyle. If no such attributes exist in targetStyle, then we add them

Parameters:
targetStyle -
partialStyle -

EchoPoint API - 3.0.0b5
App Webcontainer