public final class ResourceBundlePropertyEditor
extends java.lang.Object
implements java.beans.PropertyEditor
ResourceBundlePropertyEditor
provides a PropertyEditor
for
handling properties which are translateable strings when the project has resource
bundle support turned on.
Any implementor of a PropertyModel
will need to determine when to
use the ResourceBundlePropertyEditor instead of a standard string editor, since it
is only the property model that can answer the following questions:
1) Is the property one which represents a translateable string?
2) What is the project related to the property?
3) What is the name of the property?
Typical logic for an implementor of a property model would be as follows:
if (propertyType == String.class && isTranslateableProperty(propertyName)
{
Project project = getProject();
if (project != null)
{
if (ResourceBundlePropertyEditor.useResourceBundlePropertyEditor(project))
{
ResourceBundlePropertyEditor propEditor = new ResourceBundlePropertyEditor();
propEditor.setPropertyName(propertyName);
propEditor.setProject(project);
}
}
}Constructor and Description |
---|
ResourceBundlePropertyEditor() |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener l) |
static boolean |
containsEl(java.lang.String text)
Determines whether the supplied string contains expression language.
|
java.lang.String |
getAsText() |
java.awt.Component |
getCustomEditor() |
java.lang.String |
getJavaInitializationString() |
java.lang.String[] |
getTags() |
java.lang.Object |
getValue()
Gets the value of the property.
|
boolean |
isPaintable() |
void |
paintValue(java.awt.Graphics gfx,
java.awt.Rectangle box) |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener l) |
void |
setAsText(java.lang.String text) |
void |
setProject(Project project)
Sets the project for the property editor.
|
void |
setPropertyName(java.lang.String propertyName)
Deprecated.
|
void |
setValue(java.lang.Object value) |
boolean |
supportsCustomEditor() |
static boolean |
useResourceBundlePropertyEditor(Project project)
Determines if the
ResourceBundlePropertyEditor should be
used based on whether the project has auto-synchronization for resource
bundles turned on. |
public java.awt.Component getCustomEditor()
getCustomEditor
in interface java.beans.PropertyEditor
public boolean supportsCustomEditor()
supportsCustomEditor
in interface java.beans.PropertyEditor
public void setValue(java.lang.Object value)
setValue
in interface java.beans.PropertyEditor
public java.lang.Object getValue()
getValue
in interface java.beans.PropertyEditor
public java.lang.String getAsText()
getAsText
in interface java.beans.PropertyEditor
public void setAsText(java.lang.String text) throws java.lang.IllegalArgumentException
setAsText
in interface java.beans.PropertyEditor
java.lang.IllegalArgumentException
public boolean isPaintable()
isPaintable
in interface java.beans.PropertyEditor
public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box)
paintValue
in interface java.beans.PropertyEditor
public java.lang.String getJavaInitializationString()
getJavaInitializationString
in interface java.beans.PropertyEditor
public java.lang.String[] getTags()
getTags
in interface java.beans.PropertyEditor
public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
addPropertyChangeListener
in interface java.beans.PropertyEditor
public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
removePropertyChangeListener
in interface java.beans.PropertyEditor
public void setProject(Project project)
project
- the project which owns the object containing the propertypublic void setPropertyName(java.lang.String propertyName)
propertyName
- the name of the translateable propertypublic static boolean useResourceBundlePropertyEditor(Project project)
ResourceBundlePropertyEditor
should be
used based on whether the project has auto-synchronization for resource
bundles turned on.project
- public static boolean containsEl(java.lang.String text)
text
- the string to evaluate for expression language