|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthibergui.Component<T>
hibergui.Form<T>
T - The type of the business object edited by the form.public abstract class Form<T>
Common superclass of HiberGUI forms. Using forms business logic entities of type T can be created, deleted, updated or searched for. The individual properties of the entities are handled by edits. Forms have three parts. Edits are on the top of the form, they are created by the createFields method. Below the edits there are four buttons: create, delete, clear and search. The third part of forms is the selector table. It is visible only in search mode. It can be used for selecting one or more business entity.
| Field Summary | |
|---|---|
private org.eclipse.swt.widgets.Button |
btnClear
|
private org.eclipse.swt.widgets.Button |
btnCreate
|
private org.eclipse.swt.widgets.Button |
btnDelete
|
private org.eclipse.swt.widgets.Button |
btnSearchMode
|
private java.util.Map<org.eclipse.swt.widgets.TableColumn,java.lang.String> |
columnProperties
|
private boolean |
dirty
|
protected java.util.List<Edit<?>> |
fieldEditors
|
private boolean |
hasChanged
|
private ModificationListener |
lsnDirty
|
private org.eclipse.jface.viewers.ISelectionChangedListener |
lsnSelection
|
private ChangeListener |
lsnUpdate
|
private java.lang.String |
message
|
private java.util.List<MessageListener> |
messageListeners
|
private int |
messageType
|
protected java.lang.Class<T> |
persistentClass
The class representing the type parameter of the form. |
private boolean |
searchMode
|
private org.eclipse.jface.viewers.IStructuredSelection |
selection
|
private org.eclipse.swt.widgets.Table |
tbl
|
private org.eclipse.jface.viewers.TableViewer |
tbvSelector
|
private java.lang.String |
title
|
private T |
value
The actual business object selected by the form. |
| Fields inherited from class hibergui.Component |
|---|
lsn_WIDGET_FOCUS, lsn_WIDGET_KEY, style |
| Constructor Summary | |
|---|---|
Form(org.eclipse.swt.widgets.Composite cptParent,
int style)
Constructs a form. |
|
| Method Summary | ||
|---|---|---|
private void |
addChangeListeners(ChangeListener listener)
|
|
protected void |
addColumn(int mode,
java.lang.String prop,
java.lang.String name,
int width)
Helper method for customizing the columns of the selector table. |
|
(package private) void |
addEdit(Edit<?> edit)
|
|
void |
addMessageListener(MessageListener listener)
|
|
private void |
addModificationListeners(ModificationListener listener)
|
|
void |
apply()
Applies the recent changes and refreshes the form. |
|
private void |
clear()
Clears the edits of the form and clears the selection from the selector table when search mode is on. |
|
protected abstract void |
commit()
Commits the recent changes on the storage. |
|
protected void |
create()
Creates a business entity by extracting the values typed into the form and then saves the entity to the storage. |
|
protected org.eclipse.swt.widgets.Composite |
createButtons(org.eclipse.swt.widgets.Composite cptParent)
Creates the composite containing the control buttons of the form. |
|
protected abstract void |
createColumnsForTable()
Creates the columns of the table. |
|
protected org.eclipse.swt.widgets.Composite |
createContents(org.eclipse.swt.widgets.Composite cptParent)
Creates the GUI contents of the component. |
|
protected abstract org.eclipse.swt.widgets.Composite |
createFields(org.eclipse.swt.widgets.Composite cptParent)
Creates the composite containing the edits of the form. |
|
private org.eclipse.jface.viewers.TableViewer |
createSelector(org.eclipse.swt.widgets.Table tbl)
|
|
protected org.eclipse.swt.widgets.Table |
createTable(org.eclipse.swt.widgets.Composite cptParent)
Creates the table using which some business entities found in search mode can be selected. |
|
protected void |
delete()
Deletes the selected business entities from the storage and removes them from the selector table as well. |
|
protected abstract void |
delete(T entity)
Deletes the business entity from the storage. |
|
protected void |
dispose()
Disposes the edits of the form. |
|
protected T |
extract()
Creates a new business entity and assigns the value filled into the edits to the corresponding properties of the entity. |
|
void |
extract(T t)
Extracts the values of the edits of the form and assigns them to the corresponding properties of the entity. |
|
|
fill(java.lang.String property,
P value)
Fills some property of the entity into the corresponding edit of the form. |
|
void |
fill(T t)
Fills each property of the entity into the corresponding edits of the form. |
|
protected abstract java.util.List<T> |
findSuch()
Finds business entities similar to the entity extracted from the form. |
|
private void |
fireMessageChanged(java.lang.String message,
int type)
|
|
private void |
fireTitleChanged(java.lang.String title)
|
|
T |
get()
If the the form is in search mode and one entity is selected then returns that entity. |
|
protected java.lang.String |
getColumnText(T t,
int i)
|
|
T[] |
getSelection()
Returns an array of business entities selected in the selector table. |
|
protected int |
getSortDirection()
|
|
protected java.lang.String |
getSortProperty()
|
|
boolean |
hasChanged()
|
|
private void |
hideSelector()
|
|
protected void |
init()
Initializes the component. |
|
boolean |
isDirty()
|
|
boolean |
isSearchMode()
Returns whether the search mode is on. |
|
protected void |
modify()
Modifies the selected or actual entity of the form. |
|
void |
refresh()
Refreshes the form. |
|
void |
refreshSelector()
Refreshes the selector table. |
|
private void |
removeChangeListeners(ChangeListener listener)
|
|
void |
removeMessageListener(MessageListener listener)
|
|
private void |
removeModificationListeners(ModificationListener listener)
|
|
void |
revoke()
Revokes the recent changes and refreshes the form. |
|
protected abstract void |
rollback()
Rolls back the recent changes on the storage. |
|
protected abstract void |
save(T entity)
Saves the business entity onto the storage. |
|
void |
set(T newValue)
Sets the actual entity of the form. |
|
boolean |
setFocus()
|
|
void |
setMessage(java.lang.String message)
|
|
protected void |
setMessage(java.lang.String message,
int type)
|
|
void |
setSearchMode(boolean b)
Switches search mode on or off. |
|
private void |
setTitle(java.lang.String title)
|
|
protected void |
setWindowTitle(java.lang.String windowTitle)
Sets the title of the window containing the form. |
|
private void |
showSelector()
|
|
protected abstract void |
update(T entity)
Updates the business entity on the storage. |
|
void |
verify()
|
|
| Methods inherited from class hibergui.Component |
|---|
addChangeListener, addControlListener, addFocusListener, addKeyListener, fireChange, fireKeyPressed, fireKeyReleased, getControl, removeChangeListener, removeControlListener, removeFocusListener, removeKeyListener, setLayoutData |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private T value
private org.eclipse.jface.viewers.IStructuredSelection selection
protected final java.lang.Class<T> persistentClass
private java.lang.String title
private java.lang.String message
private int messageType
private org.eclipse.swt.widgets.Button btnCreate
private org.eclipse.swt.widgets.Button btnDelete
private org.eclipse.swt.widgets.Button btnSearchMode
private org.eclipse.swt.widgets.Button btnClear
private org.eclipse.swt.widgets.Table tbl
private java.util.Map<org.eclipse.swt.widgets.TableColumn,java.lang.String> columnProperties
private org.eclipse.jface.viewers.TableViewer tbvSelector
protected java.util.List<Edit<?>> fieldEditors
private boolean dirty
private boolean hasChanged
private boolean searchMode
private final ChangeListener lsnUpdate
private final ModificationListener lsnDirty
private org.eclipse.jface.viewers.ISelectionChangedListener lsnSelection
private java.util.List<MessageListener> messageListeners
| Constructor Detail |
|---|
public Form(org.eclipse.swt.widgets.Composite cptParent,
int style)
cptParent - The composite which the form will be placed on. The
parent of the control of the form.style - The style of the form. It is a combination of constants
defined in hibergui.HiberGUI.| Method Detail |
|---|
protected void init()
Component
init in class Component<T>protected void dispose()
dispose in class Component<T>Component.dispose()void addEdit(Edit<?> edit)
protected org.eclipse.swt.widgets.Composite createContents(org.eclipse.swt.widgets.Composite cptParent)
Component
createContents in class Component<T>cptParent - The composite which the component will be placed on. The
parent of the control of the component.
protected abstract org.eclipse.swt.widgets.Composite createFields(org.eclipse.swt.widgets.Composite cptParent)
cptParent - The composite which the composite of the edits should be
placed on.
protected org.eclipse.swt.widgets.Composite createButtons(org.eclipse.swt.widgets.Composite cptParent)
cptParent - The composite which the composite of the buttons should be
placed on.
protected final org.eclipse.swt.widgets.Table createTable(org.eclipse.swt.widgets.Composite cptParent)
cptParent - The composite which the composite of the edits should be
placed on.
protected void addColumn(int mode,
java.lang.String prop,
java.lang.String name,
int width)
mode - Mode (e.g. alignment)prop - The property of the entity showed in the column.name - The name of the column visible on its top.width - The width of the column in pixels.protected abstract void createColumnsForTable()
private org.eclipse.jface.viewers.TableViewer createSelector(org.eclipse.swt.widgets.Table tbl)
protected final java.lang.String getSortProperty()
protected final int getSortDirection()
protected java.lang.String getColumnText(T t,
int i)
public final T get()
public void set(T newValue)
newValue - The new actual entity of the form.public void refresh()
public void refreshSelector()
public void fill(T t)
t - The entity which should be filled into the form.
public <P> void fill(java.lang.String property,
P value)
P - The type of the property.property - The name of the property.value - The value of the property.public void extract(T t)
t - protected T extract()
public void apply()
public void revoke()
protected void create()
protected void modify()
protected void delete()
private final void clear()
protected abstract void commit()
throws java.lang.Exception
java.lang.Exception
protected abstract void rollback()
throws java.lang.Exception
java.lang.Exception
protected abstract void save(T entity)
throws java.lang.Exception
entity - the business entity to be saved
java.lang.Exception
protected abstract void update(T entity)
throws java.lang.Exception
entity - the business entity to be updated
java.lang.Exception
protected abstract void delete(T entity)
throws java.lang.Exception
entity - the business entity to be deleted
java.lang.Exception
protected abstract java.util.List<T> findSuch()
throws java.lang.Exception
java.lang.Exceptionpublic boolean setFocus()
setFocus in class Component<T>private void addChangeListeners(ChangeListener listener)
private void removeChangeListeners(ChangeListener listener)
public final boolean isDirty()
private void addModificationListeners(ModificationListener listener)
private void removeModificationListeners(ModificationListener listener)
public final boolean hasChanged()
public void addMessageListener(MessageListener listener)
public void removeMessageListener(MessageListener listener)
private void fireTitleChanged(java.lang.String title)
private void setTitle(java.lang.String title)
private void fireMessageChanged(java.lang.String message,
int type)
protected void setMessage(java.lang.String message,
int type)
public void setMessage(java.lang.String message)
public T[] getSelection()
public void verify()
private void showSelector()
private void hideSelector()
public void setSearchMode(boolean b)
b - When true, search mode will be switched on, otherwise off.public boolean isSearchMode()
protected final void setWindowTitle(java.lang.String windowTitle)
windowTitle - the new window title
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||