ewe.ui
Class Panel

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

public class Panel
extends Canvas
implements CellConstants, LayoutManager

A Panel is a general Container that is simpler than a CellPanel and which uses a Layout manager to layout it components. While it is not as flexible as a CellPanel and cannot support advanced features such as PanelSplitters it is faster than a CellPanel when laying out its controls.


Field Summary
protected  Vector all
           
 Image backgroundImage
          This is an optional background image to display.
protected  boolean calculated
           
protected  Vector childListeners
           
 int defaultAddToMeCellConstraints
          The default cell constraints when controls are added to the Panel.
 TagList defaultTags
          This contains default Tag values for the controls added to the Panel.
protected  Grid grid
           
protected  Control lastAdded
           
 LayoutManager layoutManager
          This is the LayoutManager being used by the Panel.
protected  boolean made
           
protected static Insets noInsets
           
 boolean stretchFirstColumn
          This is only used if the Panel is acting as its own LayoutManager - which it is by default.
 boolean stretchFirstRow
          This is only used if the Panel is acting as its own LayoutManager - which it is by default.
 boolean stretchLastColumn
          This is only used if the Panel is acting as its own LayoutManager - which it is by default.
 boolean stretchLastRow
          This is only used if the Panel is acting as its own LayoutManager - which it is by default.
protected  int 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
Panel()
          Create a new Panel which uses itself to layout components.
Panel(LayoutManager layout)
          Create a new Panel which uses a specific layout manager.
 
Method Summary
 Control add(Control c, int x, int y, int width, int height)
           
 void addChildListener(EventListener list)
           
 void addDirectly(Control c)
          Use this to add a control directly to the Panel.
 Control addLast(Control c)
           
 Control addLast(Control c, int cellConstraints, int controlConstraints)
           
 Control addNext(Control c)
           
 Control addNext(Control c, boolean last)
           
 Control addNext(Control c, int cellConstraints, int controlConstraints)
           
protected  void calculateSizes()
          Override this to calculate the preferred, minimum and maximum size of your control.
 void doBackground(Graphics g)
           
 void doBorder(Graphics g)
           
 Control endRow()
           
 Object getControlTag(int tag, Control c, Object defaultValue)
           
 Dimension getPreferredSize(Grid controls, Panel panel, Dimension destination)
           
 Iterator getSubControls()
           
 boolean isEmpty()
           
 void layout(Grid controls, Panel panel, Rect panelRect)
           
 void make(boolean reMake)
          This is used to "make" the control before being displayed.
 void relayout(boolean redisplay)
          Force a recalculation of all preferredSize() and resizing/positioning of the panel.
 void relayoutMe(boolean redisplay)
          This forces a recalculation of my preferred size, but not those of my children.
 void remove(Control c)
          Removes a child control from the container.
 void removeChildListener(EventListener list)
           
 void reShow(int x, int y, int toWidth, int toHeight)
           
 void resizeTo(int width, int height)
          This will change the width and height values.
 void sendToChildListeners(Event ev)
           
 void setText(String text)
          Calling setText() on a CellPanel gives it a labelled etched border.
 
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, removeAll, 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, onEvent, 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

noInsets

protected static Insets noInsets

defaultTags

public TagList defaultTags
This contains default Tag values for the controls added to the Panel. The only Tag used by Panel is the INSETS tag, which must contain an ewe.fx.Insets object value.


defaultAddToMeCellConstraints

public int defaultAddToMeCellConstraints
The default cell constraints when controls are added to the Panel. The default value is STRETCH


grid

protected Grid grid

stretchFirstColumn

public boolean stretchFirstColumn
This is only used if the Panel is acting as its own LayoutManager - which it is by default. It tells it to stretch the first column to fill the width of the Panel - it is false by default. If it is set true it will override stretchLastColumn.


stretchFirstRow

public boolean stretchFirstRow
This is only used if the Panel is acting as its own LayoutManager - which it is by default. It tells it to stretch the first row to fill the height of the Panel - it is false by default. If it is set true it will override stretchLastRow.


stretchLastColumn

public boolean stretchLastColumn
This is only used if the Panel is acting as its own LayoutManager - which it is by default. It tells it to stretch the last column to fill the width of the Panel - it is true by default.


stretchLastRow

public boolean stretchLastRow
This is only used if the Panel is acting as its own LayoutManager - which it is by default. It tells it to stretch the last row to fill the height of the Panel - it is true by default.


layoutManager

public LayoutManager layoutManager
This is the LayoutManager being used by the Panel. By default it will be the Panel itself. You can set this via a direct assignment.


backgroundImage

public Image backgroundImage
This is an optional background image to display.


childListeners

protected Vector childListeners

all

protected Vector all

lastAdded

protected Control lastAdded

made

protected boolean made

calculated

protected boolean calculated

titleGap

protected int titleGap
Constructor Detail

Panel

public Panel()
Create a new Panel which uses itself to layout components.


Panel

public Panel(LayoutManager layout)
Create a new Panel which uses a specific layout manager.

Method Detail

isEmpty

public boolean isEmpty()

getControlTag

public Object getControlTag(int tag,
                            Control c,
                            Object defaultValue)

add

public Control add(Control c,
                   int x,
                   int y,
                   int width,
                   int height)

addNext

public Control addNext(Control c,
                       boolean last)

addLast

public Control addLast(Control c)

addNext

public Control addNext(Control c)

endRow

public Control endRow()

addNext

public Control addNext(Control c,
                       int cellConstraints,
                       int controlConstraints)

addLast

public Control addLast(Control c,
                       int cellConstraints,
                       int controlConstraints)

setText

public void setText(String text)
Calling setText() on a CellPanel gives it a labelled etched border.

Overrides:
setText in class Control

addChildListener

public void addChildListener(EventListener list)

removeChildListener

public void removeChildListener(EventListener list)

sendToChildListeners

public void sendToChildListeners(Event ev)

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 Control
Parameters:
reMake - if this is true then you should do a full re-make.

layout

public void layout(Grid controls,
                   Panel panel,
                   Rect panelRect)
Specified by:
layout in interface LayoutManager

getPreferredSize

public Dimension getPreferredSize(Grid controls,
                                  Panel panel,
                                  Dimension destination)
Specified by:
getPreferredSize in interface LayoutManager

addDirectly

public void addDirectly(Control c)
Use this to add a control directly to the Panel. It makes it a child control immediately.

Overrides:
addDirectly in class Container

remove

public void remove(Control c)
Description copied from class: Container
Removes a child control from the container.

Overrides:
remove in class Container

getSubControls

public Iterator getSubControls()
Overrides:
getSubControls in class Control

calculateSizes

protected void calculateSizes()
Description copied from class: Control
Override this to calculate the preferred, minimum and maximum size of your control. This is only called once unless the modifier flag AlwaysRecalculateSizes is true. During the calculation you will set the variables preferredWidth, preferredHeight, etc. directly.

Overrides:
calculateSizes in class Control

doBackground

public void doBackground(Graphics g)
Overrides:
doBackground in class Control

resizeTo

public void resizeTo(int width,
                     int height)
Description copied from class: Control
This will change the width and height values.

Overrides:
resizeTo in class Control

doBorder

public void doBorder(Graphics g)
Overrides:
doBorder in class Canvas

relayout

public void relayout(boolean redisplay)
Force a recalculation of all preferredSize() and resizing/positioning of the panel.


reShow

public void reShow(int x,
                   int y,
                   int toWidth,
                   int toHeight)

relayoutMe

public void relayoutMe(boolean redisplay)
This forces a recalculation of my preferred size, but not those of my children.