Package: com.multiversesocial.hyperview
Class: com.multiversesocial.hyperview.TextPane
Source: src/com/multiversesocial/hyperview/TextPane.java

TextPane

HyperView V3.2 — class
version V3.2 class

Summary

-------- TextPane.java - HyperView 3.0 Orange Framework Complete remake with true large-file paging via NIO MappedByteBuffer + FileChannel

Source file: TextPane.java

Hierarchy

Extends: BasicPane

Implements: TextPaneConstants, HyperFileRequestPopListener, BufferControl

Referenced HyperView classes

Media files used

Declaration & members

public class TextPane extends BasicPane implements TextPaneConstants, HyperFileRequestPopListener, BufferControl

Declared in src/com/multiversesocial/hyperview/TextPane.java, lines 27–1382. 88 field(s), 5 constructor(s), 31 method(s), plus 6 nested type(s). Every member has an anchor you can link to (e.g. TextPane.html#<id>).

Fields (88)

DeclarationValue / initializerDescriptionSource
boolean binaryOutputNo comment in source; assigned in TextPane(), load(); used in update().line 59
boolean binarySourceNo comment in source; assigned in TextPane(), load().line 59
int bufferSizeNo comment in source; assigned in makeBitMap(), load(), increaseBufferSize(); used in TextPane(), print(), toString().line 76
volatile ByteBuffer byteBufferNo comment in source; name appears in 1 other source file(s): STDInputHandler.line 81
private Charset charset= StandardCharsets.ISO_8859_1default ASCline 129
Gadget charsetGadgetNo comment in source; assigned in TextPane().line 119
TextPane childPaneNo comment in source; not referenced by name in this type’s methods.line 61
private String clipboard= ""---------- CLIPBOARD & CURSOR ----------line 43
CloseListener closeListener---------- original fields (unchanged) ----------line 56
int columnsNo comment in source; used in toString().line 66
String commandStringNo comment in source; name appears in 4 other source file(s): CLICommand, Help, HyperView, STDInputHandler.line 115
volatile byte[] controlBufferNo comment in source; assigned in makeBitMap().line 80
int countNo comment in source; assigned in TextPane().line 62
int currentColumnNo comment in source; assigned in makeBitMap(), load(), print(); used in toString().line 89
int currentDataOffsetNo comment in source; assigned in TextPane(), makeBitMap(); used in toString().line 93
String currentDirNameNo comment in source; assigned in onFileSelect(); used in load().line 120
int currentPageNo comment in source; assigned in TextPane(), makeBitMap(), update(), load(), print(); used in inView().line 90
int currentPrintOffsetNo comment in source; assigned in TextPane(), load(); used in update(), inView(), toString().line 94
int currentRowNo comment in source; assigned in makeBitMap(), load(), print(); used in toString().line 88
private int cursorCol= 0No comment in source; assigned in inKey(), setCursorPosition(); used in update().line 45
private int cursorRow= 0No comment in source; assigned in inKey(), setCursorPosition(); used in update().line 44
private boolean cursorVisible= trueNo comment in source; assigned in update(), setCursorPosition().line 47
volatile int dataEndNo comment in source; assigned in TextPane(), load(), print().line 69
private static final int DEFAULT_MOVEBUFFER_SIZE= 64 (constant)No comment in source; used in TextPane(); name appears in 17 other source file(s): AnimGob, BasicPane, Gadget, GetString ….line 51
private static final int DEFAULT_WINDOW_SIZE= 16777216 (constant)
source: 16 * 1024 * 1024
No comment in source; used in load().line 53
int displayMaxColumnsNo comment in source; assigned in makeBitMap(); used in update(), load(), print(), setCursorPosition(), toString().line 68
int displayMaxRowsNo comment in source; assigned in makeBitMap(); used in update(), load(), print(), onClick(), getRowFromY() ….line 67
String[] displayStringNo comment in source; assigned in makeBitMap(); used in getColFromX(), selectWordAt(), getSelectedWord().line 84
int[] displayStringStartNo comment in source; assigned in makeBitMap().line 86
int displayTextHeightNo comment in source; assigned in makeBitMap(); used in update(), getRowFromY().line 96
private static final long DOUBLE_CLICK_DELAY= 500 (constant)No comment in source; used in onClick().line 35
volatile FileChannel fileChannelNo comment in source; assigned in load(); used in loadWindow().line 83
volatile String fileNameNo comment in source; assigned in update(), load(), onFileSelect().line 82
char fileSeparatorNo comment in source; assigned in TextPane(); used in load().line 121
private long fileSize= 0LNo comment in source; assigned in load(); used in loadWindow(), update().line 125
FontBaseButton fontBaseButtonNo comment in source; assigned in TextPane().line 57
private static final Map<Font,int[]> fontCharWidthCache= new HashMap<>()---------- character width cache ----------line 50
int fontHeightNo comment in source; used in print().line 103
Gadget forceBinaryGadgetNo comment in source; assigned in TextPane().line 118
Color frameBottomColorNo comment in source; assigned in TextPane(); used in makeBitMap(), erase(), setPaneColor().line 108
Color frameColorNo comment in source; name appears in 2 other source file(s): BasicPane, HyperBoolPop.line 98
Color frameFaceColorNo comment in source; assigned in TextPane(); used in makeBitMap(), erase(), setPaneColor().line 107
Color frameTopColorNo comment in source; assigned in TextPane(); used in makeBitMap(), erase(), setPaneColor().line 106
int frameWidthNo comment in source; assigned in makeBitMap().line 97
boolean gettingFileNo comment in source; assigned in TextPane(), onFileSelect().line 58
HyperFileRequestPopListener hyperFileRequestPopListenerNo comment in source; assigned in TextPane().line 60
int inBytesNo comment in source; assigned in makeBitMap(); used in toString().line 74
private int lastClickCol= -1No comment in source; assigned in onClick().line 34
private int lastClickRow= -1No comment in source; assigned in onClick().line 33
private long lastClickTime= 0---------- DOUBLE-CLICK DETECTION ----------line 32
private MappedByteBuffer mappedWindow= nullNo comment in source; assigned in loadWindow().line 128
int maxAdvancePrecomputed maximum drawing widthline 113
int maxColumnsNo comment in source; assigned in TextPane(); used in toString().line 71
int maxPagesNo comment in source; assigned in TextPane(), load(), increaseBufferSize(); used in makeBitMap(), toString().line 72
int maxRowsNo comment in source; assigned in TextPane(); used in toString().line 70
Color menuPaneColorNo comment in source; assigned in TextPane(), setPaneColor(); used in makeBitMap(), update(), erase(), print().line 109
int mpTextHeightNo comment in source; not referenced by name in this type’s methods.line 92
int mWidthNo comment in source; assigned in makeBitMap().line 95
private boolean pagedMode= false---------- NEW: paged large-file + Unicode support ----------line 124
Color pageRectangleColorNo comment in source; assigned in TextPane(); used in makeBitMap(), update().line 110
int pageSizeNo comment in source; assigned in makeBitMap(); used in update(), load(), inView(), increaseBufferSize(), toString().line 73
int pageXOffsetNo comment in source; assigned in TextPane(); used in makeBitMap(), update().line 77
int pageYOffsetNo comment in source; assigned in TextPane().line 78
int printXNo comment in source; not referenced by name in this type’s methods.line 87
int printYNo comment in source; not referenced by name in this type’s methods.line 87
int rowsNo comment in source; used in toString().line 65
HyperScrollbar rowScrollbarNo comment in source; assigned in TextPane(); used in load(), increaseBufferSize().line 117
private int selectionEnd= -1No comment in source; assigned in selectWordAt(), clearSelection(); used in update(), getSelectedWord().line 40
private int selectionRow= -1---------- WORD SELECTION ----------line 38
private int selectionStart= -1No comment in source; assigned in selectWordAt(), clearSelection(); used in update(), getSelectedWord().line 39
private static final long SMALL_FILE_THRESHOLD_PERCENT= 10 (constant)No comment in source; used in load().line 52
volatile byte[] sourceByteNo comment in source; assigned in makeBitMap(), loadWindow(), load(), print(), increaseBufferSize(); used in getByte(), update(), toString().line 79
int[] sourceStringLengthNo comment in source; assigned in makeBitMap().line 85
Color textColorNo comment in source; assigned in TextPane(); used in makeBitMap(), erase(), print().line 100
Font textFontNo comment in source; assigned in makeBitMap(); used in update(), getColFromX().line 101
FontMetrics textFontMetricsNo comment in source; assigned in makeBitMap(); used in update().line 102
Color textPaneColorNo comment in source; name appears in 3 other source file(s): BasicPane, HyperBoolPop, HyperEditBuffer.line 99
int textPaneFlagsNo comment in source; assigned in increaseBufferSize(); used in load(), print().line 63
int textPaneHeightNo comment in source; name appears in 3 other source file(s): BasicPane, HyperBoolPop, HyperEditBuffer.line 105
int textPaneWidthNo comment in source; name appears in 3 other source file(s): BasicPane, HyperBoolPop, HyperEditBuffer.line 104
int titleHeightNo comment in source; assigned in makeBitMap().line 91
String titleStringNo comment in source; assigned in TextPane().line 116
Dispatch updateDispatchNo comment in source; assigned in TextPane().line 64
private int windowSize= 0No comment in source; assigned in load(); used in loadWindow(), getByte().line 127
private long windowStartOffset= 0LNo comment in source; assigned in loadWindow(); used in getByte().line 126
int wrapsNo comment in source; assigned in TextPane(), load(); used in toString().line 75

Constructors (5)

SignatureDescriptionSource
TextPane()3 statement(s); calls super().line 145
TextPane(HyperView tView, int tWidth, int tHeight)2 statement(s); calls this().line 156
TextPane(HyperView tView, int tWidth, int tHeight, Color tfc1, Color tfc2, Color tfc3, Color tmpc)2 statement(s); calls this().line 171
TextPane(HyperView tView, String tTitle, int tX, int tY, int tWidth, int tHeight, Color fc1, Color fc2, Color fc3, Color mpc, int tMaxColumns, int tMaxRows)2 statement(s); calls this().line 184
TextPane(HyperView tView, String tTitle, int tX, int tY, int tWidth, int tHeight, Font tFont, Color fc1, Color fc2, Color fc3, Color mpc, int tMaxPages, int tMaxColumns, int tMaxRows)68 statement(s); calls super(), frameFaceColor.darker().darker(), frameFaceColor.darker(), makeBitMap(), curView.addGadget() …; creates Dispatch, ImageGadget, GetFileDispatch.line 198

Methods (31)

SignatureDescriptionSource
static { … }Implicit default constructor generated by the compiler (not written in the source).implicit
public String callToString()Returns toString().line 1229
public void clearSelection()3 statement(s).line 1201
public void drawString(String str, int tPen, int tx, int ty)2 statement(s); calls graphics.setColor(), graphics.drawString().
Overrides BasicPane.drawString()
line 1054
public void erase()11 statement(s); calls graphics.setColor(), graphics.drawLine(), graphics.fillRect().
Overrides BasicPane.erase()
line 699
private byte getByte(long logicalOffset)---------- transparent byte access ----------line 419
private int[] getCharWidths(Font font, FontMetrics fm)---------- get cached char widths ----------line 132
private int getColFromX(int x, int row)7 statement(s); calls graphics.getFontMetrics(), text.length(), fm.charWidth(), text.charAt().line 1145
private int getRowFromY(int y)6 statement(s).line 1136
public String getSelectedWord()2 statement(s); calls line.length(), line.substring().line 1207
public int increaseBufferSize()21 statement(s); calls curView.curRun.maxMemory(); creates HyperPop.line 959
public void inKey()Cont ContGetStringHandleKey analog for TextPane focus gadget.
Overrides Gadget.inKey()
line 997
public boolean inView()3 statement(s).
Overrides Gob.inView()
line 953
private boolean isWordChar(char c)Returns Character.isLetterOrDigit(c) || c == '_' || c == '-'.line 1197
public void load(byte[] tInByteArray)16 statement(s); calls update().line 714
public int load(String tFileName)20 statement(s); calls tFile.exists(), tFile.length(), load(), tFileName.toLowerCase(), lowerName.endsWith() …; creates File, FileInputStream.line 749
public void load(String[] tPrintStringArray)7 statement(s); calls tPrintStringArray[tY].getBytes(), increaseBufferSize(), update().line 832
private void loadWindow(long offset) throws IOException---------- load sliding window ----------line 402
public void makeBitMap(Font tFont)70 statement(s); calls textFont.toString(), curView.screenGraphics.getFontMetrics(), textFontMetrics.getHeight(), textFontMetrics.getMaxAdvance(), curView.createImage() ….
Overrides BasicPane.makeBitMap()
line 306
public void onClick()11 statement(s); calls closeListener.onClose(), System.currentTimeMillis(), getRowFromY(), getColFromX(), selectWordAt() ….
Overrides Gob.onClick()
line 1088
public void onFileSelect(String tCurrentDirName, String tFileString)4 statement(s); calls load().
Implements HyperFileRequestPopListener.onFileSelect()
line 1045
public void print(String tPrintString)8 statement(s); calls tPrintString.getBytes(), increaseBufferSize(), update().line 875
public void print(byte[] tInByte)7 statement(s); calls increaseBufferSize(), update().line 915
public void print(String[] str, int tX, int tY)6 statement(s); calls graphics.setColor(), graphics.fillRect(), graphics.drawString().line 1059
private void selectWordAt(int row, int col)12 statement(s); calls line.length(), isWordChar(), line.charAt(), line.substring().line 1165
public void setCharset(Charset newCharset)1 statement(s); calls update().line 1376
public void setCursorPosition(int row, int col)1 statement(s); calls Math.min(), System.currentTimeMillis().line 1218
public void setFont(Font tFont)Sets conFont = tFont.
Overrides BasicPane.setFont()
line 1070
public void setPaneColor(int tColorIndex)11 statement(s); calls graphics.setColor(), graphics.drawLine(), graphics.fillRect().
Overrides BasicPane.setPaneColor()
line 1074
public String toString()63 statement(s); calls "\r\n".toCharArray(), tStringBuilder.append(), tStringBuilder.toString(); creates StringBuilder.
Overrides Gadget.toString()
line 1234
public void update()29 statement(s); calls charset.equals(), graphics.setFont(), graphics.setColor(), graphics.fillRect(), graphics.drawString() …; creates String, Font, StringBuilder.
Overrides BasicPane.update()
line 439

Nested & additional classes

TextPaneUpperArrowMethod (nested type, lines 1302–1314)

class TextPaneUpperArrowMethod extends UpperArrowMethod

Fields (0)

None declared.

Constructors (1)

SignatureDescriptionSource
TextPaneUpperArrowMethod()inner scrollbar classesline 1302

Methods (1)

SignatureDescriptionSource
public void function(HyperScrollbar hsb)3 statement(s); calls update(), hsb.updateThumbPane().
Overrides UpperArrowMethod.function()
line 1303

TextPaneLowerArrowMethod (nested type, lines 1316–1324)

class TextPaneLowerArrowMethod extends LowerArrowMethod

Fields (0)

None declared.

Constructors (1)

SignatureDescriptionSource
TextPaneLowerArrowMethod()Implicit default constructor generated by the compiler (not written in the source).line 1316

Methods (1)

SignatureDescriptionSource
public void function(HyperScrollbar hsb)5 statement(s); calls update(), hsb.updateThumbPane().
Overrides LowerArrowMethod.function()
line 1317

TextPaneThumbMethod (nested type, lines 1326–1333)

class TextPaneThumbMethod extends ThumbPaneMethod

Fields (0)

None declared.

Constructors (1)

SignatureDescriptionSource
TextPaneThumbMethod()Implicit default constructor generated by the compiler (not written in the source).line 1326

Methods (1)

SignatureDescriptionSource
public void function(HyperScrollbar hsb)4 statement(s); calls update().
Overrides ThumbPaneMethod.function()
line 1327

GetFileDispatch (nested type, lines 1335–1348)

class GetFileDispatch extends Dispatch

Fields (0)

None declared.

Constructors (1)

SignatureDescriptionSource
GetFileDispatch(HyperView ttView)2 statement(s); calls super().line 1336

Methods (1)

SignatureDescriptionSource
public boolean begin(HyperView tView)2 statement(s); calls tHyperFileRequestPop.addHyperFileRequestPopListener(); creates HyperFileRequestPop.
Overrides Dispatch.begin()
line 1339

SetBinaryToggle (nested type, lines 1350–1360)

class SetBinaryToggle extends Dispatch

Fields (0)

None declared.

Constructors (1)

SignatureDescriptionSource
SetBinaryToggle()Implicit default constructor generated by the compiler (not written in the source).line 1350

Methods (1)

SignatureDescriptionSource
public boolean begin(HyperView tView)3 statement(s); calls update().
Overrides Dispatch.begin()
line 1351

SetCharsetToggle (nested type, lines 1362–1374)

class SetCharsetToggle extends Dispatch

Fields (0)

None declared.

Constructors (1)

SignatureDescriptionSource
SetCharsetToggle()Implicit default constructor generated by the compiler (not written in the source).line 1362

Methods (1)

SignatureDescriptionSource
public boolean begin(HyperView tView)3 statement(s); calls charset.equals(), charsetGadget.setName(), update().
Overrides Dispatch.begin()
line 1363

Inherited members

Non-private members inherited from HyperView superclasses and not overridden or hidden here.

From BasicPane (19 fields, 2 methods)

Fields: charHeight, deviceColor0, deviceColor1, deviceColor2, frameColor1, frameColor2, frameColor3, itemColor0, itemColor1, itemColor2, mpHeight, mpWidth, mpX, mpX2, mpY, mpY2, selectedColor0, selectedColor1, selectedColor2

Methods: drawString(String, int, int), drawStrings(StringArr, int, int)

From Gadget (35 fields, 24 methods)

Fields: backColor, conFont, cursorGraphics, cursorHeight, cursorImage, cursorName, cursorScrollXOffset, cursorScrollYOffset, cursorWidth, cursorX, cursorY, displayInfo, fGColor, flipCount, font, gadFlags, gadFlags2, gadNumber, keyboard, lastCursorX, lastCursorY, lineColorA, lineColorB, lineColorC, locked, method, parentTitlebar, stringHeight, stringWidth, stringX, stringY, tc1, tc2, tc3, tc4

Methods: addDispatch(Dispatch), allKeyMsgENA(), cleanUp(), drawCursor(), drawOutline(), drawOutline2(), getForeground(), inString(String), isEnabled(), isShowing(), isVisible(), keyReleaseENA(), keyTypedENA(), layerDisable(), layerENA(), makeBitmap(Font), mouseWheelMoved(MouseWheelEvent), onMouseOver(), setEnabled(boolean), setForeground(int), setName(String), setVisible(boolean), toFront(), updateText()

From Gob (76 fields, 25 methods)

Fields: asynchGraphics1, asynchGraphics2, asynchImage1, asynchImage2, attachedGob, attachedIndex, backGround, bgMemoryImageSource, bGPen, bottomMax, clickX, clickY, collisionClassMask, curAttached, currentZIndex, curView, depth, destGob, destGraphics, dispatchHoldCount, drawMode, dX, dY, dZ, fgMemoryImageSource, fGPen, gobEventFlags, gobFlags, gobFlags2, gobGadIndex, gobHx, gobHy, gobHz, gobName, gobNumber, gobOrbitRadius, gobPic, gobTypeFlags, graphics, gravity, height, heightBase, hSin, hyp, infoString, lClickX, lClickY, leftMin, maxAttached, memoryCounter, moveNum, mX, mX2, mY, mY2, oldX, oldY, oldZ, orbitGob, rightMax, scanLine, selectGraphics, selectImage, selectTime, spline, tint, topMin, totalAttached, width, widthBase, wSin, x, x2, y, y2, z

Methods: addGob(Gob), addSpline(Spline), center(), collisionOff(), collisionOn(), disable(), enable(), getGraphics(), getImageFromJar(String), getPixels(), gobZInit(), initScanline(int), isInView(), isMemoryImageSource(), move(int, int), move(Gadget, int, int), moveNext(), onDisplay(), onRelease(), printGobAttr(HyperView), printScanLines(), remGob(), remove(), zENA(), zOff()

From Linkable (7 fields, 1 methods)

Fields: attachment, index, linkFlags, name, next, parentList, prev

Methods: inList()

Examples

Real usage taken from elsewhere in the HyperView 3.2 source (file and line shown; source path src/com/multiversesocial/hyperview/).

instantiation — BeliefButton.java, line 38

   38  textPane = new TextPane(tView,     // Put in "this" View
   39   " NCLI ",                            // Title
   40   201,118,                             // X,Y location in View
   41   320,200,                             // Width/height

subclass — ViewMemoryPane.java, line 3

    3  public class ViewMemoryPane extends TextPane
    4  {

static call — ViewMain.java, line 330

  330  tp.print(" Textpane TextPane.print((String)) command");
Hits--