public interface Formular
Formular
is a form container for FormularComponent
s and
ManyToManyComponent
s.
The Formular
can be used to display a row of a VirtualTable
.
Therefore the Formular
must contain FormularComponent
s that
are mapped to the columns of the VirtualTable
you want to display.
This can be done by the XDEV IDE or manually.
The Formular
also manages n:m-relations. Therefore
ManyToManyComponent
s can be added into this container.
The Formular
provides methods to:
VirtualTable.VirtualTableRow
s like
setModel(xdev.vt.VirtualTable.VirtualTableRow)
VirtualTable.VirtualTableRow
s like insert(boolean)
VirtualTable.VirtualTableRow
s like
update(boolean)
VirtualTable.VirtualTableRow
s like
delete(boolean)
XdevFormular
,
XdevVirtualFormular
,
FormularListener
,
FormularComponent
,
MasterDetailComponent
,
ManyToManyComponent
Modifier and Type | Interface and Description |
---|---|
static class |
Formular.WorkingState
Current working state of a
Formular . |
Modifier and Type | Field and Description |
---|---|
static String |
CLIENT_PROPERTY_KEY
Key used to store form references in client properties
|
static String |
SAVE_STATE_AFTER_MODEL_UPDATE_PROPERTY
Identifies a change in the saveStateAfterModelUpdate property.
|
Modifier and Type | Method and Description |
---|---|
void |
addFormularListener(FormularListener l)
Registers a
FormularListener so that it will receive form events. |
Condition |
createCondition(String connector)
Alias for
createCondition(connector,null) . |
Condition |
createCondition(String connector,
Collection paramCollection)
Creates a
Condition depending on the input component's values and
their conditional settings. |
Condition |
createCondition(String connector,
Query query)
Creates a
Condition depending on the input component's values and
their conditional settings. |
QueryInfo |
createQuery(String connector)
Creates a query (SELECT * FROM ..) of the connected
VirtualTable
with a WHERE condition created by the values of the
FormularComponent s of this formular. |
void |
delete()
Alias for
delete(true). |
void |
delete(boolean synchronizeDB)
|
Iterable<FormularComponent> |
formComponents() |
Object |
getClientProperty(Object key)
Returns the value of the property with the specified key.
|
Map<String,Object> |
getData(boolean withNulls)
|
FormularListener[] |
getFormularListeners() |
Object |
getHiddenField(String name)
Returns the value of the hidden field with the specified name.
|
Iterable<String> |
getHiddenFieldNames()
Returns all hidden field names of this form.
|
boolean |
getSaveStateAfterModelUpdate()
Determines if the formular saves its state after an update of the model.
|
String |
getURLAdd()
Returns a parameter list consisting of key value pairs containing all
components of this
Formular and their values. |
VirtualTable |
getVirtualTable()
Returns the assigned
VirtualTable of this Formular . |
VirtualTable.VirtualTableRow |
getVirtualTableRow()
Returns the current assigned
VirtualTable.VirtualTableRow . |
Formular.WorkingState |
getWorkingState()
Returns the working state of the form.
|
boolean |
hasStateChanged()
Checks if one of the
FormularComponent 's or
ManyToManyComponent 's state since the last call of
saveState() has changed. |
void |
insert()
Alias for
insert(true). |
void |
insert(boolean synchronizeDB)
Propagates the values of this
Formular / the mapped components in
the Formular to the set VirtualTable as new row. |
void |
insertRowInVT(VirtualTable vt,
boolean synchronizeDB)
Propagates the values of this
Formular / the mapped components in
the Formular to the set VirtualTable as new row. |
Iterable<ManyToManyComponent> |
manyToManyComponents() |
void |
putClientProperty(Object key,
Object value)
Adds an arbitrary key/value "client property" to this component.
|
void |
putHiddenField(String name,
Object value)
Adds an arbitrary name/value "hidden field" to this form.
|
void |
removeFormularListener(FormularListener l)
Removes the listener from the listener list of this form.
|
void |
reset()
|
void |
reset(VirtualTable vt)
Resets this
Formular / the mapped components in the
Formular to the default values of the specified
VirtualTable vt . |
void |
restoreState()
|
void |
save()
Alias for
save(true). |
void |
save(boolean synchronizeDB)
Propagates the values of this
Formular / the mapped components in
the Formular to the set VirtualTable as new row if the
row is new to the VirtualTable , otherwise an update is performed. |
void |
saveState()
Saves the state of all
FormularComponent s in this formular. |
void |
search(String connector,
VirtualTableOwner target)
Updates the model of the
VirtualTableOwner target. |
void |
setModel(int row,
VirtualTable vt)
Fills this
Formular / the mapped components in the
Formular with the values provided by the specified
row in the VirtualTable vt . |
void |
setModel(VirtualTable.VirtualTableRow virtualTableRow)
|
void |
setModel(VirtualTable vt)
Resets this
Formular / the mapped components in the
Formular to the default values of the specified
VirtualTable vt . |
void |
setSaveStateAfterModelUpdate(boolean saveStateAfterModelUpdate)
Sets if the formular should save its state after an update of the model.
|
void |
submit(String url,
String target)
Submits the contents of this
Formular to the given
url . |
void |
update()
Alias for
update(true) . |
void |
update(boolean synchronizeDB)
Propagates the values of this
Formular / the mapped components in
the Formular to the set VirtualTable / the set
VirtualTable.VirtualTableRow . |
void |
updateRowsInVT(VirtualTable vt,
KeyValues keyValues,
boolean synchronizeDB)
Propagates the values of this
Formular / the mapped components in
the Formular to the specified VirtualTable
vt , to the rows which matches the given KeyValues
pkv . |
Validation |
validateFormularComponents()
Validates all
FormularComponent s of this formular. |
Validation |
validateFormularComponents(Validation validation)
Validates all
FormularComponent s of this formular depending on an
given validation object. |
boolean |
verifyFormularComponents()
Returns
ture if all values of all FormularComponent s
of this Formular could be verified, false otherwise. |
static final String CLIENT_PROPERTY_KEY
static final String SAVE_STATE_AFTER_MODEL_UPDATE_PROPERTY
Formular.WorkingState getWorkingState()
Iterable<FormularComponent> formComponents()
Iterable<ManyToManyComponent> manyToManyComponents()
void addFormularListener(FormularListener l)
FormularListener
so that it will receive form events.l
- the listener to registervoid removeFormularListener(FormularListener l)
l
- the listener to removeFormularListener[] getFormularListeners()
void setSaveStateAfterModelUpdate(boolean saveStateAfterModelUpdate)
saveStateAfterModelUpdate
- true
if the state should be saved,
false
otherwisesetModel(VirtualTable.VirtualTableRow)
,
saveState()
boolean getSaveStateAfterModelUpdate()
true
if the state is saved, false
otherwisesetModel(VirtualTable.VirtualTableRow)
,
saveState()
void saveState()
FormularComponent
s in this formular.reset()
,
FormularComponent.saveState()
void restoreState()
Formular
/ the mapped components in the
Formular
to the default values of the components.
This method is a synonym for reset()
saveState()
,
FormularComponent.restoreState()
void reset()
Formular
/ the mapped components in the
Formular
to the default values of the components.
This method is a synonym for restoreState()
saveState()
,
FormularComponent.restoreState()
boolean hasStateChanged()
FormularComponent
's or
ManyToManyComponent
's state since the last call of
saveState()
has changed.true
if one component's state has changed,
false
otherwiseFormularComponent.hasStateChanged()
,
ManyToManyComponent.hasStateChanged()
void setModel(VirtualTable vt)
Formular
/ the mapped components in the
Formular
to the default values of the specified
VirtualTable
vt
.vt
- VirtualTable
to reset on.void reset(VirtualTable vt)
Formular
/ the mapped components in the
Formular
to the default values of the specified
VirtualTable
vt
.
Alias for setModel(vt.createRow())
vt
- VirtualTable
to reset on.void setModel(int row, VirtualTable vt)
Formular
/ the mapped components in the
Formular
with the values provided by the specified
row
in the VirtualTable
vt
.row
- the row index of the VirtualTable
vt
- VirtualTable
to take the data from.VirtualTable.VirtualTableRow
,
setModel(VirtualTable.VirtualTableRow)
void setModel(VirtualTable.VirtualTableRow virtualTableRow)
Formular
/ the mapped components in the
Formular
with the values provided by the specified
row
.virtualTableRow
- VirtualTable.VirtualTableRow
to take the data from.VirtualTable.VirtualTableRow
,
setModel(int, VirtualTable)
void putHiddenField(String name, Object value)
If value is null
this method will remove the field.
name
- the new hidden field namevalue
- the new hidden field value; if null
this method
will remove the fieldgetHiddenField(String)
,
getHiddenFieldNames()
Object getHiddenField(String name)
putHiddenField
will return a non-
null
value.name
- the being queriednull
putHiddenField(String, Object)
,
getHiddenFieldNames()
Iterable<String> getHiddenFieldNames()
putHiddenField(String, Object)
,
getHiddenField(String)
VirtualTable.VirtualTableRow getVirtualTableRow()
VirtualTable.VirtualTableRow
.VirtualTable.VirtualTableRow
setModel(VirtualTable.VirtualTableRow)
VirtualTable getVirtualTable()
VirtualTable
of this Formular
.VirtualTable
void save() throws VirtualTableException, DBException
Alias for save(true).
VirtualTableException
- if the new row can't be set to the VirtualTable
.DBException
- if the new row can't be propagated to the underling database.save(boolean)
void save(boolean synchronizeDB) throws VirtualTableException, DBException
Propagates the values of this Formular
/ the mapped components in
the Formular
to the set VirtualTable
as new row if the
row is new to the VirtualTable
, otherwise an update is performed.
synchronizeDB
- true
if the new row should be propagated to the
underling database as well; otherwise false
.VirtualTableException
- if the new row can't be set to the VirtualTable
.DBException
- if the new row can't be propagated to the underling database.void update() throws VirtualTableException, DBException
update(true)
.VirtualTableException
- if the values can't be set to the VirtualTable
.DBException
- if the values can't be propagated to the underling database.update(boolean)
void update(boolean synchronizeDB) throws VirtualTableException, DBException
Propagates the values of this Formular
/ the mapped components in
the Formular
to the set VirtualTable
/ the set
VirtualTable.VirtualTableRow
.
Warning: In order to be able to update a row, you need
to set a VirtualTable.VirtualTableRow
for this Formular
. You can do
this by calling setModel(int, VirtualTable)
or
setModel(VirtualTable.VirtualTableRow)
.
synchronizeDB
- true
if the changes should be propagated to the
underling database as well; otherwise false
.VirtualTableException
- if the values can't be set to the VirtualTable
.DBException
- if the values can't be propagated to the underling database.setModel(VirtualTable.VirtualTableRow)
void updateRowsInVT(VirtualTable vt, KeyValues keyValues, boolean synchronizeDB) throws VirtualTableException, DBException
Propagates the values of this Formular
/ the mapped components in
the Formular
to the specified VirtualTable
vt
, to the rows which matches the given KeyValues
pkv
.
vt
- VirtualTable
to propagate the changes tokeyValues
- The values which identify the rows to updatesynchronizeDB
- true
if the changes should be propagated to the
underling database as well; otherwise false
.VirtualTableException
- if the values can't be set to the VirtualTable
.DBException
- if the values can't be propagated to the underling database.void insertRowInVT(VirtualTable vt, boolean synchronizeDB) throws VirtualTableException, DBException
Propagates the values of this Formular
/ the mapped components in
the Formular
to the set VirtualTable
as new row.
vt
- VirtualTable
to propagate the new row tosynchronizeDB
- true
if the changes should be propagated to the
underling database as well; otherwise false
.VirtualTableException
- if the values can't be set to the VirtualTable
.DBException
- if the values can't be propagated to the underling database.void insert() throws VirtualTableException, DBException
Alias for insert(true).
VirtualTableException
- if the new row can't be set to VirtualTable
.DBException
- if the new row can't be propagated to underling database.insert(boolean)
void insert(boolean synchronizeDB) throws VirtualTableException, DBException
Propagates the values of this Formular
/ the mapped components in
the Formular
to the set VirtualTable
as new row.
synchronizeDB
- true
if the new row should be propagated to the
underling database as well; otherwise false
.VirtualTableException
- if the new row can't be set to VirtualTable
.DBException
- if the new row can't be propagated to underling database.void delete() throws VirtualTableException, DBException
Alias for delete(true).
VirtualTableException
- if row can't be deleted from VirtualTable
.DBException
- if the row can't be deleted from the underling database.delete(boolean)
void delete(boolean synchronizeDB) throws VirtualTableException, DBException
Deletes the VirtualTable.VirtualTableRow
represented by this Formular
from the set VirtualTable
.
Warning: In order to be able to delete a row, you need
to set a VirtualTable.VirtualTableRow
for this Formular
. You can do
this by calling setModel(VirtualTable.VirtualTableRow)
or
setModel(int, VirtualTable)
.
synchronizeDB
- true
if the row should also be deleted from the
underling database as well; otherwise false
.VirtualTableException
- if row can't be deleted from VirtualTable
.DBException
- if the row can't be deleted from the underling database.boolean verifyFormularComponents()
ture
if all values of all FormularComponent
s
of this Formular
could be verified, false
otherwise.
This method shows a message box, if a validation fails.
This is a alternative method forvalidateFormularComponents()
,
but this method returns a boolean depending on the validation's result,
not the result itself.true
if all values of all FormularComponent
s
of this Formular
could be verified, false
otherwise.Validation validateFormularComponents()
FormularComponent
s of this formular.
Example:
if(formular.validateFormularComponents().hasError()) { // show message } else { formular.save(); }
Validation.hasError()
Validation validateFormularComponents(Validation validation)
FormularComponent
s of this formular depending on an
given validation object.validation
- Validation.hasError()
void submit(String url, String target) throws IOException
Formular
to the given
url
.url
- url to send the contents totarget
- HTML target (_blank
, _parent
etc.)IOException
- if the submit failsString getURLAdd()
Formular
and their values.
e.g. ?txtFirstname=John&txtLastname=DoeFormular
and their values.QueryInfo createQuery(String connector) throws IllegalStateException, IllegalArgumentException
VirtualTable
with a WHERE
condition created by the values of the
FormularComponent
s of this formular.connector
- "AND" or "OR"VirtualTable
with
a WHERE
condition created by the values of the
FormularComponent
s of this formular.IllegalStateException
- if no data binding is availableIllegalArgumentException
- if connector != "AND" resp. "OR"createCondition(String, Collection)
,
search(String, VirtualTableOwner)
Condition createCondition(String connector) throws IllegalArgumentException
Alias for createCondition(connector,null)
.
connector
- "AND" or "OR"WHERE
condition depending on the input component's
values, or null
if no values are availableIllegalArgumentException
- if connector != "AND" resp. "OR"createCondition(String, Query)
,
createCondition(String, Collection)
,
createQuery(String)
Condition createCondition(String connector, Query query) throws IllegalArgumentException
Condition
depending on the input component's values and
their conditional settings.connector
- "AND" or "OR"query
- The Query
to create this WHERE
condition for
(optional)WHERE
condition depending on the input component's
values, or null
if no values are availableIllegalArgumentException
- if connector != "AND" resp. "OR"createCondition(String, Collection)
,
createQuery(String)
Condition createCondition(String connector, Collection paramCollection) throws IllegalArgumentException
Condition
depending on the input component's values and
their conditional settings.connector
- "AND" or "OR"paramCollection
- The Collection
to add the WHERE
condition's
parameter to (optional)WHERE
condition depending on the input component's
values, or null
if no values are availableIllegalArgumentException
- if connector != "AND" resp. "OR"createCondition(String, Query)
,
createQuery(String)
void search(String connector, VirtualTableOwner target) throws IllegalArgumentException
VirtualTableOwner
target.
First a Condition
depending on the input component's values and
their conditional settings is created and then handed over to
VirtualTableOwner.updateModel(Condition, Object...)
of
target
.
connector
- "AND" or "OR"target
- the component to updateIllegalArgumentException
- if connector != "AND" resp. "OR"createCondition(String)
,
createCondition(String, Collection)
,
createCondition(String, Query)
,
createQuery(String)
void putClientProperty(Object key, Object value)
The get/putClientProperty
methods provide access to a small
per-instance hashtable. Callers can use get/putClientProperty to annotate
components that were created by another module. For example, a layout
manager might store per child constraints this way. For example:
componentA.putClientProperty("to the left of",componentB);If value is
null
this method will remove the property.
Changes to client properties are reported with
PropertyChange
events. The name of the property (for the
sake of PropertyChange events) is key.toString()
.
The clientProperty
dictionary is not intended to support
large scale extensions to form nor should be it considered an alternative
to subclassing when designing a new component.
key
- the new client property keyvalue
- the new client property value; if null
this
method will remove the propertygetClientProperty(java.lang.Object)
Object getClientProperty(Object key)
putClientProperty
will return a non-
null
value.key
- the being queriednull
putClientProperty(java.lang.Object, java.lang.Object)
Copyright © 2003–2020 XDEV Software. All rights reserved.