org.openswing.swing.client
Class NavigatorBar

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.openswing.swing.client.NavigatorBar
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class NavigatorBar
extends javax.swing.JPanel

Title: OpenSwing Framework

Description: Navigator bar: contains first, previous, next and last buttons. This class must be used inside a GridControl.

Copyright: Copyright (C) 2006 Mauro Carniel

This file is part of OpenSwing Framework. This library is free software; you can redistribute it and/or modify it under the terms of the (LGPL) Lesser General Public License as published by the Free Software Foundation; GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be contacted at: maurocarniel@tin.it

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
static java.lang.String DOWN_KEY
           
static java.lang.String FIRST_BUTTON
           
static java.lang.String LAST_BUTTON
           
static java.lang.String LEFT_MOUSE_BUTTON
           
static java.lang.String NEXT_BUTTON
           
static java.lang.String NEXT_PG_BUTTON
           
static java.lang.String PREV_BUTTON
           
static java.lang.String PREV_PG_BUTTON
           
static java.lang.String UP_KEY
           
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
NavigatorBar()
           
 
Method Summary
 void addAfterActionListener(java.awt.event.ActionListener listener)
          Add an ActionListener that will be called AFTER a navigator button has been pressed (AFTER selecting row event).
 void addBeforeActionListener(java.awt.event.ActionListener listener)
          Add an ActionListener that will be called as the first instruction when a navigator button is being pressed (BEFORE selecting row event).
 void fireButtonPressedEvent(java.lang.String buttonType)
          Method invoked by the grid control when pressing a navigator button.
 void firstButton_actionPerformed(java.awt.event.ActionEvent e)
           
 void initNavigator(NavigatorBarController resultSetController)
           
 boolean isFirstButtonEnabled()
           
 boolean isLastButtonEnabled()
           
 boolean isNextButtonEnabled()
           
 boolean isPrevButtonEnabled()
           
 boolean isShowPageNumber()
           
 boolean isShowPaginationButtons()
           
 void lastButton_actionPerformed(java.awt.event.ActionEvent e)
           
 void nextButton_actionPerformed(java.awt.event.ActionEvent e)
           
 void nextPgButton_actionPerformed(java.awt.event.ActionEvent e)
           
 void prevButton_actionPerformed(java.awt.event.ActionEvent e)
           
 void prevPgButton_actionPerformed(java.awt.event.ActionEvent e)
           
 void removeAfterActionListener(java.awt.event.ActionListener listener)
          Remove the specified ActionListener.
 void removeBeforerActionListener(java.awt.event.ActionListener listener)
          Remove the specified ActionListener.
 void setEnabled(boolean enabled)
           
 void setFirstRow(boolean isFirstRecord)
          Method called by grid component each time a row is selected.
 void setLastRow(boolean isLastRecord)
          Method called by grid component each time a row is selected.
 void setShowPageNumber(boolean showPageNumber)
          true to show page number input field in navigator bar; false to do not show it.
 void setShowPaginationButtons(boolean showPaginationButtons)
          Show/hide pagination buttons in navigator bar; false to do not show them.
 void updatePageNumber(int pageNr)
          Show/update/hide page number field, according to loading policy and current data length.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FIRST_BUTTON

public static final java.lang.String FIRST_BUTTON
See Also:
Constant Field Values

PREV_BUTTON

public static final java.lang.String PREV_BUTTON
See Also:
Constant Field Values

NEXT_BUTTON

public static final java.lang.String NEXT_BUTTON
See Also:
Constant Field Values

LAST_BUTTON

public static final java.lang.String LAST_BUTTON
See Also:
Constant Field Values

NEXT_PG_BUTTON

public static final java.lang.String NEXT_PG_BUTTON
See Also:
Constant Field Values

PREV_PG_BUTTON

public static final java.lang.String PREV_PG_BUTTON
See Also:
Constant Field Values

UP_KEY

public static final java.lang.String UP_KEY
See Also:
Constant Field Values

DOWN_KEY

public static final java.lang.String DOWN_KEY
See Also:
Constant Field Values

LEFT_MOUSE_BUTTON

public static final java.lang.String LEFT_MOUSE_BUTTON
See Also:
Constant Field Values
Constructor Detail

NavigatorBar

public NavigatorBar()
Method Detail

updatePageNumber

public final void updatePageNumber(int pageNr)
Show/update/hide page number field, according to loading policy and current data length.


firstButton_actionPerformed

public void firstButton_actionPerformed(java.awt.event.ActionEvent e)

prevPgButton_actionPerformed

public void prevPgButton_actionPerformed(java.awt.event.ActionEvent e)

prevButton_actionPerformed

public void prevButton_actionPerformed(java.awt.event.ActionEvent e)

nextButton_actionPerformed

public void nextButton_actionPerformed(java.awt.event.ActionEvent e)

nextPgButton_actionPerformed

public void nextPgButton_actionPerformed(java.awt.event.ActionEvent e)

lastButton_actionPerformed

public void lastButton_actionPerformed(java.awt.event.ActionEvent e)

setFirstRow

public void setFirstRow(boolean isFirstRecord)
Method called by grid component each time a row is selected.


setLastRow

public void setLastRow(boolean isLastRecord)
Method called by grid component each time a row is selected.


setEnabled

public void setEnabled(boolean enabled)

initNavigator

public void initNavigator(NavigatorBarController resultSetController)

isFirstButtonEnabled

public boolean isFirstButtonEnabled()

isPrevButtonEnabled

public boolean isPrevButtonEnabled()

isNextButtonEnabled

public boolean isNextButtonEnabled()

isLastButtonEnabled

public boolean isLastButtonEnabled()

addAfterActionListener

public final void addAfterActionListener(java.awt.event.ActionListener listener)
Add an ActionListener that will be called AFTER a navigator button has been pressed (AFTER selecting row event).

Parameters:
listener - ActionListener to register.

removeAfterActionListener

public final void removeAfterActionListener(java.awt.event.ActionListener listener)
Remove the specified ActionListener.

Parameters:
listener - ActionListener to remove.

fireButtonPressedEvent

public final void fireButtonPressedEvent(java.lang.String buttonType)
Method invoked by the grid control when pressing a navigator button.

Parameters:
buttonType - possible values: NavigatorBar.xxx_BUTTON

addBeforeActionListener

public final void addBeforeActionListener(java.awt.event.ActionListener listener)
Add an ActionListener that will be called as the first instruction when a navigator button is being pressed (BEFORE selecting row event).

Parameters:
listener - ActionListener to register.

removeBeforerActionListener

public final void removeBeforerActionListener(java.awt.event.ActionListener listener)
Remove the specified ActionListener.

Parameters:
listener - ActionListener to remove.

isShowPaginationButtons

public final boolean isShowPaginationButtons()
Returns:
true to show pagination buttons in navigator bar; false to do not show them

setShowPaginationButtons

public final void setShowPaginationButtons(boolean showPaginationButtons)
Show/hide pagination buttons in navigator bar; false to do not show them.

Parameters:
showPaginationButtons - true to show pagination buttons in navigator bar; false to do not show them

isShowPageNumber

public final boolean isShowPageNumber()
Returns:
boolean true to show page number input field in navigator bar; false to do not show it; default value: true

setShowPageNumber

public final void setShowPageNumber(boolean showPageNumber)
true to show page number input field in navigator bar; false to do not show it. Note: it is automatically hided if result set is fully loaded in grid, independently from this setting.

Parameters:
showPageNumber - true to show page number input field in navigator bar; false to do not show it