Class PropertyPanel


  • public class PropertyPanel
    extends java.lang.Object
    Models a panel displayed on the Topology View.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  PropertyPanel.Prop
      Simple data carrier for a property, composed of a key/label/value trio.
    • Constructor Summary

      Constructors 
      Constructor Description
      PropertyPanel​(java.lang.String title, java.lang.String glyphId)
      Constructs a property panel model with the given title and glyph identifier (icon to display).
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      PropertyPanel addButton​(ButtonId button)
      Adds the given button descriptor to the panel data.
      PropertyPanel addProp​(java.lang.String key, java.lang.String label, int value)
      Adds a property to the panel data, using a decimal formatter.
      PropertyPanel addProp​(java.lang.String key, java.lang.String label, long value)
      Adds a property to the panel data, using a decimal formatter.
      PropertyPanel addProp​(java.lang.String key, java.lang.String label, java.lang.Object value)
      Adds a property to the panel data.
      PropertyPanel addProp​(java.lang.String key, java.lang.String label, java.lang.Object value, java.lang.String reStrip)
      Adds a property to the panel data.
      PropertyPanel addProp​(java.lang.String key, java.lang.String label, java.lang.String value)
      Adds a property to the panel data.
      PropertyPanel addSeparator()
      Adds a separator to the panel data.
      java.util.List<ButtonId> buttons()
      Returns the list of button descriptors.
      protected java.text.NumberFormat formatter()
      Returns a number formatter to use for formatting integer and long property values.
      java.lang.String glyphId()
      Returns the glyph identifier.
      PropertyPanel glyphId​(java.lang.String glyphId)
      Sets the glyph identifier.
      java.lang.String id()
      Returns the internal ID.
      PropertyPanel id​(java.lang.String id)
      Adds an ID field to the panel data, to be included in the returned JSON data to the client.
      java.lang.String navPath()
      Returns the navigation path.
      PropertyPanel navPath​(java.lang.String navPath)
      Adds a navigation path field to the panel data, to be included in the returned JSON data to the client.
      java.util.List<PropertyPanel.Prop> properties()
      Returns the list of properties to be displayed.
      PropertyPanel removeAllButtons()
      Removes all currently defined buttons.
      PropertyPanel removeAllProps()
      Removes all currently defined properties.
      PropertyPanel removeButtons​(ButtonId... descriptors)
      Removes buttons with the given descriptors from the list.
      PropertyPanel removeProps​(java.lang.String... keys)
      Removes properties with the given keys from the list.
      java.lang.String title()
      Returns the title text.
      PropertyPanel title​(java.lang.String title)
      Sets the title text.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PropertyPanel

        public PropertyPanel​(java.lang.String title,
                             java.lang.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 java.text.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​(java.lang.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​(java.lang.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​(java.lang.String key,
                                     java.lang.String label,
                                     java.lang.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​(java.lang.String key,
                                     java.lang.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​(java.lang.String key,
                                     java.lang.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​(java.lang.String key,
                                     java.lang.String label,
                                     java.lang.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​(java.lang.String key,
                                     java.lang.String label,
                                     java.lang.Object value,
                                     java.lang.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 java.lang.String title()
        Returns the title text.
        Returns:
        title text
      • glyphId

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

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

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

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

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

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

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

        public PropertyPanel removeProps​(java.lang.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