List of usage examples for com.google.gwt.user.client Window prompt
public static String prompt(String msg, String initialValue)
From source file:playn.html.HtmlKeyboard.java
License:Apache License
@Override public void getText(TextType textType, String label, String initVal, Callback<String> callback) { callback.onSuccess(Window.prompt(label, initVal)); }
From source file:rocket.testing.client.InteractiveList.java
License:Apache License
protected void onListInsertClick() { String message = "list.add("; int index = -1; E element = null;//from ww w . ja v a2 s .co m try { index = Integer.parseInt(Window.prompt("add index", "0")); element = this.createElement(); this.listInsert(index, element); message = message + index + ", " + this.toString(element) + ") returned"; } catch (final Exception caught) { caught.printStackTrace(); message = message + index + "," + this.toString(element) + ") threw " + caught.getClass().getName() + ", message\"" + caught.getMessage() + "\"."; } this.log(message); }
From source file:rocket.testing.client.InteractiveList.java
License:Apache License
protected void onListGetClick() { String message = "list.get("; int index = -1; try {/*w w w . j ava 2 s .c o m*/ index = Integer.parseInt(Window.prompt("get index", "0")); final E element = this.listGet(index); this.checkType(element); message = message + index + ") returned " + this.toString(element); } catch (final Exception caught) { caught.printStackTrace(); message = message + index + ") threw " + caught.getClass().getName() + ", message\"" + caught.getMessage() + "\"."; } this.log(message); }
From source file:rocket.testing.client.InteractiveList.java
License:Apache License
protected void onListRemoveClick() { String message = "list.remove("; int index = -1; try {/*from ww w . j a va 2 s. com*/ index = Integer.parseInt(Window.prompt("remove index", "0")); final E element = this.listRemove(index); this.checkType(element); message = message + index + ") returned " + this.toString(element); } catch (final Exception caught) { caught.printStackTrace(); message = message + index + ") threw " + caught.getClass().getName() + ", message\"" + caught.getMessage() + "\"."; } this.log(message); }
From source file:rocket.testing.client.InteractiveList.java
License:Apache License
protected void onListSetClick() { String message = "list.set("; int index = -1; E element = null;// w ww . j a va2 s . c o m try { index = Integer.parseInt(Window.prompt("set index", "0")); element = this.createElement(); final E previous = this.listSet(index, element); this.checkType(previous); message = message + index + ", " + this.toString(element) + ") returned " + this.toString(previous); } catch (final Exception caught) { caught.printStackTrace(); message = message + index + "," + this.toString(element) + ") threw " + caught.getClass().getName() + ", message\"" + caught.getMessage() + "\"."; } this.log(message); }
From source file:samples.easychatroom.client.SampleEntryPoint.java
License:Apache License
@Override public void onModuleLoad() { // We can't GWT.create the server itself, instead, we need a builder //final ChatServer server = GWT.create(ChatServer.class); final ChatServerBuilder builder = GWT.create(ChatServerBuilder.class); // Set the url directly, or use the setHost, setPort, etc calls and //use the @RemoteServiceRelativePath given on the interface // builder.setUrl("ws://" + Window.Location.getHost() + "/chat"); builder.setHostname(Window.Location.getHostName()); builder.setPath("chat"); // Because this is just a demo, we're using Window.prompt to get a username final String username = Window.prompt("Select a username", ""); // Start up the server connection, then plug into it so you get the callbacks final ChatServer server = builder.start(); final ChatClientWidget impl = new ChatClientWidget(); server.setClient(impl);/*from www .j a va 2s.c o m*/ // This listens for the connection to start, so we can log in with the username // we already picked. // Remember that you don't need to build this here, it could be in your client // impl's onOpen method (and the next block in onClose). impl.addConnectionOpenedHandler(new ConnectionOpenedHandler() { @Override public void onConnectionOpened(ConnectionOpenedEvent event) { server.login(username, new Callback<Void, String>() { @Override public void onFailure(String reason) { Window.alert(reason); final String username = Window.prompt("Select a username", ""); server.login(username, this); } @Override public void onSuccess(Void result) { RootLayoutPanel.get().add(impl); } }); } }); // Then listen for close too, so we can do something about the lost connection. impl.addConnectionClosedHandler(new ConnectionClosedEvent.ConnectionClosedHandler() { @Override public void onConnectionClosed(ConnectionClosedEvent event) { // Take the easy/stupid way out and restart the page! // This will stop at the prompt and wait for a username before connecting Window.Location.reload(); } }); impl.send.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { server.say(impl.message.getValue()); impl.message.setValue(""); } }); }
From source file:stroom.alert.client.view.PromptViewImpl.java
License:Apache License
@Override public String prompt(final String message, final String initialValue) { return Window.prompt(message, initialValue); }
From source file:tv.dyndns.kishibe.qmaclone.client.creation.WidgetProblemForm.java
License:Open Source License
private void indicate() { String prompt = Window.prompt("????????", "(????????)"); if (prompt == null) { return;/* w ww. j a v a2s. c o m*/ } final String message = prompt.trim(); if (Strings.isNullOrEmpty(message)) { return; } if (indicationResolved != null && System.currentTimeMillis() < indicationResolved.getTime() + 7L * 24 * 60 * 60 * 1000) { // ???7?? AsyncCallback<List<PacketBbsThread>> callbackGetBbsThreads = new AsyncCallback<List<PacketBbsThread>>() { @Override public void onSuccess(List<PacketBbsThread> result) { if (result == null || result.isEmpty()) { logger.log(Level.WARNING, "???????"); return; } PacketBbsThread thread = result.get(0); PacketBbsResponse response = new PacketBbsResponse(); response.threadId = thread.id; response.name = UserData.get().getPlayerName(); response.userCode = UserData.get().getUserCode(); response.dispInfo = 2; response.postTime = System.currentTimeMillis(); response.body = message; Service.Util.getInstance().writeToBbs(response, true, callbackBuildBbsThread); } @Override public void onFailure(Throwable caught) { } }; Service.Util.getInstance().getBbsThreads(problemId, 0, 1, callbackGetBbsThreads); } else { // ????????????7???? PacketBbsThread thread = new PacketBbsThread(); thread.title = "??????? (" + Utility.toDateFormat(new Date()) + ")"; PacketBbsResponse response = new PacketBbsResponse(); response.body = message; response.dispInfo = 2; // ? response.name = UserData.get().getPlayerName(); response.userCode = UserData.get().getUserCode(); Service.Util.getInstance().buildBbsThread(problemId, thread, response, callbackBuildBbsThread); } }