com.ccg.swing
Class LookupINISectionEditor

java.lang.Object
  extended by com.ccg.swing.LookupINISectionEditor

public class LookupINISectionEditor
extends Object

A graphical interface to allow a user to interact with a LookupINI object.

This class provides the graphical foundation to allow a user to interact with the various sections found in a LookupINI object. This class works in conjunction with the LookupINIComboBoxModel object and provides the following features:

It should be noted, that one must fully configure the object BEFORE retreiving the graphical component OR adding any action listeners.

Since:
1.0
Version:
$Revision: 1.2 $
Author:
$Author: pkb $
See Also:
LookupINIComboBoxModel

Field Summary
(package private)  JComboBox _Chooser
           
 
Constructor Summary
LookupINISectionEditor()
          Construct the object with using a default model.
LookupINISectionEditor(LookupINIComboBoxModel model)
          Construct the object with an already existant model.
 
Method Summary
 void addActionListener(ActionListener al)
          Add's a new action listener to be notified when the user selects a new section.
protected  JComboBox buildChooser()
          Construct the JComboBox chooser for picking sections.
protected  JComponent buildFinalComponent(JComboBox chooser)
          Build the final graphical component to present to the end user.
 JComponent getComponent()
          Get the graphical component which the user will interact with.
 LookupINI getLookupINI()
          Get the LookupINI object we are providing a model of.
 LookupINIComboBoxModel getModel()
          Get the swing "model" used when we create the graphical component.
protected  String getUserSpecifiedSection()
          Get the user's current section choice.
 boolean isAddEnabled()
          Is the user able to "add" new sections?
protected  boolean isEditable()
          Can the user edit the text choice displayed set?
 boolean isRemoveEnabled()
          Can the user "remove" existing sections?
 void setAddEnabled(boolean val)
          Set whether the user "add" new sections or not.
protected  void setEditable(boolean val)
          Set whether the user can edit the text choice displayed.
 void setRemoveEnabled(boolean val)
          Set whether the user can "remove" existing sections.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_Chooser

JComboBox _Chooser
Constructor Detail

LookupINISectionEditor

public LookupINISectionEditor(LookupINIComboBoxModel model)
Construct the object with an already existant model.

After construction, you may want to use some of the "set" methods PRIOR to retrieving the graphical component OR adding any action listeners.

Parameters:
model - The model to be associated with the graphical component. Must NOT be null.
Since:
1.0

LookupINISectionEditor

public LookupINISectionEditor()
Construct the object with using a default model.

After construction, you may want to use some of the "set" methods PRIOR to retrieving the graphical component OR adding any action listeners.

Since:
1.0
Method Detail

addActionListener

public void addActionListener(ActionListener al)
Add's a new action listener to be notified when the user selects a new section.

Use this method if you want to be notified whenever the user chooses (or enters) a new section name. Note, invoking this method causes the getComponent method to be invoked as well. This means that you should do all of your configuration of the object PRIOR to invoking this method.

Parameters:
al - The action listener to be notified.
Since:
1.0
See Also:
getComponent()

getModel

public final LookupINIComboBoxModel getModel()
Get the swing "model" used when we create the graphical component.

Returns:
Current LookupINIComboBoxModel value assigned.

getLookupINI

public final LookupINI getLookupINI()
Get the LookupINI object we are providing a model of.

Returns:
Current LookupINI value assigned.

setAddEnabled

public final void setAddEnabled(boolean val)
Set whether the user "add" new sections or not.

NOTE: This can not be changed once the graphical component is retrieved! Also, enabling the "add" also enables the "editable" capacity.

Parameters:
val - New boolean value to assign.
See Also:
isAddEnabled()

isAddEnabled

public final boolean isAddEnabled()
Is the user able to "add" new sections?

Returns:
Current boolean value assigned.
See Also:
setAddEnabled(boolean)

setRemoveEnabled

public final void setRemoveEnabled(boolean val)
Set whether the user can "remove" existing sections.

NOTE: This can not be changed once the graphical component is retrieved!

Parameters:
val - New boolean value to assign.
See Also:
isRemoveEnabled()

isRemoveEnabled

public final boolean isRemoveEnabled()
Can the user "remove" existing sections?

Returns:
Current boolean value assigned.
See Also:
setRemoveEnabled(boolean)

setEditable

protected final void setEditable(boolean val)
Set whether the user can edit the text choice displayed.

Parameters:
val - New boolean value to assign.
See Also:
isEditable()

isEditable

protected final boolean isEditable()
Can the user edit the text choice displayed set?

Returns:
Current boolean value assigned.
See Also:
setEditable(boolean)

getComponent

public final JComponent getComponent()
Get the graphical component which the user will interact with.

It should be noted that once the component is retrieved (or a action listener is added, one will no longer be able to adjust the properties of the object.

Returns:
Current Component value assigned.
See Also:
addActionListener(java.awt.event.ActionListener)

buildChooser

protected JComboBox buildChooser()
Construct the JComboBox chooser for picking sections.

Typically derived classes will NOT override this method. However, if yo want to provide your own custom JComboBox object used to allow the user to specify a section name, you can do so here.

Returns:
Must NEVER return null!
Since:
1.0
See Also:
buildFinalComponent(javax.swing.JComboBox)

buildFinalComponent

protected JComponent buildFinalComponent(JComboBox chooser)
Build the final graphical component to present to the end user.

This method will be called at most one time for the object. Its purpose is to build the complete graphical component which the user can interact with. This default implementation will add the "Add"/"Remove" buttons if the object has the add enabled and/or the remove enabled.

Derived classes will typically replace this ENTIRE method if they want to create their own custom look & feel.

Parameters:
chooser - The JComboBox object which the user has access to to choose (and possibly type in) section names.
Returns:
The full graphical component to present to the user - must not return null.
Since:
1.0
See Also:
buildChooser()

getUserSpecifiedSection

protected String getUserSpecifiedSection()
Get the user's current section choice.

Returns:
The string of the user's current choice, or null if the user hasn't made a choice yet.
Since:
1.0


Copyright 1998-1998-2006 null. All Rights Reserved.