|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectplugins.adufour.vars.gui.VarEditor<V>
plugins.adufour.vars.gui.swing.SwingVarEditor<java.lang.Object>
plugins.adufour.vars.gui.swing.MutableVarEditor
public class MutableVarEditor
Special editor that changes type according to the underlying variable
Field Summary |
---|
Fields inherited from class plugins.adufour.vars.gui.VarEditor |
---|
variable |
Constructor Summary | |
---|---|
MutableVarEditor(VarMutable variable)
|
Method Summary | |
---|---|
protected void |
activateListeners()
Activates listeners on the editor component. |
protected javax.swing.JComponent |
createEditorComponent()
Creates the component to display on the graphical user interface, allowing the user to modify the variable's value via appropriate listeners (listeners should be added or removed via the VarEditor.activateListeners() and VarEditor.deactivateListeners() methods).In order to allow multiple editors to modify the same variable, this method should always return a newly constructed component (by Swing design, a same component can only be used once per interface). Once created, the component is stored in the final VarEditor.editorComponent field to avoid
unnecessary re-creations (e.g. |
protected void |
deactivateListeners()
Deactivates listeners on the editor component. |
void |
dispose()
Dispose of resources (e.g. |
double |
getComponentVerticalResizeFactor()
Indicates whether and how this component should resize vertically if the container panel allows resizing. |
javax.swing.JComponent |
getEditorComponent()
|
java.awt.Dimension |
getPreferredSize()
|
boolean |
isComponentEnabled()
|
boolean |
isComponentOpaque()
|
boolean |
isComponentResizeable()
|
void |
setComponentToolTipText(java.lang.String s)
|
protected void |
setEditorEnabled(boolean enabled)
|
void |
setEnabled(boolean enabled)
Enables (or disables) the graphical component associated with the Var iable object. |
protected void |
updateInterfaceValue()
Updates the graphical interface component to reflect the new value of the underlying variable (accessible via the Var.getValue() method). |
Methods inherited from class plugins.adufour.vars.gui.VarEditor |
---|
getComponentHorizontalResizeFactor, getVariable, isComponentFocusable, isNameVisible, referenceChanged, setComponentFocusable, setComponentResizeable, setNameVisible, valueChanged |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MutableVarEditor(VarMutable variable)
Method Detail |
---|
protected javax.swing.JComponent createEditorComponent()
VarEditor
VarEditor.activateListeners()
and VarEditor.deactivateListeners()
methods).VarEditor.editorComponent
field to avoid
unnecessary re-creations (e.g. during interface refresh). To bypass this optimization and
force the creation of a new component for every interface refresh, consider overriding the
VarEditor.getEditorComponent()
method. VarEditor.VarEditor(Var)
constructor,
therefore all instance fields besides the final VarEditor.variable
field will be
null
until this method returns.
createEditorComponent
in class SwingVarEditor<java.lang.Object>
public void dispose()
VarEditor
dispose
in class VarEditor<java.lang.Object>
public javax.swing.JComponent getEditorComponent()
getEditorComponent
in class SwingVarEditor<java.lang.Object>
VarEditor.createEditorComponent()
method
during object construction. This method can be overridden to return a new component
for each call (note however that this method may be called many times, e.g. during
interface refresh)public java.awt.Dimension getPreferredSize()
getPreferredSize
in class SwingVarEditor<java.lang.Object>
VarEditor.editorComponent
. By default, this
method calls the component's JComponent.getPreferredSize()
method. However,
this method can be overridden to provide a custom dimension, e.g. to fix the size of
the component regardless of its contentpublic boolean isComponentOpaque()
isComponentOpaque
in class SwingVarEditor<java.lang.Object>
public boolean isComponentEnabled()
isComponentEnabled
in class SwingVarEditor<java.lang.Object>
public void setComponentToolTipText(java.lang.String s)
setComponentToolTipText
in class SwingVarEditor<java.lang.Object>
protected void activateListeners()
VarEditor
VarEditor.createEditorComponent()
method, in order to allow the target containers to
optimize the scheduling and load of events to fire, and to ensure proper garbage collection
when the interface is destroyed.
activateListeners
in class VarEditor<java.lang.Object>
protected void deactivateListeners()
VarEditor
VarEditor.createEditorComponent()
method, in order to allow the target containers
to optimize the scheduling and load of events to fire, and to ensure proper garbage
collection when the interface is destroyed.
deactivateListeners
in class VarEditor<java.lang.Object>
public boolean isComponentResizeable()
isComponentResizeable
in class VarEditor<java.lang.Object>
true
if the container panel should allow this component to be resized,
false
otherwisepublic double getComponentVerticalResizeFactor()
VarEditor
getComponentVerticalResizeFactor
in class VarEditor<java.lang.Object>
public void setEnabled(boolean enabled)
VarEditor
Var
iable object.
This method should be used by the enclosing graphical interface instead of the traditional
JComponent.setEnabled(boolean)
, since listeners are automatically activated (or
deactivated) to avoid excessive event firing and ensure proper garbage collection.
setEnabled
in class VarEditor<java.lang.Object>
protected void setEditorEnabled(boolean enabled)
setEditorEnabled
in class SwingVarEditor<java.lang.Object>
protected void updateInterfaceValue()
VarEditor
Var.getValue()
method).
updateInterfaceValue
in class VarEditor<java.lang.Object>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |