FormController

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.openswing.swing.form.client
Class FormController

    java.lang.Object
      org.openswing.swing.form.client.FormController

public class FormController
extends java.lang.Object

Title: OpenSwing Framework

Description: Form controller, used to listener events generated by the Form panel and to execute operations related to the form (for example loading data).

Copyright: Copyright (C) 2006 Mauro Carniel

This file is part of OpenSwing Framework. This library is free software; you can redistribute it and/or modify it under the terms of the (LGPL) Lesser General Public License as published by the Free Software Foundation; GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be contacted at: maurocarniel@tin.it

Constructor Summary
`FormController()`

Method Summary
`void` | `afterDeleteData()` Callback method called after deleting SUCCESSFULLY data.
`void` | `afterEditData()` Callback method called after saving SUCCESSFULLY data in EDIT mode.
`void` | `afterEditData(Form form)` Callback method invoked on pressing EDIT button, after changing to edit mode.
`void` | `afterInsertData()` Callback method called after saving SUCCESSFULLY data in INSERT mode.
`void` | `afterInsertData(Form form)` Callback method invoked on pressing INSERT button, after changing to insert mode.
`void` | `afterReloadData()` Callback method called when user has pressed on reload button.
`boolean` | `beforeDeleteData(Form form)` Callback method invoked before deleting data when the form was in READONLY mode (on pressing delete button).
`boolean` | `beforeEditData(Form form)` Callback method invoked on pressing EDIT button to check if edit mode is allowed.
`boolean` | `beforeInsertData(Form form)` Callback method invoked on pressing INSERT button to check if insert mode is allowed.
`void` | `createPersistentObject(ValueObject PersistentObject)` Callback method called by the Form panel when the Form is set to INSERT mode.
`Response` | `deleteRecord(ValueObject persistentObject)` Method called by the Form panel to delete existing data.
`Response` | `insertRecord(ValueObject newPersistentObject)` Method called by the Form panel to insert new data.
`Response` | `loadData(java.lang.Class valueObjectClass)` This method must be overridden by the subclass to retrieve data and return the valorized value object.
`void` | `loadDataCompleted(boolean error)` Callback method called when the data loading is completed.
`void` | `modeChanged(int currentMode)` Callback method called when the Form mode is changed.
`Response` | `updateRecord(ValueObject oldPersistentObject, ValueObject persistentObject)` Method called by the Form panel to update existing data.
`boolean` | `validateControl(java.lang.String attributeName, java.lang.Object oldValue, java.lang.Object newValue)` Callback method invoked each time an input control is edited: this method define if the new value if valid.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### FormController

    public FormController()

Method Detail

### insertRecord

    public Response insertRecord(ValueObject newPersistentObject)
                          throws java.lang.Exception

  Method called by the Form panel to insert new data.

  Returns:
    an ErrorResponse value object in case of errors, VOResponse if the operation is successfully completed
  Throws:
    `java.lang.Exception`

### updateRecord

    public Response updateRecord(ValueObject oldPersistentObject,
                                 ValueObject persistentObject)
                          throws java.lang.Exception

  Method called by the Form panel to update existing data.

  Parameters:
    `oldPersistentObject` - original value object, previous to the changes
    `persistentObject` - value object to save
  Returns:
    an ErrorResponse value object in case of errors, VOResponse if the operation is successfully completed
  Throws:
    `java.lang.Exception`

### deleteRecord

    public Response deleteRecord(ValueObject persistentObject)
                          throws java.lang.Exception

  Method called by the Form panel to delete existing data.

  Parameters:
    `persistentObject` - value object to delete
  Returns:
    an ErrorResponse value object in case of errors, VOResponse if the operation is successfully completed
  Throws:
    `java.lang.Exception`

### createPersistentObject

    public void createPersistentObject(ValueObject PersistentObject)
                                throws java.lang.Exception

  Callback method called by the Form panel when the Form is set to INSERT mode. The method can pre-set some v.o. attributes, so that some input controls will have a predefined value associated.

  Throws:
    `java.lang.Exception`

### loadDataCompleted

    public void loadDataCompleted(boolean error)

  Callback method called when the data loading is completed.

  Parameters:
    `error` - `true` if an error occours during data loading, `false` if data loading is successfully completed

### afterReloadData

    public void afterReloadData()

  Callback method called when user has pressed on reload button.

### afterEditData

    public void afterEditData()

  Callback method called after saving SUCCESSFULLY data in EDIT mode.

### afterInsertData

    public void afterInsertData()

  Callback method called after saving SUCCESSFULLY data in INSERT mode.

### afterDeleteData

    public void afterDeleteData()

  Callback method called after deleting SUCCESSFULLY data.

### loadData

    public Response loadData(java.lang.Class valueObjectClass)

  This method must be overridden by the subclass to retrieve data and return the valorized value object. If the method is not overridden, the current version will return a "demo" value object.

  Parameters:
    `valueObjectClass` - value object class
  Returns:
    a VOResponse object if data loading is successfully completed, or an ErrorResponse object if an error occours

### modeChanged

    public void modeChanged(int currentMode)

  Callback method called when the Form mode is changed.

  Parameters:
    `currentMode` - current Form mode

### beforeEditData

    public boolean beforeEditData(Form form)

  Callback method invoked on pressing EDIT button to check if edit mode is allowed.

  Returns:
    `true` allows to go to EDIT mode, `false` the mode change is interrupted

### beforeInsertData

    public boolean beforeInsertData(Form form)

  Callback method invoked on pressing INSERT button to check if insert mode is allowed.

  Returns:
    `true` allows to go to INSERT mode, `false` the mode change is interrupted

### beforeDeleteData

    public boolean beforeDeleteData(Form form)

  Callback method invoked before deleting data when the form was in READONLY mode (on pressing delete button).

  Returns:
    `true` allows the deleting to continue, `false` the deleting is interrupted

### afterEditData

    public void afterEditData(Form form)

  Callback method invoked on pressing EDIT button, after changing to edit mode.

### afterInsertData

    public void afterInsertData(Form form)

  Callback method invoked on pressing INSERT button, after changing to insert mode.

### validateControl

    public boolean validateControl(java.lang.String attributeName,
                                   java.lang.Object oldValue,
                                   java.lang.Object newValue)

  Callback method invoked each time an input control is edited: this method define if the new value if valid. Default behaviour: input control value is valid.

  Parameters:
    `attributeName` - attribute name related to the input control currently edited
    `oldValue` - old input control value (before editing)
    `newValue` - new input control value (just edited)
  Returns:
    `true` if input control value is valid, `false` otherwise

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD