ewe.ui
Class TreeControl

java.lang.Object
  extended byewe.ui.ControlBase
      extended byewe.ui.Control
          extended byewe.ui.Container
              extended byewe.ui.TableControl
                  extended byewe.ui.TreeControl
All Implemented Interfaces:
CellConstants, ControlConstants, EventListener, ImageRefresher, IScroll, ScrollClient, Selectable, TimerProc, UIConstants

public class TreeControl
extends TableControl
implements Selectable


Nested Class Summary
static class TreeControl.ControlTreeNode
           
 
Field Summary
 boolean doSelections
           
 
Fields inherited from class ewe.ui.TableControl
allowClipboardOperations, allowDragSelection, autoScrollToVisible, clickClearsItself, clickedFlags, clickMode, cursor, extendedSelection, listMode, model, multiSelect, oldExtendedSelection, oldSelection, penSelectMode, selection
 
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.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.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.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
TreeControl()
           
 
Method Summary
 void cursorTo(int row, boolean selectNew)
           
 void cursorTo(int row, int col, boolean selectNew)
           
protected  void dataAccepted(Control byWho, Object data, String action)
          This is called either when data that was cut from this control was pasted into another control, OR when data that was dragged from this control is dropped into another control.
protected  void dataBeingRemoved(Object data, DragContext dc)
          This tells the control that data is being removed from it either via a cut operation or by a drag operation that is not explicitly a copy operation.
protected  void dataTransferCancelled(Object data)
          This gets called either when that was cut from this control was not placed into another control (either it was rejected by a paste or a subsequent copy/cut into the clipboard occured before the data was pasted) or a drag and drop was initiated but not completed.
 void deleteAndUpdate(MutableTreeNode child, MutableTreeNode parent)
           
 boolean deleteSelection()
           
 boolean doMenu(Point where)
          This is a request to display a menu based on the pen being held or the mouse being right clicked on the Control.
 boolean getDataToDragAndDrop(DragContext dc)
          A quick way to provide DragAndDrop data.
 Point getSelectedCell(Point dest)
          This returns a single selected cell.
 Object getSelection()
           
 TreeTableModel getTreeTableModel()
           
 boolean hasSelection()
           
 int indexOfPoint(int x, int y)
           
 boolean noSelection()
           
 void onKeyEvent(KeyEvent ev)
           
 void paintLine(int index)
           
 void penClicked(Point p)
          Called if the Pen or Mouse button is quickly pressed and released.
 void penDoubleClicked(Point p)
          Called if the Pen or Mouse button is double clicked on the Control.
 void penPressed(Point p)
          Called when the Pen or Mouse button is pressed on the control.
 void penReleased(Point p)
          Called when the Pen or Mouse button is released on the control.
 boolean replaceSelection(Object with)
           
 boolean scrollToVisible(int index)
           
 void setData(Object data)
           
 void startDragging(DragContext dc)
          This is called to indicate the start of a pen/mouse drag operation.
 void updateInsertion(TreeNode insertedChild)
           
 
Methods inherited from class ewe.ui.TableControl
addToSelection, addToSelection, addToSelection, calculateSizes, canGo, canSelect, cellAtPoint, cellAtPoint, changeOrigin, checkFirstKey, clearCursor, clearSelectedBlock, clearSelectedCells, clearSelection, clearSelection, clicked, doHotKey, doPaint, doPaintChildren, doScroll, doubleClicked, dragged, findSelectedBlock, fireClickedEvent, fireSelectionEvent, fireSelectionEvent, firstCellToPaint, getActual, getCurrent, getCursorSize, getDataArea, getFirstFocus, getLastColToShow, getLastColToShow, getLastRowToShow, getLastRowToShow, getOnScreen, getOnScreen, getPageUp, getScreenRect, getSelectedCells, getSelectedIndexes, getSelection, getTableModel, getToolTip, getVisible, inRect, invertSelectedIndexes, isASelection, isIn, isSelected, isVisible, make, multipleSelected, needScrollBar, onPenEvent, overColStretch, overrideAttributes, overRowStretch, paintBackground, paintCells, paintCells, paintSelectedCells, paintSelection, penReleased, popupMenuEvent, repaintCell, repaintNow, resizeTo, scrollToVisible, selectAllIndexes, selectAndUpdate, selectAndUpdate, setClickMode, setTableModel, startDropMenu, startNewSelectionBlock, stopDragging, update, updateControls
 
Methods inherited from class ewe.ui.Container
_paintChildren, add, addDirectly, containerHasFocus, dismantle, dismantle, findChild, focusFirst, focusFirst, focusOnContainer, focusOnData, getChildren, getChildrenBackwards, getNextKeyFocus, gotFocus, lostFocus, remove, removeAll, repaintDataNow, scrollToVisible, 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, dataDraggedOff, dataDraggedOver, dataDraggedOver, dataDroppedOn, deactivate, defaultTo, doAction, doActionKey, doBackground, doBorder, dontAcceptDrop, doPaintChildren, doPaintChildren, doPaintData, doPaintData, doShowMenu, exitEntry, fillBackground, formClosing, fromClipboard, fromField, fromField, getAllDescendants, getAllSubControls, getBackground, getClipboardMenu, getClipObject, getControlBuffer, getControlBuffer, getDataRect, getDataToCopy, 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, getSubControls, getTag, getText, 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, onLabelPenEvent, onPaint, paintChildren, penHeld, penRightReleased, popupBeep, popupMenuClosed, popupMenuEvent, postEvent, recalculatePreferredSize, redisplay, refresh, removeListener, removeTimer, repaint, 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, setText, setTextSize, setToolTip, show, shown, standardOnKeyEvent, startDragAndDrop, startDragAndDrop, 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

doSelections

public boolean doSelections
Constructor Detail

TreeControl

public TreeControl()
Method Detail

getTreeTableModel

public TreeTableModel getTreeTableModel()

getSelectedCell

public Point getSelectedCell(Point dest)
Description copied from class: TableControl
This returns a single selected cell. It will work for TreeControls as well as TableControls. It will return null if no cell is selected.

Overrides:
getSelectedCell in class TableControl

setData

public void setData(Object data)

scrollToVisible

public boolean scrollToVisible(int index)

penPressed

public void penPressed(Point p)
Description copied from class: Control
Called when the Pen or Mouse button is pressed on the control. This is called by the onPenEvent(PenEvent ev) method.

Within this method you can use the Control.currentPenEvent value to find out more about the PenEvent that caused this - including any modifiers (e.g. SHIFT keys) or determine if the left or right mouse button was pressed.

Overrides:
penPressed in class TableControl

getDataToDragAndDrop

public boolean getDataToDragAndDrop(DragContext dc)
Description copied from class: Control
A quick way to provide DragAndDrop data. This will be called from tryDragAndDrop() which itself may be called from the startDragging() method.

To setup the DragContext you should set the dataToDrag, isMultiple and isCopy and (optionally) the dragCursor value.

Overrides:
getDataToDragAndDrop in class Control
Parameters:
dc - the DragContext to setup for the drag and drop operation.
Returns:
true if the data was successfully provided to drag and drop in the DragContext. false if there is no data to drag.

startDragging

public void startDragging(DragContext dc)
Description copied from class: Control
This is called to indicate the start of a pen/mouse drag operation. This will only get called if the WantDrag modifier has been set for this control. Within this method you can call startDragAndDrop() or tryDragAndDrop() to begin a data DragAndDrop operation.

Overrides:
startDragging in class TableControl

penDoubleClicked

public void penDoubleClicked(Point p)
Description copied from class: Control
Called if the Pen or Mouse button is double clicked on the Control. This is called by the onPenEvent(PenEvent ev) method.

Within this method you can use the Control.currentPenEvent value to find out more about the PenEvent that caused this - including any modifiers (e.g. SHIFT keys) or determine if the left or right mouse button was pressed.

By default this method simply calls the penClicked() method.

Overrides:
penDoubleClicked in class TableControl

penClicked

public void penClicked(Point p)
Description copied from class: Control
Called if the Pen or Mouse button is quickly pressed and released. This is called by the onPenEvent(PenEvent ev) method.

Within this method you can use the Control.currentPenEvent value to find out more about the PenEvent that caused this - including any modifiers (e.g. SHIFT keys) or determine if the left or right mouse button was pressed.

By default this method simply calls the penReleased() method.

Overrides:
penClicked in class Control
Parameters:
p - The point on the Control where the pen was clicked.

penReleased

public void penReleased(Point p)
Description copied from class: Control
Called when the Pen or Mouse button is released on the control. This is called by the onPenEvent(PenEvent ev) method.

Within this method you can use the Control.currentPenEvent value to find out more about the PenEvent that caused this - including any modifiers (e.g. SHIFT keys) or determine if the left or right mouse button was pressed.

Overrides:
penReleased in class TableControl

indexOfPoint

public int indexOfPoint(int x,
                        int y)

paintLine

public void paintLine(int index)

doMenu

public boolean doMenu(Point where)
Description copied from class: Control
This is a request to display a menu based on the pen being held or the mouse being right clicked on the Control. By default this method calls tryStartMenu(p);

Overrides:
doMenu in class TableControl

cursorTo

public void cursorTo(int row,
                     int col,
                     boolean selectNew)
Overrides:
cursorTo in class TableControl

cursorTo

public void cursorTo(int row,
                     boolean selectNew)

onKeyEvent

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

noSelection

public boolean noSelection()
Specified by:
noSelection in interface Selectable

replaceSelection

public boolean replaceSelection(Object with)
Specified by:
replaceSelection in interface Selectable

deleteSelection

public boolean deleteSelection()
Specified by:
deleteSelection in interface Selectable

getSelection

public Object getSelection()
Specified by:
getSelection in interface Selectable

hasSelection

public boolean hasSelection()
Specified by:
hasSelection in interface Selectable

dataBeingRemoved

protected void dataBeingRemoved(Object data,
                                DragContext dc)
Description copied from class: Control
This tells the control that data is being removed from it either via a cut operation or by a drag operation that is not explicitly a copy operation. If the object is a Selectable object, then by default this will call delete selection. If you want more advanced operations (e.g. graying out the selection) you need to override this. If DragContext is null, it implies that it is via a "cut" operation, otherwise it is via a drag.

Overrides:
dataBeingRemoved in class Control

dataTransferCancelled

protected void dataTransferCancelled(Object data)
Description copied from class: Control
This gets called either when that was cut from this control was not placed into another control (either it was rejected by a paste or a subsequent copy/cut into the clipboard occured before the data was pasted) or a drag and drop was initiated but not completed.

Overrides:
dataTransferCancelled in class Control
Parameters:
data - The data that was being transferred. If it is null it indicates that this Control was a destination for a Drag and Drop operation, but the operation was cancelled by the user.

dataAccepted

protected void dataAccepted(Control byWho,
                            Object data,
                            String action)
Description copied from class: Control
This is called either when data that was cut from this control was pasted into another control, OR when data that was dragged from this control is dropped into another control.

Overrides:
dataAccepted in class Control
Parameters:
byWho - The Control that accepted the data.
data - The data being transferred.
action - This is either "copy" or "move" indicating if the data is meant to be copied to the other control or moved to the other Control.

deleteAndUpdate

public void deleteAndUpdate(MutableTreeNode child,
                            MutableTreeNode parent)

updateInsertion

public void updateInsertion(TreeNode insertedChild)