ewe.ui.formatted
Class TextDisplay

java.lang.Object
  extended byewe.ui.ControlBase
      extended byewe.ui.Control
          extended byewe.ui.EditControl
              extended byewe.ui.mTextPad
                  extended byewe.ui.formatted.TextDisplay
All Implemented Interfaces:
AniImage.ImageRefresher, CellConstants, ControlConstants, EventListener, ImageRefresher, IScroll, ScrollClient, Selectable, TimerProc, UIConstants
Direct Known Subclasses:
HtmlDisplay

public class TextDisplay
extends mTextPad
implements AniImage.ImageRefresher


Nested Class Summary
 class TextDisplay.HotSpotEvent
           
 
Field Summary
 Color hotColor
          The color for hot spots.
static int LINES_SPLIT
          This is a type of Control event.
protected  TextFormatter mouseOver
           
 
Fields inherited from class ewe.ui.mTextPad
allowOverwrite, amScrolling, backgroundImage, blockBuffer, charWidth, curState, disableCursor, disableTextChanges, dls, dontWantPopup, extraLineSpacing, forcedActualWidth, format, inputState, itemBuffer, leftMargin, lineHeight, lines, minXScroll, minYScroll, numLines, rightMargin, selectAllOnFocus, spacing, STATE_AUTOTAB, STATE_OVERWRITE, wantReturn, wrapToScreenSize
 
Fields inherited from class ewe.ui.EditControl
blinkId, CASE_LOWER, CASE_NORMAL, CASE_NUMBERS, CASE_SENTENCE, CASE_UPPER, colors, conditionalChar, conditionalCharIndex, doingLocalInput, doingNativeInput, FLAG_INPUT_ON_FOCUS, FLAG_KEEP_FOCUS_AFTER_INPUT, FLAG_PASSIVE, FLAG_USE_NATIVE, inFocus, inputFlags, inputMethod, justGotFocus, oldText, pageColor, startNativeOnPaint, textCase, validator
 
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, 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
TextDisplay()
           
TextDisplay(int rows, int columns)
           
 
Method Summary
 TextFormatter addTextFormatter(int lineIndex, int numLines, int fontFlags, int lineFlags)
           
 TextFormatter addTextFormatter(int lineIndex, int characterIndex, int length, int fontFlags, int lineFlags)
           
 TextFormatter addTextFormatter(int lineIndex, int characterIndex, int length, TextFormatter dest)
           
 TextFormatter addTextFormatter(int indexInFullText, int length, TextFormatter dest)
           
 TextFormatter addTextFormatter(TextFormatter formatter)
           
protected  void applySpecialFormat(int formatIndex, int lineIndex, DisplayLine theLine, FormattedTextSpecs format)
           
 void clearHistory()
          Clear the goBack history.
 void clearTextFormatters()
           
 void deleteLastHistory()
           
 void displayPropertiesChanged()
          Call this to indicate that something about the display has changed.
protected  void drawSpecialFormat(int formatIndex, int lineIndex, DisplayLine theLine, FormattedTextSpecs format, Graphics g, Color background)
           
 void formattersSet()
          This tells the TextDisplay that formatters have been set and so it can optimize itself based on this.
 void formClosing()
          This is called to indicate that the Form is about to close and it causes a FormClosed event to be posted.
protected  void getColors(boolean hasFocus, int flags)
          Provides the colors to be used for the text and background colors.
protected  int getSpecialFormatCount(int lineIndex, DisplayLine theLine)
           
 TextFormatter getTextFormatter(Point onControl)
           
 Vector getTextFormatter(Point onControl, Vector dest)
           
 Iterator getTextFormatters()
           
 Object getToolTip(int x, int y)
          This should return an acceptable ToolTip object.
 void goBack()
          This goes back one place in the saved states for the HtmlDisplay.
 boolean goToAnchor(String anchorName)
          This tells the display to go to the specified anchor.
 boolean goToLine(int line)
          Scroll to the specified line.
protected  boolean hotspotPressed(HotSpot hs, Point where)
           
 void imageSet(TextFormatter formatter)
           
 void markHistory()
          Mark the current location in the goBack history.
protected  void mouseMovedOnOff(TextFormatter tf, boolean movedOn)
           
 void onPenEvent(PenEvent ev)
          Called to handle an incoming PenEvent.
 void penPressed(Point where)
          Called when the Pen or Mouse button is pressed on the control.
 void refresh(AniImage image)
           
 void repaintDataNow()
          Repaint the "data" part of the Control now.
protected  void splitLines(int width)
           
 void stopAniImages()
           
 
Methods inherited from class ewe.ui.mTextPad
acceptsData, addDisplayLine, addDisplayLines, appendText, autoTab, breakLineBefore, calculateSizes, canGo, checkScrolls, checkSipCoverage, clearCursor, clearSelection, dataAccepted, dataDraggedOff, dataDraggedOver, dataDroppedOn, dataTransferCancelled, deleteSelection, displayLinesChanged, doPaint, doPaintData, doPaintData, doScroll, doShowMenu, dragged, ensureBlankLines, fix, fixText, getActual, getAvailableWidth, getBaselineHeight, getCharAt, getCharAt, getCharRect, getCurrent, getCursorPosition, getCursorRect, getIndexLocation, getLeftPosition, getLine, getLine, getLineAt, getLineAt, getLineHeight, getLineLength, getLines, getNumLines, getPenChar, getScreenRows, getScrollablePanel, getSelection, getSelectionRange, getState, getText, getTextPadMenu, getTextPositions, getTextPositions, getTextWidth, getTopLine, getTrueCharIndex, getTrueCharIndex, getVisible, gotFocus, hasSelection, lostFocus, needScrollBar, newCursorPos, newCursorPos, noSelection, onEvent, onKeyEvent, paintConditionalChar, paintCursor, paintCursor, paintLastChar, paintLastChar, paintLine, paintLine, paintLines, paintLinesFrom, penDoubleClicked, penReleased, popupMenuClosed, popupMenuEvent, pushDisplayLine, rearrange, removeDisplayLine, removeSelection, replaceDisplayLines, replaceLines, replaceSelection, resizeTo, resplit, scrollTo, selectAll, setAsStaticDisplay, setNativeInputFlags, setSelectionRange, setSelectionRange, setState, setText, splitLines, splitLines, startDragging, ticked, update, update, updateScrolls
 
Methods inherited from class ewe.ui.EditControl
checkInputMethod, dataBeingRemoved, fixCase, getBestPassiveFlags, hasChanged, keepConditionalChar, onControlEvent, setConditionalChar, startActiveInput, startLocalInput, startNativeInput, takeData, updateData
 
Methods inherited from class ewe.ui.Control
activate, addListener, addTimer, amOnTopFrame, calculateTextSize, cancelCut, cancelHoldDown, canEdit, chainDataChange, change, checkClipboardOperations, checkExitKey, checkMenu, checkMenuKey, checkModifiers, checkPenTransparent, clearTag, clipboardToString, clipboardTransfer, closeMenu, contains, contains, createGraphics, dataDraggedOver, deactivate, defaultTo, doAction, doActionKey, doBackground, doBorder, doHotKey, doMenu, dontAcceptDrop, doPaintChildren, doPaintChildren, doPaintChildren, doPaintData, exitEntry, fillBackground, 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, getWindow, hasModifier, hasPopupFormAttached, hasTag, inheritModifiers, isChildOf, isModal, isOnMe, isSomeonesHotKey, make, makeFrameTopMost, makeHot, menuIsActive, modify, modifyAll, modifyAll, notifyAction, notifyDataChange, notifyDataChange, notNative_doPaintChildren, oldButWorksDoPaintChildren, oldPaintChildren, oldPostEvent, onLabelPenEvent, onPaint, paintBackground, paintChildren, penClicked, penHeld, penRightReleased, popupBeep, 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, stopDragging, takeFocus, takeFromClipboard, takePromptControl, testDim, toClipboard, toField, toField, toString, toTextData, transferPenPress, transferPenPress, tryDragAndDrop, tryNext, tryStartMenu, 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

hotColor

public Color hotColor
The color for hot spots. By default it is bright blue.


mouseOver

protected TextFormatter mouseOver

LINES_SPLIT

public static final int LINES_SPLIT
This is a type of Control event. It is sent after the text has been split into separate lines by the TextDisplay. It can be used to trigger the setting up of the TextFormatters.

See Also:
Constant Field Values
Constructor Detail

TextDisplay

public TextDisplay()

TextDisplay

public TextDisplay(int rows,
                   int columns)
Method Detail

repaintDataNow

public void repaintDataNow()
Description copied from class: Control
Repaint the "data" part of the Control now. This is only used for Controls with the HasData modifier. These are controls that distinguish between their data (e.g. contained text) and non-data (e.g. border) on-screen display. If the Control does not have the HasData modifier, then the entire control will be repainted via repaintNow().

Overrides:
repaintDataNow in class Control

getSpecialFormatCount

protected int getSpecialFormatCount(int lineIndex,
                                    DisplayLine theLine)
Overrides:
getSpecialFormatCount in class mTextPad

getTextFormatter

public Vector getTextFormatter(Point onControl,
                               Vector dest)

getTextFormatter

public TextFormatter getTextFormatter(Point onControl)

applySpecialFormat

protected void applySpecialFormat(int formatIndex,
                                  int lineIndex,
                                  DisplayLine theLine,
                                  FormattedTextSpecs format)
Overrides:
applySpecialFormat in class mTextPad

drawSpecialFormat

protected void drawSpecialFormat(int formatIndex,
                                 int lineIndex,
                                 DisplayLine theLine,
                                 FormattedTextSpecs format,
                                 Graphics g,
                                 Color background)
Overrides:
drawSpecialFormat in class mTextPad

refresh

public void refresh(AniImage image)
Specified by:
refresh in interface AniImage.ImageRefresher

stopAniImages

public void stopAniImages()

formClosing

public void formClosing()
Description copied from class: Control
This is called to indicate that the Form is about to close and it causes a FormClosed event to be posted. If you override it you should call super.formClosing(). There is no way of stopping the Form closing at this point.

Overrides:
formClosing in class Control

imageSet

public void imageSet(TextFormatter formatter)

addTextFormatter

public TextFormatter addTextFormatter(TextFormatter formatter)

addTextFormatter

public TextFormatter addTextFormatter(int lineIndex,
                                      int characterIndex,
                                      int length,
                                      TextFormatter dest)

addTextFormatter

public TextFormatter addTextFormatter(int lineIndex,
                                      int characterIndex,
                                      int length,
                                      int fontFlags,
                                      int lineFlags)

addTextFormatter

public TextFormatter addTextFormatter(int lineIndex,
                                      int numLines,
                                      int fontFlags,
                                      int lineFlags)

clearTextFormatters

public void clearTextFormatters()

getTextFormatters

public Iterator getTextFormatters()

addTextFormatter

public TextFormatter addTextFormatter(int indexInFullText,
                                      int length,
                                      TextFormatter dest)

splitLines

protected void splitLines(int width)
Overrides:
splitLines in class mTextPad

formattersSet

public void formattersSet()
This tells the TextDisplay that formatters have been set and so it can optimize itself based on this.


getColors

protected void getColors(boolean hasFocus,
                         int flags)
Description copied from class: EditControl
Provides the colors to be used for the text and background colors. The colors are placed in the colors variable. This is an array of Colors of length 4 which is to receive the colors to be used as follows:
colors[0] = Text color, colors[1] = Background color, colors[2] = Selected text color, colors[3] = Selected text background color.

Overrides:
getColors in class EditControl
Parameters:
hasFocus - True if the control currently has the focus.
flags - This is the result of a call to getFlags(true) - which provides an OR'ing of all the flags of this control and all its parents.

mouseMovedOnOff

protected void mouseMovedOnOff(TextFormatter tf,
                               boolean movedOn)

onPenEvent

public void onPenEvent(PenEvent ev)
Description copied from class: Control
Called to handle an incoming PenEvent. By default this dispatches the event to the various pen handling methods like penPressed()

Overrides:
onPenEvent in class mTextPad

goToAnchor

public boolean goToAnchor(String anchorName)
This tells the display to go to the specified anchor.

Parameters:
anchorName - The name of the anchor.
Returns:
true if the anchor is in the current document. False otherwise.

hotspotPressed

protected boolean hotspotPressed(HotSpot hs,
                                 Point where)

goToLine

public boolean goToLine(int line)
Scroll to the specified line. An entry in the "goBack" history will be made with the current position.

Parameters:
line - The line to go to.
Returns:
true if scrolled, false otherwise.

clearHistory

public void clearHistory()
Clear the goBack history.


markHistory

public void markHistory()
Mark the current location in the goBack history.


deleteLastHistory

public void deleteLastHistory()

goBack

public void goBack()
This goes back one place in the saved states for the HtmlDisplay.


penPressed

public void penPressed(Point where)
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 mTextPad

getToolTip

public Object getToolTip(int x,
                         int y)
Description copied from class: Control
This should return an acceptable ToolTip object. That is either a String, IImage, Control or ToolTip

Overrides:
getToolTip in class Control
Parameters:
x - The x location of the mouse in this control.
y - The y location of the mouse in this control.
Returns:
A suitable ToolTip or null.

displayPropertiesChanged

public void displayPropertiesChanged()
Call this to indicate that something about the display has changed. By default it simply does a repaintNow(), but HtmlDisplay will update its background images etc.