Class PropertyEditorSetup

java.lang.Object
com.iizigo.prop.PropertyEditorSetup

public class PropertyEditorSetup extends Object
Class holding information in a plug-in of the Property Classes and how to set up their Editors.
Author:
Christopher Mindus, Mikael Andersson
  • Field Details

    • classLoader

      public final ClassLoader classLoader
      Get the resource bundle.
  • Constructor Details

    • PropertyEditorSetup

      public PropertyEditorSetup(ResourceBundle resourceBundle)
      Constructor.
      Parameters:
      resourceBundle - Resource bundle.
    • PropertyEditorSetup

      public PropertyEditorSetup(ResourceBundle resourceBundle, ClassLoader classLoader)
      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

      public String getBundleSymbolicName()
      Gets the bundle symbolic name.
      Returns:
      The symbolic name of the bundle.
    • forName

      public Class<?> forName(String cn) throws ClassNotFoundException
      Loads a class using the appropriate class loader.
      Parameters:
      cn - The class name to load.
      Throws:
      ClassNotFoundException - For class loader errors.
    • getString

      public String getString(String key)
      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

      public boolean hasNonEmptyString(String key)
      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

      public boolean getPrivate(String name)
      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

      public String getTextPrompt(String name)
      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

      public String getToolTipText(String name)
      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

      public String getGroup(String name)
      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

      public String getGroupTextPrompt(String group)
      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

      public String getGroupToolTipText(String group)
      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

      public PropertyEditorGroupInfo getGroupInfo(String group)
      Gets the group information to use.
      Parameters:
      group - The group name.
      Returns:
      The PropertyEditorGroupInfo instance, or null if not found.
    • getPropertyClass

      public Class<GProp<?>> getPropertyClass(String name)
      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 the name ends with "$" or starts with '%'.
      Throws:
      InternalError - If the class is not found.
    • getParentProperty

      public String getParentProperty(String name)
      Gets parent property name.
      Parameters:
      name - The name of the property.
      Returns:
      null if not specified.
    • getEditProperty

      public IEditedPropertyEntry<?,?> getEditProperty(String name)
      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

      public String getDefaultPropertyValue(String name)
      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

      public String[] getEditOptions(String name)
      Gets a String for the IEditProperty for a property.
      Parameters:
      name - The name of the property.
      Returns:
      null for none.
    • getGroupFormatter

      public IGroupTextFormatter getGroupFormatter(String group)
      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

      public String verifyPropertiesPresentInGroup(PropertyEditorInfo[] infos, String[] names)
      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

      public boolean hasAtLeastOnePropertyInGroup(PropertyEditorInfo[] infos, String[] names)
      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

      public PropCnrEditorProperties getEditProperties(PropCnr pc)
      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

      public PropCnrEditorProperties getEditProperties(PropCnr pc, boolean logError)
      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

      public PropCnrEditorProperties getEditProperties(PropCnr pc, boolean logError, Throwable prev)
      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

      public IEntryValidator getValidator(String name)
      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

      public boolean equalsMultiEdit(PropertyEditorSetup setup)
      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.