public class LiveObject extends OwnedObject implements LiveData
Constructor and Description |
---|
LiveObject() |
Modifier and Type | Method and Description |
---|---|
void |
action(FieldTransfer ft,
Editor ed)
This implements the action() method in FieldListener.
|
void |
action(String fieldName,
Editor ed)
This gets called by action(FieldTransfer ft,Editor ed) and by fieldChanged(FieldTransfer ft,Editor ed)
if the field changed is a menu item.
|
protected UIBuilder |
addMeToPanel(CellPanel cp,
Editor ed,
String baseClassName)
Use this within addToPanel() if you still want it's default of creating
a new UIBuilder and adding an InputStack.
|
static UIBuilder |
addObjectToPanel(CellPanel cp,
Editor ed,
Object objectOrClass,
boolean declaredOnly)
This works on any object.
|
void |
addToPanel(CellPanel cp,
Editor ed,
int options)
Override this to provide the user interface for editing the Object.
|
boolean |
editorCanExit(Editor ed,
int canExitCode)
This is called only if exit(int exitCode) is called on the Editor.
|
static void |
enableEditorScrolling(Editor ed,
boolean enable)
Deprecated.
use Form.enableScrolling(boolean horizontally, boolean vertically) instead.
|
void |
fieldChanged(FieldTransfer ft,
Editor ed)
This implements the fieldChanged() method in FieldListener.
|
void |
fieldChanged(String fieldName,
Editor ed)
This gets called by fieldChanged(FieldTransfer ft,Editor ed).
|
void |
fieldEvent(FieldTransfer ft,
Editor ed,
Object event)
This implements the fieldEvent() method in FieldListener.
|
Editor |
getEditor(int options)
This creates a new Editor Object - you should not override this method,
rather you should override the addToPanel() method to provide a custom
Editor for your LiveData.
|
protected ScrollablePanel |
getEditorScroller(CellPanel cp)
This is called by the default getEditor() should return a ScrollBarPanel for the CellPanel that the editor
is being placed in.
|
IImage |
getIcon()
This returns null by default.
|
String |
getName()
By default this returns the String "unnamed".
|
boolean |
input(String title,
int editorOption)
This opens an Editor for this object.
|
boolean |
isNamed(String name)
By default this does a direct comparison between name and getName().
|
static void |
liveMain(String liveClass,
String[] args) |
static void |
main(String[] args) |
protected Editor |
makeNewEditor(int options)
This shoudl create the new Editor object but not add anything to it.
|
protected boolean |
menuItemSelected(MenuItem mi,
String fieldName,
Editor ed)
This is called during a fieldChanged(FieldTransfer,Editor) call if
the field is a MenuItem.
|
protected CellPanel |
prepareMainPanel(CellPanel cp,
Editor ed) |
Form |
runAsApp()
Get a Form to run this LiveObject as a stand-alone application.
|
protected void |
setToEditor(Editor ed)
This is called when this Object is set as the object the Editor is now editing.
|
protected void |
willBeSetToEditor(Editor ed)
This is called when this Object is going to be set as the object the Editor is now editing.
|
getParentObject, getParentObject, setParentObject
decode, decoded, decoded, decodeFields, decodeFields, encode, encoded, encoded, encodeFields, encodeFields, textDecode, textEncode
_getFieldType, _getSetField, cache, compareTo, copied, copyFrom, equals, getCopy, getDeclaredField, getDeclaredFieldValue, getMyFieldList, getNew
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
compareTo
textDecode, textEncode
public String getName()
public boolean isNamed(String name)
isNamed
in interface Named
name
- a possible name.Named.isNamed(java.lang.String)
protected Editor makeNewEditor(int options)
protected ScrollablePanel getEditorScroller(CellPanel cp)
You may return null from this.
public Editor getEditor(int options)
public static void enableEditorScrolling(Editor ed, boolean enable)
By default, the getEditor() method will place a CellPanel into a ScrollBarPanel and then add it the Editor before calling addToPanel(). However initially this ScrollBarPanel is disabled (i.e. it's "shrinkComponent" variable is true - which results in ScrollBars never appearing). This method is used to enable it.
ed
- The editor created by getEditor().enable
- true to enable scrolling, false to disable it.public void action(String fieldName, Editor ed)
public void fieldChanged(String fieldName, Editor ed)
public void action(FieldTransfer ft, Editor ed)
action
in interface FieldListener
ft
- The FieldTransfer object representing the changed field.ed
- The Editor from which the event came.protected boolean menuItemSelected(MenuItem mi, String fieldName, Editor ed)
mi
- the selected MenuItem.fieldName
- the fieldName associated with the menu.ed
- The Editor from which the event came.public void fieldChanged(FieldTransfer ft, Editor ed)
If the field is of type ewe.ui.MenuItem then the method action(String name,Editor ed) is called with the "name" parameter being set to the "action" member of the selected MenuItem.
Otherwise the fieldChanged(String fieldName,Editor ed) method is called with the fieldName of the FieldTransfer object.
fieldChanged
in interface FieldListener
ft
- The FieldTransfer object representing the changed field.ed
- The Editor from which the event came.public void fieldEvent(FieldTransfer ft, Editor ed, Object event)
fieldEvent
in interface FieldListener
public boolean editorCanExit(Editor ed, int canExitCode)
ed
- the Editor.canExitCode
- the exit code the editor intends to exit with.protected void setToEditor(Editor ed)
ed
- the active Editor. By default this does nothing.protected void willBeSetToEditor(Editor ed)
ed
- the active Editor. By default this does nothing.public void addToPanel(CellPanel cp, Editor ed, int options)
protected UIBuilder addMeToPanel(CellPanel cp, Editor ed, String baseClassName) throws IllegalArgumentException
cp
- The CellPanel passed to addToPanel()ed
- The Editor passed to addToPanel()baseClassName
- The base class being added.IllegalArgumentException
- if the baseClassName is not valid for this object.public IImage getIcon()
public boolean input(String title, int editorOption)
title
- The title for the editor. Can be null to leave as is.editorOption
- Options to pass to getEditor().public static UIBuilder addObjectToPanel(CellPanel cp, Editor ed, Object objectOrClass, boolean declaredOnly) throws IllegalArgumentException
cp
- A CellPanel to add the object fields to.ed
- The Editor to be used to edit the object.objectOrClass
- The object or the Class/Reflect of the object.declaredOnly
- if this is true then only the declared fields will be added
and not the fields of the superclass.IllegalArgumentException
public Form runAsApp()