Package net.sf.jguiraffe.gui.forms
Class ComponentStoreImpl
- java.lang.Object
-
- net.sf.jguiraffe.gui.forms.ComponentStoreImpl
-
- All Implemented Interfaces:
ComponentStore
public class ComponentStoreImpl extends Object implements ComponentStore
A fully functional default implementation of the
ComponentStore
interface.This implementation keeps the managed components and handlers in maps where they can directly be accessed. The components of the stored component handlers are also put in the map for the components, so the name spaces of these entities are not disjunct.
For field handlers situation is similar: The component handlers associated to the added field handlers will be added to the map with the component handlers, too (and their components will in turn be added to the component map). So access to the stored entities is somewhat hierarchical.
- Version:
- $Id: ComponentStoreImpl.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description ComponentStoreImpl()
Creates a new instance ofComponentStoreImpl
and initializes it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(String name, Object component)
Adds a new component to this store.void
addComponentHandler(String name, ComponentHandler<?> handler)
Adds a new component handler to this store.void
addFieldHandler(String name, FieldHandler fldHandler)
Adds a new field handler to this store.void
clear()
Clears the content of this store.Object
findComponent(String name)
Searches the component with the specified name.ComponentHandler<?>
findComponentHandler(String name)
Searches the component handler with the specified name.FieldHandler
findFieldHandler(String name)
Searches the field handler with the specified name.Set<String>
getComponentHandlerNames()
Returns a set with the names of all stored component handlers.Set<String>
getComponentNames()
Returns a set with the names of all stored components.Set<String>
getFieldHandlerNames()
Returns a set with the names of all stored field handlers.
-
-
-
Method Detail
-
add
public void add(String name, Object component)
Adds a new component to this store.- Specified by:
add
in interfaceComponentStore
- Parameters:
name
- the name of the componentcomponent
- the component to be added- Throws:
IllegalArgumentException
- if either name or component are null
-
addComponentHandler
public void addComponentHandler(String name, ComponentHandler<?> handler)
Adds a new component handler to this store.- Specified by:
addComponentHandler
in interfaceComponentStore
- Parameters:
name
- the name of the handlerhandler
- the handler to be added- Throws:
IllegalArgumentException
- if either name or component handler are null
-
addFieldHandler
public void addFieldHandler(String name, FieldHandler fldHandler)
Adds a new field handler to this store.- Specified by:
addFieldHandler
in interfaceComponentStore
- Parameters:
name
- the name of the field handlerfldHandler
- the handler to be added- Throws:
IllegalArgumentException
- if either name or handler are null
-
findComponent
public Object findComponent(String name)
Searches the component with the specified name.- Specified by:
findComponent
in interfaceComponentStore
- Parameters:
name
- the name- Returns:
- the component with this name or null if it cannot be found
-
findComponentHandler
public ComponentHandler<?> findComponentHandler(String name)
Searches the component handler with the specified name.- Specified by:
findComponentHandler
in interfaceComponentStore
- Parameters:
name
- the name- Returns:
- the component handler with this name or null if it cannot be found
-
findFieldHandler
public FieldHandler findFieldHandler(String name)
Searches the field handler with the specified name.- Specified by:
findFieldHandler
in interfaceComponentStore
- Parameters:
name
- the name- Returns:
- the field handler with this name or null if it cannot be found
-
getComponentHandlerNames
public Set<String> getComponentHandlerNames()
Returns a set with the names of all stored component handlers.- Specified by:
getComponentHandlerNames
in interfaceComponentStore
- Returns:
- the names of the stored component handlers
-
getComponentNames
public Set<String> getComponentNames()
Returns a set with the names of all stored components.- Specified by:
getComponentNames
in interfaceComponentStore
- Returns:
- the names of the stored components
-
getFieldHandlerNames
public Set<String> getFieldHandlerNames()
Returns a set with the names of all stored field handlers.- Specified by:
getFieldHandlerNames
in interfaceComponentStore
- Returns:
- the names of the stored field handlers
-
clear
public void clear()
Clears the content of this store. After that this object is exactly like a newly created one.
-
-