com.jeta.open.support
Class CompositeComponentFinder

java.lang.Object
  extended by com.jeta.open.support.CompositeComponentFinder
All Implemented Interfaces:
ComponentFinder

public class CompositeComponentFinder
extends Object
implements ComponentFinder

A component finder that is composed of multipe component finders. This is very useful for Frames that contain multiple containers with components that have the same command. For example, you might have a menu item, toolbar button, and popup menu item that have the same cut, copy, and paste commands. These commands should route to the same action listener in the controller. To handle this case, use a CompositeComponentFinder which is composed of a finder for the menu, toolbar, and popup. You can then define your Frame as a JETAContainer and delegate the most of the JETAContainer methods to this finder.


Constructor Summary
CompositeComponentFinder()
          Constructor
CompositeComponentFinder(ComponentFinder finder)
          Constructor
 
Method Summary
 void add(ComponentFinder finder)
          Adds a finder to this composite.
 void enableComponent(String commandId, boolean bEnable)
          Enables/Disables the component associated with the commandid
 Collection getAllNamedComponents()
          Recursively searches an associated parent container for all components that are named.
 Component getComponentByName(String compName)
          Since we have multiple finders, the only approach we can take is to return the first component found.
 Collection getComponentsByName(String compName)
          Recursively searches an associated parent container for all components with the given name.
 Collection getFinders()
          Return a collection of ComponentFinder instances that are contained by this composite.
 void reset()
          Tells the implementation that any cached components should be flushed and reloaded because the parent container might have changed.
 void setVisible(String commandId, boolean bVisible)
          Shows/Hides the component associated with the commandid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeComponentFinder

public CompositeComponentFinder()
Constructor


CompositeComponentFinder

public CompositeComponentFinder(ComponentFinder finder)
Constructor

Method Detail

add

public void add(ComponentFinder finder)
Adds a finder to this composite.


enableComponent

public void enableComponent(String commandId,
                            boolean bEnable)
Enables/Disables the component associated with the commandid

Parameters:
commandId - the id of the command whose button to enable/disable
bEnable - true/false to enable/disable

getComponentByName

public Component getComponentByName(String compName)
Since we have multiple finders, the only approach we can take is to return the first component found.

Specified by:
getComponentByName in interface ComponentFinder

getComponentsByName

public Collection getComponentsByName(String compName)
Recursively searches an associated parent container for all components with the given name. An empty collection is returned if no components are found with the given name.

Specified by:
getComponentsByName in interface ComponentFinder
Returns:
a collection of Component objects that have the given name.

getFinders

public Collection getFinders()
Return a collection of ComponentFinder instances that are contained by this composite.

Returns:
the collection of ComponentFinder instances owned by this composite.

reset

public void reset()
Tells the implementation that any cached components should be flushed and reloaded because the parent container might have changed.

Specified by:
reset in interface ComponentFinder

setVisible

public void setVisible(String commandId,
                       boolean bVisible)
Shows/Hides the component associated with the commandid

Parameters:
commandId - the id of the command whose button to enable/disable
bVisible - show/hide the component/disable

getAllNamedComponents

public Collection getAllNamedComponents()
Recursively searches an associated parent container for all components that are named. An empty collection is returned if no names components exist.

Specified by:
getAllNamedComponents in interface ComponentFinder
Returns:
a collection of all named Component objects.


Copyright © 2005-2007 Jeff Tassin & Todd Viegut. All Rights Reserved.