nl.coderight.jazz.form
Class FormView

java.lang.Object
  extended by nl.coderight.jazz.View
      extended by nl.coderight.jazz.form.FormView

public abstract class FormView
extends View

Base class for form views.


Nested Class Summary
 
Nested classes/interfaces inherited from class nl.coderight.jazz.View
View.Position
 
Field Summary
static LabelField.Align CENTER
           
static LabelField.Align EAST
           
static LabelField.Align NORTH
           
static LabelField.Align SOUTH
           
static LabelField.Align WEST
           
 
Constructor Summary
FormView()
           
 
Method Summary
 void addField(FormField field)
          Add field.
 void addField(FormField<?> field, Object constraints)
          Add field with constraints.
 void addHorizontalSeparator()
          Add a (horizontal) separator.
 void addHorizontalSeparator(Object constraints)
          Add a (horizontal) separator.
 void addLabel(String text)
          Add label (as text).
 void addLabel(String text, Object constraints)
          Add label (as text).
 void addVerticalSeparator()
          Add a (vertical) separator.
 void addVerticalSeparator(Object constraints)
          Add a (vertical) separator.
protected  void dispose()
          Invoked when view is closed.
 void focus()
           
 void focusNextField(FormField fromField)
           
 void focusPreviousField(FormField fromField)
           
 FormField getDefaultFocusField()
          Returns field which gets default focus.
 FormField getFirstFocusableField(boolean isVisible)
           
 FormField getFocusField()
           
 FormField getLastFocusableField(boolean isVisible)
           
 FormField getNextFocusableField(FormField current, boolean isVisible)
           
 FormField getPreviousFocusableField(FormField current, boolean isVisible)
           
 void handleEvent(ClipboardEvent evt)
           
 void handleEvent(FormFieldEvent evt)
           
 void handleEvent(FormModelEvent evt)
           
 void handleEvent(FormViewEvent evt)
           
 void handleEvent(ValidationEvent evt)
           
 boolean isChanged()
          Returns whether the form is changed.
 boolean isEditable()
           
protected  void onChange()
           
protected  void onReset()
           
protected  void onShow()
          Invoked when view has been made visible.
protected  void onSubmit()
           
 void reset()
          Read values from model.
 void setDefaultButton(PushButton defaultButton)
          Sets the default button.
 void setDefaultFocusField(FormField field)
          Sets field which gets default focus.
 void setEditable(boolean editable)
          Sets whether form is editable.
 void setEnabled(boolean enabled)
          Sets whether form is enabled.
 void setHeader(FormHeader header)
           
 FormLayout setLayout(FormLayout formLayout)
           
 void setLayout(LayoutManager layoutManager)
           
 void setOnChangeAction(Action onChangeAction)
           
 void setOnChangeGroup(ActionGroup onChangeGroup)
           
 void submit()
          Write values to model.
 List<ValidationError> validate()
          Validates form fields and returns a list of validation errors, or an empty list if there are no errors.
 
Methods inherited from class nl.coderight.jazz.View
capture, center, center, close, getComponent, getCursor, getDefaultButton, getLocation, getModel, getProgressMonitor, getResource, getResourceAsIcon, getResourceAsImage, getSize, getTitle, handleEvent, init, isEnabled, isMaximizable, isMinimizable, isModal, isOpaque, isResizable, maximize, minimize, onActivate, onClose, onDeactivate, onMaximize, onMinimize, onOpen, postEvent, print, propagateEvent, registerKeyboardAction, restore, setBackground, setBorder, setCursor, setDefaultButton, setForeground, setIcon, setLocation, setLocation, setMaximizable, setMinimizable, setOpaque, setPainter, setPosition, setProgressMonitor, setResizable, setSize, setSize, setTimer, setTitle, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NORTH

public static final LabelField.Align NORTH

SOUTH

public static final LabelField.Align SOUTH

CENTER

public static final LabelField.Align CENTER

WEST

public static final LabelField.Align WEST

EAST

public static final LabelField.Align EAST
Constructor Detail

FormView

public FormView()
Method Detail

focus

public void focus()
Overrides:
focus in class View
See Also:
JComponent.requestFocus()

focusNextField

public void focusNextField(FormField fromField)

getFirstFocusableField

public FormField getFirstFocusableField(boolean isVisible)

getNextFocusableField

public FormField getNextFocusableField(FormField current,
                                       boolean isVisible)

getPreviousFocusableField

public FormField getPreviousFocusableField(FormField current,
                                           boolean isVisible)

getLastFocusableField

public FormField getLastFocusableField(boolean isVisible)

focusPreviousField

public void focusPreviousField(FormField fromField)

getDefaultFocusField

public FormField getDefaultFocusField()
Returns field which gets default focus.


setDefaultFocusField

public void setDefaultFocusField(FormField field)
Sets field which gets default focus.


getFocusField

public FormField getFocusField()

setDefaultButton

public void setDefaultButton(PushButton defaultButton)
Sets the default button.


reset

public final void reset()
Read values from model.

Specified by:
reset in class View

submit

public final void submit()
Write values to model.
 NOTE:
 All values are written to model, even if invalid!
 


validate

public List<ValidationError> validate()
Validates form fields and returns a list of validation errors, or an empty list if there are no errors.


isChanged

public final boolean isChanged()
Returns whether the form is changed.

Returns:
boolean (true is changed)

setOnChangeAction

public void setOnChangeAction(Action onChangeAction)

setOnChangeGroup

public void setOnChangeGroup(ActionGroup onChangeGroup)

setEnabled

public void setEnabled(boolean enabled)
Sets whether form is enabled.

Invokes setEnabled on all form fields.

Overrides:
setEnabled in class View
See Also:
JComponent.setEnabled(boolean)

isEditable

public final boolean isEditable()

setEditable

public void setEditable(boolean editable)
Sets whether form is editable.

Invokes setEditable on all form fields that implement Editable.

See Also:
Editable

addLabel

public void addLabel(String text)
Add label (as text).


addLabel

public void addLabel(String text,
                     Object constraints)
Add label (as text).


addField

public final void addField(FormField field)
Add field.


addField

public final void addField(FormField<?> field,
                           Object constraints)
Add field with constraints.


addHorizontalSeparator

public final void addHorizontalSeparator()
Add a (horizontal) separator.


addHorizontalSeparator

public final void addHorizontalSeparator(Object constraints)
Add a (horizontal) separator.


addVerticalSeparator

public final void addVerticalSeparator()
Add a (vertical) separator.


addVerticalSeparator

public final void addVerticalSeparator(Object constraints)
Add a (vertical) separator.


setLayout

public void setLayout(LayoutManager layoutManager)
Overrides:
setLayout in class View
See Also:
Container.setLayout(LayoutManager)

setLayout

public final FormLayout setLayout(FormLayout formLayout)

setHeader

public final void setHeader(FormHeader header)

onReset

protected void onReset()

onSubmit

protected void onSubmit()

onChange

protected void onChange()

handleEvent

public void handleEvent(FormViewEvent evt)

handleEvent

public final void handleEvent(FormModelEvent evt)

handleEvent

public void handleEvent(FormFieldEvent evt)

handleEvent

public void handleEvent(ClipboardEvent evt)

handleEvent

public void handleEvent(ValidationEvent evt)

dispose

protected void dispose()
Description copied from class: View
Invoked when view is closed.

Overrides:
dispose in class View

onShow

protected void onShow()
Description copied from class: View
Invoked when view has been made visible.

Overrides:
onShow in class View


Copyright 2010 CodeRight, All rights reserved.