|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectARoad0.Gui1.GraphicViewPropertyEditor
public class GraphicViewPropertyEditor
This class is responsible for displaying, without editing, the GraphicView and the text properties of a ViewInBase, by the mean of a simple panel without buttons. The getCustomEditor() method returns the final result. This class is returned by Gui1.ActionOpenAllFullViews or ActionOpenAllNoThanViews, which generates the descriptors, and it is so independant to the gBase package, on the contrary of other CommonPropertyEditor subclasses. getSource() returns null. It is used by Gui1.BeamerManager.addPropertyEditor() when BeamerManager is called by ActionOpenAllFullViews or ActionOpenAllNoThanViews.
This class displays two properties derived from the view, and their types are ARoad0.Gui2.GraphicView and javax.swing.JTextPane. This class is a PropertyEditor that gets the property and does NOT listen the changes. It is a custom editor that provides getCustomEditor(), and specifies the prefered size of the panel to be displayed.
When the user updatings make some changes in the view, there are listen by a GraphicViewBaseListenerImpl instance dedicated to the view, then this instance updates directly the GraphicView and the JTextPane in this property editor by the way of propertyChange(). The GUI displays always the right data.
As a PropertyEditor, it must be able to register PropertyChangeListeners but this is not a feature to use so far. Use only registration on GraphicViewBaseListenerImpl, that handle PropertyChangeListeners.
An instance is constructed by the factory method valueOf(), and it is possible to get a reusable empty instance. java.beans.PropertyEditorManager is not used.
For thread management, this class runs a worker thread in propertyChange(). It calls GraphicView.resetGraphicView() or resetRights(), then call GraphicView.setWhyText() in the Event Dispatch Thread. propertyChange() processes the calls in their calling order, as asynchronous tasks in the worker thread.
Field Summary | |
---|---|
protected java.lang.String |
displayName_
It is not the display name of the property, given by the property descriptor. |
static GraphicViewPropertyEditor |
EMPTY_INSTANCE
A reusable empty instance for initialization, to avoid the use of 'new' for temporary values. |
protected static java.lang.Object |
EMPTY_OBJECT
An empty object for initialization |
protected static int |
INITIAL_CAPACITY
|
protected java.util.ArrayList |
listeners_
The listeners for property updates |
protected GraphicView |
property_
The property is a GraphicView there. |
protected java.beans.PropertyDescriptor |
propertyDescriptor_
The property descriptor |
protected java.lang.Class |
propertyType_
The property type. |
protected BaseObject |
source_
The instance owning the property. |
protected javax.swing.JTextPane |
subproperty_
The subproperty is a text from the GraphicView. |
protected java.lang.Class |
subpropertyType_
The subproperty type. |
protected boolean |
withSeeWhy_
True when the 'See Why' text is displayed; then, subproperty_ is not null. |
Constructor Summary | |
---|---|
GraphicViewPropertyEditor()
Constructor FOR USE ONLY through the valueOf() method, EMPTY_INSTANCE and the subclasses. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent _evt)
NOOP |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener _listener)
Register a listener for the PropertyChange event - NO USE SO FAR. |
void |
finalizeForProcess()
Finalizes the instance; the call is reserved to BeamerManager. |
private void |
firePropertyChange()
Reports that we have been modified to any interested listeners - NOT USED SO FAR. |
java.lang.String |
getAsText()
Gets the property value as a string suitable for presentation to a human to edit. |
java.awt.Component |
getCustomEditor()
Returns a full custom Component that displays the GraphicView and the associated 'See why' text. |
java.lang.String |
getDisplayName()
Gets the value of the display property name (not the true name, given by the property descriptor). |
java.lang.String |
getJavaInitializationString()
This method is intended for use when generating Java code to set the value of the property. |
java.awt.Dimension |
getPreferedSizeForEditing()
Get the prefered size for the rectangle into which the value is displayed, in the component returned by getCustomEditor(). |
java.beans.PropertyDescriptor |
getPropertyDescriptor()
Gets the descriptor of the property. |
java.lang.Class |
getPropertyType()
Gets the value of the property type, that is the Class of the returned object in getValue(): GraphicView, and not ViewInBase. |
BaseObject |
getSource()
Gets the value of the property source, which is null there. |
java.lang.String[] |
getTags()
When the value is a boolean, the tages are yes/no, excepted if a couple of tag is set in the property descriptor with the key 'tags'. |
java.lang.Object |
getValue()
Get the value of the GraphicView. |
java.lang.reflect.Method |
getWriteMethod()
Gets the method on the source for updates. |
boolean |
isPaintable()
Determines whether the class will honor the paintValue method. |
void |
paintValue(java.awt.Graphics gfx,
java.awt.Rectangle box)
Paint a representation of the value into a given area of screen real estate. |
void |
propertyChange(java.beans.PropertyChangeEvent _evt)
Manages the event fired by the GraphicViewBaseListener when the GraphicView has to be changed (then, _evt.getNewValue() is not null) or to be reset only for updating the rights. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener _listener)
Remove a listener for the PropertyChange event - NO USE SO FAR. |
void |
setAsText(java.lang.String _text)
Raise java.lang.IllegalArgumentException since this kind of property can't be expressed as text. |
void |
setValue(java.lang.Object _value)
NOOP - Set (or change) the object that is to be edited. |
boolean |
supportsCustomEditor()
Determines whether the propertyEditor can provide a custom editor. |
java.lang.String |
toString()
Get the values of variables for the instance. |
static CommonPropertyEditor |
valueOf(BaseObject _source,
java.beans.PropertyDescriptor _propertyDescriptor)
Factory method to use when a CommonPropertyEditor is delegating to us. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final int INITIAL_CAPACITY
protected java.lang.String displayName_
protected BaseObject source_
protected java.beans.PropertyDescriptor propertyDescriptor_
protected GraphicView property_
protected java.lang.Class propertyType_
protected javax.swing.JTextPane subproperty_
protected java.lang.Class subpropertyType_
protected boolean withSeeWhy_
protected java.util.ArrayList listeners_
protected static final java.lang.Object EMPTY_OBJECT
public static final GraphicViewPropertyEditor EMPTY_INSTANCE
Constructor Detail |
---|
GraphicViewPropertyEditor()
Method Detail |
---|
public static CommonPropertyEditor valueOf(BaseObject _source, java.beans.PropertyDescriptor _propertyDescriptor) throws java.lang.NullPointerException, BaseError, ProcessError
_source
- the ViewInBase - no use there_propertyDescriptor
- for the property, where getDisplayName() gives
the ViewInBase name.toString()
java.lang.NullPointerException
- if _source or _propertyDescriptor is null
BaseError
- if the display name or the graphic view are not found
ProcessError
- if BeanInfo and PropertyDecriptor calls failpublic void setValue(java.lang.Object _value)
setValue
in interface java.beans.PropertyEditor
_value
- is the new target object to be edited. This
object is not modified by the PropertyEditor. Never null.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
_text
- is the string to be parsed.
in
- all cases.
java.lang.IllegalArgumentException
public BaseObject getSource()
public java.lang.String getDisplayName()
getDisplayName
in interface CommonPropertyEditor
public java.lang.Class getPropertyType()
getPropertyType
in interface CommonPropertyEditor
public java.beans.PropertyDescriptor getPropertyDescriptor()
getPropertyDescriptor
in interface CommonPropertyEditor
public java.lang.reflect.Method getWriteMethod()
getWriteMethod
in interface CommonPropertyEditor
public java.lang.String[] getTags()
getTags
in interface java.beans.PropertyEditor
public boolean supportsCustomEditor()
supportsCustomEditor
in interface java.beans.PropertyEditor
public java.lang.String getJavaInitializationString()
Example results are "2", "new Color(127,127,34)", "Color.orange", etc.
getJavaInitializationString
in interface java.beans.PropertyEditor
public java.awt.Dimension getPreferedSizeForEditing()
getPreferedSizeForEditing
in interface CommonPropertyEditor
public boolean isPaintable()
isPaintable
in interface java.beans.PropertyEditor
public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box)
If the PropertyEditor doesn't honor paint requests (see isPaintable) this method should be a silent noop.
paintValue
in interface java.beans.PropertyEditor
gfx
- Graphics object to paint into.box
- Rectangle within graphics object into which we should paint.public void addPropertyChangeListener(java.beans.PropertyChangeListener _listener)
addPropertyChangeListener
in interface java.beans.PropertyEditor
_listener
- An object to be invoked when a PropertyChange
event is fired.public void removePropertyChangeListener(java.beans.PropertyChangeListener _listener)
removePropertyChangeListener
in interface java.beans.PropertyEditor
_listener
- The PropertyChange listener to be removed.public void propertyChange(java.beans.PropertyChangeEvent _evt)
propertyChange
in interface java.beans.PropertyChangeListener
_evt
- the eventpublic java.lang.String toString()
toString
in class java.lang.Object
public void finalizeForProcess()
finalizeForProcess
in interface CommonPropertyEditor
public void actionPerformed(java.awt.event.ActionEvent _evt)
actionPerformed
in interface java.awt.event.ActionListener
_evt
- is the event fired by a JComponent displayed by getCustomEditor()public java.awt.Component getCustomEditor()
getCustomEditor
in interface CommonPropertyEditor
getCustomEditor
in interface java.beans.PropertyEditor
PropertyEditor.getCustomEditor()
private void firePropertyChange()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |