courselog
Class AbstractImageDisplay

java.lang.Object
  extended by ewe.ui.ControlBase
      extended by ewe.ui.Control
          extended by courselog.AbstractImageDisplay
All Implemented Interfaces:
ewe.fx.ImageRefresher, ewe.sys.TimerProc, ewe.ui.CellConstants, ewe.ui.ControlConstants, ewe.ui.EventListener, ewe.ui.UIConstants
Direct Known Subclasses:
ImageBrowser, TiledMapBrowser

public abstract class AbstractImageDisplay
extends ewe.ui.Control

Class providing basic image display features. Allows to move, zoom.


Field Summary
protected  ActionKeysDispatcher akdC
          Dispatcher of action keys.
protected  double deltaScaleDisplay
          Modification of Scaling of display image.
protected  ewe.fx.Image dispImage
          Display image.
protected  int iEnterPressed
          Time Stamp of enter pressed.
protected  int imageDelta
          Origin displacement when directionkey is touched.
static int INTDBLPRESSMS
          Interval between double press on enter. in milliseconds (==400)
static int INTLGPRESSMS
          Interval for long press on enter or pen in milliseconds (==500).
protected  int iNumberEnterPressed
          Number of enter pressed.
protected  int iOX
          Display image X offset when dragged.
protected  int iOY
          Display image Y offset when dragged.
protected  int iStampWhenPressed
          Time stamp of pen press.
protected  ewe.ui.KeyEvent keEnter
          KeyEvent of first press on ENTER.
protected  boolean notPenDragged
          Flag to check if penDrag event took place.
protected  boolean notPenHeld
          Flag to check if penHeld event took place.
protected  ewe.fx.Point poBase
          Point in baseImage for pen actions.
protected  ewe.fx.Point poPress
          Point of first press on Pen.
protected  int tickerForEnter
          Ticker id when Enter key is pressed.
 
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.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
AbstractImageDisplay()
           
 
Method Summary
abstract  void actionOnPenClick(ewe.fx.Point p)
           
abstract  void actionOnPenHeld(ewe.fx.Point p)
           
 void directionButtonReleased(ewe.ui.KeyEvent kEv)
          (up,down,left,right) was released.
 void doPaint(ewe.fx.Graphics g, ewe.fx.Rect r)
          Paint this control.
 void doublePressEnter(ewe.ui.KeyEvent kEv)
          Double press on enter, does nothing.
 void downButtonPressed(ewe.ui.KeyEvent kEv)
          Down button pressed, moves down the origin of the picture.
 void leftButtonPressed(ewe.ui.KeyEvent kEv)
          Left button pressed, moves left the origin of the picture.
 void longPressEnter(ewe.ui.KeyEvent kEv)
          Long press on enter, zoom out of the picture.
 void moveImage(int dx, int dy)
          Move picture quickly on the display.
 void onEvent(ewe.ui.Event ev)
          Handle properly key end pen events.
 void penDrag(ewe.ui.PenEvent pEv)
          Pen is dragged on the image.
 void penHeld(ewe.fx.Point p)
          When pen is pressed on the image, the image moves with it.
 void penPressed(ewe.fx.Point p)
          When pen is pressed on the image, the image moves with it.
 void penReleased(ewe.fx.Point p)
          When pen is released, either it is the end of a click (short or long), either it is the end of a drag.
abstract  void rescaleImage(double byFactor)
          Rescale the displayed image by a given factor.
 void rightButtonPressed(ewe.ui.KeyEvent kEv)
          Right button pressed, moves right the origin of the picture.
 void setActionKeyDispatcher(ActionKeysDispatcher akdC)
          This display can handle action keys if this method is called.
 void shortPressEnter(ewe.ui.KeyEvent kEv)
          Short press on enter, does a zoom in of the picture.
 void ticked(int id, int elapsed)
          Get the tick for the double press on enter, otherwise, pass to super.
 void upButtonPressed(ewe.ui.KeyEvent kEv)
          Up button pressed, moves up the origin of the picture.
abstract  void updateDisplayedImage(ewe.fx.Rect r, int opt)
           
 
Methods inherited from class ewe.ui.Control
acceptsData, activate, addListener, addTimer, amOnTopFrame, calculateSizes, 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, doBackground, doBorder, doHotKey, doMenu, dontAcceptDrop, doPaintChildren, doPaintChildren, doPaintChildren, doPaintData, doPaintData, doShowMenu, dragged, exitEntry, fillBackground, formClosing, fromClipboard, fromField, fromField, getAllDescendants, getAllSubControls, getBackground, getChildren, getChildrenBackwards, 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, getNextKeyFocus, getParent, getPasswordCharacter, getPosInFrame, getPosInParent, getPreferredSize, getPrompt, getPromptText, getRect, getRect, getServer, getSize, getSizes, getSubControls, getTag, getText, getToolTip, getWindow, gotFocus, hasModifier, hasPopupFormAttached, hasTag, inheritModifiers, isChildOf, isModal, isOnMe, isSomeonesHotKey, lostFocus, make, makeFrameTopMost, makeHot, menuIsActive, modify, modifyAll, modifyAll, notifyAction, notifyDataChange, notifyDataChange, notNative_doPaintChildren, oldButWorksDoPaintChildren, oldPaintChildren, oldPostEvent, onControlEvent, onKeyEvent, onLabelPenEvent, onPaint, onPenEvent, paintBackground, paintChildren, penClicked, penDoubleClicked, penRightReleased, popupBeep, popupMenuClosed, popupMenuEvent, popupMenuEvent, postEvent, recalculatePreferredSize, redisplay, refresh, removeListener, removeTimer, repaint, repaintDataNow, repaintNow, repaintNow, repaintNow, requestPaint, requestResizeTo, resetRect, resizeTo, 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, startDragging, stopDragging, takeData, takeFocus, takeFromClipboard, takePromptControl, testDim, 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, notify, notifyAll, wait, wait, wait
 

Field Detail

INTLGPRESSMS

public static final int INTLGPRESSMS
Interval for long press on enter or pen in milliseconds (==500).

See Also:
Constant Field Values

INTDBLPRESSMS

public static final int INTDBLPRESSMS
Interval between double press on enter. in milliseconds (==400)

See Also:
Constant Field Values

dispImage

protected ewe.fx.Image dispImage
Display image.


deltaScaleDisplay

protected double deltaScaleDisplay
Modification of Scaling of display image.


imageDelta

protected int imageDelta
Origin displacement when directionkey is touched.


iOX

protected int iOX
Display image X offset when dragged.


iOY

protected int iOY
Display image Y offset when dragged.


iEnterPressed

protected int iEnterPressed
Time Stamp of enter pressed.


iNumberEnterPressed

protected int iNumberEnterPressed
Number of enter pressed.


tickerForEnter

protected int tickerForEnter
Ticker id when Enter key is pressed.


keEnter

protected ewe.ui.KeyEvent keEnter
KeyEvent of first press on ENTER.


akdC

protected ActionKeysDispatcher akdC
Dispatcher of action keys.


poPress

protected ewe.fx.Point poPress
Point of first press on Pen.


iStampWhenPressed

protected int iStampWhenPressed
Time stamp of pen press.


notPenHeld

protected boolean notPenHeld
Flag to check if penHeld event took place.


notPenDragged

protected boolean notPenDragged
Flag to check if penDrag event took place.


poBase

protected ewe.fx.Point poBase
Point in baseImage for pen actions.

Constructor Detail

AbstractImageDisplay

public AbstractImageDisplay()
Method Detail

moveImage

public void moveImage(int dx,
                      int dy)
Move picture quickly on the display.

Parameters:
dx - move in x direction.
dy - move in y direction.

penDrag

public void penDrag(ewe.ui.PenEvent pEv)
Pen is dragged on the image.

Parameters:
pEv - Gives the pen position.

setActionKeyDispatcher

public void setActionKeyDispatcher(ActionKeysDispatcher akdC)
This display can handle action keys if this method is called.

Parameters:
akdC - Dispatcher to use. If null, no action.

upButtonPressed

public void upButtonPressed(ewe.ui.KeyEvent kEv)
Up button pressed, moves up the origin of the picture.

Parameters:
kEv - Key generating the move.

downButtonPressed

public void downButtonPressed(ewe.ui.KeyEvent kEv)
Down button pressed, moves down the origin of the picture.

Parameters:
kEv - Key generating the move.

leftButtonPressed

public void leftButtonPressed(ewe.ui.KeyEvent kEv)
Left button pressed, moves left the origin of the picture.

Parameters:
kEv - Key generating the move.

rightButtonPressed

public void rightButtonPressed(ewe.ui.KeyEvent kEv)
Right button pressed, moves right the origin of the picture.

Parameters:
kEv - Key generating the move.

directionButtonReleased

public void directionButtonReleased(ewe.ui.KeyEvent kEv)
(up,down,left,right) was released. Update completely the image. Calls a updateDisplayedImage(null,0).

Parameters:
kEv - Key generating the move.
See Also:
updateDisplayedImage(Rect,int)

longPressEnter

public void longPressEnter(ewe.ui.KeyEvent kEv)
Long press on enter, zoom out of the picture.

Parameters:
kEv - Key generating the move.

shortPressEnter

public void shortPressEnter(ewe.ui.KeyEvent kEv)
Short press on enter, does a zoom in of the picture.

Parameters:
kEv - Key generating the move.

doublePressEnter

public void doublePressEnter(ewe.ui.KeyEvent kEv)
Double press on enter, does nothing. Override this to take an action.

Parameters:
kEv - Key generating the move.

onEvent

public void onEvent(ewe.ui.Event ev)
Handle properly key end pen events.

Specified by:
onEvent in interface ewe.ui.EventListener
Overrides:
onEvent in class ewe.ui.Control
Parameters:
ev - Event.

doPaint

public void doPaint(ewe.fx.Graphics g,
                    ewe.fx.Rect r)
Paint this control.

Overrides:
doPaint in class ewe.ui.Control
Parameters:
g - Graphic context.
r - rectangle to repaint.

ticked

public void ticked(int id,
                   int elapsed)
Get the tick for the double press on enter, otherwise, pass to super.

Specified by:
ticked in interface ewe.sys.TimerProc
Overrides:
ticked in class ewe.ui.Control
Parameters:
id - the event of the tick.
elapsed - milliseconds elapsed.

penReleased

public void penReleased(ewe.fx.Point p)
When pen is released, either it is the end of a click (short or long), either it is the end of a drag. Call the appropriate methods or update the image if it has been dragged.

Overrides:
penReleased in class ewe.ui.Control

penHeld

public void penHeld(ewe.fx.Point p)
When pen is pressed on the image, the image moves with it.

Overrides:
penHeld in class ewe.ui.Control

penPressed

public void penPressed(ewe.fx.Point p)
When pen is pressed on the image, the image moves with it.

Overrides:
penPressed in class ewe.ui.Control
Parameters:
p - point where it was pressed.

actionOnPenHeld

public abstract void actionOnPenHeld(ewe.fx.Point p)

actionOnPenClick

public abstract void actionOnPenClick(ewe.fx.Point p)

updateDisplayedImage

public abstract void updateDisplayedImage(ewe.fx.Rect r,
                                          int opt)

rescaleImage

public abstract void rescaleImage(double byFactor)
Rescale the displayed image by a given factor. This is not supposed to update the displayed image, only to apply some factor.