Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## semorg.gui
Class ClientWindow

    java.lang.Object
      semorg.gui.ClientWindow

    public class ClientWindow

extends Object

The window for editing new or existing client records.

Nested Class Summary
`(package private) class` | `ClientWindow.InputChangedListener` Inner class which provides a listener reacting on changes of the input in the lecturer window.

Field Summary
`private org.eclipse.swt.widgets.Button` | `abortButton`
`private org.eclipse.swt.widgets.Button` | `addressLabelButton` The button to create a address label.
`private org.eclipse.swt.widgets.Combo` | `annexCombo`
`private org.eclipse.swt.widgets.Button` | `applyButton`
`private CalendarControl` | `birthDayCalendar`
`private AssociationTabControl` | `bookingsControl` The control widget to manage the association between `Client` and `Booking` (and its subclasses).
`private org.eclipse.swt.widgets.Text` | `cityText`
`private org.eclipse.swt.widgets.Combo` | `countryCombo`
`private DelayedPaymentViewerControl` | `delayedPaymentsControl` The control widget to display all delayed payments of a client.
`private org.eclipse.swt.widgets.Text` | `emailText`
`private ForeignKeyConstraintSelector` | `employerSelector`
`private org.eclipse.swt.widgets.Text` | `faxText`
`private CalendarControl` | `firstContactCalendar`
`private org.eclipse.swt.widgets.Text` | `firstNameText`
`private Client` | `input` Holds the data of the actual displayed data record.
`private boolean` | `inputChanged` Is set to `true` if the input has been changed and not committed yet, otherwise it is set to `false`.
`private ClientWindow.InputChangedListener` | `inputChangedListener` Listener instance added to the most elements of the window.
`private boolean` | `inputEditingEnabled` `true` if the editing of the input (i.e. the elements of the form) has been enabled, otherwise it is `false`.
`private org.eclipse.swt.widgets.Text` | `memoText`
`private org.eclipse.swt.widgets.Button` | `messageButton` The button to send a message.
`private org.eclipse.swt.widgets.Text` | `mobileText`
`private org.eclipse.swt.widgets.Text` | `nameText` Text field for the lastname of the lecurer.
`private org.eclipse.swt.widgets.Button` | `newButton`
`private org.eclipse.swt.widgets.Button` | `nextButton` The triangle-button with the apex to the right.
`private org.eclipse.swt.widgets.Label` | `numberLabel`
`private org.eclipse.swt.widgets.Text` | `numberText`
`private org.eclipse.swt.widgets.Button` | `okButton`
`private org.eclipse.swt.widgets.Text` | `phoneText`
`private org.eclipse.swt.widgets.Button` | `prevButton` The triangle-button with the apex to the left.
`private org.eclipse.swt.widgets.Combo` | `salutationCombo`
`private boolean` | `settingInput` Is set to `true` if the data from the database (or corresponding from `input`) is to be set into the window form, otherwise `false`.
`private org.eclipse.swt.widgets.Shell` | `shell` The editing window.
`private org.eclipse.swt.widgets.Text` | `shortMessageText`
`private org.eclipse.swt.widgets.Text` | `streetText`
`private org.eclipse.swt.widgets.Text` | `taskText` The task of the client in a company.
`private int` | `titleBarHeight`
`private org.eclipse.swt.widgets.Combo` | `titleCombo`
`private org.eclipse.swt.widgets.Text` | `turnoverText`
`private org.eclipse.swt.widgets.Text` | `zipCodeText`

Constructor Summary
`private` | `ClientWindow(org.eclipse.swt.widgets.Shell parent)` Creates a `ClientWindow` instance with the given shell as the parent shell.
`` | `ClientWindow(org.eclipse.swt.widgets.Shell parent, Client input, AssociationTabControl caller)` Creates an instance of this class, sets the input and finally opens it.
`` | `ClientWindow(org.eclipse.swt.widgets.Shell parent, Client input, ForeignKeyConstraintSelector caller)` Creates an instance of this class, sets the input and finally opens it.

Method Summary
`protected boolean` | `checkInput()` Checks if all obligatory attributes (salutation, lastname) of a client record are entered into the window form and if the entered fees are correct float numbers.
`protected void` | `commitInputToDB()` Reads the data from the window form elements, sets the values to a `Client` instance and commits the changes / the new record into the database.
`private boolean` | `confirmClose()` Creates a message dialog if the data in the window form has been changed (or was entered newly) and these changes haven't been confirmed (e.g. by clicking the ok button) or discarded so far.
`private void` | `createButtonListener(AssociationTabControl caller)` Adds a listener to several buttons of the window form.
`private void` | `createButtonListener(ForeignKeyConstraintSelector caller)` Adds a listener to several buttons of the window form.
`private boolean` | `onSave()` Checks whether the input has been changed (i.e. inputChanged equals `true`) or not.
`private void` | `setInput(Client client)` Loads a given client record into the window form of initialize the elements of the form the empty string/null if no data is given.
`private void` | `setInputComponentsEnabled(boolean enabled)` According to the value of the given parameter (`true`/`false`) this method enables / disables the widgets of the window form.

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

Field Detail

### input

    private Client input

  Holds the data of the actual displayed data record. If a new record is entered it is set to `null` until the changes have been committed.

### settingInput

    private boolean settingInput

  Is set to `true` if the data from the database (or corresponding from `input`) is to be set into the window form, otherwise `false`.
  That is needed to prevent the `ModifyListener` from firing when the data is load into the window form by using the .setText() methods of the GUI elements.

### inputChanged

    private boolean inputChanged

  Is set to `true` if the input has been changed and not committed yet, otherwise it is set to `false`.

### inputEditingEnabled

    private boolean inputEditingEnabled

  `true` if the editing of the input (i.e. the elements of the form) has been enabled, otherwise it is `false`.
  This flag indicates whether the actual displayed record has been locked by the actual editing window or not. This avoids the releasing of records which are locked by other editing windows.

### inputChangedListener

    private ClientWindow.InputChangedListener inputChangedListener

  Listener instance added to the most elements of the window.

### shell

    private org.eclipse.swt.widgets.Shell shell

  The editing window.

### titleBarHeight

    private int titleBarHeight

### numberLabel

    private final org.eclipse.swt.widgets.Label numberLabel

### numberText

    private final org.eclipse.swt.widgets.Text numberText

### salutationCombo

    private final org.eclipse.swt.widgets.Combo salutationCombo

### titleCombo

    private final org.eclipse.swt.widgets.Combo titleCombo

### firstNameText

    private final org.eclipse.swt.widgets.Text firstNameText

### nameText

    private final org.eclipse.swt.widgets.Text nameText

  Text field for the lastname of the lecurer.

### streetText

    private final org.eclipse.swt.widgets.Text streetText

### zipCodeText

    private final org.eclipse.swt.widgets.Text zipCodeText

### cityText

    private final org.eclipse.swt.widgets.Text cityText

### countryCombo

    private final org.eclipse.swt.widgets.Combo countryCombo

### annexCombo

    private final org.eclipse.swt.widgets.Combo annexCombo

### phoneText

    private final org.eclipse.swt.widgets.Text phoneText

### mobileText

    private final org.eclipse.swt.widgets.Text mobileText

### faxText

    private final org.eclipse.swt.widgets.Text faxText

### emailText

    private final org.eclipse.swt.widgets.Text emailText

### birthDayCalendar

    private final CalendarControl birthDayCalendar

### firstContactCalendar

    private final CalendarControl firstContactCalendar

### taskText

    private final org.eclipse.swt.widgets.Text taskText

  The task of the client in a company.

### turnoverText

    private final org.eclipse.swt.widgets.Text turnoverText

### employerSelector

    private final ForeignKeyConstraintSelector employerSelector

### bookingsControl

    private final AssociationTabControl bookingsControl

  The control widget to manage the association between `Client` and `Booking` (and its subclasses).

### delayedPaymentsControl

    private final DelayedPaymentViewerControl delayedPaymentsControl

  The control widget to display all delayed payments of a client.

### shortMessageText

    private final org.eclipse.swt.widgets.Text shortMessageText

### memoText

    private final org.eclipse.swt.widgets.Text memoText

### okButton

    private final org.eclipse.swt.widgets.Button okButton

### applyButton

    private final org.eclipse.swt.widgets.Button applyButton

### newButton

    private final org.eclipse.swt.widgets.Button newButton

### abortButton

    private final org.eclipse.swt.widgets.Button abortButton

### prevButton

    private final org.eclipse.swt.widgets.Button prevButton

  The triangle-button with the apex to the left.

### nextButton

    private final org.eclipse.swt.widgets.Button nextButton

  The triangle-button with the apex to the right.

### addressLabelButton

    private final org.eclipse.swt.widgets.Button addressLabelButton

  The button to create a address label.

### messageButton

    private final org.eclipse.swt.widgets.Button messageButton

  The button to send a message.

Constructor Detail

### ClientWindow

    private ClientWindow(org.eclipse.swt.widgets.Shell parent)

  Creates a `ClientWindow` instance with the given shell as the parent shell.
  It also adds a listener which reacts on closing events. It checks if changes have been made and if so it opens a dialog which informs the user and asks for a decision (confirm/discard). Finally it releases the locked record (if one is displayed and it is locked by this editing window).

  Parameters:
    `parent` - Shell instance used the as parent shell of the window.

### ClientWindow

    public ClientWindow(org.eclipse.swt.widgets.Shell parent,
                        Client input,
                        AssociationTabControl caller)

  Creates an instance of this class, sets the input and finally opens it.

  Parameters:
    `parent` - the parent shell to which this window belongs
    `input` - the client data to be displayed in the window
    `caller` - the `AssociationTabControl` instance which calls the constructor.

### ClientWindow

    public ClientWindow(org.eclipse.swt.widgets.Shell parent,
                        Client input,
                        ForeignKeyConstraintSelector caller)

  Creates an instance of this class, sets the input and finally opens it.

  Parameters:
    `parent` - the parent shell to which this window belongs
    `input` - the client data to be displayed in the window
    `caller` - the `ForeignKeyConstraintSelector` instance which calls the constructor.

Method Detail

### setInput

    private void setInput(Client client)

  Loads a given client record into the window form of initialize the elements of the form the empty string/null if no data is given.

  Parameters:
    `client` - `Client` instance which contains the data to be displayed or `null` if a completely new record is to be edited.

### setInputComponentsEnabled

    private void setInputComponentsEnabled(boolean enabled)

  According to the value of the given parameter (`true`/`false`) this method enables / disables the widgets of the window form.
  Note: It also sets the member `inputEditingEnabled` to the value of the parameter to signal that editing of the input has been enabled or not.

  Parameters:
    `enabled` - if equals `true` the widgets are enabled otherwise the widgets get disabled.

### createButtonListener

    private void createButtonListener(AssociationTabControl caller)

  Adds a listener to several buttons of the window form.
  This involves at the moment the buttons `okButton`, `abortButton`, `applyButton`, `newButton`, `prevButton`, `nextButton`.

### createButtonListener

    private void createButtonListener(ForeignKeyConstraintSelector caller)

  Adds a listener to several buttons of the window form.
  This involves at the moment the buttons `okButton`, `abortButton`, `applyButton`, `newButton`, `prevButton`, `nextButton`.

### checkInput

    protected boolean checkInput()

  Checks if all obligatory attributes (salutation, lastname) of a client record are entered into the window form and if the entered fees are correct float numbers.

  Returns:
    `true` if all mandatory fields are set and the fee values are valid float numbers (if entered), otherwise `false`.
  See Also:
    `Utility.isCorrectFloat(String)`

### commitInputToDB

    protected void commitInputToDB()

  Reads the data from the window form elements, sets the values to a `Client` instance and commits the changes / the new record into the database. Furthermore the member `input` is set to the new values.

### confirmClose

    private boolean confirmClose()

  Creates a message dialog if the data in the window form has been changed (or was entered newly) and these changes haven't been confirmed (e.g. by clicking the ok button) or discarded so far. It also receives the decision of the user (confirm/discard changes or abort the window closing) and handels it. In the positive case (confirmation of the changes) it invokes the method `onSave()`.

  Returns:
    `true` if the shell can be closed and `false` otherwise.

### onSave

    private boolean onSave()

  Checks whether the input has been changed (i.e. inputChanged equals `true`) or not. If changes have been done, it firstly checks if the changes are valid (`checkInput()`), secondly invokes the method `commitInputToDB()` to commit the changes and thirdly updates the GUI by invoking the method `setInput(Client)`.

  Returns:
    `true` if nothing has changed or the commit of the changes to the database was successful, `false` otherwise.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD