|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jeters.componentInterface.ComponentManager
public class ComponentManager
class that manages components. It will make sure configurations and translations are applied to components when being initialized. For other classes, it provides get and set methods to access components and to change which components are currently in use. Note that neither set nor get methods clone the components, modifying them (e.g. by setting configurations) will affect the active component.
Constructor Summary | |
---|---|
ComponentManager(java.io.File componentDirectory,
net.sf.jeters.configuration.io.ConfigurationReader[] configurationReaders,
TranslationReader translationReader)
constructor creating a component manager using a given directory as component source |
Method Summary | |
---|---|
void |
createMissingComponentConfigurations()
creates missing configuration data. |
void |
createMissingComponentConfigurations(java.lang.Class componentClass,
Configuration defaultConfig)
creates missing configuration data for a single component class, has a parameter for the default configuration, thus it is not necessary for this method to create an instance of the componentClass. |
java.util.List<java.lang.Class> |
getAvailableComponentClasses(java.lang.Class... classes)
returns the available components classes, can be limited to those components that are instances of given classes/interfaces. |
java.lang.Class |
getComponentClassForName(java.lang.String name)
returns the component class for the given name |
InputComponent |
getInputComponent()
returns the current input component |
java.lang.String |
getLocalizedComponentName(java.lang.Class componentClass)
returns the localized component name for a component; this name is determined from its ressource bundle for the current locale (if it exists) |
java.util.List<java.lang.String> |
getNamesOfAvailableComponentClasses(java.lang.Class... classes)
returns the full names of the available components classes, can be limited to those components that are instances of given classes/interfaces. |
OutputComponent |
getOutputComponent()
returns the current output component |
java.util.List<ReplacerComponent> |
getReplacerComponents()
returns a list of the current replacer components; modifying of the list will not affect the component manager, modifying the components, however, will modify the originals. |
UIComponent |
getUIComponent()
returns the current input component |
void |
setInputComponent(java.lang.Class componentClass)
creates a new input component from the given class and sets it as active input component |
void |
setOutputComponent(java.lang.Class componentClass)
creates a new output component from the given class and sets it as active output component |
void |
setReplacerComponent(java.util.Collection<java.lang.Class> componentClasses)
creates new replacer components from the given classes and sets it as active replacer components |
void |
setTranslation(Component component)
loads and sets the translation for a translatable component using the current translatationReader. |
void |
setUIComponent(java.lang.Class componentClass)
creates a new UI component from the given class and sets it as active UI component |
void |
writeCurrentConfigurations()
stores the current configurations of all active components; to be used before exiting program |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ComponentManager(java.io.File componentDirectory, net.sf.jeters.configuration.io.ConfigurationReader[] configurationReaders, TranslationReader translationReader)
componentDirectory
- directory containing components (classes/jars)configurationReaders
- objects reading and writing configurations
for components, with decreasing priority
(conflicting values => first one is kept)translationReader
- reader providing language-specific Strings for
components implementing TranslatableMethod Detail |
---|
public UIComponent getUIComponent()
public InputComponent getInputComponent()
public OutputComponent getOutputComponent()
public java.util.List<ReplacerComponent> getReplacerComponents()
public void setUIComponent(java.lang.Class componentClass)
componentClass
- class that will be instantiated to create the
component; must implement UIComponent, not null,
a call to newInstance must not cause an
InstantiationException or IllegalAccessExceptionpublic void setInputComponent(java.lang.Class componentClass)
componentClass
- class that will be instantiated to create the
component; must implement InputComponent,
not null, a call to newInstance must not cause an
InstantiationException or IllegalAccessExceptionpublic void setOutputComponent(java.lang.Class componentClass)
componentClass
- class that will be instantiated to create the
component; must implement OutputComponent,
not null, a call to newInstance must not cause an
InstantiationException or IllegalAccessExceptionpublic void setReplacerComponent(java.util.Collection<java.lang.Class> componentClasses)
componentClasses
- collection of classes that will be instantiated
to create the components; every class must
implement ReplacerComponent, neither the list
nor its element may be null, a call to
newInstance for a class must not cause an
InstantiationException or IllegalAccessExceptionpublic void createMissingComponentConfigurations()
public void createMissingComponentConfigurations(java.lang.Class componentClass, Configuration defaultConfig)
componentClass
- class to check completeness of config for, != nulldefaultConfig
- default configuration used as template for missing
entries, != nullpublic java.util.List<java.lang.Class> getAvailableComponentClasses(java.lang.Class... classes)
getAvailableComponentClasses(UIComponent.class)
getAvailableComponentClasses(Configurable.class,
InputComponent.class)
getAvailableComponents()
classes
- classes/interfaces the component classes must be
subtypes of (a vararg parameter)
public java.util.List<java.lang.String> getNamesOfAvailableComponentClasses(java.lang.Class... classes)
getAvailableComponentClasses(Class[])
classes
- classes/interfaces the component classes must be
subtypes of (a vararg parameter)
public java.lang.Class getComponentClassForName(java.lang.String name)
name
- the full name of the component class
public void writeCurrentConfigurations()
public void setTranslation(Component component)
component
- component whose translation is to be set,
not null; may be a component that is not translatable
(=> no action)public java.lang.String getLocalizedComponentName(java.lang.Class componentClass)
componentClass
- component class to get localized name for, != null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |