Package com.iizigo.prop
Class PropertyEditorSetup
java.lang.Object
com.iizigo.prop.PropertyEditorSetup
Class holding information in a plug-in of the Property Classes and how to set up their Editors.
- Author:
- Christopher Mindus, Mikael Andersson
Field Summary
Constructor Summary
ConstructorDescriptionPropertyEditorSetup
(ResourceBundle resourceBundle) Constructor.PropertyEditorSetup
(ResourceBundle resourceBundle, ClassLoader classLoader) Constructor.Method Summary
Modifier and TypeMethodDescriptionvoid
assignBundleContext
(org.osgi.framework.BundleContext bundleContext) Assigns the bundle.boolean
Checks if two instances are "multi-edit-equals", i.e.Class<?>
Loads a class using the appropriate class loader.Gets the bundle symbolic name.Gets a default value for a property.String[]
getEditOptions
(String name) Gets a String for the IEditProperty for a property.Gets the name mapping from a class to another, e.g.getEditProperties
(PropCnr pc, boolean logError) Gets the name mapping from a class to another, e.g.getEditProperties
(PropCnr pc, boolean logError, Throwable prev) Gets the name mapping from a class to another, e.g.IEditedPropertyEntry<?,
?> getEditProperty
(String name) Gets an IEditProperty for a property.Gets the group for a property name.getGroupFormatter
(String group) Gets an group formatter for a group.getGroupInfo
(String group) Gets the group information to use.getGroupTextPrompt
(String group) Get a group text prompt.getGroupToolTipText
(String group) Get a group tooltip text.getParentProperty
(String name) Gets parent property name.boolean
getPrivate
(String name) Gets the text prompt for a property name.getPropertyClass
(String name) Gets the class for the property.Gets the localized string from a resource bundle.getTextPrompt
(String name) Gets the text prompt for a property name.getToolTipText
(String name) Gets the tooltip text for a property name.getValidator
(String name) Gets an entry/property validator.boolean
hasAtLeastOnePropertyInGroup
(PropertyEditorInfo[] infos, String[] names) Helper to check for at least one property in group.boolean
hasNonEmptyString
(String key) Checks if string is present.verifyPropertiesPresentInGroup
(PropertyEditorInfo[] infos, String[] names) Helper to verify properties are present for a group.
Field Details
classLoader
Get the resource bundle.
Constructor Details
PropertyEditorSetup
Constructor.- Parameters:
resourceBundle
- Resource bundle.
PropertyEditorSetup
Constructor.- Parameters:
resourceBundle
- Resource bundle.classLoader
- The class loader or null for default.
Method Details
assignBundleContext
public void assignBundleContext(org.osgi.framework.BundleContext bundleContext) Assigns the bundle.- Parameters:
bundleContext
- The bundle context.
getBundleSymbolicName
Gets the bundle symbolic name.- Returns:
- The symbolic name of the bundle.
forName
Loads a class using the appropriate class loader.- Parameters:
cn
- The class name to load.- Throws:
ClassNotFoundException
- For class loader errors.
getString
Gets the localized string from a resource bundle.- Parameters:
key
- The key for the localized message.- Returns:
- The string matching a key, or
"?<i>key</i>?"
if not found.
hasNonEmptyString
Checks if string is present.- Parameters:
key
- The key to verify.- Returns:
- true if the key is present and is has a non-empty value String.
getPrivate
Gets the text prompt for a property name.- Parameters:
name
- The property name.- Returns:
- true If the key
<i>name</i>.private
equals to (String) "true
".
getTextPrompt
Gets the text prompt for a property name.- Parameters:
name
- The property name.- Returns:
- The text prompt for the key, or
"?<i>name</i>.p?"
if not found.
getToolTipText
Gets the tooltip text for a property name.- Parameters:
name
- The property name.- Returns:
- The text prompt for the key, or
"?<i>name</i>.t?"
if not found.
getGroup
Gets the group for a property name.- Parameters:
name
- The property name.- Returns:
- The text prompt for the key, or
"?<i>name</i>.g?"
if not found.
getGroupTextPrompt
Get a group text prompt.- Parameters:
group
- The group name.- Returns:
- The group text prompt for the key, or
"?_<i>group</i>.g?"
if not found.
getGroupToolTipText
Get a group tooltip text.- Parameters:
group
- The group name.- Returns:
- The group tooltip text for the key, or
"?_<i>group</i>.t?"
if not found.
getGroupInfo
Gets the group information to use.- Parameters:
group
- The group name.- Returns:
- The PropertyEditorGroupInfo instance, or
null
if not found.
getPropertyClass
Gets the class for the property. An InternalError is thrown in case the class is not found.- Parameters:
name
- The property class name to find.- Returns:
- The class, or
null
if thename
ends with "$" or starts with '%'. - Throws:
InternalError
- If the class is not found.
getParentProperty
Gets parent property name.- Parameters:
name
- The name of the property.- Returns:
- null if not specified.
getEditProperty
Gets an IEditProperty for a property. An InternalError is thrown if the instance cannot be created.- Parameters:
name
- The name of the property.- Returns:
- The IEditedPropertyEntry interface.
- Throws:
InternalError
- If IEditedPropertyEntry interface is not found.
getDefaultPropertyValue
Gets a default value for a property.- Parameters:
name
- The name of the property.- Returns:
- The description string of the name property, or empty string if not found.
getEditOptions
Gets a String for the IEditProperty for a property.- Parameters:
name
- The name of the property.- Returns:
- null for none.
getGroupFormatter
Gets an group formatter for a group. If no group formatter is defined, null is returned.- Parameters:
group
- The group name of the property.- Throws:
InternalError
- If the instance cannot be created.
verifyPropertiesPresentInGroup
Helper to verify properties are present for a group.- Parameters:
infos
- The array of edit's for the property.names
- The names to verify.- Returns:
- null for no error, otherwise the missing name(s) (comma separated preceeded with "missing property name:").
hasAtLeastOnePropertyInGroup
Helper to check for at least one property in group.- Parameters:
infos
- The array of edit's for the property.names
- The names to verify.- Returns:
- null for no error, otherwise the missing name(s) (comma separated preceeded with "missing property name:").
getEditProperties
Gets the name mapping from a class to another, e.g. UILabel to EUILabel (in different packages). The method throws an InternalError in case of error.- Parameters:
pc
- The instance of the class.- Returns:
- The edit properties for the property container.
getEditProperties
Gets the name mapping from a class to another, e.g. UILabel to EUILabel (in different packages). The method throws an InternalError in case of error.- Parameters:
pc
- The instance of the class.- Returns:
- The edit properties for the property container.
getEditProperties
Gets the name mapping from a class to another, e.g. UILabel to EUILabel (in different packages). The method throws an InternalError in case of error.- Parameters:
pc
- The instance of the class.logError
- Flag to log the error.prev
- Previous exception thrown.- Returns:
- The edit properties for the property container.
getValidator
Gets an entry/property validator. If no group formatter is defined, null is returned.- Parameters:
name
- The validator name.- Returns:
- The validator, or
null
for none. - Throws:
InternalError
- If the instance cannot be created.
equalsMultiEdit
Checks if two instances are "multi-edit-equals", i.e. same definition name in the same bundle.- Parameters:
setup
- Another setup to verify.- Returns:
- The equality flag.