Class PropertyPanel


  • public class PropertyPanel
    extends Object
    Models a panel displayed on the Topology View.
    • Constructor Detail

      • PropertyPanel

        public PropertyPanel​(String title,
                             String glyphId)
        Constructs a property panel model with the given title and glyph identifier (icon to display).
        Parameters:
        title - title text
        glyphId - glyph ID
    • Method Detail

      • formatter

        protected NumberFormat formatter()
        Returns a number formatter to use for formatting integer and long property values.

        This default implementation uses a formatter for the default locale. For example:

             Locale.ENGLISH  :  1000 -> "1,000"
             Locale.FRENCH   :  1000 -> "1 000"
             Locale.GERMAN   :  1000 -> "1.000"
         
        Returns:
        the number formatter
      • navPath

        public PropertyPanel navPath​(String navPath)
        Adds a navigation path field to the panel data, to be included in the returned JSON data to the client. This is typically used to configure the topology view with the appropriate navigation path for a hot-link to some other view.
        Parameters:
        navPath - the navigation path
        Returns:
        self for chaining
      • id

        public PropertyPanel id​(String id)
        Adds an ID field to the panel data, to be included in the returned JSON data to the client.
        Parameters:
        id - the identifier
        Returns:
        self, for chaining
      • addProp

        public PropertyPanel addProp​(String key,
                                     String label,
                                     String value)
        Adds a property to the panel data.
        Parameters:
        key - property key
        label - property label (localized)
        value - property value
        Returns:
        self, for chaining
      • addProp

        public PropertyPanel addProp​(String key,
                                     String label,
                                     int value)
        Adds a property to the panel data, using a decimal formatter.
        Parameters:
        key - property key
        label - property label (localized)
        value - property value
        Returns:
        self, for chaining
      • addProp

        public PropertyPanel addProp​(String key,
                                     String label,
                                     long value)
        Adds a property to the panel data, using a decimal formatter.
        Parameters:
        key - property key
        label - property label (localized)
        value - property value
        Returns:
        self, for chaining
      • addProp

        public PropertyPanel addProp​(String key,
                                     String label,
                                     Object value)
        Adds a property to the panel data. Note that the value's toString() method is used to convert the value to a string.
        Parameters:
        key - property key
        label - property label (localized)
        value - property value
        Returns:
        self, for chaining
      • addProp

        public PropertyPanel addProp​(String key,
                                     String label,
                                     Object value,
                                     String reStrip)
        Adds a property to the panel data. Note that the value's toString() method is used to convert the value to a string, from which the characters defined in the given regular expression string are stripped.
        Parameters:
        key - property key
        label - property label (localized)
        value - property value
        reStrip - regexp characters to strip from value string
        Returns:
        self, for chaining
      • addSeparator

        public PropertyPanel addSeparator()
        Adds a separator to the panel data.
        Returns:
        self, for chaining
      • title

        public String title()
        Returns the title text.
        Returns:
        title text
      • glyphId

        public String glyphId()
        Returns the glyph identifier.
        Returns:
        glyph identifier
      • navPath

        public String navPath()
        Returns the navigation path.
        Returns:
        the navigation path
      • id

        public String id()
        Returns the internal ID.
        Returns:
        the ID
      • properties

        public List<PropertyPanel.Prop> properties()
        Returns the list of properties to be displayed.
        Returns:
        the property list
      • buttons

        public List<ButtonId> buttons()
        Returns the list of button descriptors.
        Returns:
        the button list
      • title

        public PropertyPanel title​(String title)
        Sets the title text.
        Parameters:
        title - title text
        Returns:
        self, for chaining
      • glyphId

        public PropertyPanel glyphId​(String glyphId)
        Sets the glyph identifier.
        Parameters:
        glyphId - glyph identifier
        Returns:
        self, for chaining
      • removeProps

        public PropertyPanel removeProps​(String... keys)
        Removes properties with the given keys from the list.
        Parameters:
        keys - keys of properties to remove
        Returns:
        self, for chaining
      • removeAllProps

        public PropertyPanel removeAllProps()
        Removes all currently defined properties.
        Returns:
        self, for chaining
      • addButton

        public PropertyPanel addButton​(ButtonId button)
        Adds the given button descriptor to the panel data.
        Parameters:
        button - button descriptor
        Returns:
        self, for chaining
      • removeButtons

        public PropertyPanel removeButtons​(ButtonId... descriptors)
        Removes buttons with the given descriptors from the list.
        Parameters:
        descriptors - descriptors to remove
        Returns:
        self, for chaining
      • removeAllButtons

        public PropertyPanel removeAllButtons()
        Removes all currently defined buttons.
        Returns:
        self, for chaining