/** Creates the sound of silence. */ public Sound () { this.state = RFuture.success(this); }
protected Image (Graphics gfx) { this.gfx = gfx; this.state = RFuture.success(this); }
/** Creates the sound of silence. */ public Sound () { this.state = RFuture.success(this); }
/** Returns a future result for a {@code Void} method. */ public static RFuture<Void> success () { return success(null); }
protected Image (Graphics gfx) { this.gfx = gfx; this.state = RFuture.success(this); }
/** Returns a future result for a {@code Void} method. */ public static RFuture<Void> success () { return success(null); }
@Override public RFuture<Icon> state () { return RFuture.<Icon>success(this); } @Override public Layer render () {
@Override public RFuture<Tile> tileAsync () { return RFuture.success(this); }
@Override public RFuture<String> getText(TextType textType, String label, String initVal) { Object result = JOptionPane.showInputDialog( null, label, "", JOptionPane.QUESTION_MESSAGE, null, null, initVal); return RFuture.success((String)result); }
@Override public RFuture<Boolean> sysDialog (String title, String text, String ok, String cancel) { int optType = JOptionPane.OK_CANCEL_OPTION; int msgType = cancel == null ? JOptionPane.INFORMATION_MESSAGE : JOptionPane.QUESTION_MESSAGE; Object[] options = (cancel == null) ? new Object[] { ok } : new Object[] { ok, cancel }; Object defOption = (cancel == null) ? ok : cancel; int result = JOptionPane.showOptionDialog( null, text, title, optType, msgType, null, options, defOption); return RFuture.success(result == 0); }
@Override public RFuture<Boolean> sysDialog(String title, String text, String ok, String cancel) { if (plat.needsHeadless()) throw new UnsupportedOperationException(NO_UI_ERROR); int optType = JOptionPane.OK_CANCEL_OPTION; int msgType = cancel == null ? JOptionPane.INFORMATION_MESSAGE : JOptionPane.QUESTION_MESSAGE; Object[] options = (cancel == null) ? new Object[] { ok } : new Object[] { ok, cancel }; Object defOption = (cancel == null) ? ok : cancel; int result = JOptionPane.showOptionDialog( null, text, title, optType, msgType, null, options, defOption); return RFuture.success(result == 0); }
@Override public RFuture<String> getText(TextType textType, String label, String initVal) { if (plat.needsHeadless()) throw new UnsupportedOperationException(NO_UI_ERROR); Object result = JOptionPane.showInputDialog( null, label, "", JOptionPane.QUESTION_MESSAGE, null, null, initVal); return RFuture.success((String)result); }
@Override public RFuture<String> getText(Keyboard.TextType textType, String label, String initVal) { String result = Window.prompt(label, initVal); emitFakeMouseUp(); return RFuture.success(result); }
@Override public RFuture<String> getText(Keyboard.TextType textType, String label, String initVal) { String result = Window.prompt(label, initVal); emitFakeMouseUp(); return RFuture.success(result); }
@Override public RFuture<Boolean> sysDialog(String title, String message, String ok, String cancel) { boolean result; if (cancel != null) result = Window.confirm(message); else { Window.alert(message); result = true; } emitFakeMouseUp(); return RFuture.success(result); }
@Override public RFuture<Boolean> sysDialog(String title, String message, String ok, String cancel) { boolean result; if (cancel != null) result = Window.confirm(message); else { Window.alert(message); result = true; } emitFakeMouseUp(); return RFuture.success(result); }
@Override public RFuture<T> when (Function<? super T, Boolean> cond) { T current = get(); if (cond.apply(current)) return RFuture.success(current); else return changes().filter(cond).next(); }
@Override public RFuture<T> when (Function<? super T, Boolean> cond) { T current = get(); if (cond.apply(current)) return RFuture.success(current); else return changes().filter(cond).next(); }
@Override public RFuture<Boolean> sysDialog (String title, String text, String ok, String cancel) { int style = (cancel == null) ? SWT.ICON_INFORMATION|SWT.OK : SWT.ICON_QUESTION|SWT.OK|SWT.CANCEL; MessageBox box = new MessageBox(plat.shell(), style); box.setText(title); box.setMessage(text); // HACK HACK HACK: see above hand wringing emitFakeMouseUp(); int button = box.open(); return RFuture.success(button == SWT.OK); }
@Override public RFuture<Boolean> sysDialog (String title, String text, String ok, String cancel) { int style = (cancel == null) ? SWT.ICON_INFORMATION|SWT.OK : SWT.ICON_QUESTION|SWT.OK|SWT.CANCEL; MessageBox box = new MessageBox(plat.shell(), style); box.setText(title); box.setMessage(text); // HACK HACK HACK: see above hand wringing emitFakeMouseUp(); int button = box.open(); return RFuture.success(button == SWT.OK); }