ewe.ui
Class SplittablePanel

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.SplittablePanel
All Implemented Interfaces:
CellConstants, ControlConstants, EventListener, ImageRefresher, IScroll, LayoutManager, ScrollClient, TimerProc, UIConstants

public class SplittablePanel
extends CellPanel

This class supports a moveable PanelSplitter between two CellPanels. ONLY two CellPanels are supported - any attempt to create more will throw a RuntimeException. Call getNextPanel() twice to get the two panels in left-to-right or top-to-bottom order.

After you get the two panels, you can set up the open/closed and initial state of the splitter (the bar between the two panels). The splitter is "open" when it is extended to a predefined location to the right/down and "closed" when it is brought back to a predefined location to the left/up. The splitter is toggled between these points when the user clicks the bar or when doOpenClose() is called on the splitter.

The exact location of the open and closed locations is specified by a value that consists of either PanelSplitter.BEFORE or PanelSplitter.AFTER, bitwised ORed with one of the values: PanelSplitter.MIN_SIZE, PanelSplitter.PREFERRED_SIZE, PanelSplitter.HIDDEN.

The BEFORE/AFTER value indicates that the limit depends on the size of the control before (left/above) or after (right/below) the splitter. The other values indicate that either the minimum size or preferred size of the before/after control should be used as the limit, or HIDDEN indicates that the control should be completely hidden.

The initial state of the splitter can be PanelSplitter.OPENED or PanelSplitter.CLOSED or 0(indicating the splitter should be placed proportionally between the two controls).

Use setSplitter(int openState,int closeState,int initialState) to set the open/closed/initial state of the splitter. For example:

        sp.setSplitter(PanelSplitter.AFTER|PanelSplitter.HIDDEN,PanelSplitter.BEFORE|PanelSplitter.HIDDEN,0);
This will set the splitter such that when it is open the control after the splitter is completely hidden, and when it is closed the control before the splitter is completely hidden. The initial state will show both controls.

        sp.setSplitter(PanelSplitter.BEFORE|PanelSplitter.PREFERRED_SIZE,PanelSplitter.BEFORE|PanelSplitter.MIN_SIZE,PanelSplitter.CLOSED);
This will set the splitter such that when it is open the control before the splitter is shown at its preferred size, and when it is closed the control before the splitter is shown at its minimum size.

By default the open type of the splitter is AFTER|MIN_SIZE and the closed type is BEFORE|MIN_SIZE.

These open and closed positions do not put a limit on the range of motion of the splitter when being dragged by the user. The user can drag the splitter to the full on-screen limits.


Field Summary
static int DONT_STRETCH_CONTENTS
          This is an option for getNextPanel().
static int HORIZONTAL
           
 PanelSplitter theSplitter
          This is created when the SplittablePanel is created, and is then added as a child during the first call to getNextPanel().
 int type
          The type of the PanelSplitter.
static int VERTICAL
           
 
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
SplittablePanel(int type)
          Create an new SplittablePanel.
 
Method Summary
 CellPanel getNextPanel()
          Create and return the next cell panel either before or after the splitter.
 CellPanel getNextPanel(int options)
          Return a new section in the SplittablePanel.
 PanelSplitter setSplitter(int openType, int closeType, int initialState)
          Define the "opened" and "closed" state of the splitter along with its initial state.
 
Methods inherited from class ewe.ui.CellPanel
calculateSizes, make, 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, doHotKey, findChild, focusFirst, focusFirst, focusOnContainer, focusOnData, getChildren, getChildrenBackwards, getFirstFocus, getNextKeyFocus, gotFocus, lostFocus, 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, doPaint, 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, onControlEvent, onKeyEvent, 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

VERTICAL

public static final int VERTICAL

HORIZONTAL

public static final int HORIZONTAL

DONT_STRETCH_CONTENTS

public static final int DONT_STRETCH_CONTENTS
This is an option for getNextPanel(). It indicates that the defaultAddToMeCellConstraints of the retrieved panel should be set to DONT_STRETCH.

See Also:
Constant Field Values

type

public int type
The type of the PanelSplitter. Either HORIZONTAL or VERTICAL.


theSplitter

public PanelSplitter theSplitter
This is created when the SplittablePanel is created, and is then added as a child during the first call to getNextPanel().

Constructor Detail

SplittablePanel

public SplittablePanel(int type)
Create an new SplittablePanel.

Parameters:
type - This can be VERTICAL or HORIZONTAL
Method Detail

getNextPanel

public CellPanel getNextPanel(int options)
Return a new section in the SplittablePanel.

Parameters:
options - can be DONT_STRETCH_CONTENTS.
Returns:
A new CellPanel.

getNextPanel

public CellPanel getNextPanel()
Create and return the next cell panel either before or after the splitter. This will throw a runtime exception if it is called more than twice.

Returns:
A new CellPanel.

setSplitter

public PanelSplitter setSplitter(int openType,
                                 int closeType,
                                 int initialState)
Define the "opened" and "closed" state of the splitter along with its initial state. Call this after calling getNextPanel() twice - calling it before will throw a RuntimeException

Parameters:
openType - This sould be (PanelSplitter.BEFORE or PanelSplitter.AFTER) OR'ed with one of (PanelSplitter.PREFERRED_SIZE or PanelSplitter.MINIMUM_SIZE or PanelSplitter.HIDDEN).
closeType - This sould be (PanelSplitter.BEFORE or PanelSplitter.AFTER) OR'ed with one of (PanelSplitter.PREFERRED_SIZE or PanelSplitter.MINIMUM_SIZE or PanelSplitter.HIDDEN).
initialState - This should be PanelSplitter.OPENED or PanelSplitter.CLOSED or 0.
Returns:
The PanelSplitter for this SplittablePanel.