git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cutting v0.0.1
[fanfix.git]
/
src
/
jexer
/
TField.java
diff --git
a/src/jexer/TField.java
b/src/jexer/TField.java
index 14e93e78c0d34585e40bcda850451a7a9b1e3902..406c57567bc2871e6c13e1bed93c275ef4b75ce8 100644
(file)
--- a/
src/jexer/TField.java
+++ b/
src/jexer/TField.java
@@
-37,21
+37,21
@@
import jexer.event.TMouseEvent;
import static jexer.TKeypress.*;
/**
import static jexer.TKeypress.*;
/**
- *
+ *
TField implements an editable text field.
*/
*/
-public
final
class TField extends TWidget {
+public class TField extends TWidget {
/**
* Field text.
*/
/**
* Field text.
*/
- pr
ivate
String text = "";
+ pr
otected
String text = "";
/**
* Get field text.
*
* @return field text
*/
/**
* Get field text.
*
* @return field text
*/
- public String getText() {
+ public
final
String getText() {
return text;
}
return text;
}
@@
-59,37
+59,37
@@
public final class TField extends TWidget {
* If true, only allow enough characters that will fit in the width. If
* false, allow the field to scroll to the right.
*/
* If true, only allow enough characters that will fit in the width. If
* false, allow the field to scroll to the right.
*/
- pr
ivate
boolean fixed = false;
+ pr
otected
boolean fixed = false;
/**
* Current editing position within text.
*/
/**
* Current editing position within text.
*/
- pr
ivate
int position = 0;
+ pr
otected
int position = 0;
/**
* Beginning of visible portion.
*/
/**
* Beginning of visible portion.
*/
- pr
ivate
int windowStart = 0;
+ pr
otected
int windowStart = 0;
/**
* If true, new characters are inserted at position.
*/
/**
* If true, new characters are inserted at position.
*/
- pr
ivate
boolean insertMode = true;
+ pr
otected
boolean insertMode = true;
/**
* Remember mouse state.
*/
/**
* Remember mouse state.
*/
- pr
ivate
TMouseEvent mouse;
+ pr
otected
TMouseEvent mouse;
/**
* The action to perform when the user presses enter.
*/
/**
* The action to perform when the user presses enter.
*/
- pr
ivate
TAction enterAction;
+ pr
otected
TAction enterAction;
/**
* The action to perform when the text is updated.
*/
/**
* The action to perform when the text is updated.
*/
- pr
ivate
TAction updateAction;
+ pr
otected
TAction updateAction;
/**
* Public constructor.
/**
* Public constructor.
@@
-157,7
+157,7
@@
public final class TField extends TWidget {
*
* @return if true the mouse is currently on the field
*/
*
* @return if true the mouse is currently on the field
*/
- pr
ivate
boolean mouseOnField() {
+ pr
otected
boolean mouseOnField() {
int rightEdge = getWidth() - 1;
if ((mouse != null)
&& (mouse.getY() == 0)
int rightEdge = getWidth() - 1;
if ((mouse != null)
&& (mouse.getY() == 0)
@@
-175,7
+175,7
@@
public final class TField extends TWidget {
* @param enter if true, the user pressed Enter, else this was an update
* to the text.
*/
* @param enter if true, the user pressed Enter, else this was an update
* to the text.
*/
- pr
ivate
void dispatch(final boolean enter) {
+ pr
otected
void dispatch(final boolean enter) {
if (enter) {
if (enterAction != null) {
enterAction.DO();
if (enter) {
if (enterAction != null) {
enterAction.DO();
@@
-215,7
+215,7
@@
public final class TField extends TWidget {
/**
* Update the cursor position.
*/
/**
* Update the cursor position.
*/
- pr
ivate
void updateCursor() {
+ pr
otected
void updateCursor() {
if ((position > getWidth()) && fixed) {
setCursorX(getWidth());
} else if ((position - windowStart == getWidth()) && !fixed) {
if ((position > getWidth()) && fixed) {
setCursorX(getWidth());
} else if ((position - windowStart == getWidth()) && !fixed) {
@@
-409,7
+409,7
@@
public final class TField extends TWidget {
*
* @param ch = char to append
*/
*
* @param ch = char to append
*/
- pr
ivate
void appendChar(final char ch) {
+ pr
otected
void appendChar(final char ch) {
// Append the LAST character
text += ch;
position++;
// Append the LAST character
text += ch;
position++;
@@
-432,7
+432,7
@@
public final class TField extends TWidget {
*
* @param ch char to append
*/
*
* @param ch char to append
*/
- pr
ivate
void insertChar(final char ch) {
+ pr
otected
void insertChar(final char ch) {
text = text.substring(0, position) + ch + text.substring(position);
position++;
if ((position - windowStart) == getWidth()) {
text = text.substring(0, position) + ch + text.substring(position);
position++;
if ((position - windowStart) == getWidth()) {