List of usage examples for com.google.gwt.user.client Window alert
public static void alert(String msg)
From source file:cc.alcina.framework.gwt.persistence.client.FromOfflineConflictResolver.java
License:Apache License
public void notResolved() { Window.alert(getText(TextItem.OFFLINE_NO_DISCARD_WARNING)); Window.Location.reload(); }
From source file:cc.kune.sandbox.client.KuneSandboxEntryPoint.java
License:GNU Affero Public License
private void testPromptDialog() { final Builder builder = new PromptTopDialog.Builder("kkj-kk", "Some ask text?", false, true, Direction.LTR, new OnEnter() { @Override//from w w w . ja v a2 s . com public void onEnter() { NotifyUser.info("On Enter"); } }); builder.width("200px").height("200px").firstButtonTitle("Create").sndButtonTitle("Cancel"); builder.regex(TextUtils.UNIX_NAME).regexText("The name must contain only characters, numbers and dashes"); final PromptTopDialog diag = builder.build(); diag.showCentered(); diag.focusOnTextBox(); diag.getFirstBtn().addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { Window.alert("ok"); } }); }
From source file:ccc.client.gwt.core.GWTWindow.java
License:Open Source License
/** {@inheritDoc} */ @Override public void alert(final String string) { Window.alert(string); }
From source file:ch.sebastienzurfluh.swissmuseum.parcours.client.control.AppPresenter.java
License:Open Source License
private void startAfterPhoneGapLoad() { eventBus = new EventBus(); AsyncConnectorFactory.createConnector(new ParcoursConfig(), new AsyncCallback<IOConnector>() { @Override//w w w . ja va 2 s . c o m public void onSuccess(IOConnector result) { model = new Model(result); PageRequestEventHandler pageRequestHandler = new PageRequestEventHandler(eventBus, model); ResourceRequestEventHandler resourceRequestHandler = new ResourceRequestEventHandler(eventBus, model); PageRequestHistory pageRequestHistory = new PageRequestHistory(eventBus, model); View view = new View(eventBus, model, pageRequestHandler, resourceRequestHandler); parent.add(view); // Start the app eventBus.fireEvent(new PageChangeRequest(DataReference.SUPER)); } @Override public void onFailure(Throwable caught) { Window.alert("The app failed to initialise."); } }); }
From source file:ch.unifr.pai.ice.client.clickblobs.Blob.java
License:Apache License
private void setBlobPositionHandler(int[][] blobPosition) { if (blobPosition == null) { Window.alert("No set of position defined!"); } else {/* ww w . j a v a 2s . c om*/ this.absPanel.sinkEvents(Event.ONMOUSEDOWN); //this.absPanel.sinkEvents(Event.ONCLICK); this.absPanel.addDomHandler(new MouseDownHandler() { //this.absPanel.addHandler( new ClickHandler(){ @Override public void onMouseDown(MouseDownEvent event) { //public void onClick(ClickEvent event) { if (!isStarted) { //start time of experiment startTime = System.currentTimeMillis(); isStarted = true; } if (blobClickVector.size() == 0) { blobClickVector.add(new CursorXY(uNb, event.getClientX(), event.getClientY(), System.currentTimeMillis(), -5)); count++; System.out.println(uNb + ": " + "Out of blob clicked!" + "; x: " + event.getClientX() + "; y: " + event.getClientY() + "; Time: " + System.currentTimeMillis()); } else { if (!isLogged) { num++; if (num > iteration) { blobClickVector.add(new CursorXY(uNb, event.getClientX(), event.getClientY(), System.currentTimeMillis(), -5)); System.out.println(uNb + ": " + "Out of blob clicked!" + "; x: " + event.getClientX() + "; y: " + event.getClientY() + "; Time: " + System.currentTimeMillis()); num = iteration; count++; } } if (isLogged) { num++; if (num > iteration) { blobClickVector.add(new CursorXY(uNb, event.getClientX(), event.getClientY(), System.currentTimeMillis(), -5)); System.out.println(uNb + ": " + "Out of blob clicked!" + "; x: " + event.getClientX() + "; y: " + event.getClientY() + "; Time: " + System.currentTimeMillis()); logger.setLoggedData(blobClickVector, false); num = iteration; trialcount++; } } } } }, MouseDownEvent.getType()); this.addMouseDownHandler(new MouseDownHandler() { @Override public void onMouseDown(MouseDownEvent event) { if (!isStarted) { startTime = System.currentTimeMillis(); isStarted = true; } iteration++; if (iteration < blobPos.length) { //experiment hasn't finished yet if (!isLogged) { blobClickVector.add(new CursorXY(uNb, blob.getAbsoluteLeft(), blob.getAbsoluteTop(), System.currentTimeMillis(), blob.getBlobNumber())); //First blob is done, adds the first blob information to the Vector //PRINTING LOGS// //System.out.println("(Log INFO) Blob clicked! --- " + uNb + " ; BlobNo:" + blob.getBlobNumber() + " ; Coordinates of Blob Clicked:(" + //blob.getAbsoluteLeft() + "," + blob.getAbsoluteTop() + ")" + " ; Time clicked:" + System.currentTimeMillis()); } if (isLogged) { //second set blobClickVector.add(new CursorXY(uNb, blob.getAbsoluteLeft(), blob.getAbsoluteTop(), System.currentTimeMillis(), blob.getBlobNumber())); //First blob is done, adds the first blob information to the Vector //PRINTING LOGS //System.out.println("Trial Set: Blob clicked! --- " + uNb + " ; BlobNo:" + blob.getBlobNumber() + " ; Coordinates of Blob Clicked: ( " + //blob.getAbsoluteLeft() + "," + blob.getAbsoluteTop() + " )" + " ; Time clicked: " + System.currentTimeMillis() ); check = false; logger.setLoggedData(blobClickVector, false); } // Check the pos. in the array and get back to 0 if over array length -> loop if ((iteration + arrayOffset) < blobPos.length) { absPanel.setWidgetPosition(blob, blobPos[iteration + arrayOffset][0] + offset[0], blobPos[iteration + arrayOffset][1] + offset[1]); blob.setBlobNumber(iteration + arrayOffset); } else { //for User 2,3,4 absPanel.setWidgetPosition(blob, blobPos[(iteration + arrayOffset) - blobPos.length][0] + offset[0], blobPos[(iteration + arrayOffset) - blobPos.length][1] + offset[1]); blob.setBlobNumber((iteration + arrayOffset) - blobPos.length); // System.out.println("else set widget: " + " X: blobPos[" + ( (iteration + arrayOffset) - blobPos.length ) + "][0] + offset[0]:" + offset[0] // + " = " + ( blobPos[(iteration + arrayOffset) - blobPos.length][0] + offset[0] ) // + " --- Y: blobPos[" + ((iteration + arrayOffset) - blobPos.length) + "][1] + offset[1]:" + offset[1] // + " = " + (blobPos[(iteration + arrayOffset) - blobPos.length][1] + offset[1])); // } } else { //For the last blob if (!isSetFinished) { long setfinishtime = System.currentTimeMillis(); isSetFinished = true; setFinishTime = setfinishtime; } if (!isLogged) { //isLogged=false blobClickVector.add(new CursorXY(uNb, blob.getAbsoluteLeft(), blob.getAbsoluteTop(), setFinishTime, blob.getBlobNumber())); logger.setLoggedData(blobClickVector, true); isLogged = true; check = true; } if (isLogged && !check) { blobClickVector.add(new CursorXY(uNb, blob.getAbsoluteLeft(), blob.getAbsoluteTop(), System.currentTimeMillis(), blob.getBlobNumber())); //PRINTING LOG INFO OF LAST BLOB //System.out.println("(Trial Set LAST BLOB INFO) Blob clicked! --- : " + uNb + " ; BlobNo:" + blob.getBlobNumber() + " ; Coordinates of Blob Clicked: ( " + //blob.getAbsoluteLeft() + "," + blob.getAbsoluteTop() + " )" + " ; Time clicked: " + System.currentTimeMillis() ); logger.setLoggedData(blobClickVector, false); } iteration = 0; num = -1; //for the second set // continue to move the blob without recording the position // this is to let the user continue until the others finished // Check the pos. in the array and get back to 0 if over array length -> loop System.out.println("Trial set started"); //to be deleted if ((iteration + arrayOffset) < blobPos.length) { absPanel.setWidgetPosition(blob, blobPos[iteration + arrayOffset][0] + offset[0], blobPos[iteration + arrayOffset][1] + offset[1]); blob.setBlobNumber(iteration + arrayOffset); } else { absPanel.setWidgetPosition(blob, blobPos[(iteration + arrayOffset) - blobPos.length][0] + offset[0], blobPos[(iteration + arrayOffset) - blobPos.length][1] + offset[1]); blob.setBlobNumber((iteration + arrayOffset) - blobPos.length); } onFinishedInitialIteration(); //iteration++; } } }); } }
From source file:ch.unifr.pai.ice.client.clickblobs.ClickBlobs1user.java
License:Apache License
@Override public void initialise() { if (!init) {/*w w w . java2 s . co m*/ panelWidth = user1Panel.getElement().getOffsetWidth(); panelHeight = user1Panel.getElement().getOffsetHeight(); // // statically set the position of the 10 blobs // blobCoord = new int[][] { // { panelWidth - 100, panelHeight - 100 }, // { (panelWidth / 2)-40, 70 }, // { 50, panelHeight - 100 }, // { 100, 70 }, // { panelWidth - 130, 90 }, // { panelWidth - 110, panelHeight - 180 }, // { 140, panelHeight / 2 }, // { panelWidth / 2, panelHeight - 100 }, // { (panelWidth / 2) - 50, (panelHeight / 2) - 30 }, // { 200, 110 }, // { (panelWidth / 2) + 80, panelHeight - 100 }, // { (panelWidth / 4) * 3, panelHeight - 100 }, // { (panelWidth / 4), panelHeight - 120 }, // { (panelWidth / 4) * 3, panelHeight / 2 }, // { (panelWidth / 4), panelHeight - 130 }, // { panelWidth - 110, panelHeight - 180 }, // { 140, panelHeight / 3 }, // { panelWidth / 2, panelHeight /3 }, // { panelWidth - 70, (panelHeight / 3) }, // { panelWidth - 80, (panelHeight / 3) * 2 }, // }; // set the blob position array around a circle blobCoord = PositioningUtils.getPositionsInCircle(nbBlobs, panelWidth / 2, panelHeight / 2, (panelHeight / 2) - 50); user1 = new Blob(blob1, "User 1", nbIteration, user1Panel, this, blobCoord, 0, 0, 0, doLog) { @Override protected void onFinishedInitialIteration() { if (!doLog) { // for training ClickBlobs1user.this.clear(); Window.alert("Task finished!"); } } }; user1Panel.add(user1); user1Panel.setWidgetPosition(user1, blobCoord[0][0], blobCoord[0][1]); user1.setBlobNumber(0); //PRINTING LOGS System.out.println("Experiment Identifier: " + ICEMain.identifier); System.out.println("Name of Experiment Task: " + ExperimentIdentifier.CLICKBLOB); System.out.println("User Number: " + nbUser); System.out.println(); user1.resetCounter(); init = true; } }
From source file:ch.unifr.pai.ice.client.clickblobs.ClickBlobs1user.java
License:Apache License
/** * log the data and indicate if logged is OK or not *///from w w w . ja v a2 s.c o m private void log() { EventingServiceAsync svc = GWT.create(EventingService.class); svc.log(ICEMain.identifier, getLoggedResult(loggedData), ExperimentIdentifier.CLICKBLOB, 1, new AsyncCallback<Void>() { @Override public void onSuccess(Void result) { ClickBlobs1user.this.clear(); Window.alert("Successfully logged! Experiment finished"); } @Override public void onFailure(Throwable caught) { GWT.log("Error:", caught); ClickBlobs1user.this.clear(); Window.alert("Task finished but was not able to log!"); } }); }
From source file:ch.unifr.pai.ice.client.clickblobs.ClickBlobs2users.java
License:Apache License
/** * log the data and indicate if logged is OK or not *//*from w ww .j a v a2 s. c o m*/ private void log() { EventingServiceAsync svc = GWT.create(EventingService.class); svc.log(ICEMain.identifier, getLoggedResult(loggedData), ExperimentIdentifier.CLICKBLOB, 2, new AsyncCallback<Void>() { @Override public void onSuccess(Void result) { ClickBlobs2users.this.clear(); Window.alert("Successfully logged! Experiment finished"); } @Override public void onFailure(Throwable caught) { GWT.log("Error:", caught); ClickBlobs2users.this.clear(); caught.printStackTrace(); Window.alert("Not logged"); } }); }
From source file:ch.unifr.pai.ice.client.clickblobs.ClickBlobs4users.java
License:Apache License
/** * log the data and indicate if logged is OK or not *//*from ww w . j a va 2s .co m*/ private void log() { EventingServiceAsync svc = GWT.create(EventingService.class); svc.log(ICEMain.identifier, getLoggedResult(loggedData), ExperimentIdentifier.CLICKBLOB, 4, new AsyncCallback<Void>() { @Override public void onSuccess(Void result) { ClickBlobs4users.this.clear(); ; Window.alert("Successfully logged! Experiment finished"); } @Override public void onFailure(Throwable caught) { GWT.log("Error:", caught); ClickBlobs4users.this.clear(); Window.alert("Not logged"); } }); }
From source file:ch.unifr.pai.ice.client.dragNdrop.DnD1user.java
License:Apache License
/** * log the data and indicate if logged is OK or not *///from ww w.j a v a 2s . c o m private void log() { if (doLog) { EventingServiceAsync svc = GWT.create(EventingService.class); svc.log(ICEMain.identifier, getLoggedResult(loggedData), ExperimentIdentifier.DRAGNDROP, 1, new AsyncCallback<Void>() { @Override public void onSuccess(Void result) { DnD1user.this.clear(); Window.alert("Successfully logged! Experiment finished"); } @Override public void onFailure(Throwable caught) { GWT.log("Error:", caught); DnD1user.this.clear(); Window.alert("Task finished but was not able to log!"); } }); } else { this.clear(); Window.alert("Task finished!"); } }