corny.addressbook.searching.ValueModifier
Interface ValueModifier

All Known Implementing Classes:
ValueModifierImpl

public interface ValueModifier

Interface class for value modifiers. The value modifiers are used to search and replace in the Address Book.

Author:
Corny

Nested Class Summary
static class ValueModifier.Modifier
          Enumeration which contains every available ValueModifier.
 
Method Summary
 boolean appliesToProperty(ContactProperty prop, java.lang.Class<?> cl)
          Specifies whether or not this ValueModifier can be applied on a given ContactProperty.
 java.lang.String getDescriptionForParameter(int index, java.lang.Class<?> cl, ContactProperty replaceProperty)
          Returns the description text for the parameter at a specified index
 javax.swing.JComponent getEditorForParameter(int index, java.lang.Class<?> cl, ContactProperty replaceProperty, java.awt.event.KeyListener l)
          Returns the editing component for the given parameter index.
 boolean getEditorIncludesDescription(int index, java.lang.Class<?> cl)
          Specifies whether the editing component includes its description text or not.
 java.lang.Object getModifiedValue(java.lang.Object initialValue, java.lang.Class<?> cl)
          Modifies a value and returns the modified value.
 java.lang.String getModifierName(java.lang.Class<?> cl)
          Returns a human readable text representation for this ValueModifier
 java.lang.Object getObjectForComponent(int parameterIndex, javax.swing.JComponent comp, java.lang.Class<?> cl)
          Returns the Object matching the class returned by getParameterClass(int, Class), containing the values entered in the editor returned by the getEditorForParameter(int, Class, ContactProperty, KeyListener).
 java.lang.Class<?> getParameterClass(int index, java.lang.Class<?> cl)
          Returns the Class of the parameter at a specified index
 int getParameterCount(java.lang.Class<?> cl)
          Returns the count of the parameters this ValueModifier needs.
 void setParameter(int index, java.lang.Object value, java.lang.Class<?> cl)
          Sets the parameter at a given index
 

Method Detail

getModifierName

java.lang.String getModifierName(java.lang.Class<?> cl)
Returns a human readable text representation for this ValueModifier

Parameters:
cl - Class of the value to modify
Returns:
Text representation

getModifiedValue

java.lang.Object getModifiedValue(java.lang.Object initialValue,
                                  java.lang.Class<?> cl)
Modifies a value and returns the modified value.

Parameters:
initialValue - Value to modify
cl - Class of the value to modify
Returns:
Modified value

getParameterCount

int getParameterCount(java.lang.Class<?> cl)
Returns the count of the parameters this ValueModifier needs.

Parameters:
cl - Class of the value to modify
Returns:
Count

getDescriptionForParameter

java.lang.String getDescriptionForParameter(int index,
                                            java.lang.Class<?> cl,
                                            ContactProperty replaceProperty)
Returns the description text for the parameter at a specified index

Parameters:
index - Parameter index
cl - Class of the value to modify
replaceProperty - Contact property to modify
Returns:
Description text

getParameterClass

java.lang.Class<?> getParameterClass(int index,
                                     java.lang.Class<?> cl)
Returns the Class of the parameter at a specified index

Parameters:
index - Parameter index
cl - Class of the value to modify
Returns:
Class of the parameter

setParameter

void setParameter(int index,
                  java.lang.Object value,
                  java.lang.Class<?> cl)
Sets the parameter at a given index

Parameters:
index - Parameter index
cl - Class of the value to modify
value - New value

appliesToProperty

boolean appliesToProperty(ContactProperty prop,
                          java.lang.Class<?> cl)
Specifies whether or not this ValueModifier can be applied on a given ContactProperty.

Parameters:
prop - ContactProperty to modify
cl - Class of the value to modify
Returns:
true if this ValueModifier can be applied on the Class

getEditorForParameter

javax.swing.JComponent getEditorForParameter(int index,
                                             java.lang.Class<?> cl,
                                             ContactProperty replaceProperty,
                                             java.awt.event.KeyListener l)
Returns the editing component for the given parameter index. The same instance will be passed when the getObjectForComponent(int, JComponent, Class) method is called.

Parameters:
index - Parameter index
cl - Class of the value to modify
replaceProperty - Contact property to modify
l - KeyListener to be added to the editor
Returns:
Editing component

getEditorIncludesDescription

boolean getEditorIncludesDescription(int index,
                                     java.lang.Class<?> cl)
Specifies whether the editing component includes its description text or not.

Parameters:
index - Parameter index
cl - Class of the value to modify
Returns:
false if an additional description label should be added

getObjectForComponent

java.lang.Object getObjectForComponent(int parameterIndex,
                                       javax.swing.JComponent comp,
                                       java.lang.Class<?> cl)
Returns the Object matching the class returned by getParameterClass(int, Class), containing the values entered in the editor returned by the getEditorForParameter(int, Class, ContactProperty, KeyListener).

Parameters:
parameterIndex - Parameter index
comp - Editing component
cl - Class of the value to modify
Returns:
Entered value