org.gvnix.flex.ui
Class MxmlRoundTripUtils

java.lang.Object
  extended by org.gvnix.flex.ui.MxmlRoundTripUtils

public abstract class MxmlRoundTripUtils
extends Object

Utilities related to round-tripping MXML documents

Author:
Stefan Schmidt, Jeremy Grelle

Constructor Summary
MxmlRoundTripUtils()
           
 
Method Summary
static String calculateUniqueKeyFor(Element element)
          Create a base 64 encoded SHA1 hash key for a given XML element.
static boolean compareDocuments(Document original, Document proposed)
          This method will compare the original document with the proposed document and return an adjusted document if necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MxmlRoundTripUtils

public MxmlRoundTripUtils()
Method Detail

calculateUniqueKeyFor

public static String calculateUniqueKeyFor(Element element)
Create a base 64 encoded SHA1 hash key for a given XML element. The key is based on the element name, the attribute names and their values. Child elements are ignored. Attributes named 'z' are not concluded since they contain the hash key itself.

Parameters:
element - The element to create the base 64 encoded hash key for
Returns:
the unique key

compareDocuments

public static boolean compareDocuments(Document original,
                                       Document proposed)
This method will compare the original document with the proposed document and return an adjusted document if necessary. Adjustments are only made if new elements or attributes are proposed. Changes to the order of attributes or elements in the original document will not result in an adjustment.

Parameters:
original - document as read from the file system
proposed - document as determined by the JspViewManager
Returns:
the new document if changes are necessary, null if no changes are necessary


Copyright © 2010–2015 Conselleria d'Infraestructures i Transport - Generalitat Valenciana. All rights reserved.