it.amattioli.applicate.browsing
Class ObjectBrowserImpl<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>

Show UML class diagram
java.lang.Object
  extended by it.amattioli.applicate.browsing.ObjectBrowserImpl<I,T>
Type Parameters:
I -
T -
All Implemented Interfaces:
Browser<I,T>, ObjectBrowser<I,T>, CommandListener, PropertyClassRetriever, SelectionListener, Selector<T>, it.amattioli.dominate.util.PropertyChangeEmitter, PropertyChangeListener, EventListener, org.apache.commons.beanutils.DynaBean

public class ObjectBrowserImpl<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
extends Object
implements ObjectBrowser<I,T>, org.apache.commons.beanutils.DynaBean, PropertyClassRetriever

Author:
a.mattioli

Constructor Summary
ObjectBrowserImpl()
           
ObjectBrowserImpl(Class<T> entityClass)
           
ObjectBrowserImpl(I holdId, it.amattioli.dominate.Repository<I,T> repository)
           
ObjectBrowserImpl(it.amattioli.dominate.Repository<I,T> repository)
           
ObjectBrowserImpl(T hold, it.amattioli.dominate.Repository<I,T> repository)
           
 
Method Summary
 void addCommandListener(CommandListener listener)
           
 void addContentChangeListener(ContentChangeListener listener)
          Add a listener for events fired when the browser content changes.
protected  void additionalRefresh()
           
 void addPropertyChangeListener(PropertyChangeListener listener)
           
 void addSelectionListener(SelectionListener listener)
          Register a listener for the object selection.
 void commandDone(CommandEvent source)
          This method will be called every time a CommandEvent is fired by the command to which this listener has been added.
 boolean contains(String name, String key)
           
protected  void fireContentChange()
           
 Object get(String name)
           
 Object get(String name, int index)
           
 Object get(String name, String key)
           
 ListBrowserImpl<?,?> getDetailsBrowser(String propertyName)
          Retrieves a ListBrowser to navigate the collection of objects contained in a property.
 Map<String,ListBrowserImpl<?,?>> getDetailsBrowsers()
          Retrieves a map containing all the possible browsers that ObjectBrowser.getDetailsBrowser(String) will return.
protected
<J extends Serializable,E extends it.amattioli.dominate.Entity<J>>
it.amattioli.dominate.Repository<J,E>
getDetailsRepository(String propertyName, Class<E> c)
           
 org.apache.commons.beanutils.DynaClass getDynaClass()
           
 T getHold()
          Retrieves the object that this browser is holding.
 I getHoldId()
           
protected  it.amattioli.dominate.Repository<I,T> getRepository()
           
 T getSelectedObject()
          Retrieves the object currently selected.
 void objectSelected(SelectionEvent event)
          Will be called every time an object is selected in a Selector service on which this listener has been registered.
 void propertyChange(PropertyChangeEvent event)
           
 void refresh()
          Refresh the object that this browser is holding retrieving a fresh copy from the repository.
protected
<J extends Serializable,E extends it.amattioli.dominate.Entity<J>>
void
registerDetailBrowser(Class<E> entityClass, Class<? extends ListBrowser<J,E>> browserClass)
           
 void release()
          Releases eventually acquired resources.
 void remove(String name, String key)
           
 void removeContentChangeListener(ContentChangeListener listener)
          Remove a listener for events fired when the browser content changes.
 void removePropertyChangeListener(PropertyChangeListener listener)
           
 void removeSelectionListener(SelectionListener listener)
          Remove a listener from the collection of the listeners that will be notified when an object is slected in this browser.
 PropertyClass retrievePropertyClass(String propertyName)
           
 void set(String name, int index, Object value)
           
 void set(String name, Object value)
           
 void set(String name, String key, Object value)
           
 void setHoldId(I holdId)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectBrowserImpl

public ObjectBrowserImpl()

ObjectBrowserImpl

public ObjectBrowserImpl(T hold,
                         it.amattioli.dominate.Repository<I,T> repository)

ObjectBrowserImpl

public ObjectBrowserImpl(I holdId,
                         it.amattioli.dominate.Repository<I,T> repository)

ObjectBrowserImpl

public ObjectBrowserImpl(it.amattioli.dominate.Repository<I,T> repository)

ObjectBrowserImpl

public ObjectBrowserImpl(Class<T> entityClass)
Method Detail

getRepository

protected it.amattioli.dominate.Repository<I,T> getRepository()

objectSelected

public void objectSelected(SelectionEvent event)
Description copied from interface: SelectionListener
Will be called every time an object is selected in a Selector service on which this listener has been registered.

Specified by:
objectSelected in interface SelectionListener
Parameters:
event - the selection event

propertyChange

public void propertyChange(PropertyChangeEvent event)
Specified by:
propertyChange in interface PropertyChangeListener

getHold

public T getHold()
Description copied from interface: ObjectBrowser
Retrieves the object that this browser is holding.

Specified by:
getHold in interface ObjectBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Returns:
the object that this browser is holding

getHoldId

public I getHoldId()

setHoldId

public void setHoldId(I holdId)

addCommandListener

public void addCommandListener(CommandListener listener)

refresh

public void refresh()
Description copied from interface: ObjectBrowser
Refresh the object that this browser is holding retrieving a fresh copy from the repository.

Specified by:
refresh in interface ObjectBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>

additionalRefresh

protected void additionalRefresh()

commandDone

public void commandDone(CommandEvent source)
Description copied from interface: CommandListener
This method will be called every time a CommandEvent is fired by the command to which this listener has been added.

Specified by:
commandDone in interface CommandListener
Parameters:
source - the fired event

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Specified by:
addPropertyChangeListener in interface it.amattioli.dominate.util.PropertyChangeEmitter

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Specified by:
removePropertyChangeListener in interface it.amattioli.dominate.util.PropertyChangeEmitter

registerDetailBrowser

protected <J extends Serializable,E extends it.amattioli.dominate.Entity<J>> void registerDetailBrowser(Class<E> entityClass,
                                                                                                        Class<? extends ListBrowser<J,E>> browserClass)

getDetailsRepository

protected <J extends Serializable,E extends it.amattioli.dominate.Entity<J>> it.amattioli.dominate.Repository<J,E> getDetailsRepository(String propertyName,
                                                                                                                                        Class<E> c)

getDetailsBrowsers

public Map<String,ListBrowserImpl<?,?>> getDetailsBrowsers()
Description copied from interface: ObjectBrowser
Retrieves a map containing all the possible browsers that ObjectBrowser.getDetailsBrowser(String) will return.

Specified by:
getDetailsBrowsers in interface ObjectBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Returns:

getDetailsBrowser

public ListBrowserImpl<?,?> getDetailsBrowser(String propertyName)
Description copied from interface: ObjectBrowser
Retrieves a ListBrowser to navigate the collection of objects contained in a property.

If the hold object has a property whose name is the passed string and whose type is a collection of entities, this method returns a ListBrowser to navigate the entities contained in this collection.

If such a property does not exists, null will be returned.

Specified by:
getDetailsBrowser in interface ObjectBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Parameters:
propertyName - the name of the property whose content will be browsed
Returns:
a ListBrowser to navigate the collection of objects contained in a property

release

public void release()
Description copied from interface: Browser
Releases eventually acquired resources. After calling this method the browser can no longer be used.

Specified by:
release in interface Browser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>

contains

public boolean contains(String name,
                        String key)
Specified by:
contains in interface org.apache.commons.beanutils.DynaBean

get

public Object get(String name,
                  int index)
Specified by:
get in interface org.apache.commons.beanutils.DynaBean

get

public Object get(String name,
                  String key)
Specified by:
get in interface org.apache.commons.beanutils.DynaBean

get

public Object get(String name)
Specified by:
get in interface org.apache.commons.beanutils.DynaBean

getDynaClass

public org.apache.commons.beanutils.DynaClass getDynaClass()
Specified by:
getDynaClass in interface org.apache.commons.beanutils.DynaBean

remove

public void remove(String name,
                   String key)
Specified by:
remove in interface org.apache.commons.beanutils.DynaBean

set

public void set(String name,
                int index,
                Object value)
Specified by:
set in interface org.apache.commons.beanutils.DynaBean

set

public void set(String name,
                Object value)
Specified by:
set in interface org.apache.commons.beanutils.DynaBean

set

public void set(String name,
                String key,
                Object value)
Specified by:
set in interface org.apache.commons.beanutils.DynaBean

retrievePropertyClass

public PropertyClass retrievePropertyClass(String propertyName)
Specified by:
retrievePropertyClass in interface PropertyClassRetriever

getSelectedObject

public T getSelectedObject()
Description copied from interface: Selector
Retrieves the object currently selected.

Specified by:
getSelectedObject in interface Selector<T extends it.amattioli.dominate.Entity<I>>
Returns:
the object currently selected or null if no object is selected

addSelectionListener

public void addSelectionListener(SelectionListener listener)
Description copied from interface: Selector
Register a listener for the object selection. Every time an object is selected in this browser all the registered objects will be notified.

Specified by:
addSelectionListener in interface Selector<T extends it.amattioli.dominate.Entity<I>>
Parameters:
listener - the listener to be registered

removeSelectionListener

public void removeSelectionListener(SelectionListener listener)
Description copied from interface: Selector
Remove a listener from the collection of the listeners that will be notified when an object is slected in this browser.

Specified by:
removeSelectionListener in interface Selector<T extends it.amattioli.dominate.Entity<I>>
Parameters:
listener - the listener to be removed

addContentChangeListener

public void addContentChangeListener(ContentChangeListener listener)
Description copied from interface: Browser
Add a listener for events fired when the browser content changes.

Specified by:
addContentChangeListener in interface Browser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Parameters:
listener - the listener to be added

removeContentChangeListener

public void removeContentChangeListener(ContentChangeListener listener)
Description copied from interface: Browser
Remove a listener for events fired when the browser content changes.

Specified by:
removeContentChangeListener in interface Browser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Parameters:
listener - the listener to be removed

fireContentChange

protected void fireContentChange()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.