wiki:BASE_BOUND_CONTROLS_R0

Version 26 (modified by peko, 17 years ago) (diff)

--

Analysis

Overview

  • Bound controls are used to provide a way for data validation on user input. We need to define and create some base classes to serve as a mainframe and some base bound controls.

Task requirements

  • Bound controls provide a way for user input. They differ from standard controls in their behavior.
    • Bound controls should act like a View-Controller and you can consider them a Model-View-Controller pattern.
      • View is represented by a field, spinner or a drop-down menu plus a sign whether the current data input is valid or not.
      • The Controller is the part that validates the data and inputs it in the model or rejects it.
    • As the user inputs data in a bound control it is automatically validated.
    • If the data is correct it is put in the undo/redo mechanism.
    • If the data is correct the information in the bound control is sent to the bound data-holder(the control model).
    • This transition is two-way.
    • They allow to attach a model and a verification mechanism.
  • Bound controls are composed of:
    • a standard control
    • a notification sign. It shows the verification status. Example - icon: It can be either correct (a green tick) or incorrect (a red cross.) Both the tick and the cross should have an explanation in its tool-tip what is wrong with the input of the user.
    • a label (optionally).
  • We have:
    • BoundTextField, which contains:
      • icon - green tick, red cross.
      • label - what the input is.
      • text field - for the input itself.
  • We need:
    • Some base bound control which eases bound controls creation.
    • Some Bound controls to use as a start:
      • Spinner with the minimum and maximum value set and a label to say what it is.
  • We should:
    • Design the base classes
    • Polish the BoundTextField class and fix what is to be fixed.
    • Create a class containing a spinner.
      • When inputing data the tool-tip of the spinner should containing a understandable explanation about its correctness and validity.
      • The spinner bound control should also contain a label, so that the user understands what it is used for.
      *Create a class containing a combo box. Apply same things like the spinner.

Task result

The result of this task must be code.

Implementation idea

  • Use a JPanel, with other panels for input field(spinner, text field etc.), notification icons and other.
  • BoundTextField class in sophie.

How to demo

  • Show working controls.
  • Try to input invalid data.
  • Try to input valid data, that must result to expected change.
  • Open Eclipse and run => net.asteasolutions.veda.gui.util.demo.BoundControlsDemo

Design

  • A base class for bound controls. Different classes extending it and providing different UI for input of data.
  • BoundBaseControl:
    • A base class for bound controls.
    • A JLabel to tell the user what the input is about.
    • A JPanel with an Icon - to inform about the validity of the input.
    • When mouse is over the Icon - a tool-tip is displayed to tell what the current status of the validation is.
  • Three classes that extend BoundBaseControl:
    • BoundSpinner - contains a JSpinner for the input of the user.
    • BoundTextField - contains a JTextField for the input of the user.
    • BoundComboBox - contains a JComboBox for the input of the user.
  • The only difference in the tree classes is the GUI used for input of data. One should extend these classes and implement the corresponding methods.
  • All of the four classes mentioned above are abstract. If one wants to have a different UI for input of data they should extend the BoundBaseControl class. Otherwise extend one of the other three.
  • UML:

source:/trunk/sophie2-platform/doc/uml-design-diagrams/Bound-Controls.png

Implementation

  • For more information see documentation and classes locate at: 'net.asteasolutions.veda.gui.util.boundcontrols'
  • For Unit tests and Demo see 'net.asteasolutions.veda.gui.util.boundcontrols' and 'net.asteasolutions.veda.gui.util.demo'

Log

  • Analyzing : Pap - done (35 min)
    • Review: 2 by Tanya - 10min. It is incorrect. The analysis must cover what should be done only through the current revision. This analysis is for the whole task.
  • Analyzing 2: Peko - done (30 mins)
    • Review: 3.5 by Tanya -10m
  • Designing : Peko - 3.5h - done.
    • Review: 4 by Pap - 10m. OK
  • Implementing : Peko 3.5h
  • Implementing 2 : Peko 4h - done.
    • Review: 3.5 by Pavlina - 30 mins
  • Testing :