ewe.ui
Class mTabbedPanel

java.lang.Object
  extended byewe.ui.ControlBase
      extended byewe.ui.Control
          extended byewe.ui.Container
              extended byewe.ui.Canvas
                  extended byewe.ui.Panel
                      extended byewe.ui.CellPanel
                          extended byewe.ui.mTabbedPanel
All Implemented Interfaces:
CellConstants, ControlConstants, EventListener, ImageRefresher, IScroll, LayoutManager, MultiPanel, ScrollClient, TimerProc, UIConstants

public class mTabbedPanel
extends CellPanel
implements MultiPanel

This is a Tabbed Panel with tab selectors placed at the top of the panel. Left and right scroll buttons are automatically provided should the tabs not fit completely in the tab selector area.

mTabbedPanels generate a DataChange event when their selected item is changed.


Field Summary
 CardPanel cardPanel
          This does the actual MultiPanel work.
 boolean dontExpandTabs
          If this is true, then the tabs are not expanded to show both the icon AND the text when selected.
 boolean dontFocusOnNextSelect
          Set this true if you dont want the focus to move to the Card on the next select().
 Control extraControlsLeft
          This is initially null.
 Control extraControlsRight
          This is initially null.
protected  mButton left
           
 boolean noScrollButtons
          This is false by default - set it true so that the left/right scroll buttons are never seen.
protected  mButton right
           
 int tabLocation
          This should be NORTH/SOUTH/EAST/WEST (but only NORTH/SOUTH are currently supported)
protected  ewe.ui.TabsPanel tabs
           
protected  CellPanel top
           
 
Fields inherited from class ewe.ui.CellPanel
autoSpan, equalHeights, equalWidths, layout, mySplitter, nextSplitter, quickRecalculate
 
Fields inherited from class ewe.ui.Panel
all, backgroundImage, calculated, childListeners, defaultAddToMeCellConstraints, defaultTags, grid, lastAdded, layoutManager, made, noInsets, stretchFirstColumn, stretchFirstRow, stretchLastColumn, stretchLastRow, titleGap
 
Fields inherited from class ewe.ui.Canvas
isFullScrollClient, origin, scrollPercent, virtualSize
 
Fields inherited from class ewe.ui.Container
closedFocus, cycleFocus, dontAutoScroll, dontFocusOnChildren
 
Fields inherited from class ewe.ui.Control
_debug, backGround, beforeRemoved, borderColor, borderStyle, borderWidth, children, columns, constraints, DoPaintMethod, dragging, dragResolution, dragTime, exitKeys, fieldTransfer, font, foreGround, haveNativePaint, height, holdDownPause, holdTick, hotKey, image, lastSelected, listeners, maxHeight, maxWidth, menuState, minHeight, minWidth, modifiers, MyClass, name, next, np, parent, penStatus, popupSound, popupSoundClip, preferredHeight, preferredWidth, prev, prompt, promptControl, rows, ss, standardBorder, standardEdge, startDragResolution, tags, tail, text, toolTip, width, x, y
 
Fields inherited from class ewe.ui.ControlBase
clipItems, clipObject, clipOwner, curPoint, currentPenEvent, debugControl, debugFlag, DidHoldDown, doubleBuffer, doubleClickTime, firstPress, globalDrawFlat, globalEditable, globalEnabled, globalPalmStyle, globalSmallControls, GotPenDown, PenIsOn, pressPoint, TAG_LAST_USER_DATA, TAG_USER_DATA, TAKE_FIRST_PRESS, unnamed, useNativeTextInput
 
Fields inherited from interface ewe.ui.CellConstants
BORDER, BOTTOM, CELLFLAG, CELLMASK, CENTER, CONTROLMASK, DONTCHANGE, DONTFILL, DONTSTRETCH, EAST, FILL, FIXEDSIZE, GROW, HCENTER, HCONTRACT, HEXPAND, HFILL, HGROW, HSHRINK, HSTRETCH, INITIALLY_CLOSED, INITIALLY_MINIMIZED, INITIALLY_PREFERRED_SIZE, INSETS, LEFT, MAXIMUMSIZE, MINIMUMSIZE, NORTH, NORTHEAST, NORTHWEST, PREFERREDSIZE, RECT, RIGHT, SHRINK, SOUTH, SOUTHEAST, SOUTHWEST, SPAN, STRETCH, TEXTSIZE, TOP, VCENTER, VCONTRACT, VEXPAND, VFILL, VGROW, VSHRINK, VSTRETCH, WEST
 
Fields inherited from interface ewe.ui.IScroll
Higher, Horizontal, Lower, OPTION_INDICATOR_ONLY, PageHigher, PageLower, ScrollHigher, ScrollLower, TrackTo, Vertical
 
Fields inherited from interface ewe.ui.UIConstants
BDR_DOTTED, BDR_INNER, BDR_NOBORDER, BDR_OUTER, BDR_OUTLINE, BDR_RAISEDINNER, BDR_RAISEDOUTER, BDR_SUNKENINNER, BDR_SUNKENOUTER, BF_BOTTOM, BF_BOTTOMLEFT, BF_BOTTOMRIGHT, BF_BUTTON, BF_DIAGONAL, BF_DIAGONAL_ENDBOTTOMLEFT, BF_DIAGONAL_ENDBOTTOMRIGHT, BF_DIAGONAL_ENDTOPLEFT, BF_DIAGONAL_ENDTOPRIGHT, BF_EXACT, BF_FLAT, BF_LEFT, BF_MIDDLE, BF_MONO, BF_PALM, BF_RECT, BF_RIGHT, BF_SOFT, BF_SQUARE, BF_TOP, BF_TOPLEFT, BF_TOPRIGHT, EDGE_BUMP, EDGE_ETCHED, EDGE_RAISED, EDGE_SUNKEN
 
Fields inherited from interface ewe.ui.ControlConstants
All, AlwaysEnabled, AlwaysRecalculateSizes, ByDeferredMouse, ByDeferredPen, ByFrameChange, ByKeyboard, ByMouse, ByPen, ByRequest, CalculatedSizes, Disabled, DisablePopupMenu, DisplayOnly, Down, DrawFlat, Flag, ForceResize, HasData, Invisible, KeepImage, KeepSIP, Left, MakeMenuAtLeastAsWide, Maximize, Minimize, MouseSensitive, NoFocus, NotAnEditor, NotEditable, PaintDataOnly, PaintOutsideOnly, PenTransparent, PreferredSizeOnly, Right, SendUpKeyEvents, SendUpPenEvents, ShowSIP, ShrinkToNothing, SmallControl, SpecialBackground, TakeControlEvents, TakesKeyFocus, Transparent, Up, WantDrag, WantHoldDown
 
Fields inherited from interface ewe.fx.ImageRefresher
KEEP_VISIBLE
 
Constructor Summary
mTabbedPanel()
           
 
Method Summary
 Card addCard(Control item, String tabName, String longName)
          Add a new item to the tabbed panel.
 Control addItem(Control item, String tabName, String longName)
          Add a new item to the tabbed panel.
protected  void calculateSizes()
          Use this to add a control directly to the CellPanel.
 void checkLeftRight()
           
 void checkLeftRight(boolean dontAutoShift)
           
protected  boolean doHotKey(Control from, KeyEvent ev)
          This method checks to see if a KeyEvent should be considered the Control's hot-key.
 void doPaint(Graphics g, Rect r)
           
static Object[] getExpandingTabbedPanel(boolean above)
          Use this to create a self-expanding mTabbedPanel.
 CellPanel getExtraControls(boolean isLeft)
          This gets a container to put extra controls in.
 CellPanel getExtremeControls(boolean isLeft)
          This gets a CellPanel to put extra controls in that will be further left or right of the container provided by getExtraControls().
protected  Control getFirstFocus()
           
 Card getItem(Control item)
          This returns a Card object holding information about the item added for the specified control.
 Card getItem(int index)
          This returns a Card object holding information about the item added at the specified index.
 int getItemCount()
          This returns the number of items added to the MultiPanel.
 int getSelectedItem()
          This returns the index for the currently selected item.
 void gotFocus(int how)
          This can only get focus explicitly - via focusOnTab, or via selectNextTab().
 void lostFocus(int how)
           
 void make(boolean remake)
          This is used to "make" the control before being displayed.
 void newSelection()
           
 void onControlEvent(ControlEvent ev)
           
 void onKeyEvent(KeyEvent ev)
           
 void repaintTabs()
           
 void select(Control item)
          This selects for display one of the previously added Controls.
 void select(int index)
          This selects for display one of the previously added Controls, given the index of the item.
 void select(String tabName)
          This selects for display one of the previously added Controls, given the short (tab) name for the item.
 void selectAndExpand(int which)
           
 void selectNextTab(boolean forwards, boolean focusOnTab)
          Select the next tab.
 void setAutoExpand(SplittablePanel splittablePanel)
          Call this AFTER setting the tabLocation to be NORTH or SOUTH (it is NORTH by default), but before doing a make().
 
Methods inherited from class ewe.ui.CellPanel
makeLayoutGrid, onEvent, relayout, relayoutMe, removeAll, reShow, resize, resizeTo
 
Methods inherited from class ewe.ui.Panel
add, addChildListener, addDirectly, addLast, addLast, addNext, addNext, addNext, doBackground, doBorder, endRow, getControlTag, getPreferredSize, getSubControls, isEmpty, layout, remove, removeChildListener, sendToChildListeners, setText
 
Methods inherited from class ewe.ui.Canvas
canGo, canScreenScroll, checkScrolls, doScroll, fixOrigin, getActual, getBuffer, getCurrent, getDisplayedSize, getMySize, getPercent, getScrollablePanel, getScrollClient, getVisible, getVisibleArea, needScrollBar, onScroll, onSetOrigin, reduceClip, scroll, scroll, scrollToVisible, setOrigin, updateScrollServer
 
Methods inherited from class ewe.ui.Container
_paintChildren, add, containerHasFocus, dismantle, dismantle, findChild, focusFirst, focusFirst, focusOnContainer, focusOnData, getChildren, getChildrenBackwards, getNextKeyFocus, repaintDataNow, takeFocus, takePromptControl
 
Methods inherited from class ewe.ui.Control
acceptsData, activate, addListener, addTimer, amOnTopFrame, calculateTextSize, cancelCut, cancelHoldDown, canEdit, chainDataChange, change, checkClipboardOperations, checkExitKey, checkMenu, checkMenuKey, checkModifiers, checkPenTransparent, clearTag, clipboardToString, clipboardTransfer, closeMenu, contains, contains, createGraphics, dataAccepted, dataBeingRemoved, dataDraggedOff, dataDraggedOver, dataDraggedOver, dataDroppedOn, dataTransferCancelled, deactivate, defaultTo, doAction, doActionKey, doMenu, dontAcceptDrop, doPaintChildren, doPaintChildren, doPaintChildren, doPaintData, doPaintData, doShowMenu, dragged, exitEntry, fillBackground, formClosing, fromClipboard, fromField, fromField, getAllDescendants, getAllSubControls, getBackground, getClipboardMenu, getClipObject, getControlBuffer, getControlBuffer, getDataRect, getDataToCopy, getDataToDragAndDrop, getDim, getDisplayText, getDragAndDropContext, getFont, getFontMetrics, getFontMetrics, getForeground, getFrame, getFrameOrContainer, getGraphics, getImage, getLastSelected, getLocation, getMaximumSize, getMenu, getMinimumSize, getModifiers, getNext, getParent, getPasswordCharacter, getPosInFrame, getPosInParent, getPreferredSize, getPrompt, getPromptText, getRect, getRect, getServer, getSize, getSizes, getTag, getText, getToolTip, getWindow, hasModifier, hasPopupFormAttached, hasTag, inheritModifiers, isChildOf, isModal, isOnMe, isSomeonesHotKey, makeFrameTopMost, makeHot, menuIsActive, modify, modifyAll, modifyAll, notifyAction, notifyDataChange, notifyDataChange, notNative_doPaintChildren, oldButWorksDoPaintChildren, oldPaintChildren, oldPostEvent, onLabelPenEvent, onPaint, onPenEvent, paintBackground, paintChildren, penClicked, penDoubleClicked, penHeld, penPressed, penReleased, penRightReleased, popupBeep, popupMenuClosed, popupMenuEvent, popupMenuEvent, postEvent, recalculatePreferredSize, redisplay, refresh, removeListener, removeTimer, repaint, repaintNow, repaintNow, repaintNow, requestPaint, requestResizeTo, resetRect, restore, scrollAndRepaint, sendToListeners, set, setBorder, setCell, setClipObject, setControl, setCursor, setFixedSize, setFont, setHotKey, setHotKey, setLocation, setMaximumSize, setMenu, setMinimumSize, setPreferredSize, setPromptControl, setRect, setRect, setServer, setTag, setTags, setTextSize, setToolTip, show, shown, standardOnKeyEvent, startDragAndDrop, startDragAndDrop, startDragging, stopDragging, takeData, takeFromClipboard, testDim, ticked, toClipboard, toField, toField, toString, toTextData, transferPenPress, transferPenPress, tryDragAndDrop, tryNext, tryStartMenu, updateData, willAcceptDrop, willShowFrame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode
 
Methods inherited from interface ewe.ui.ScrollClient
getServer, setServer
 

Field Detail

cardPanel

public CardPanel cardPanel
This does the actual MultiPanel work. You can set cardPanel.autoScroll true or false as needed. By default cardPanel.autoScroll is true.


tabLocation

public int tabLocation
This should be NORTH/SOUTH/EAST/WEST (but only NORTH/SOUTH are currently supported)


extraControlsLeft

public Control extraControlsLeft
This is initially null. If you set it to a control, it will be added to the left of the tabs during the make.


extraControlsRight

public Control extraControlsRight
This is initially null. If you set it to a control, it will be added to the right of the tabs during the make.


noScrollButtons

public boolean noScrollButtons
This is false by default - set it true so that the left/right scroll buttons are never seen.


tabs

protected ewe.ui.TabsPanel tabs

top

protected CellPanel top

left

protected mButton left

right

protected mButton right

dontExpandTabs

public boolean dontExpandTabs
If this is true, then the tabs are not expanded to show both the icon AND the text when selected. Rather, only the closedIcon will be displayed. By default this is false.


dontFocusOnNextSelect

public boolean dontFocusOnNextSelect
Set this true if you dont want the focus to move to the Card on the next select(). It is set back to false after each select() call.

Constructor Detail

mTabbedPanel

public mTabbedPanel()
Method Detail

addItem

public Control addItem(Control item,
                       String tabName,
                       String longName)
Add a new item to the tabbed panel.

Specified by:
addItem in interface MultiPanel
Parameters:
item - The item to be added
tabName - The name to appear on the tab.
longName - A longer descriptive name for the tab. If this is null it will be set to tabName.
Returns:
The parameter item.

addCard

public Card addCard(Control item,
                    String tabName,
                    String longName)
Add a new item to the tabbed panel.

Parameters:
item - The item to be added
tabName - The name to appear on the tab.
longName - A longer descriptive name for the tab. If this is null it will be set to tabName.
Returns:
The Card created for the item.

select

public void select(Control item)
Description copied from interface: MultiPanel
This selects for display one of the previously added Controls.

Specified by:
select in interface MultiPanel

select

public void select(String tabName)
Description copied from interface: MultiPanel
This selects for display one of the previously added Controls, given the short (tab) name for the item.

Specified by:
select in interface MultiPanel

select

public void select(int index)
Description copied from interface: MultiPanel
This selects for display one of the previously added Controls, given the index of the item.

Specified by:
select in interface MultiPanel

getItem

public Card getItem(int index)
Description copied from interface: MultiPanel
This returns a Card object holding information about the item added at the specified index.

Specified by:
getItem in interface MultiPanel

getItem

public Card getItem(Control item)
Description copied from interface: MultiPanel
This returns a Card object holding information about the item added for the specified control.

Specified by:
getItem in interface MultiPanel

getSelectedItem

public int getSelectedItem()
Description copied from interface: MultiPanel
This returns the index for the currently selected item. It will return -1 if none is currently selected.

Specified by:
getSelectedItem in interface MultiPanel

getItemCount

public int getItemCount()
Description copied from interface: MultiPanel
This returns the number of items added to the MultiPanel.

Specified by:
getItemCount in interface MultiPanel

getFirstFocus

protected Control getFirstFocus()
Overrides:
getFirstFocus in class Container

getExtremeControls

public CellPanel getExtremeControls(boolean isLeft)
This gets a CellPanel to put extra controls in that will be further left or right of the container provided by getExtraControls().

Parameters:
isLeft - If the container goes on the left or right.
Returns:
The CellPanel to add your controls to.

getExtraControls

public CellPanel getExtraControls(boolean isLeft)
This gets a container to put extra controls in. These extra controls will either go the the left of the tabs (isLeft is true) or the right of the tabls (isLeft is false). If you are going to change tabLocation, do so before calling this.


setAutoExpand

public void setAutoExpand(SplittablePanel splittablePanel)
Call this AFTER setting the tabLocation to be NORTH or SOUTH (it is NORTH by default), but before doing a make(). You should use getExpandingTabbedPanel() instead to do all the hard work for you when creating an expanding tabbed panel.

Parameters:
splittablePanel - The SplittablePanel that contains the TabbedPanel.

make

public void make(boolean remake)
Description copied from class: Control
This is used to "make" the control before being displayed. This is usually only overridden by containers.

Overrides:
make in class CellPanel

doPaint

public void doPaint(Graphics g,
                    Rect r)
Overrides:
doPaint in class Control

checkLeftRight

public void checkLeftRight()

checkLeftRight

public void checkLeftRight(boolean dontAutoShift)

selectAndExpand

public void selectAndExpand(int which)

repaintTabs

public void repaintTabs()

newSelection

public void newSelection()

onControlEvent

public void onControlEvent(ControlEvent ev)
Overrides:
onControlEvent in class Control

gotFocus

public void gotFocus(int how)
This can only get focus explicitly - via focusOnTab, or via selectNextTab(). Normal navigation will always focus the control within it.

Overrides:
gotFocus in class Container

lostFocus

public void lostFocus(int how)
Overrides:
lostFocus in class Container

selectNextTab

public void selectNextTab(boolean forwards,
                          boolean focusOnTab)
Select the next tab. Additional verbose

Parameters:
forwards - true to move to the next tab, false to move to the previous one.
focusOnTab - true to move or keep the focus on the tabs.
Returns:

onKeyEvent

public void onKeyEvent(KeyEvent ev)
Overrides:
onKeyEvent in class Control

doHotKey

protected boolean doHotKey(Control from,
                           KeyEvent ev)
Description copied from class: Control
This method checks to see if a KeyEvent should be considered the Control's hot-key. If it is it calls doAction(ByKeyboard).

Overrides:
doHotKey in class Container

calculateSizes

protected void calculateSizes()
Description copied from class: CellPanel
Use this to add a control directly to the CellPanel. It makes it a child control immediately.

Overrides:
calculateSizes in class CellPanel

getExpandingTabbedPanel

public static Object[] getExpandingTabbedPanel(boolean above)
Use this to create a self-expanding mTabbedPanel. This actuall consists of a SplittablePanel which contiains an mTabbedPanel and an empty CellPanel. Selecting the tabs of the mTabbedPanel automatically opens and displays the panel.

Parameters:
above - set this to true if the mTabbedPanel should be above the CellPanel data, false if it should be below.
Returns:
An array of Objects which are as follows:
Index 0 = the mTabbedPanel itself - add items to it, but do not set the tabLocation.
Index 1 = the SplittablePanel that you should add to the destination container.
Index 2 = the empty CellPanel that you should add your other controls to.