|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.table.NavigationBar
public class NavigationBar
A selector for navigating through a table. Objects which implement
com.sas.table.TableNavigationInterface
can serve as the model
for the NavigationBar
(such as classes created with the DataWizard
in webAF).
NavigationBar navBar = new NavigationBar();
navBar.initialize();
The default orientation is HORIZONTAL
.
NavigationBar provides ways of determining when an action (ex. next, delete) is either about to occur or has already occurred. A validator is used to receive notification just before an action occurs and an action listener is used to receive notification just after an action occurs.
An ActionEvent
will be fired after an event
occurs with one of the action command identifiers as the action command
(ex. NavigationBar.NEXT
, NavigationBar.DELETE
).
A validator
can be set on the
NavigationBar in order to perform some pre-processing for an action before that
action occurs. The action command for the specific action will be passed in
as the value argument to the validator. To use a validator for
pre-processing true
should always be returned from the
validation method. However returning false
from the validation
method will stop the action from occurring (i.e. the model method will not be
called).
For example, to perform some operation before the action is performed on the model,
the validator's validateValue
method may look like:
public boolean validateValue(Object component, Object value) { if (component instanceof NavigationBar) { if (value == NavigationBar.FIRST) System.out.println("TableNavigationInterface.first() is about to be called!"); else if (value == NavigationBar.LAST) System.out.println("TableNavigationInterface.last() is about to be called!"); } return true; }
To disable an action based on some criteria the validator's validateValue
method may look like:
public boolean validateValue(Object component, Object value) { if (component instanceof NavigationBar) { if (value == NavigationBar.DELETE && customMethodToSeeIfDeleteIsEnabled() == false) { setValidationMessage(newValidationMessage("Delete is not enabled.")); return false; } } return true; }
TableNavigationInterface
,
Serialized FormField Summary | |
---|---|
static java.lang.String |
COMMIT
Action command for the commit button. |
static java.lang.String |
DELETE
Action command for the delete button. |
static java.lang.String |
FIRST
Action command for the first button. |
static int |
HORIZONTAL
The horizontal orientation. |
static java.lang.String |
INSERT
Action command for the insert button. |
static java.lang.String |
LAST
Action command for the last button. |
static java.lang.String |
NEXT
Action command for the next button. |
static java.lang.String |
PREVIOUS
Action command for the previous button. |
static java.lang.String |
RB_KEY
|
static int |
VERTICAL
The vertical orientation. |
Constructor Summary | |
---|---|
NavigationBar()
Constructs a NavigationBar object. |
|
NavigationBar(int orientation)
Constructs a NavigationBar object with the specified orientation. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent ae)
Handles action events on NavigationBar. |
void |
addActionListener(java.awt.event.ActionListener listener)
Add a listener for the java.awt.ActionEvent event. |
void |
attachModel(com.sas.ModelInterface mi)
Attaches the specified model. |
void |
detachModel(com.sas.ModelInterface mi)
Detaches the specified model. |
protected java.lang.reflect.Method |
findActionCommandMethod()
|
protected java.lang.reflect.Method |
findActionPerformedMethod()
|
protected void |
fireActionEvent(java.lang.String actionCommand)
Deprecated. Subclasses should override processActionEvent
instead to modify behavior |
static int |
getDefaultHeight()
Returns the default height in pixels. |
static int |
getDefaultWidth()
Returns the default width in pixels. |
java.lang.reflect.Method |
getEventMethod(java.lang.reflect.Method lMethod)
If this component supports the given event method, return the method that will give the source of the command |
java.lang.String[] |
getEventValues(java.lang.reflect.Method lMethod)
If this component supports the given event method, return the list of supported action events |
static com.sas.beans.ExtendedBeanInfo |
getExtendedBeanInfo()
Returns property information about the NavigationBar. |
int |
getOrientation()
Returns the value of the orientation property. |
java.util.Vector |
getRequiredInterfaces()
Returns the required interfaces Vector for this component. |
protected void |
handleError(java.lang.String message,
java.lang.String errorCode)
|
protected void |
init()
Initializes transient values. |
boolean |
isCommitButtonVisible()
Returns the value of the commitButtonVisible property. |
boolean |
isCommitConfirmed()
Returns the value of the commitConfirmed property. |
boolean |
isDeleteButtonVisible()
Returns the value of the deleteButtonVisible property. |
boolean |
isDeleteConfirmed()
Returns the value of the deleteConfirmed property. |
boolean |
isFirstButtonVisible()
Returns the value of the firstButtonVisible property. |
boolean |
isInsertButtonVisible()
Returns the value of the insertButtonVisible property. |
boolean |
isLastButtonVisible()
Returns the value of the lastButtonVisible property. |
boolean |
isNextButtonVisible()
Returns the value of the nextButtonVisible property. |
boolean |
isPreviousButtonVisible()
Returns the value of the previousButtonVisible property. |
protected void |
onButtonPressed(java.lang.String button)
Handles a button being pressed. |
protected boolean |
onCommit()
Handles the commit action. |
protected boolean |
onDelete()
Handles the delete action. |
protected boolean |
onFirst()
Handles the first action. |
protected boolean |
onInsert()
Handles the insert action. |
protected boolean |
onLast()
Handles the last action. |
protected boolean |
onNext()
Handles the next action. |
protected boolean |
onPrevious()
Handles the previous action. |
protected void |
processActionEvent(java.awt.event.ActionEvent event)
Processes action events occurring on the NavigationBar by dispatching them to any registered listeners. |
protected void |
processEvent(java.awt.AWTEvent event)
Processes events occurring on the NavigationBar. |
void |
propertyChange(java.beans.PropertyChangeEvent pce)
Handles property change events on NavigationBar. |
void |
refresh()
Directs NavigationBar to refresh itself from its model. |
void |
refresh(com.sas.ModelInterface mi)
Directs NavigationBar to refresh itself from its model. |
void |
removeActionListener(java.awt.event.ActionListener listener)
Remove a listener for the java.awt.ActionEvent event. |
void |
setCommitButtonVisible(boolean newValue)
Sets the value of the commitButtonVisible property. |
void |
setCommitConfirmed(boolean newValue)
Sets the value of the commitConfirmed property. |
void |
setDefaultValues()
Sets the default non-transient values. |
void |
setDeleteButtonVisible(boolean newValue)
Sets the value of the deleteButtonVisible property. |
void |
setDeleteConfirmed(boolean newValue)
Sets the value of the deleteConfirmed property. |
void |
setFirstButtonVisible(boolean newValue)
Sets the value of the firstButtonVisible property. |
void |
setInsertButtonVisible(boolean newValue)
Sets the value of the insertButtonVisible property. |
void |
setLastButtonVisible(boolean newValue)
Sets the value of the lastButtonVisible property. |
void |
setNextButtonVisible(boolean newValue)
Sets the value of the nextButtonVisible property. |
void |
setOrientation(int newValue)
Sets the value of the orientation property. |
void |
setPreviousButtonVisible(boolean newValue)
Sets the value of the previousButtonVisible property. |
boolean |
supportsListenerInterface(java.lang.Class listenerInterface)
Does this component support the given listener interface with mulitple events? |
Methods inherited from class com.sas.visuals.CompositeContainer |
---|
setDefaultHeight, setDefaultWidth |
Methods inherited from interface com.sas.awt.ContainerInterface |
---|
getComponents, getLayout, invalidate, setLayout, validate |
Field Detail |
---|
public static final java.lang.String RB_KEY
public static final java.lang.String COMMIT
public static final java.lang.String DELETE
public static final java.lang.String FIRST
public static final java.lang.String INSERT
public static final java.lang.String LAST
public static final java.lang.String NEXT
public static final java.lang.String PREVIOUS
public static final int HORIZONTAL
public static final int VERTICAL
Constructor Detail |
---|
public NavigationBar()
public NavigationBar(int orientation)
orientation
- initial orientation of the NavigationBarMethod Detail |
---|
public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
public static int getDefaultHeight()
public static int getDefaultWidth()
public void addActionListener(java.awt.event.ActionListener listener)
ActionSource
addActionListener
in interface ActionSource
listener
- an object which handles ActionEvent events
the listener is not added a second time if it already exists
in the list of listeners for this event.removeActionListener(java.awt.event.ActionListener)
,
ActionSource.addActionListener(java.awt.event.ActionListener)
public void setDefaultValues()
setDefaultValues
in interface ContainerInterface
setDefaultValues
in interface VisualInterface
setDefaultValues
in interface com.sas.ComponentInterface
setDefaultValues
in class CompositeContainer
ContainerInterface.setDefaultValues()
public int getOrientation()
HORIZONTAL
.
setOrientation(int)
public java.util.Vector getRequiredInterfaces()
getRequiredInterfaces
in interface com.sas.ViewInterface
getRequiredInterfaces
in class ContainerVisualComponent
ViewInterface.getRequiredInterfaces()
protected void init()
public void attachModel(com.sas.ModelInterface mi)
attachModel
in interface com.sas.ViewInterface
attachModel
in class ContainerVisualComponent
mi
- model to attachdetachModel(com.sas.ModelInterface)
public void detachModel(com.sas.ModelInterface mi)
detachModel
in interface com.sas.ViewInterface
detachModel
in class ContainerVisualComponent
mi
- the model to detachattachModel(com.sas.ModelInterface)
protected void fireActionEvent(java.lang.String actionCommand)
processActionEvent
instead to modify behavior
actionCommand
- the actionCommand of the button that was clickedpublic boolean isCommitButtonVisible()
true
if the commit button is visible, false
otherwise.setCommitButtonVisible(boolean)
public boolean isCommitConfirmed()
true
to display a warning dialog, false
to commit the changes firstsetCommitConfirmed(boolean)
public boolean isDeleteButtonVisible()
true
if the delete button is visible, false
otherwise.setDeleteButtonVisible(boolean)
public boolean isDeleteConfirmed()
true
to display a warning dialog, false
to silently deletesetDeleteConfirmed(boolean)
public boolean isFirstButtonVisible()
true
if the first button is visible, false
otherwise.setFirstButtonVisible(boolean)
public boolean isInsertButtonVisible()
true
if the insert button is visible, false
otherwise.setInsertButtonVisible(boolean)
public boolean isLastButtonVisible()
true
if the last button is visible, false
otherwise.setLastButtonVisible(boolean)
public boolean isNextButtonVisible()
true
if the next button is visible, false
otherwise.setNextButtonVisible(boolean)
public boolean isPreviousButtonVisible()
true
if the previous button is visible, false
otherwise.setPreviousButtonVisible(boolean)
public void refresh()
public void refresh(com.sas.ModelInterface mi)
refresh
in interface com.sas.ViewInterface
refresh
in class ContainerVisualComponent
mi
- model of NavigationBarViewInterface.refresh(com.sas.ModelInterface)
public void removeActionListener(java.awt.event.ActionListener listener)
ActionSource
removeActionListener
in interface ActionSource
listener
- an object which handles ActionEvent eventsaddActionListener(java.awt.event.ActionListener)
,
ActionSource.removeActionListener(java.awt.event.ActionListener)
public void setCommitButtonVisible(boolean newValue)
newValue
- true
if the commit button is to be visible,
false
otherwise.isCommitButtonVisible()
public void setCommitConfirmed(boolean newValue)
true
means that a warning dialog is displayed
and false
means that
the changes are first committed before the action is performed. The default value is
true
.
newValue
- true
to display a warning dialog,
false
to commit the changes firstisCommitConfirmed()
public void setDeleteButtonVisible(boolean newValue)
newValue
- true
if the delete button is to be visible,
false
otherwise.isDeleteButtonVisible()
public void setDeleteConfirmed(boolean newValue)
true
means that a warning dialog is displayed and false
means that
the delete action is performed without warning. The default value is true
.
newValue
- true
to display a warning dialog, false
to silently deleteisDeleteConfirmed()
public void setFirstButtonVisible(boolean newValue)
newValue
- true
if the first button is to be visible,
false
otherwise.isFirstButtonVisible()
public void setInsertButtonVisible(boolean newValue)
newValue
- true
if the insert button is to be visible,
false
otherwise.isInsertButtonVisible()
public void setLastButtonVisible(boolean newValue)
newValue
- true
if the last button is to be visible,
false
otherwise.isLastButtonVisible()
public void setNextButtonVisible(boolean newValue)
newValue
- true
if the next button is to be visible,
false
otherwise.isNextButtonVisible()
public void setOrientation(int newValue)
HORIZONTAL
and VERTICAL
. The default orientation
value is HORIZONTAL
.
newValue
- new value of the orientation propertygetOrientation()
public void setPreviousButtonVisible(boolean newValue)
newValue
- true
if the previous button is to be visible,
false
otherwise.isPreviousButtonVisible()
protected void handleError(java.lang.String message, java.lang.String errorCode)
public void actionPerformed(java.awt.event.ActionEvent ae)
actionPerformed
in interface java.awt.event.ActionListener
ae
- the event to handlepublic void propertyChange(java.beans.PropertyChangeEvent pce)
propertyChange
in interface java.beans.PropertyChangeListener
propertyChange
in class ContainerVisualComponent
pce
- the event to handlePropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)
public boolean supportsListenerInterface(java.lang.Class listenerInterface)
supportsListenerInterface
in interface MultipleValueEventSourceInterface
supportsListenerInterface
in class ContainerVisualComponent
listenerInterface
- the class of the listenerInterface of the event sent out
MultipleValueEventSourceInterfaceSupport.supportsListenerInterface(java.lang.Object, java.lang.Class)
public java.lang.reflect.Method getEventMethod(java.lang.reflect.Method lMethod)
getEventMethod
in interface MultipleValueEventSourceInterface
getEventMethod
in class ContainerVisualComponent
lMethod
- the listenerInterface method the event is sent to.
MultipleValueEventSourceInterfaceSupport.getEventMethod(java.lang.Object, java.lang.reflect.Method)
public java.lang.String[] getEventValues(java.lang.reflect.Method lMethod)
getEventValues
in interface MultipleValueEventSourceInterface
getEventValues
in class ContainerVisualComponent
lMethod
- the listenerInterface method the event is sent to.
MultipleValueEventSourceInterfaceSupport.getEventValues(java.lang.Object, java.lang.reflect.Method)
protected java.lang.reflect.Method findActionPerformedMethod()
protected java.lang.reflect.Method findActionCommandMethod()
protected void processEvent(java.awt.AWTEvent event)
processEvent
in class java.awt.Container
event
- the event to processprotected void processActionEvent(java.awt.event.ActionEvent event)
event
- the event to processprotected void onButtonPressed(java.lang.String button)
button
- id for the button that was pressedprotected boolean onFirst()
validator.validateValue(this, FIRST);
- Returns:
- true if the first method was completed successfully on the model
- See Also:
ValidationInterface.validateValue(java.lang.Object, java.lang.Object)
protected boolean onLast()
validator.validateValue(this, LAST);
- Returns:
- true if the last method was completed successfully on the model
- See Also:
ValidationInterface.validateValue(java.lang.Object, java.lang.Object)
protected boolean onPrevious()
validator.validateValue(this, PREVIOUS);
- Returns:
- true if the previous method was completed successfully on the model
- See Also:
ValidationInterface.validateValue(java.lang.Object, java.lang.Object)
protected boolean onNext()
validator.validateValue(this, NEXT);
- Returns:
- true if the next method was completed successfully on the model
- See Also:
ValidationInterface.validateValue(java.lang.Object, java.lang.Object)
protected boolean onInsert()
validator.validateValue(this, INSERT);
- Returns:
- true if the insert method was completed successfully on the model
- See Also:
ValidationInterface.validateValue(java.lang.Object, java.lang.Object)
protected boolean onCommit()
validator.validateValue(this, COMMIT);
- Returns:
- true if the commit method was completed successfully on the model
- See Also:
ValidationInterface.validateValue(java.lang.Object, java.lang.Object)
protected boolean onDelete()
validator.validateValue(this, DELETE);
- Returns:
- true if the delete method was completed successfully on the model
- See Also:
ValidationInterface.validateValue(java.lang.Object, java.lang.Object)
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |