コード例 #1
0
ファイル: FetchApp.java プロジェクト: marigostra/luwrain
 public void close() {
   if (fetchThread != null && !fetchThread.done) {
     luwrain.message(stringConstructor.processNotFinished());
     return;
   }
   luwrain.closeApp();
 }
コード例 #2
0
ファイル: ListPopupBase.java プロジェクト: rPman/luwrain
 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;
 }
コード例 #3
0
ファイル: ListPopupBase.java プロジェクト: rPman/luwrain
 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;
 }
コード例 #4
0
ファイル: ListPopupBase.java プロジェクト: rPman/luwrain
 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;
 }
コード例 #5
0
ファイル: ListPopupBase.java プロジェクト: rPman/luwrain
 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;
 }
コード例 #6
0
ファイル: ListPopupBase.java プロジェクト: luwrain/luwrain
 @Override
 public boolean onEnvironmentEvent(EnvironmentEvent event) {
   NullCheck.notNull(event, "event");
   if (closing.onEnvironmentEvent(event)) return true;
   switch (event.getCode()) {
     case INTRODUCE:
       luwrain.silence();
       luwrain.playSound(Sounds.INTRO_POPUP);
       luwrain.say(getAreaName());
       return true;
     default:
       return super.onEnvironmentEvent(event);
   }
 }
コード例 #7
0
ファイル: ListPopupBase.java プロジェクト: rPman/luwrain
 private boolean onAltRight(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 >= rightBound) {
     luwrain.hint(Hints.END_OF_LINE);
     return true;
   }
   final String subline = line.substring(leftBound, rightBound);
   WordIterator it = new WordIterator(subline, hotPointX - leftBound);
   if (!it.stepForward()) {
     luwrain.hint(Hints.END_OF_LINE);
     return true;
   }
   hotPointX = it.pos() + leftBound;
   if (it.announce().length() > 0) luwrain.say(it.announce());
   else luwrain.hint(Hints.END_OF_LINE);
   luwrain.onAreaNewHotPoint(this);
   return true;
 }
コード例 #8
0
ファイル: ListPopupBase.java プロジェクト: rPman/luwrain
 public void refresh() {
   model.refresh();
   final int count = model.getItemCount();
   if (count < 1) {
     items = new Object[0];
     hotPointX = 0;
     hotPointY = 0;
     luwrain.onAreaNewContent(this);
     luwrain.onAreaNewHotPoint(this);
     return;
   }
   items = new Object[count];
   for (int i = 0; i < count; ++i) items[i] = model.getItem(i);
   if (hotPointY > items.length) hotPointY = items.length;
   hotPointX = 0;
   luwrain.onAreaNewContent(this);
   luwrain.onAreaNewHotPoint(this);
 }
コード例 #9
0
ファイル: ListPopupBase.java プロジェクト: rPman/luwrain
 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);
 }
コード例 #10
0
ファイル: ListPopupBase.java プロジェクト: rPman/luwrain
 @Override
 public boolean onEnvironmentEvent(EnvironmentEvent event) {
   NullCheck.notNull(event, "event");
   if (closing.onEnvironmentEvent(event)) return true;
   if (region.onEnvironmentEvent(event, hotPointX, hotPointY)) return false;
   switch (event.getCode()) {
     case REFRESH:
       refresh();
       return true;
     case INTRODUCE:
       luwrain.silence();
       luwrain.playSound(Sounds.INTRO_POPUP);
       luwrain.say(getAreaName());
       return true;
     default:
       return false;
   }
 }
コード例 #11
0
ファイル: UserInterface.java プロジェクト: luwrain/luwrain
 UserInterface(ControlPanel controlPanel) {
   super(
       new DefaultControlEnvironment(controlPanel.getCoreInterface()),
       controlPanel.getCoreInterface().i18n().getStaticStr("CpUserInterfaceGeneral"));
   NullCheck.notNull(controlPanel, "controlPanel");
   this.controlPanel = controlPanel;
   this.luwrain = controlPanel.getCoreInterface();
   this.sett = Settings.createUserInterface(luwrain.getRegistry());
   fillForm();
 }
コード例 #12
0
ファイル: FetchApp.java プロジェクト: marigostra/luwrain
 public void launchFetching() {
   if (fetchThread != null && !fetchThread.done) {
     luwrain.message(stringConstructor.processAlreadyRunning());
     return;
   }
   fetchArea.clear();
   fetchThread = new FetchThread(luwrain, stringConstructor, fetchArea);
   Thread t = new Thread(fetchThread);
   t.start();
 }
コード例 #13
0
ファイル: ListPopupBase.java プロジェクト: rPman/luwrain
 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;
 }
コード例 #14
0
ファイル: ListPopupBase.java プロジェクト: rPman/luwrain
 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;
 }
コード例 #15
0
ファイル: UserInterface.java プロジェクト: luwrain/luwrain
 private void fillForm() {
   addEdit(
       "launch-greeting",
       luwrain.i18n().getStaticStr("CpLaunchingGreetingText"),
       sett.getLaunchGreeting(""));
   //	addCheckbox("file-popup-skip-hidden", "Исключать скрытые файлы в о всплывающих окнах:",
   // settings.getFilePopupSkipHidden(false));
   //	addCheckbox("empty-line-under-regular-lists", "Добавлять пустую строку в конце списков:",
   // settings.getEmptyLineUnderRegularLists(false));
   //	addCheckbox("empty-line-above-popup-lists", "Добавлять пустую строку в начало всплывающих
   // списков:", settings.getEmptyLineAbovePopupLists(false));
   //	addCheckbox("cycling-regular-lists", "Зацикливать навигацию по спискам:",
   // settings.getCyclingRegularLists(false));
   //	addCheckbox("cycling-popup-lists", "Зацикливать навигацию по всплывающим спискам:",
   // settings.getCyclingPopupLists(false));
 }