nl.gx.webmanager.springmvc.editor
Class JCRWrapperPropertyEditor<T extends Wrapper>

java.lang.Object
  extended by java.beans.PropertyEditorSupport
      extended by nl.gx.webmanager.springmvc.editor.JCRWrapperPropertyEditor<T>
Type Parameters:
T - Wrapper class to create the property editor for
All Implemented Interfaces:
java.beans.PropertyEditor

public class JCRWrapperPropertyEditor<T extends Wrapper>
extends java.beans.PropertyEditorSupport

This class represents a generic property editor for JCR wrappers. It provided an editor for all classes that implement the Wrapper interface. The property editor uses the UUID of the wrapper for String representation and WebManager session to retrieve the object from a given UUID. Therefore the WebManager session is input parameter of the constructor of this property editor. The property editor uses generics to specify the wrapper type it should support. Add this property editor in your initBinder method. For example to define a property editor for the language: public void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { super.initBinder(request, binder); // Register basic property editors binder.registerCustomEditor(Language.class, new JCRWrapperPropertyEditor(getWmSession(request))); }

Author:
ivol

Constructor Summary
JCRWrapperPropertyEditor(nl.gx.webmanager.foundation.Session webmanagerSession)
          Constructor
 
Method Summary
 java.lang.String getAsText()
          Format the Language as String, using the uuid of the language
 void setAsText(java.lang.String text)
          Parse the Language from the given text
 
Methods inherited from class java.beans.PropertyEditorSupport
addPropertyChangeListener, firePropertyChange, getCustomEditor, getJavaInitializationString, getSource, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setSource, setValue, supportsCustomEditor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JCRWrapperPropertyEditor

public JCRWrapperPropertyEditor(nl.gx.webmanager.foundation.Session webmanagerSession)
Constructor

Parameters:
webmanagerSession - the WebManager session
Method Detail

setAsText

public void setAsText(java.lang.String text)
               throws java.lang.IllegalArgumentException
Parse the Language from the given text

Specified by:
setAsText in interface java.beans.PropertyEditor
Overrides:
setAsText in class java.beans.PropertyEditorSupport
Throws:
java.lang.IllegalArgumentException

getAsText

public java.lang.String getAsText()
Format the Language as String, using the uuid of the language

Specified by:
getAsText in interface java.beans.PropertyEditor
Overrides:
getAsText in class java.beans.PropertyEditorSupport
Returns:
Unique String representation of the Language


Copyright © 2007-2010 GX creative online development BV. All Rights Reserved.