Class PropertyEditorSetup


  • public class PropertyEditorSetup
    extends java.lang.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 Detail

      • classLoader

        public final java.lang.ClassLoader classLoader
        Get the resource bundle.
    • Constructor Detail

      • PropertyEditorSetup

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

        public PropertyEditorSetup​(java.util.ResourceBundle resourceBundle,
                                   java.lang.ClassLoader classLoader)
        Constructor.
        Parameters:
        resourceBundle - Resource bundle.
        classLoader - The class loader or null for default.
    • Method Detail

      • assignBundleContext

        public void assignBundleContext​(org.osgi.framework.BundleContext bundleContext)
        Assigns the bundle.
      • getBundleSymbolicName

        public java.lang.String getBundleSymbolicName()
        Gets the bundle symbolic name.
      • forName

        public java.lang.Class<?> forName​(java.lang.String cn)
                                   throws java.lang.ClassNotFoundException
        Loads a class using the appropriate class loader.
        Throws:
        java.lang.ClassNotFoundException - For class loader errors.
      • getString

        public java.lang.String getString​(java.lang.String key)
        Gets the localized string from a resource bundle.
        Parameters:
        key - The key for the localized message.
        Returns:
        The string matching a key.
      • hasNonEmptyString

        public boolean hasNonEmptyString​(java.lang.String key)
        Checks if string is present.
      • getPrivate

        public boolean getPrivate​(java.lang.String name)
        Gets the text prompt for a property name.
      • getTextPrompt

        public java.lang.String getTextPrompt​(java.lang.String name)
        Gets the text prompt for a property name.
      • getToolTipText

        public java.lang.String getToolTipText​(java.lang.String name)
        Gets the tooltip text for a property name.
      • getGroup

        public java.lang.String getGroup​(java.lang.String name)
        Gets the group for a property name.
      • getGroupTextPrompt

        public java.lang.String getGroupTextPrompt​(java.lang.String group)
        Get a group text prompt.
      • getGroupToolTipText

        public java.lang.String getGroupToolTipText​(java.lang.String group)
        Get a group tooltip text.
      • getGroupInfo

        public PropertyEditorGroupInfo getGroupInfo​(java.lang.String group)
        Gets the group information to use.
      • getPropertyClass

        public java.lang.Class<GProp<?>> getPropertyClass​(java.lang.String name)
        Gets the class for the property. An InternalError is thrown in case the class is not found.
      • getParentProperty

        public java.lang.String getParentProperty​(java.lang.String name)
        Gets parent property name.
        Returns:
        null if not specified.
      • getEditProperty

        public IEditedPropertyEntry<?,​?> getEditProperty​(java.lang.String name)
        Gets an IEditProperty for a property. An InternalError is thrown if the instance cannot be created.
      • getDefaultPropertyValue

        public java.lang.String getDefaultPropertyValue​(java.lang.String name)
        Gets a default value for a property. An InternalError is thrown if the instance cannot be created.
      • getEditOptions

        public java.lang.String[] getEditOptions​(java.lang.String name)
        Gets a String for the IEditProperty for a property.
        Returns:
        null for none.
      • getGroupFormatter

        public IGroupTextFormatter getGroupFormatter​(java.lang.String group)
        Gets an group formatter for a group. If no group formatter is defined, null is returned. An InternalError is thrown if the instance cannot be created.
      • verifyPropertiesPresentInGroup

        public java.lang.String verifyPropertiesPresentInGroup​(PropertyEditorInfo[] infos,
                                                               java.lang.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,
                                                    java.lang.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.
      • getValidator

        public IEntryValidator getValidator​(java.lang.String name)
        Gets an entry/property validator. If no group formatter is defined, null is returned. An InternalError is thrown 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.