nl.gx.webmanager.springmvc.editor
Class EntityPropertyEditor<T>

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

public class EntityPropertyEditor<T>
extends java.beans.PropertyEditorSupport

This class represents a generic property editor for entities. It provided an editor for all entities that implement the Identifiable interface. The property editor uses the WmId for String representation and WebManager session to retrieve the object from a given WmId. Therefore the Entity Manager is input parameter of the constructor of this property editor. The property editor uses generics to specify the entity 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(CustomEntity.class, new EntityPropertyEditor(entityManager)); }

Author:
ivol

Constructor Summary
EntityPropertyEditor(EntityManager entityManager)
          Constructor of the entity property editor
 
Method Summary
 java.lang.String getAsText()
          Returns a String that uniquely identifies this entity
 void setAsText(java.lang.String text)
          Sets the entity by a String value.
 
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

EntityPropertyEditor

public EntityPropertyEditor(EntityManager entityManager)
Constructor of the entity property editor

Parameters:
entityManager - Entity manager needed to convert from text to entity
Method Detail

setAsText

public void setAsText(java.lang.String text)
Sets the entity by a String value. The String value is converted internally to a real entity object

Specified by:
setAsText in interface java.beans.PropertyEditor
Overrides:
setAsText in class java.beans.PropertyEditorSupport
Parameters:
text - a String that uniquely identifies this entity

getAsText

public java.lang.String getAsText()
Returns a String that uniquely identifies this entity

Specified by:
getAsText in interface java.beans.PropertyEditor
Overrides:
getAsText in class java.beans.PropertyEditorSupport
Returns:
a String that uniquely identifies this entity


Copyright © 2007-2011 GX Software BV. All Rights Reserved.