Example usage for com.google.gwt.user.client Window alert

List of usage examples for com.google.gwt.user.client Window alert

Introduction

In this page you can find the example usage for com.google.gwt.user.client Window alert.

Prototype

public static void alert(String msg) 

Source Link

Usage

From source file:com.fullmetalgalaxy.client.ressources.tokens.TokenImages.java

License:Open Source License

public static void loadAllBundle() {
    synchronized (s_bundle) {
        GWT.runAsync(TokenImages.class, new RunAsyncCallback() {
            @Override//from ww w  .  j a  v  a  2s .co m
            public void onFailure(Throwable caught) {
                Window.alert("Error while downloading script: " + caught.getLocalizedMessage());
            }

            @Override
            public void onSuccess() {
                if (s_bundle.isEmpty()) {
                    s_bundle.put(EnuColor.Purple, (Purple) GWT.create(Purple.class));
                    s_bundle.put(EnuColor.Blue, (Blue) GWT.create(Blue.class));
                    s_bundle.put(EnuColor.Cyan, (Cyan) GWT.create(Cyan.class));
                    s_bundle.put(EnuColor.Green, (Green) GWT.create(Green.class));
                    s_bundle.put(EnuColor.Grey, (Grey) GWT.create(Grey.class));
                    s_bundle.put(EnuColor.Olive, (Olive) GWT.create(Olive.class));
                    s_bundle.put(EnuColor.Orange, (Orange) GWT.create(Orange.class));
                    s_bundle.put(EnuColor.Red, (Red) GWT.create(Red.class));
                    s_bundle.put(EnuColor.Yellow, (Yellow) GWT.create(Yellow.class));
                    s_bundle.put(EnuColor.Brown, (Brown) GWT.create(Brown.class));
                    s_bundle.put(EnuColor.Camouflage, (Camouflage) GWT.create(Camouflage.class));
                    s_bundle.put(EnuColor.Lightning, (Lightning) GWT.create(Lightning.class));
                    s_bundle.put(EnuColor.Pantera, (Pantera) GWT.create(Pantera.class));
                    s_bundle.put(EnuColor.Pink, (Pink) GWT.create(Pink.class));
                    s_bundle.put(EnuColor.White, (White) GWT.create(White.class));
                    s_bundle.put(EnuColor.Zebra, (Zebra) GWT.create(Zebra.class));
                    s_bundle.put(EnuColor.None, (Colorless) GWT.create(Colorless.class));
                }
                if (s_bundleFreighter.isEmpty()) {
                    s_bundleFreighter.put(EnuColor.Purple, (PurpleFreighter) GWT.create(PurpleFreighter.class));
                    s_bundleFreighter.put(EnuColor.Blue, (BlueFreighter) GWT.create(BlueFreighter.class));
                    s_bundleFreighter.put(EnuColor.Cyan, (CyanFreighter) GWT.create(CyanFreighter.class));
                    s_bundleFreighter.put(EnuColor.Green, (GreenFreighter) GWT.create(GreenFreighter.class));
                    s_bundleFreighter.put(EnuColor.Grey, (GreyFreighter) GWT.create(GreyFreighter.class));
                    s_bundleFreighter.put(EnuColor.Olive, (OliveFreighter) GWT.create(OliveFreighter.class));
                    s_bundleFreighter.put(EnuColor.Orange, (OrangeFreighter) GWT.create(OrangeFreighter.class));
                    s_bundleFreighter.put(EnuColor.Red, (RedFreighter) GWT.create(RedFreighter.class));
                    s_bundleFreighter.put(EnuColor.Yellow, (YellowFreighter) GWT.create(YellowFreighter.class));
                    s_bundleFreighter.put(EnuColor.Brown, (BrownFreighter) GWT.create(BrownFreighter.class));
                    s_bundleFreighter.put(EnuColor.Camouflage,
                            (CamouflageFreighter) GWT.create(CamouflageFreighter.class));
                    s_bundleFreighter.put(EnuColor.Lightning,
                            (LightningFreighter) GWT.create(LightningFreighter.class));
                    s_bundleFreighter.put(EnuColor.Pantera,
                            (PanteraFreighter) GWT.create(PanteraFreighter.class));
                    s_bundleFreighter.put(EnuColor.Pink, (PinkFreighter) GWT.create(PinkFreighter.class));
                    s_bundleFreighter.put(EnuColor.White, (WhiteFreighter) GWT.create(WhiteFreighter.class));
                    s_bundleFreighter.put(EnuColor.Zebra, (ZebraFreighter) GWT.create(ZebraFreighter.class));
                    s_bundleFreighter.put(EnuColor.None,
                            (ColorlessFreighter) GWT.create(ColorlessFreighter.class));
                }
                if (s_bundleExtra.isEmpty()) {
                    s_bundleExtra.put(EnuColor.Purple, (PurpleExtra) GWT.create(PurpleExtra.class));
                    s_bundleExtra.put(EnuColor.Blue, (BlueExtra) GWT.create(BlueExtra.class));
                    s_bundleExtra.put(EnuColor.Cyan, (CyanExtra) GWT.create(CyanExtra.class));
                    s_bundleExtra.put(EnuColor.Green, (GreenExtra) GWT.create(GreenExtra.class));
                    s_bundleExtra.put(EnuColor.Grey, (GreyExtra) GWT.create(GreyExtra.class));
                    s_bundleExtra.put(EnuColor.Olive, (OliveExtra) GWT.create(OliveExtra.class));
                    s_bundleExtra.put(EnuColor.Orange, (OrangeExtra) GWT.create(OrangeExtra.class));
                    s_bundleExtra.put(EnuColor.Red, (RedExtra) GWT.create(RedExtra.class));
                    s_bundleExtra.put(EnuColor.Yellow, (YellowExtra) GWT.create(YellowExtra.class));
                    s_bundleExtra.put(EnuColor.Brown, (BrownExtra) GWT.create(BrownExtra.class));
                    s_bundleExtra.put(EnuColor.Camouflage, (CamouflageExtra) GWT.create(CamouflageExtra.class));
                    s_bundleExtra.put(EnuColor.Lightning, (LightningExtra) GWT.create(LightningExtra.class));
                    s_bundleExtra.put(EnuColor.Pantera, (PanteraExtra) GWT.create(PanteraExtra.class));
                    s_bundleExtra.put(EnuColor.Pink, (PinkExtra) GWT.create(PinkExtra.class));
                    s_bundleExtra.put(EnuColor.White, (WhiteExtra) GWT.create(WhiteExtra.class));
                    s_bundleExtra.put(EnuColor.Zebra, (ZebraExtra) GWT.create(ZebraExtra.class));
                    s_bundleExtra.put(EnuColor.None, (ColorlessExtra) GWT.create(ColorlessExtra.class));
                }

                // TODO create special event
                AppRoot.getEventBus().fireEvent(new ModelUpdateEvent(GameEngine.model()));
            }
        });
    }
}

From source file:com.github.a2g.core.platforms.html4.FactoryForHtml4.java

License:Apache License

public void alert(String text) {
    Window.alert(text);
}

From source file:com.github.gwtbootstrap.demo.client.BootstrapUiBinderDemo.java

License:Apache License

@UiHandler("button")
void onClick(ClickEvent e) {

    Window.alert("Hello!");
}

From source file:com.github.gwtbootstrap.demo.client.BootstrapUiBinderDemo.java

License:Apache License

@UiHandler("splitDropdownButton")
void onSplitClick(ClickEvent e) {
    Window.alert("Split");
}

From source file:com.github.gwtbootstrap.showcase.client.Navigation.java

License:Apache License

public Navigation() {

    tabPosition.setValue(Tabs.LEFT);//w  ww .  j a v a  2  s  . com

    tabPosition.setAcceptableValues(Arrays.asList(Tabs.values()));

    initWidget(uiBinder.createAndBindUi(this));
    ClickHandler handler = new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Window.alert("ClickHandler navlink example.");
        }
    };
    navlink1.addClickHandler(handler);
    navlink2.addClickHandler(handler);
}

From source file:com.github.gwtbootstrap.showcase.client.Navigation.java

License:Apache License

@UiHandler("utilitiesTab")
void onShown(ShownEvent e) {
    Window.alert("Change tab from " + e.getRelatedTarget().getText() + " to " + e.getTarget().getText() + ".");
}

From source file:com.github.jdramaix.client.ConverterApp.java

License:Apache License

private void onreadystatechange(XMLHttpRequest xhr) {
    if (xhr.getReadyState() == 4) {
        Properties json = JsUtils.parseJSON(xhr.getResponseText());
        if (xhr.getStatus() == 200) {
            displayAnswer(json.getStr("result"));
            console.log("Logs form server: \n" + json.getStr("logs"));
        } else {//w ww.  j a  v  a 2  s  . com
            Window.alert("Ooops something went wrong... Please try again!");
            console.log(json.getStr("result"));
        }

        uploadUrl = json.getStr("nextUrl");
    }
}

From source file:com.github.ludorival.dao.gwt.client.local.GwtLocalAsyncStore.java

License:Apache License

@Override
protected void runAsync(final Runnable runnable) {
    GWT.runAsync(new RunAsyncCallback() {

        @Override/*from  w  w w  . j  a va 2s. c o m*/
        public void onSuccess() {
            runnable.run();
        }

        @Override
        public void onFailure(Throwable reason) {
            Window.alert(reason.getMessage());
            runnable.run();//run any way
        }
    });
}

From source file:com.github.tdesjardins.ol3.demo.client.example.GeolocationExample.java

License:Apache License

@Override
public void show(String exampleId) {

    // create a OSM-layer
    XyzOptions osmSourceOptions = OLFactory.createOptions();

    Osm osmSource = new Osm(osmSourceOptions);
    LayerOptions osmLayerOptions = OLFactory.createOptions();
    osmLayerOptions.setSource(osmSource);

    Tile osmLayer = new Tile(osmLayerOptions);

    Vector vector = new Vector();

    // create a view
    ViewOptions viewOptions = OLFactory.createOptions();
    View view = new View(viewOptions);

    Coordinate centerCoordinate = new Coordinate(-0.1275, 51.507222);
    Coordinate transformedCenterCoordinate = Projection.transform(centerCoordinate, DemoConstants.EPSG_4326,
            DemoConstants.EPSG_3857);/*from   www. j  a  v a 2 s.  c  o m*/

    view.setCenter(transformedCenterCoordinate);
    view.setZoom(10);

    // create the map
    MapOptions mapOptions = OLFactory.createOptions();
    mapOptions.setTarget(exampleId);
    mapOptions.setView(view);

    Map map = new Map(mapOptions);

    map.addLayer(osmLayer);
    map.addLayer(vector);

    // add some controls
    map.addControl(new ScaleLine());
    DemoUtils.addDefaultControls(map.getControls());

    Attribution attribution = new Attribution();
    attribution.setCollapsed(true);

    map.addControl(attribution);

    // add some interactions
    map.addInteraction(new KeyboardPan());
    map.addInteraction(new KeyboardZoom());

    ol.source.Vector vectorSource = new ol.source.Vector();
    vector.setSource(vectorSource);

    Feature positionFeature = new Feature();
    Feature accuracyFeature = new Feature();

    vectorSource.addFeature(accuracyFeature);
    vectorSource.addFeature(positionFeature);

    PositionOptions positionOptions = new PositionOptions();
    positionOptions.setEnableHighAccuracy(true);

    GeolocationOptions geolocationOptions = new GeolocationOptions();
    geolocationOptions.setTrackingOptions(positionOptions);
    geolocationOptions.setProjection(view.getProjection());

    Geolocation geolocation = new Geolocation(geolocationOptions);

    geolocation.addChangeListener((Event event) -> {

        positionFeature.setGeometry(new Point(geolocation.getPosition()));
        view.setCenter(geolocation.getPosition());

    });

    ViewFitOptions viewFitOptions = OLFactory.createOptions();
    viewFitOptions.setSize(new Size(100, 100));

    geolocation.on("change:accuracyGeometry", (Event event) -> {

        accuracyFeature.setGeometry(geolocation.getAccuracyGeometry());
        view.fit(geolocation.getAccuracyGeometry(), viewFitOptions);

    });

    geolocation.on("error", (Event event) -> {

        Window.alert("Could't determine location!");

    });

    // start tracking
    geolocation.setTracking(true);

}

From source file:com.github.tdesjardins.ol3.demo.client.example.MapEventsExample.java

License:Apache License

@Override
public void show(String exampleId) {

    // create a OSM-layer
    XyzOptions osmSourceOptions = OLFactory.createOptions();

    Osm osmSource = new Osm(osmSourceOptions);
    LayerOptions osmLayerOptions = OLFactory.createOptions();
    osmLayerOptions.setSource(osmSource);

    Tile osmLayer = new Tile(osmLayerOptions);

    // create a view
    View view = new View();

    Coordinate centerCoordinate = OLFactory.createCoordinate(-0.1275, 51.507222);
    Coordinate transformedCenterCoordinate = Projection.transform(centerCoordinate, DemoConstants.EPSG_4326,
            DemoConstants.EPSG_3857);// w ww.j  a  va 2 s.c  o m

    view.setCenter(transformedCenterCoordinate);
    view.setZoom(10);

    // create the map
    MapOptions mapOptions = OLFactory.createOptions();
    mapOptions.setTarget(exampleId);
    mapOptions.setView(view);

    Map map = new Map(mapOptions);

    map.addLayer(osmLayer);

    // add some controls
    map.addControl(OLFactory.createScaleLine());
    DemoUtils.addDefaultControls(map.getControls());

    Attribution attribution = new Attribution();
    attribution.setCollapsed(true);

    map.addControl(attribution);

    // clear default interactions
    map.getInteractions().clear();

    // add some interactions
    map.addInteraction(new DragPan());
    map.addInteraction(new KeyboardPan());
    map.addInteraction(new KeyboardZoom());
    map.addInteraction(new MouseWheelZoom());

    // add event handlers
    map.addDoubleClickListener(new DoubleClickListener() {

        @Override
        public void onDoubleClick(MapBrowserEvent evt) {
            Window.alert("double click at " + evt.getCoordinate().getX() + ", " + evt.getCoordinate().getX());
        }

    });

}