John W. Campbell
This class provides a window for the input/editing/display of an address
book entry.
Class, fields, constructor and methods:
Class Details
Accessible Fields
Constructor
Set Address Details
Editing the Address
Standard Positioning and Sizing
Add/Remove Action Listener
Get Returned Data
Overriden Superclass Methods
- Package:
- Jdl.JdlView;
- Class name:
- JdlAddressWindow
- Class definition:
- public class JdlAddressWindow
- Extends:
- JdlDrawPanel
- Implements:
- ChangeListener
KeyListener
ActionListener
JdlViewObject
- Actions:
- An action event will be generated when either an item in the address window
is edited (Action command starts with the string "Edit:") or when one of
the buttons is pressed (Action command starts with the string "Button:").
The command string indicates which item has been edited or which button
has been pressed as follows:
Edit: mult
Edit: mobile_main
Edit: section
Edit: sort_key
Edit: mail_address
Edit: post_code
Edit: mail_header
Edit: letter_header
Edit: tel_no
Edit: mobile_no
Edit: email_address
Edit: group_names
Edit: birth_date
Edit: notes_header
Button: OK
Button: Apply
Button: Reset
Button: Cancel
The following accessible fields have been defined:
- public final static int PREFERRED
- Size Constraint: preferred size.
- public final static int FREE
- Size/Location Constraint: free.
- public final static int NO_BUTTONS
- Buttons option: none.
- public final static int APPLY_AND_RESET
- Buttons option: Apply & Reset.
- public final static int ALL_BUTTONS
- Buttons option: OK, Apply, Reset & Cancel.
- static final long serialVersionUID
A single constructor is available.
Constructor:
Standard constructor
Constructs a JdlAddressWindow with the required resources.
- Constructor Definition:
- public JdlAddressWindow(int but_opt, JdlViewOptions view_opts)
- Parameters List:
- but_opt
- Buttons option:
= 0, none - NO_BUTTONS
= 1, Apply & Reset buttons to be shown - APPLY_AND_RESET
= 2, OK, Apply, Reset & Cancel to be shown - ALL_BUTTONS
- view_opts
- Object to set non-default options for borders, active strip,
colours and fonts.
This section has methods to set the various items which for an address
book entry.
Methods:
Set sections list - setSectionStrings
Set address entry - setAddressEntry
Set address entry - setAddressEntry
This method sets the Address Book 'sections' list.
- Method Definition:
- public void setSectionStrings (String[] strs)
- Parameters List:
- strs
- Section name strings for popup menu (min. of 1 string).
This method sets an address entry using a JdlAddressEntry object.
- Method Definition:
- public void setAddressEntry (JdlAddressEntry entry)
- Parameters List:
- entry
- The address book entry to be listed (null will clear entry)
Set an address entry using a JdlAddressEntry object and display the details
for a selected individual from the entry.
- Method Definition:
- public void setAddressEntry (JdlAddressEntry entry, int idx)
- Parameters List:
- entry
- The address book entry to be listed (null will clear entry)
- idx
- The index of the individual to be displayed.
This section has method relating to the control of editing the address
and monitoring edits made.
Methods:
Set editable state - setEditable
Clear changes flag - clearChanged
Reset entry - resetEntry
Get last changed string - lastChangedString
Get entry - getChangedEntry
See if changed - wasChanged
This method sets editable state of the contents of the address window.
- Method Definition:
- public void setEditable(boolean edt)
- Parameters List:
- edt
- Edit state flag:
= true, Set editable
= false, Set uneditable
This method clears the address entry changed flag. It will be set again
if any further edits are made.
- Method Definition:
- public void clearChanged()
- Parameters List:
- none
This method will reset the entry to the state it was in when the
setAddressEntry(..) method was called. Note: This will clear the entry
changed flag.
- Method Definition:
- public void resetEntry()
- Parameters List:
- none
This method returns the last changed string (following an Edit action).
- Method Definition:
- public String lastChangedString()
- Parameters List:
- none
- Method Return:
-
The string.
This method gets a changed (edited) address entry in its current state.
- Method Definition:
- public JdlAddressEntry getChangedEntry()
- Parameters List:
- none
- Method Return:
-
A new (cloned) JdlAddressEntry object.
See if an entry was changed since last setAddressEntry(..) or clearChanged(..)
method call.
- Method Definition:
- public boolean wasChanged()
- Parameters List:
- none
- Method Return:
-
true if changed, false if no changes made.
This section contains the standard methods for positioning and sizing
JdlView objects and getting the current minimum height and width values.
Methods:
Set position constraints - setLocationConstraints
Set size constraints - setSizeConstraints
Set minimum height - setMinimumHeight
Set minimum width - setMinimumWidth
Set constraints on the Jdl object positioning.
- Method Definition:
- public void setLocationConstraints (int constraint_x, int constraint_y)
- Parameters List:
- constraint_x
- Constrain the Jdl Object 'x' position = the required
Jdl Object 'x' position (overrides setLocation method) or FREE if the 'x'
position may be set by the setLocation method and hence possibly by the
layout manager.
- constraint_y
- Constrain the Jdl Object 'y' position = the required
the Jdl Object 'y'position (overrides setLocation method) or FREE if the 'y'
position may be set by the setLocation method and hence possibly by the
layout manager.
Set constraints on the Jdl Object resizing permitted.
- Method Definition:
- public void setSizeConstraints (int constraint_w, int constraint_h)
- Parameters List:
- constraint_w
- Constrain the Jdl Object width = the required
Jdl Object width, or PREFERRED (default) if the width is to be calculated
from the current resources, or FREE if the width may be resized to anything
greater than the minimum width required.
- constraint_h
- Constrain the Jdl Object height = the required
Jdl Object height, or PREFERRED (default) if the height is to be calculated
from the current resources, or FREE if the height may be resized to anything
greater than the minimum height required.
Set the minimum height resource.
- Method Definition:
- public void setMinimumHeight(int minh)
- Parameters List:
- minh
- The minimum height required for the object (ignored if less
than that required by the minimum layout) (default = 0).
Set the minimum width resource.
- Method Definition:
- public void setMinimumWidth(int minw)
- Parameters List:
- minh
- The minimum width required for the object (ignored if less
than that required by the minimum layout) (default = 0).
This section has methods to add or remove an action listener.
Methods:
Add action listener - addActionListener
Remove action listener - removeActionListener
This adds the specified action listener to receive action events from this
object.
- Method Definition:
- public void addActionListener(ActionListener listener)
- Parameters List:
- listener
- The action listener to be added.
This removes the specified action listener so that it no longer receives action
events from this object.
- Method Definition:
- public void removeActionListener(ActionListener listener)
- Parameters List:
- listener
- The action listener to be removed.
This section has methods to get data from the object relating to an
action and following that action.
Methods:
Get input - getReturnedData
This method is a dummy for this object. Details of the action event are
returned in the action event command string.
- Method Definition:
- public int getReturnedData()
- Parameters List:
- none
- Method Return:
-
Returns 0.
This section contains methods which override the corresponding superclass
methods. These are basically standard for JdlView objects and comprise
methods to set background and foreground colours and to get the minimum
and preferred sizes for the object. (The paintComponent and setSize methods
are also over-ridden but they are not normally called by the user).
Methods:
Set background - setBackground
Set background colours - setBackground
Set foreground - setForeground
Get minimum size - getMinimumSize
Get preferred size - getPreferredSize
This method sets the background colour resource.
- Method Definition:
- public void setBackground (Color c)
- Parameters List:
- c
- The color to become this object's background color.
This method sets the background colour resource and brighter and darker shades
of that colour (e.g. for 3-D frames).
- Method Definition:
- public void setBackground (Color c, Color brighter, Color darker)
- Parameters List:
- c
- The background colour.
- brighter
- A brighter shade of the background colour.
- darker
- A darker shade of the background colour.
This method sets the foreground colour resource.
- Method Definition:
- public void setForeground (Color c)
- Parameters List:
- c
- The color to become this object's foreground color.
This method returns the minimum size of the component.
- Method Definition:
- public Dimension getMinimumSize()
- Parameters List:
- none
This method returns the preferred size of the component.
- Method Definition:
- public Dimension getPreferredSize()
- Parameters List:
- none
⇑ Up 3
⇑ Up 2
⇑ Up 1
⇑ Top of this