Class ResourceMessageElementFactory


  • public class ResourceMessageElementFactory
    extends TextElementFactory
    A factory to define translateable LabelElements. LabelElements are considered immutable and should not be modified once they are created. The label expects plain text. The content of the label will be translated using an assigned resource bundle.
    Author:
    Thomas Morgner
    • Constructor Detail

      • ResourceMessageElementFactory

        public ResourceMessageElementFactory()
        DefaultConstructor.
    • Method Detail

      • getMessageNullString

        public String getMessageNullString()
      • setMessageNullString

        public void setMessageNullString​(String messageNullString)
      • getResourceBase

        public String getResourceBase()
        Returns the base name of the resource bundle used to translate the content later.
        Returns:
        the resource bundle name of the element.
      • setResourceBase

        public void setResourceBase​(String resourceBase)
        Defines the base name of the resource bundle used to translate the content later.
        Parameters:
        resourceBase - the resource bundle name of the element.
      • getNullString

        public String getNullString()
        Returns the null string for the text element. The null string is used when no content is found for that element.
        Returns:
        the null string.
      • setNullString

        public void setNullString​(String nullString)
        Defines the null string for the text element. The null string is used when no content is found for that element. The nullstring itself can be null.
        Parameters:
        nullString - the null string.
      • getFormatKey

        public String getFormatKey()
        Returns the resource key that contains the label text.
        Returns:
        the label resource bundle key.
      • setFormatKey

        public void setFormatKey​(String formatKey)
        Defines the resource key, which will be used to read the translated label text.
        Parameters:
        formatKey - the resource bundle key.
      • createResourceMessage

        public static Element createResourceMessage​(String name,
                                                    Rectangle2D bounds,
                                                    Color paint,
                                                    ElementAlignment alignment,
                                                    ElementAlignment valign,
                                                    FontDefinition font,
                                                    String nullValue,
                                                    String resourceBase,
                                                    String resourceKey)
        Deprecated.
        Use a more fine-grained approach to define this element by using the element-factory directly.
        Creates a ResourceElement. ResourceElements resolve their value using a java.util.ResourceBundle.
        Parameters:
        name - the name of the new element.
        bounds - the bounds of the new element.
        paint - the text color of this text element.
        alignment - the horizontal alignment.
        valign - the vertical alignment.
        font - the font for this element.
        resourceKey - the key which is used to query the resource bundle
        resourceBase - the classname/basename of the assigned resource bundle
        nullValue - the null string of the text element (can be null).
        Returns:
        the created ResourceElement