Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

oracle.ide.resourcebundle
Class ResourceBundlePropertyEditor

java.lang.Object
  extended by oracle.ide.resourcebundle.ResourceBundlePropertyEditor
All Implemented Interfaces:
java.beans.PropertyEditor

public final class ResourceBundlePropertyEditor
extends java.lang.Object
implements java.beans.PropertyEditor

The 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 Summary
ResourceBundlePropertyEditor()
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceBundlePropertyEditor

public ResourceBundlePropertyEditor()
Method Detail

getCustomEditor

public java.awt.Component getCustomEditor()
Specified by:
getCustomEditor in interface java.beans.PropertyEditor

supportsCustomEditor

public boolean supportsCustomEditor()
Specified by:
supportsCustomEditor in interface java.beans.PropertyEditor

setValue

public void setValue(java.lang.Object value)
Specified by:
setValue in interface java.beans.PropertyEditor

getValue

public java.lang.Object getValue()
Gets the value of the property.

Specified by:
getValue in interface java.beans.PropertyEditor
Returns:
The value of the property.

getAsText

public java.lang.String getAsText()
Specified by:
getAsText in interface java.beans.PropertyEditor

setAsText

public void setAsText(java.lang.String text)
               throws java.lang.IllegalArgumentException
Specified by:
setAsText in interface java.beans.PropertyEditor
Throws:
java.lang.IllegalArgumentException

isPaintable

public boolean isPaintable()
Specified by:
isPaintable in interface java.beans.PropertyEditor

paintValue

public void paintValue(java.awt.Graphics gfx,
                       java.awt.Rectangle box)
Specified by:
paintValue in interface java.beans.PropertyEditor

getJavaInitializationString

public java.lang.String getJavaInitializationString()
Specified by:
getJavaInitializationString in interface java.beans.PropertyEditor

getTags

public java.lang.String[] getTags()
Specified by:
getTags in interface java.beans.PropertyEditor

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Specified by:
addPropertyChangeListener in interface java.beans.PropertyEditor

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Specified by:
removePropertyChangeListener in interface java.beans.PropertyEditor

setProject

public void setProject(Project project)
Sets the project for the property editor. The project is necessary so the property editor can determine what resource bundles are available and where to create new resource bundle keys when necessary.

Parameters:
project - the project which owns the object containing the property

setPropertyName

public void setPropertyName(java.lang.String propertyName)
Deprecated. 

Sets the property name that will be used when notifying property change listeners. The property model needs to ensure this is called so the property editor knows whether the property is "title", "label", "tooltipText", or whatever translateable property is being dealt with.

Parameters:
propertyName - the name of the translateable property

useResourceBundlePropertyEditor

public 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.

Parameters:
project -
Returns:
true if the resource bundle property editor should be used; false otherwise

containsEl

public static boolean containsEl(java.lang.String text)
Determines whether the supplied string contains expression language. For purposes of this method if the string contains "#{" and ends with "}" it will be deemed to contain expression language.

Parameters:
text - the string to evaluate for expression language
Returns:
true if the string contains expression language; false otherwise

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

Copyright © 1997, 2011, Oracle. All rights reserved.