Class ToolbarPanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--ToolbarPanel

public class ToolbarPanel
extends java.awt.Panel

Objects of this class are panel that have a row of bitmapped buttons and optional separators. The buttons can act like push buttons. The toolbar can be locate at the top or bottom in the horizontal orientation or at the left or right side in vertical orientation. All parameters are defined in Rosa applet parameters

Author:
Guy Parent
See Also:
Serialized Form

Inner classes inherited from class java.awt.Component
java.awt.Component.AWTTreeLock
 
Field Summary
 java.lang.String kstrBottom
          Constant - Location of the toolbar.
private  java.lang.String kstrBottomAling
          Alignment of the toolbar.
private  java.lang.String kstrCenterAling
          Alignment of the toolbar.
protected  java.lang.String kstrDefImageParam
          Postfix parameters name using for reading the default image on the button.
protected  java.lang.String kstrImagePressParam
          Postfix parameters name using for reading the pressed state image on the button.
 java.lang.String kstrLeft
          Constant - Location of the toolbar.
private  java.lang.String kstrLeftAling
          Alignment of the toolbar.
private  java.lang.String kstrMiddleAling
          Alignment of the toolbar.
 java.lang.String kstrRight
          Constant - Location of the toolbar.
private  java.lang.String kstrRightAling
          Alignment of the toolbar.
 java.lang.String kstrTop
          Constant - Location of the toolbar.
private  java.lang.String kstrTopAling
          Alignment of the toolbar.
private  boolean m_bIsVertical
          TRUE if the orientation of the toolbar is vertical
private  Map m_buttonListener
          this object answer to the button command
private  int m_nNbrButton
          Number of button item in the toolbar
private  Rosa2000 m_parent
          Use to place the buttons
private  java.awt.Point m_ptLocation
          XY location of the toolbar inside the applet.
private  java.lang.String m_strAlign
          Used to define the aligment of the toolbar.
private  java.lang.String m_strLocation
          Used to define the location of the toolbar.
 
Fields inherited from class java.awt.Panel
base, nameCounter, serialVersionUID
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dispatcher, layoutMgr, maxSize, ncomponents, serialVersionUID
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, assert, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, hasFocus, height, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, serialVersionUID, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowListenerK, x, y
 
Constructor Summary
(package private) ToolbarPanel(Rosa2000 parent, Map listener, java.lang.String strLocation, java.lang.String strAlignment)
          Constructor.
 
Method Summary
 void addButton(ButtonCtrl button)
          Add the button in the toolbar.
 void automaticPlace()
          Place the toolbar at the defined location in the applet.
protected  void autoPlace(int nIndex, ButtonCtrl button)
          Place automaticaly the button passed in parameter at the index position.
 boolean createButton(java.lang.String strButtonName)
          Create a new button using the string name passed in parameter.
 java.lang.String getAligment()
          Return the aligment string of the toolbar.
 java.awt.Dimension getCurrentSize()
          Return the dimension of the toolbar.
 java.lang.String getTbLocation()
          Return the string location.
 void moveTB(int nX, int nY)
          Move the toolbar at the possition passed in parameter.
protected  void placeTbHorizontal()
          Place the toolbar in horizontal orientation
protected  void placeTbVertical()
          Place the toolbar in vertical orientation
private  java.awt.Image readButtonImage(java.lang.String strNameParam)
          Read the button image from the parameters applet and load it.
 void setAlignment(java.lang.String strAlignment)
          Validate and assing the alingment.
 void setButtonPress(ButtonCtrl button)
          Set the button passed in parameter in pressed state.
 void setLocation(java.lang.String strLocation)
          Set the Location of the toolbar.
 
Methods inherited from class java.awt.Panel
, addNotify, constructComponentName
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyOrientation, countComponents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getCursorTarget, getInsets, getLayout, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, initIDs, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPrint, list, list, locate, minimumSize, nextFocus, paint, paintComponents, paramString, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, print, printComponents, printOneComponent, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, readObject, remove, remove, removeAll, removeContainerListener, removeNotify, setCursor, setFocusOwner, setFont, setLayout, transferFocus, update, updateCursor, validate, validateTree, writeObject
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getIntrinsicCursor, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

kstrTop

public final java.lang.String kstrTop
Constant - Location of the toolbar. Top location.

kstrBottom

public final java.lang.String kstrBottom
Constant - Location of the toolbar. Bottom location.

kstrLeft

public final java.lang.String kstrLeft
Constant - Location of the toolbar. Left location.

kstrRight

public final java.lang.String kstrRight
Constant - Location of the toolbar. right location.

kstrDefImageParam

protected final java.lang.String kstrDefImageParam
Postfix parameters name using for reading the default image on the button.

kstrImagePressParam

protected final java.lang.String kstrImagePressParam
Postfix parameters name using for reading the pressed state image on the button.

kstrTopAling

private final java.lang.String kstrTopAling
Alignment of the toolbar. Used in combination of vertical orientation. Top alignment.

kstrBottomAling

private final java.lang.String kstrBottomAling
Alignment of the toolbar. Used in combination of vertical orientation. Bottom alignment.

kstrMiddleAling

private final java.lang.String kstrMiddleAling
Alignment of the toolbar. Used in combination of vertical orientation. Middle alignment.

kstrCenterAling

private final java.lang.String kstrCenterAling
Alignment of the toolbar. Used in combination of horizontal orientation. Center alignment.

kstrLeftAling

private final java.lang.String kstrLeftAling
Alignment of the toolbar. Used in combination of horizontal orientation. Left alignment.

kstrRightAling

private final java.lang.String kstrRightAling
Alignment of the toolbar. Used in combination of horizontal orientation. Right alignment.

m_nNbrButton

private int m_nNbrButton
Number of button item in the toolbar

m_bIsVertical

private boolean m_bIsVertical
TRUE if the orientation of the toolbar is vertical

m_strAlign

private java.lang.String m_strAlign
Used to define the aligment of the toolbar.

m_strLocation

private java.lang.String m_strLocation
Used to define the location of the toolbar.

m_buttonListener

private Map m_buttonListener
this object answer to the button command

m_parent

private Rosa2000 m_parent
Use to place the buttons

m_ptLocation

private java.awt.Point m_ptLocation
XY location of the toolbar inside the applet.
Constructor Detail

ToolbarPanel

ToolbarPanel(Rosa2000 parent,
             Map listener,
             java.lang.String strLocation,
             java.lang.String strAlignment)
Constructor. Create and initialize the toolbar.
Parameters:
parent - Reference on the applet.
listener - This object will receive the button action.
strLocation - String location.
strAligment - Sting aligment.
Method Detail

setLocation

public void setLocation(java.lang.String strLocation)
Set the Location of the toolbar. The string should be define using the constant top, bottom, left or right. Otherwise an error msg will be send to the java console.
Parameters:
strLocation - Location of the toolbar.

getAligment

public java.lang.String getAligment()
Return the aligment string of the toolbar. It should be top, bottom or middle for the vertical orientation or left, right or center for horizontal horientation.

getTbLocation

public java.lang.String getTbLocation()
Return the string location. It should be top, bottom, left or right.

setButtonPress

public void setButtonPress(ButtonCtrl button)
Set the button passed in parameter in pressed state.
Parameters:
button - Button to set.

setAlignment

public void setAlignment(java.lang.String strAlignment)
Validate and assing the alingment. The value must be a good combination with the location. top, bottom and middle could be used with left or right and left, right and center could be used with top or bottom.

createButton

public boolean createButton(java.lang.String strButtonName)
Create a new button using the string name passed in parameter. If two images are defined to show the button, a round button will be created, otherwise, it will be a rectangle button.
Parameters:
strButtonName - Name of the button. It use to read the applet parameters.

readButtonImage

private java.awt.Image readButtonImage(java.lang.String strNameParam)
Read the button image from the parameters applet and load it.
Returns:
Image loaded.

addButton

public void addButton(ButtonCtrl button)
Add the button in the toolbar.
Parameters:
button - Button to add.

getCurrentSize

public java.awt.Dimension getCurrentSize()
Return the dimension of the toolbar.

autoPlace

protected void autoPlace(int nIndex,
                         ButtonCtrl button)
Place automaticaly the button passed in parameter at the index position.

moveTB

public void moveTB(int nX,
                   int nY)
Move the toolbar at the possition passed in parameter.

automaticPlace

public void automaticPlace()
Place the toolbar at the defined location in the applet.

placeTbVertical

protected void placeTbVertical()
Place the toolbar in vertical orientation

placeTbHorizontal

protected void placeTbHorizontal()
Place the toolbar in horizontal orientation