Exemplo n.º 1
0
 private boolean onAltEnd(KeyboardEvent event) {
   if (noContentCheck()) return true;
   if (hotPointY <= 0 || hotPointY > items.length || items[hotPointY - 1] == null) {
     luwrain.hint(Hints.EMPTY_LINE);
     return true;
   }
   final Object item = items[hotPointY - 1];
   final String line = appearance.getScreenAppearance(item, 0);
   int leftBound = appearance.getObservableLeftBound(item);
   if (leftBound < 0) leftBound = 0;
   if (leftBound > line.length()) leftBound = line.length();
   int rightBound = appearance.getObservableRightBound(item);
   if (rightBound < 0) rightBound = 0;
   if (rightBound >= line.length()) rightBound = line.length();
   if (leftBound >= rightBound) {
     luwrain.hint(Hints.EMPTY_LINE);
     return true;
   }
   if (hotPointX <= leftBound) {
     luwrain.hint(Hints.BEGIN_OF_LINE);
     return true;
   }
   hotPointX = rightBound;
   luwrain.hint(Hints.END_OF_LINE);
   luwrain.onAreaNewHotPoint(this);
   return true;
 }
Exemplo n.º 2
0
 private boolean onAltLeft(KeyboardEvent event) {
   if (noContentCheck()) return true;
   if (hotPointY <= 0 || hotPointY > items.length || items[hotPointY - 1] == null) {
     luwrain.hint(Hints.EMPTY_LINE);
     return true;
   }
   final Object item = items[hotPointY - 1];
   final String line = appearance.getScreenAppearance(item, 0);
   int leftBound = appearance.getObservableLeftBound(item);
   if (leftBound < 0) leftBound = 0;
   if (leftBound > line.length()) leftBound = line.length();
   int rightBound = appearance.getObservableRightBound(item);
   if (rightBound < 0) rightBound = 0;
   if (rightBound >= line.length()) rightBound = line.length();
   if (leftBound >= rightBound) {
     luwrain.hint(Hints.EMPTY_LINE);
     return true;
   }
   if (hotPointX <= leftBound) {
     luwrain.hint(Hints.BEGIN_OF_LINE);
     return true;
   }
   final String subline = line.substring(leftBound, rightBound);
   WordIterator it = new WordIterator(subline, hotPointX - leftBound);
   if (!it.stepBackward()) {
     luwrain.hint(Hints.BEGIN_OF_LINE);
     return true;
   }
   hotPointX = it.pos() + leftBound;
   luwrain.say(it.announce());
   luwrain.onAreaNewHotPoint(this);
   return true;
 }
Exemplo n.º 3
0
 private boolean noContentCheck() {
   if (items == null || items.length <= 0) {
     luwrain.hint(luwrain.i18n().staticStr(LangStatic.LIST_NO_CONTENT), Hints.NO_CONTENT);
     return true;
   }
   return false;
 }
Exemplo n.º 4
0
 private void onNewHotPointY(boolean briefIntroduction) {
   if (hotPointY <= 0) {
     hotPointX = 0;
     luwrain.hint(Hints.EMPTY_LINE);
     luwrain.onAreaNewHotPoint(this);
     return;
   }
   final Object item = items[hotPointY - 1];
   luwrain.playSound(Sounds.NEW_LIST_ITEM);
   if (item == null) {
     hotPointX = 0;
     luwrain.hint(Hints.EMPTY_LINE);
   } else {
     hotPointX = getInitialHotPointX(item);
     appearance.introduceItem(item, briefIntroduction ? ListItemAppearance.BRIEF : 0);
   }
   luwrain.onAreaNewHotPoint(this);
 }
Exemplo n.º 5
0
 private boolean onArrowUp(KeyboardEvent event, boolean briefIntroduction) {
   if (noContentCheck()) return true;
   if (hotPointY <= 0) {
     luwrain.hint(Hints.NO_ITEMS_ABOVE);
     return true;
   }
   --hotPointY;
   onNewHotPointY(briefIntroduction);
   return true;
 }
Exemplo n.º 6
0
 private boolean onArrowDown(KeyboardEvent event, boolean briefIntroduction) {
   if (noContentCheck()) return true;
   if (hotPointY >= items.length) {
     luwrain.hint(Hints.NO_ITEMS_BELOW);
     return true;
   }
   ++hotPointY;
   onNewHotPointY(briefIntroduction);
   return true;
 }
Exemplo n.º 7
0
 private boolean onPageUp(KeyboardEvent event, boolean briefIntroduction) {
   if (noContentCheck()) return true;
   if (hotPointY <= 0) {
     luwrain.hint(Hints.NO_ITEMS_ABOVE);
     return true;
   }
   final int visibleHeight = luwrain.getAreaVisibleHeight(this);
   if (visibleHeight < 1) return false;
   if (hotPointY > visibleHeight) hotPointY -= visibleHeight;
   else hotPointY = 0;
   onNewHotPointY(briefIntroduction);
   return true;
 }
Exemplo n.º 8
0
 private boolean onPageDown(KeyboardEvent event, boolean briefIntroduction) {
   if (noContentCheck()) return true;
   if (hotPointY >= items.length) {
     luwrain.hint(Hints.NO_ITEMS_BELOW);
     return true;
   }
   final int visibleHeight = luwrain.getAreaVisibleHeight(this);
   if (visibleHeight < 1) return false;
   hotPointY += visibleHeight;
   if (hotPointY > items.length) hotPointY = items.length;
   onNewHotPointY(briefIntroduction);
   return true;
 }