Package org.onosproject.ui.topo
Class PropertyPanel
- java.lang.Object
-
- org.onosproject.ui.topo.PropertyPanel
-
public class PropertyPanel extends java.lang.ObjectModels a panel displayed on the Topology View.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPropertyPanel.PropSimple 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 PropertyPaneladdButton(ButtonId button)Adds the given button descriptor to the panel data.PropertyPaneladdProp(java.lang.String key, java.lang.String label, int value)Adds a property to the panel data, using a decimal formatter.PropertyPaneladdProp(java.lang.String key, java.lang.String label, long value)Adds a property to the panel data, using a decimal formatter.PropertyPaneladdProp(java.lang.String key, java.lang.String label, java.lang.Object value)Adds a property to the panel data.PropertyPaneladdProp(java.lang.String key, java.lang.String label, java.lang.Object value, java.lang.String reStrip)Adds a property to the panel data.PropertyPaneladdProp(java.lang.String key, java.lang.String label, java.lang.String value)Adds a property to the panel data.PropertyPaneladdSeparator()Adds a separator to the panel data.java.util.List<ButtonId>buttons()Returns the list of button descriptors.protected java.text.NumberFormatformatter()Returns a number formatter to use for formatting integer and long property values.java.lang.StringglyphId()Returns the glyph identifier.PropertyPanelglyphId(java.lang.String glyphId)Sets the glyph identifier.java.lang.Stringid()Returns the internal ID.PropertyPanelid(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.StringnavPath()Returns the navigation path.PropertyPanelnavPath(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.PropertyPanelremoveAllButtons()Removes all currently defined buttons.PropertyPanelremoveAllProps()Removes all currently defined properties.PropertyPanelremoveButtons(ButtonId... descriptors)Removes buttons with the given descriptors from the list.PropertyPanelremoveProps(java.lang.String... keys)Removes properties with the given keys from the list.java.lang.Stringtitle()Returns the title text.PropertyPaneltitle(java.lang.String title)Sets the title text.
-
-
-
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 keylabel- 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 keylabel- 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 keylabel- 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'stoString()method is used to convert the value to a string.- Parameters:
key- property keylabel- 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'stoString()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 keylabel- property label (localized)value- property valuereStrip- 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
-
-