org.rhq.enterprise.communications.command.param
Class ParameterRenderingInformation

java.lang.Object
  extended by org.rhq.enterprise.communications.command.param.ParameterRenderingInformation
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
FileUploadRenderingInformation, OptionListRenderingInformation, TextFieldRenderingInformation, UnorderedListRenderingInformation

public class ParameterRenderingInformation
extends Object
implements Serializable

Class used to encapsulate information about how clients should render parameters when displaying them for reading/editing. Supports general rendering information common to all Parameters.

This class uses resource bundles to support internationalization/localization of the information. You must apply a resource bundle to this object in order to obtain the strings that are to be used to render the parameter information.

Author:
Charles Crouch, John Mazzitelli
See Also:
Serialized Form

Constructor Summary
ParameterRenderingInformation()
          Create a new ParameterRenderingInformation with all keys being null.
ParameterRenderingInformation(String labelKey, String descriptionKey)
          Create a new ParameterRenderingInformation.
 
Method Summary
 void applyResourceBundle(ResourceBundle resourceBundle)
          Applies the given resource bundle to this object so this object can obtain the actual string values for the label and description.
 String getDescription()
          Get the description string as found in the resource bundle.
 String getDescriptionKey()
          Returns the key that will be used to look up the description in a resource bundle.
 String getLabel()
          Get the label string as found in the resource bundle.
 String getLabelKey()
          Returns the key that will be used to look up the label in a resource bundle.
 boolean isHidden()
          Indicates if this parameter should be considered hidden (which usually means this parameter is hidden from view in a user interface).
 boolean isObfuscated()
          Indicates if this parameter should be obfuscated (which usually means the value should be garbled in a user interface, such as the typical "***" in a password field).
 boolean isReadOnly()
          Indicates if this parameter should be considered read-only (which usually means a user cannot alter the parameter's value within a user interface).
 void setDescription(String description)
          Explicitly sets the description string.
 void setHidden(boolean hidden)
          Set the hidden flag.
 void setLabel(String label)
          Explicitly sets the label string.
 void setObfuscated(boolean obfuscated)
          Set the obfuscated flag.
 void setReadOnly(boolean readOnly)
          Sets the read-only flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParameterRenderingInformation

public ParameterRenderingInformation(String labelKey,
                                     String descriptionKey)
Create a new ParameterRenderingInformation. This constructor takes keys to labels and descriptions, rather than actual values. Those keys will later be used to look up the values from a resource bundle.

A key can be null; for those keys that are null, they simply will not be looked up in a resource bundle. In this case you need to explicitly call the setter to define the value. For example, if labelKey is null, then the only way for getLabel() to return a non-null label string would be if you explicitly call setLabel(String) since the label string will not be found in any resource bundle.

By default, the parameter is defined as:

Parameters:
labelKey - the key into a resource bundle where the resource bundle string is the parameter label (may be null)
descriptionKey - the key into a resource bundle where the resource bundle string is the parameter description (may be null)

ParameterRenderingInformation

public ParameterRenderingInformation()
Create a new ParameterRenderingInformation with all keys being null. See ParameterRenderingInformation(String, String) for more information.

Method Detail

getLabelKey

public String getLabelKey()
Returns the key that will be used to look up the label in a resource bundle.

Returns:
the description key

getDescriptionKey

public String getDescriptionKey()
Returns the key that will be used to look up the description in a resource bundle.

Returns:
the description key

getDescription

public String getDescription()
Get the description string as found in the resource bundle.

This will return null until a resource bundle has been applied to this object. This description string may also be explicitly set via setDescription(String).

Returns:
the description string or null

setDescription

public void setDescription(String description)
Explicitly sets the description string. This can be used if you want to supply a default description without having to apply a resource bundle.

Parameters:
description - The description to set.

getLabel

public String getLabel()
Get the label string as found in the resource bundle.

This will return null until a resource bundle has been applied to this object. This label string may also be explicitly set via setLabel(String).

Returns:
the label string or null

setLabel

public void setLabel(String label)
Explicitly sets the label string. This can be used if you want to supply a default label without having to apply a resource bundle.

Parameters:
label - The label to set.

applyResourceBundle

public void applyResourceBundle(ResourceBundle resourceBundle)
                         throws MissingResourceException
Applies the given resource bundle to this object so this object can obtain the actual string values for the label and description. If a label was explicitly set or a description was explicitly set, those values will be overwritten by the values found in the given resource bundle. If the given bundle is null, this method does nothing.

Note that if the resource bundle was null but one or more keys were not null, an exception is thrown. In this case, you must either define a resource bundle or you must not define keys.

Parameters:
resourceBundle - the resource bundle where the key values are found (may be null)
Throws:
MissingResourceException - if a key was not found in the resource bundle
InvalidParameterDefinitionException - key(s) were non-null but resourceBundle was null

isReadOnly

public boolean isReadOnly()
Indicates if this parameter should be considered read-only (which usually means a user cannot alter the parameter's value within a user interface).

Returns:
the read-only flag

setReadOnly

public void setReadOnly(boolean readOnly)
Sets the read-only flag.

Parameters:
readOnly -

isHidden

public boolean isHidden()
Indicates if this parameter should be considered hidden (which usually means this parameter is hidden from view in a user interface).

Returns:
the hidden flag

setHidden

public void setHidden(boolean hidden)
Set the hidden flag.

Parameters:
hidden -

isObfuscated

public boolean isObfuscated()
Indicates if this parameter should be obfuscated (which usually means the value should be garbled in a user interface, such as the typical "***" in a password field).

Returns:
the obfuscated flag

setObfuscated

public void setObfuscated(boolean obfuscated)
Set the obfuscated flag.

Parameters:
obfuscated -


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.