public class UIBuilder extends Object
Modifier and Type | Field and Description |
---|---|
Object |
editedObject
This is an instance of the object being edited (this is allowed to be null).
|
Editor |
editor
This is the Editor that the UIBuilder is building.
|
static int |
inputStackLength |
Class |
objectClass
This is a ewe.reflect.Reflect object representing the object being edited.
|
protected Vector |
openPanels |
protected Object |
properties |
Constructor and Description |
---|
UIBuilder() |
UIBuilder(Editor ed)
Create a UIBuilder for an Editor.
|
UIBuilder(Editor ed,
Object classOrObject)
Create a UIBuilder for an Editor which will edit a specific type of object.
|
UIBuilder(Editor ed,
Object classOrObject,
CellPanel cp)
Create a UIBuilder for an Editor which will edit a specific type of object, given a CellPanel
that has already been added to the Editor as the starting point.
|
Modifier and Type | Method and Description |
---|---|
Control |
add(Control c) |
Control |
add(String field) |
Control |
add(String field,
Control c) |
Control |
add(String prompt,
String field) |
Control |
add(String prompt,
String field,
Control c) |
Control[] |
addAll(String promptsAndFields)
Add all the specified fields.
|
void |
addChecks(InputStack is,
Editor ed,
String promptsAndFields,
boolean exclusive) |
static void |
addChecks(InputStack is,
Editor ed,
String promptsAndFields,
boolean exclusive,
boolean checkOnLeft) |
Control |
addChoice(String prompt,
String field,
String[] choices) |
Control |
addCombo(String prompt,
String field,
String[] choices) |
CellPanel |
addTo(CellPanel cp)
Set the specified CellPanel as being the current open panel.
|
CellPanel |
close()
Close the current cell panel.
|
CellPanel |
close(boolean endRow)
Close the current cell panel.
|
void |
endRow()
This ends the row in the current open CellPanel.
|
Control |
getControlFor(String prompt,
FieldTransfer ft,
boolean forInputStack,
Object properties,
FieldData fd)
This returns the appropriate Control for a given field.
|
protected Control |
getControlFor(String prompt,
String field,
boolean forInputStack) |
Control |
getControlFor(String prompt,
String field,
boolean forInputStack,
Object properties)
This returns the appropriate Control for a given field.
|
CellPanel |
getOpenPanel()
Return the current open CellPanel.
|
static UIBuilder |
newInputStack(CellPanel cp,
Editor ed,
Object objectOrClass)
A quick way of creating a new UIBuilder and opening an InputStack.
|
static UIBuilder |
newPanel(CellPanel cp,
Editor ed,
Object objectOrClass)
A quick way of creating a new UIBuilder and opening a panel.
|
static UIBuilder |
newStack(CellPanel cp,
Editor ed,
Object objectOrClass)
A quick way of creating a new UIBuilder and opening a stack (NOT an InputStack).
|
CellPanel |
open()
Open a new CellPanel within the current open CellPanel.
|
CellPanel |
open(CellPanel cp,
MultiPanel mp,
String tabName,
String longName)
Open a specified CellPanel within an already added Multipanel.
|
CellPanel |
open(CellPanel cp,
String text)
Set a new CellPanel as the current open panel and add it to the previously open panel.
|
CellPanel |
open(MultiPanel mp,
String tabName,
String longName)
Open a new CellPanel within an already added Multipanel.
|
CellPanel |
open(String text)
Open a new CellPanel within the current open CellPanel.
|
EditorStack |
openInputStack()
Open a new ewe.ui.InputStack within the current open CellPanel.
|
EditorStack |
openInputStack(String text)
Open a new ewe.ui.InputStack within the current open CellPanel.
|
CellPanel |
openStack()
Open a new Stack within the current open CellPanel.
|
CellPanel |
openStack(String text)
Open a new Stack within the current open CellPanel.
|
UIBuilder |
set(Object properties)
This sets the properties of the next control to be added.
|
void |
setEditedObject(Object object)
This is used to set an example of the data being edited.
|
UIBuilder |
setFormats(String formats)
Set the formats for the fields that will be added.
|
void |
setObjectClass(Object objectOrClass) |
public Editor editor
public Class objectClass
public Object editedObject
public static int inputStackLength
protected Vector openPanels
protected Object properties
public UIBuilder()
public UIBuilder(Editor ed)
ed
- The editor being built. It assumes that the object being edited is
the editor itself.public UIBuilder(Editor ed, Object classOrObject)
ed
- The editor being builtclassOrObject
- This is either a java.lang.Class object representing the object to be
edited, or a ewe.reflect.Reflect representing the object to be edited, or an instance of the
object to be edited.public UIBuilder(Editor ed, Object classOrObject, CellPanel cp)
ed
- The editor being builtclassOrObject
- This is either a java.lang.Class object representing the object to be
edited, or a ewe.reflect.Reflect representing the object to be edited, or an instance of the
object to be edited.cp
- A CellPanel that has already been added to the Editor and that will be used as the
start point for adding controls.public UIBuilder setFormats(String formats)
formats
- A format specifier string or null to clear the formats.public void setEditedObject(Object object)
object
- An example of the object to be edited.public void setObjectClass(Object objectOrClass)
public CellPanel getOpenPanel()
public CellPanel close()
public CellPanel close(boolean endRow)
endRow
- If this is true then the previous open panel will have its current row ended.public CellPanel addTo(CellPanel cp)
cp
- The CellPanel to be considered the current open panel.public CellPanel open(CellPanel cp, String text)
cp
- The CellPanel to be added to the current open panel.text
- Optional text for the CellPanel.public CellPanel open(MultiPanel mp, String tabName, String longName)
mp
- The MultiPanel you have added already.tabName
- The tabName for the new panel to add.longName
- The longName for the new panel to add.public CellPanel open(CellPanel cp, MultiPanel mp, String tabName, String longName)
mp
- The MultiPanel you have added already.tabName
- The tabName for the new panel to add.longName
- The longName for the new panel to add.public CellPanel open()
public CellPanel openStack()
public EditorStack openInputStack()
public CellPanel open(String text)
text
- A text that is used as a heading with etched border for the CellPanel.public CellPanel openStack(String text)
text
- A text that is used as a heading with etched border for the Stack.public EditorStack openInputStack(String text)
text
- A text that is used as a heading with etched border for the InputStack.public void endRow()
public Control getControlFor(String prompt, FieldTransfer ft, boolean forInputStack, Object properties, FieldData fd)
prompt
- The prompt for the control (may be null).ft
- The FieldTransfer representing the field for the control.forInputStack
- This should be true if the control is to be added to an InputStack.properties
- This is either a ewe.data.PropertyList object, or a set of properties encoded as
a String separated by '|' characters. (e.g. "rows|10|columns|30").public Control getControlFor(String prompt, String field, boolean forInputStack, Object properties) throws RuntimeException
prompt
- The prompt for the control (may be null).ft
- The FieldTransfer representing the field for the control.forInputStack
- This should be true if the control is to be added to an InputStack.properties
- This is either a ewe.data.PropertyList object, or a set of properties encoded as
a String separated by '|' characters. (e.g. "rows|10|columns|30").RuntimeException
- If no Control could be created.protected Control getControlFor(String prompt, String field, boolean forInputStack) throws RuntimeException
RuntimeException
public UIBuilder set(Object properties)
properties
- This is either a ewe.data.PropertyList object, or a set of properties encoded as
a String separated by '|' characters. (e.g. "rows|10|columns|30").public Control[] addAll(String promptsAndFields)
promptsAndFields
- If this string contains the '|' (pipe) character,
then it is assumed to be a list of the form: "Prompt1|Field1|Prompt2|Field2|..."
If there are no '|' characters then it is assumed to be a comma separated list of
fields in the form "Field1,Field2,..." and the field names will then be converted
to prompt names.public static UIBuilder newInputStack(CellPanel cp, Editor ed, Object objectOrClass)
ed
- The editor being added to.objectOrClass
- The objectOrClass being edited.public static UIBuilder newPanel(CellPanel cp, Editor ed, Object objectOrClass)
ed
- The editor being added to.objectOrClass
- The objectOrClass being edited.public static UIBuilder newStack(CellPanel cp, Editor ed, Object objectOrClass)
ed
- The editor being added to.objectOrClass
- The objectOrClass being edited.public void addChecks(InputStack is, Editor ed, String promptsAndFields, boolean exclusive)
public static void addChecks(InputStack is, Editor ed, String promptsAndFields, boolean exclusive, boolean checkOnLeft)