List of usage examples for com.google.gwt.user.client Window alert
public static void alert(String msg)
From source file:com.allen_sauer.gwt.log.client.util.DOMUtil.java
License:Apache License
public static void reportFatalAndThrowRuntimeException(String msg) throws RuntimeException { msg = "gwt-dnd warning: " + msg; Window.alert(msg); throw new RuntimeException(msg); }
From source file:com.alonsoruibal.chess.bitboard.JSONAttackGenerator.java
License:Open Source License
public void run() { long t1 = System.currentTimeMillis(); BitboardAttacks.rook = new long[64]; BitboardAttacks.rookMask = new long[64]; BitboardAttacks.rookMagic = new long[64][]; BitboardAttacks.bishop = new long[64]; BitboardAttacks.bishopMask = new long[64]; BitboardAttacks.bishopMagic = new long[64][]; BitboardAttacks.knight = new long[64]; BitboardAttacks.king = new long[64]; BitboardAttacks.pawnDownwards = new long[64]; BitboardAttacks.pawnUpwards = new long[64]; long square = 1; byte i = 0;/*from ww w .j a v a2 s . c om*/ while (square != 0) { BitboardAttacks.rook[i] = squareAttackedAuxSlider(square, +8, BitboardUtils.b_u) | squareAttackedAuxSlider(square, -8, BitboardUtils.b_d) | squareAttackedAuxSlider(square, -1, BitboardUtils.b_r) | squareAttackedAuxSlider(square, +1, BitboardUtils.b_l); BitboardAttacks.rookMask[i] = squareAttackedAuxSliderMask(square, +8, BitboardUtils.b_u) | squareAttackedAuxSliderMask(square, -8, BitboardUtils.b_d) | squareAttackedAuxSliderMask(square, -1, BitboardUtils.b_r) | squareAttackedAuxSliderMask(square, +1, BitboardUtils.b_l); BitboardAttacks.bishop[i] = squareAttackedAuxSlider(square, +9, BitboardUtils.b_u | BitboardUtils.b_l) | squareAttackedAuxSlider(square, +7, BitboardUtils.b_u | BitboardUtils.b_r) | squareAttackedAuxSlider(square, -7, BitboardUtils.b_d | BitboardUtils.b_l) | squareAttackedAuxSlider(square, -9, BitboardUtils.b_d | BitboardUtils.b_r); BitboardAttacks.bishopMask[i] = squareAttackedAuxSliderMask(square, +9, BitboardUtils.b_u | BitboardUtils.b_l) | squareAttackedAuxSliderMask(square, +7, BitboardUtils.b_u | BitboardUtils.b_r) | squareAttackedAuxSliderMask(square, -7, BitboardUtils.b_d | BitboardUtils.b_l) | squareAttackedAuxSliderMask(square, -9, BitboardUtils.b_d | BitboardUtils.b_r); BitboardAttacks.knight[i] = squareAttackedAux(square, +17, BitboardUtils.b2_u | BitboardUtils.b_l) | squareAttackedAux(square, +15, BitboardUtils.b2_u | BitboardUtils.b_r) | squareAttackedAux(square, -15, BitboardUtils.b2_d | BitboardUtils.b_l) | squareAttackedAux(square, -17, BitboardUtils.b2_d | BitboardUtils.b_r) | squareAttackedAux(square, +10, BitboardUtils.b_u | BitboardUtils.b2_l) | squareAttackedAux(square, +6, BitboardUtils.b_u | BitboardUtils.b2_r) | squareAttackedAux(square, -6, BitboardUtils.b_d | BitboardUtils.b2_l) | squareAttackedAux(square, -10, BitboardUtils.b_d | BitboardUtils.b2_r); BitboardAttacks.pawnUpwards[i] = squareAttackedAux(square, 7, BitboardUtils.b_u | BitboardUtils.b_r) | squareAttackedAux(square, 9, BitboardUtils.b_u | BitboardUtils.b_l); BitboardAttacks.pawnDownwards[i] = squareAttackedAux(square, -7, BitboardUtils.b_d | BitboardUtils.b_l) | squareAttackedAux(square, -9, BitboardUtils.b_d | BitboardUtils.b_r); BitboardAttacks.king[i] = squareAttackedAux(square, +8, BitboardUtils.b_u) | squareAttackedAux(square, -8, BitboardUtils.b_d) | squareAttackedAux(square, -1, BitboardUtils.b_r) | squareAttackedAux(square, +1, BitboardUtils.b_l) | squareAttackedAux(square, +9, BitboardUtils.b_u | BitboardUtils.b_l) | squareAttackedAux(square, +7, BitboardUtils.b_u | BitboardUtils.b_r) | squareAttackedAux(square, -7, BitboardUtils.b_d | BitboardUtils.b_l) | squareAttackedAux(square, -9, BitboardUtils.b_d | BitboardUtils.b_r); // And now generate magics int rookPositions = (1 << BitboardAttacks.rookShiftBits[i]); BitboardAttacks.rookMagic[i] = new long[rookPositions]; for (int j = 0; j < rookPositions; j++) { long pieces = generatePieces(j, BitboardAttacks.rookShiftBits[i], BitboardAttacks.rookMask[i]); int magicIndex = magicTransform(pieces, BitboardAttacks.rookMagicNumber[i], BitboardAttacks.rookShiftBits[i]); BitboardAttacks.rookMagic[i][magicIndex] = getRookShiftAttacks(square, pieces); } int bishopPositions = (1 << BitboardAttacks.bishopShiftBits[i]); BitboardAttacks.bishopMagic[i] = new long[bishopPositions]; for (int j = 0; j < bishopPositions; j++) { long pieces = generatePieces(j, BitboardAttacks.bishopShiftBits[i], BitboardAttacks.bishopMask[i]); int magicIndex = magicTransform(pieces, BitboardAttacks.bishopMagicNumber[i], BitboardAttacks.bishopShiftBits[i]); BitboardAttacks.bishopMagic[i][magicIndex] = getBishopShiftAttacks(square, pieces); } square <<= 1; i++; } long t2 = System.currentTimeMillis(); GWT.log("ellapsed: " + (t2 - t1)); if ("true".equals(Window.Location.getParameter("debug"))) { Window.alert("ellapsed: " + (t2 - t1)); } }
From source file:com.appspot.attractiveness.client.RatingWidget.java
License:Apache License
@UiHandler("submitBtn") protected void onClick(ClickEvent e) { // Get the rating int rating = 0; if (r1.getValue()) rating = 1;// w ww . j ava 2 s.c o m else if (r2.getValue()) rating = 2; else if (r3.getValue()) rating = 3; else if (r4.getValue()) rating = 4; else if (r5.getValue()) rating = 5; // Save the rating to the datastore PersonRequest request = requestFactory.personRequest(); PersonProxy newPerson = request.create(PersonProxy.class); newPerson.setAge(21); newPerson.setAvailable(false); newPerson.setLanguage("en"); newPerson.setMale(true); request.persist().using(newPerson).fire(new Receiver<Void>() { @Override public void onSuccess(Void response) { Window.alert("Successfully added person!"); } @Override public void onFailure(ServerFailure error) { super.onFailure(error); Window.alert("Failed to add person!"); } }); }
From source file:com.appspot.attractiveness.client.RatingWidget.java
License:Apache License
/** * Entry point classes define <code>onModuleLoad()</code>. *///from ww w. j a v a 2s .c o m @Override public void onModuleLoad() { // Setup RequestFactory EventBus eventBus = new SimpleEventBus(); requestFactory = GWT.create(AttractivenessRequestFactory.class); requestFactory.initialize(eventBus); AuthRequest request = new AuthRequest(FB_OAUTH_URL, CLIENT_ID).withScopes(RELATIONSHIPS_SCOPE, ABOUT_ME_SCOPE); Auth.get().login(request, new Callback<String, Throwable>() { @Override public void onSuccess(String result) { // TODO: This should be externalized into a seperate Facebook // Opengraph GWT library String fbQueryUrl = PERSON_GRAPH_QUERY + "access_token=" + result; fbQueryUrl = URL.encode(fbQueryUrl); try { new RequestBuilder(RequestBuilder.GET, fbQueryUrl).sendRequest(null, new RequestCallback() { @Override public void onResponseReceived(Request request, Response response) { PersonJso personData = PersonJso.fromJSON(response.getText()); Window.alert( "Gender: " + personData.getGender() + ", Birthday: " + personData.getBirthday() + ", RelStatus: " + personData.getRelationshipStatus()); } @Override public void onError(Request request, Throwable exception) { Window.alert("I was unable to get data: " + exception.getMessage()); } }); } catch (RequestException ex) { Window.alert(ex.getMessage()); } } @Override public void onFailure(Throwable reason) { Window.alert("Failed to Authenticate: " + reason.getMessage()); } }); RootPanel.get("contentDiv").add(this); }
From source file:com.appspot.socialinquirer.client.activity.HomeActivity.java
License:Apache License
@Override public void onQuestionsSearchPerformed(final String text) { GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable caught) { Window.alert("Code download failed"); }//from w ww . j a va 2 s . co m public void onSuccess() { SearchControlOptions options = new SearchControlOptions(); WebSearch ws = new WebSearch(); ws.setSiteRestriction("015203706368483719477:w4zebhpqxyu"); options.add(ws); SearchControl searchControl = new SearchControl(options); searchControl.addSearchResultsHandler(new SearchResultsHandler() { @Override public void onSearchResults(SearchResultsEvent event) { JsArray<? extends Result> results = event.getResults(); ArrayList<Question> questions = new ArrayList<Question>(); for (int i = 0; i < results.length(); i++) { Result result = results.get(i); if (result instanceof WebResult) { Question question = createQuestion((WebResult) result); question.setKey(getQuestionId(((WebResult) result).getUnescapedUrl())); if (question.getKey() != null) { questions.add(question); } } } homeView.setQuestions(questions); } }); searchControl.execute(text); } }); }
From source file:com.appspot.socialinquirer.client.view.NetworkViewImpl.java
License:Apache License
/** * Instantiates a new network view impl. * * @param constants the constants/* ww w. j a v a 2 s . c o m*/ */ public NetworkViewImpl(EverScribeConstants constants) { this.constants = constants; GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable caught) { Window.alert("Code download failed"); } public void onSuccess() { connectionsTable = new CellTable<User>(); SimplePager.Resources linkedHubPagerResources = GWT.create(SimplePager.Resources.class); connectionsPaginator = new SimplePager(TextLocation.CENTER, linkedHubPagerResources, false, 0, true); connectionsPaginator.setDisplay(connectionsTable); final SelectionModel<User> linkedHubConnectionsSelectionModel = new SingleSelectionModel<User>( new KeyProvider<User>()); connectionsTable.setSelectionModel(linkedHubConnectionsSelectionModel, DefaultSelectionEventManager.<User>createCheckboxManager()); initTableColumns(connectionsTable, linkedHubConnectionsSelectionModel); initWidget(uiBinder.createAndBindUi(NetworkViewImpl.this)); } }); }
From source file:com.arcbees.beestore.client.application.widget.sidepanel.checkout.PaymentView.java
License:Apache License
@Override public void showErrorMessage(String message) { Window.alert(message); }
From source file:com.arcbees.beestore.client.application.widget.sidepanel.checkout.PaymentView.java
License:Apache License
@Override public void showSuccessMessage(String message) { Window.alert(message); }
From source file:com.arcbees.project.client.application.admin.AdminPresenter.java
License:Apache License
private void fetchTaskCount() { FetchAdminTaskCountAction action = new FetchAdminTaskCountAction(); dispatcher.execute(action, new AsyncCallbackImpl<FetchAdminTaskCountResult>() { @Override//from w w w . jav a2 s . c o m public void onSuccess(FetchAdminTaskCountResult result) { displayTaskCount(result.getTotalTasksCount()); } @Override public void onFailure(Throwable caught) { if (caught.getMessage().contains("not logged in")) { Window.alert("Please login."); } else if (caught.getMessage().contains("couldn't allow access to action")) { Window.alert("Please login as an Application Admin."); } else { super.onFailure(caught); } } }); }
From source file:com.arcbees.project.client.dispatch.AsyncCallbackImpl.java
License:Apache License
@Override public void onFailure(Throwable caught) { Window.alert("Communication to the server has failed."); }