public class PropertyPanel extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PropertyPanel.Prop
Simple data carrier for a property, composed of a key/label/value trio.
|
Constructor and Description |
---|
PropertyPanel(String title,
String glyphId)
Constructs a property panel model with the given title and
glyph identifier (icon to display).
|
Modifier and Type | Method and Description |
---|---|
PropertyPanel |
addButton(ButtonId button)
Adds the given button descriptor to the panel data.
|
PropertyPanel |
addProp(String key,
String label,
int value)
Adds a property to the panel data, using a decimal formatter.
|
PropertyPanel |
addProp(String key,
String label,
long value)
Adds a property to the panel data, using a decimal formatter.
|
PropertyPanel |
addProp(String key,
String label,
Object value)
Adds a property to the panel data.
|
PropertyPanel |
addProp(String key,
String label,
Object value,
String reStrip)
Adds a property to the panel data.
|
PropertyPanel |
addProp(String key,
String label,
String value)
Adds a property to the panel data.
|
PropertyPanel |
addSeparator()
Adds a separator to the panel data.
|
List<ButtonId> |
buttons()
Returns the list of button descriptors.
|
protected NumberFormat |
formatter()
Returns a number formatter to use for formatting integer and long
property values.
|
String |
glyphId()
Returns the glyph identifier.
|
PropertyPanel |
glyphId(String glyphId)
Sets the glyph identifier.
|
String |
id()
Returns the internal ID.
|
PropertyPanel |
id(String id)
Adds an ID field to the panel data, to be included in
the returned JSON data to the client.
|
String |
navPath()
Returns the navigation path.
|
PropertyPanel |
navPath(String navPath)
Adds a navigation path field to the panel data, to be included in
the returned JSON data to the client.
|
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(String... keys)
Removes properties with the given keys from the list.
|
String |
title()
Returns the title text.
|
PropertyPanel |
title(String title)
Sets the title text.
|
protected NumberFormat formatter()
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"
public PropertyPanel navPath(String navPath)
navPath
- the navigation pathpublic PropertyPanel id(String id)
id
- the identifierpublic PropertyPanel addProp(String key, String label, String value)
key
- property keylabel
- property label (localized)value
- property valuepublic PropertyPanel addProp(String key, String label, int value)
key
- property keylabel
- property label (localized)value
- property valuepublic PropertyPanel addProp(String key, String label, long value)
key
- property keylabel
- property label (localized)value
- property valuepublic PropertyPanel addProp(String key, String label, Object value)
toString()
method is used to convert the
value to a string.key
- property keylabel
- property label (localized)value
- property valuepublic PropertyPanel addProp(String key, String label, Object value, String reStrip)
toString()
method is used to convert the
value to a string, from which the characters defined in the given
regular expression string are stripped.key
- property keylabel
- property label (localized)value
- property valuereStrip
- regexp characters to strip from value stringpublic PropertyPanel addSeparator()
public String title()
public String glyphId()
public String navPath()
public String id()
public List<PropertyPanel.Prop> properties()
public List<ButtonId> buttons()
public PropertyPanel title(String title)
title
- title textpublic PropertyPanel glyphId(String glyphId)
glyphId
- glyph identifierpublic PropertyPanel removeProps(String... keys)
keys
- keys of properties to removepublic PropertyPanel removeAllProps()
public PropertyPanel addButton(ButtonId button)
button
- button descriptorpublic PropertyPanel removeButtons(ButtonId... descriptors)
descriptors
- descriptors to removepublic PropertyPanel removeAllButtons()