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

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

Introduction

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

Prototype

public static int getClientWidth() 

Source Link

Usage

From source file:com.arcbees.website.client.application.contact.ContactView.java

License:Apache License

private void onMapsLoaded() {
    // -- HOW TO STYLE A GOOGLE MAP
    // -> First, we create the style. To help : http://software.stadtwerk.org/google_maps_colorizr/
    MapTypeStyle style1 = MapTypeStyle.newInstance();
    style1.setElementType(MapTypeStyleElementType.GEOMETRY);
    style1.setFeatureType(MapTypeStyleFeatureType.ROAD);
    style1.setStylers(new MapTypeStyler[] { MapTypeStyler.newHueStyler("#FFF"),
            MapTypeStyler.newSaturationStyler(-100), MapTypeStyler.newLightnessStyler(100) });

    MapTypeStyle style2 = MapTypeStyle.newInstance();
    style2.setElementType(MapTypeStyleElementType.ALL);
    style2.setFeatureType(MapTypeStyleFeatureType.LANDSCAPE);
    style2.setStylers(new MapTypeStyler[] { MapTypeStyler.newHueStyler("#cccccc"),
            MapTypeStyler.newSaturationStyler(-100), MapTypeStyler.newLightnessStyler(-10) });

    MapTypeStyle style3 = MapTypeStyle.newInstance();
    style3.setElementType(MapTypeStyleElementType.ALL);
    style3.setFeatureType(MapTypeStyleFeatureType.POI);
    style3.setStylers(new MapTypeStyler[] { MapTypeStyler.newHueStyler("#f00"),
            MapTypeStyler.newSaturationStyler(-100), MapTypeStyler.newLightnessStyler(9), });

    MapTypeStyle style4 = MapTypeStyle.newInstance();
    style4.setElementType(MapTypeStyleElementType.ALL);
    style4.setFeatureType(MapTypeStyleFeatureType.WATER);
    style4.setStylers(new MapTypeStyler[] { MapTypeStyler.newHueStyler("#1c1c1c"),
            MapTypeStyler.newSaturationStyler(-100), MapTypeStyler.newLightnessStyler(86), });

    MapTypeStyle[] array = { style1, style2, style3, style4 };

    JsArray<MapTypeStyle> styles = ArrayHelper.toJsArray(array);

    // -> Then we tell the map to use our new style by default
    MapTypeControlOptions controlOptions = MapTypeControlOptions.newInstance();
    controlOptions.setMapTypeIds(new String[] {});
    controlOptions.setPosition(ControlPosition.TOP_RIGHT);

    // -> And tell the map what our custom style is
    StyledMapTypeOptions styledMapTypeOptions = StyledMapTypeOptions.newInstance();
    styledMapTypeOptions.setName("Arcbees");
    StyledMapType customMapType = StyledMapType.newInstance(styles, styledMapTypeOptions);

    // -> Then we define our Lat and Long
    LatLng arcbeesCoord = LatLng.newInstance(46.792097, -71.285362);

    // -> Then goes the map options
    MapOptions options = MapOptions.newInstance();
    options.setCenter(arcbeesCoord);//  ww w. j av  a2  s.com
    options.setZoom(16);
    options.setScrollWheel(false);
    options.setMapTypeControlOptions(controlOptions);
    options.setMapTypeId(ARCBEES_MAPTYPE);
    options.setPanControl(false);
    options.setDraggable(Window.getClientWidth() > 649);

    ZoomControlOptions zoomControlOptions = ZoomControlOptions.newInstance();
    zoomControlOptions.setPosition(ControlPosition.RIGHT_CENTER);
    options.setZoomControlOptions(zoomControlOptions);

    // -> We create the map with our options
    MapWidget mapWidget = new MapWidget(options);
    mapWidget.addStyleName(page.style().map());
    mapWidget.setCustomMapType(ARCBEES_MAPTYPE, customMapType);

    // -> We define the marker
    MarkerOptions markerOptions = MarkerOptions.newInstance();
    markerOptions.setIcon(pageContactResources.marker().getSafeUri().asString());
    markerOptions.setMap(mapWidget);
    markerOptions.setPosition(arcbeesCoord);

    Marker.newInstance(markerOptions);

    // -> And finally, add it to its container
    container.add(mapWidget);
}

From source file:com.audata.client.admin.NewHierarchy.java

License:Open Source License

/**
 * Overide parent show() to integrate effects
 *//* www.  j  a  v  a2  s  .  c o m*/
public void show() {
    this.setVisible(false);
    super.show();
    Effect.appear(this);
    int left = (Window.getClientWidth() / 2) - 150;
    int top = (Window.getClientHeight() / 2) - 50;
    this.setPopupPosition(left, top);
}

From source file:com.audata.client.admin.UserDialog.java

License:Open Source License

public UserDialog(UserPanel parent, String uuid, HashMap details) {
    this.parent = parent;
    this.uuid = uuid;
    if (this.uuid != "") {
        this.setText(LANG.edit_user_Text());
        //call details
    } else {/*  ww  w.  j a v a  2 s .  c o  m*/
        this.setText(LANG.new_user_Text());
    }
    //build empty
    VerticalPanel main = new VerticalPanel();

    HorizontalPanel fname = new HorizontalPanel();
    fname.setSpacing(5);
    Label flabel = new Label(LANG.forename_Text());
    flabel.setWidth("150px");
    fname.add(flabel);
    this.forename = new TextBox();
    fname.add(this.forename);
    main.add(fname);

    HorizontalPanel sname = new HorizontalPanel();
    sname.setSpacing(5);
    Label slabel = new Label(LANG.surname_Text());
    slabel.setWidth("150px");
    sname.add(slabel);
    this.surname = new TextBox();
    sname.add(this.surname);
    main.add(sname);

    HorizontalPanel uname = new HorizontalPanel();
    uname.setSpacing(5);
    Label ulabel = new Label(LANG.username_Text());
    ulabel.setWidth("150px");
    uname.add(ulabel);
    this.username = new TextBox();
    uname.add(this.username);
    main.add(uname);
    if (this.uuid.equals("")) {
        HorizontalPanel p1 = new HorizontalPanel();
        p1.setSpacing(5);
        Label p1label = new Label(LANG.password_Text());
        p1label.setWidth("150px");
        p1.add(p1label);
        this.pass1 = new PasswordTextBox();
        p1.add(this.pass1);
        main.add(p1);

        HorizontalPanel p2 = new HorizontalPanel();
        p2.setSpacing(5);
        Label p2label = new Label(LANG.password_reenter_Text());
        p2label.setWidth("150px");
        p2.add(p2label);
        this.pass2 = new PasswordTextBox();
        p2.add(this.pass2);
        main.add(p2);
    }

    HorizontalPanel adminPanel = new HorizontalPanel();
    adminPanel.setSpacing(5);
    Label adminlabel = new Label(LANG.is_admin_Text());
    adminlabel.setWidth("150px");
    adminPanel.add(adminlabel);
    this.isAdmin = new CheckBox();
    adminPanel.add(this.isAdmin);
    main.add(adminPanel);

    HorizontalPanel levPanel = new HorizontalPanel();
    levPanel.setSpacing(5);
    Label levlabel = new Label(LANG.security_level_Text());
    levlabel.setWidth("150px");
    levPanel.add(levlabel);
    this.secLevel = new ListBox();
    levPanel.add(this.secLevel);
    main.add(levPanel);

    HorizontalPanel cavPanel = new HorizontalPanel();
    cavPanel.setSpacing(5);
    Label cavlabel = new Label(LANG.security_caveats_Text());
    cavlabel.setWidth("150px");
    cavPanel.add(cavlabel);
    this.caveats = new ListBox();
    this.caveats.setMultipleSelect(true);
    this.caveats.setVisibleItemCount(5);
    cavPanel.add(this.caveats);
    main.add(cavPanel);

    HorizontalPanel butPanel = new HorizontalPanel();
    butPanel.setSpacing(5);
    this.saveBut = new Button(LANG.save_Text());
    this.saveBut.addClickListener(this);
    butPanel.add(this.saveBut);
    this.cancelBut = new Button(LANG.cancel_Text());
    this.cancelBut.addClickListener(this);
    butPanel.add(this.cancelBut);
    main.add(butPanel);

    this.popLists();

    this.setWidget(main);
    //this.show();
    int left = (Window.getClientWidth() - this.getOffsetWidth()) / 2;
    int top = (Window.getClientHeight() - this.getOffsetHeight()) / 2;
    this.setPopupPosition(left, top);

    if (details != null) {
        this.setValues(details);
    }
}

From source file:com.audata.client.admin.UserPanel.java

License:Open Source License

public void onClick(Widget sender) {
    if (sender == this.setPassword) {
        if (this.userUUID != "") {
            this.dialog.show(this.userUUID);
            this.dialog.setVisible(false);
            int left = (Window.getClientWidth() / 2) - 150;
            int top = (Window.getClientHeight() / 2) - 50;
            this.dialog.setPopupPosition(left, top);
            Effect.appear(this.dialog);
        }/*from w ww.  j a  va  2  s. c o m*/
        return;
    }

    if (sender == this.newUser) {
        UserDialog dialog = new UserDialog(this);
        //dialog.setVisible(false);
        dialog.show();
        int left = (Window.getClientWidth() / 2) - 150;
        int top = (Window.getClientHeight() / 2) - 150;
        dialog.setPopupPosition(left, top);
        Effect.appear(dialog);
        return;
    }

    if (sender == this.editUser) {
        if (this.userUUID != "") {
            UserDialog dialog = new UserDialog(this, this.userUUID, this.custom);
            //dialog.setVisible(false);
            dialog.show();
            int left = (Window.getClientWidth() / 2) - 150;
            int top = (Window.getClientHeight() / 2) - 150;
            dialog.setPopupPosition(left, top);
            Effect.appear(dialog);
        }
        return;
    }

    if (sender == this.delUser) {
        if (this.userUUID != "") {
            SimpleDialog.displayDialog(SimpleDialog.TYPE_QUERY, LANG.confirm_Text(), LANG.del_user_msg_Text(),
                    this);
        }
    }
}

From source file:com.audata.client.authentication.LoginDialog.java

License:Open Source License

/**
 * Overide parent show to integrate effects
 *//*w w  w.  j a  va  2  s .c o m*/
public void show() {
    this.setPopupPosition(-400, -400);
    super.show();
    //this.setVisible(false);
    Effect.appear(this);
    int left = (Window.getClientWidth() / 2) - 150;
    int top = (Window.getClientHeight() / 2) - 50;
    this.setPopupPosition(left, top);
}

From source file:com.audata.client.checkout.CheckinDialog.java

License:Open Source License

/**
 * Overide parent show to integrate effects
 *///ww  w  . ja  v a  2  s. c  o m
public void show() {
    this.setVisible(false);
    super.show();
    Effect.appear(this);
    int left = (Window.getClientWidth() / 2) - 150;
    int top = (Window.getClientHeight() / 2) - 150;
    this.setPopupPosition(left, top);
}

From source file:com.axlight.gbrain.client.MainPane.java

License:Apache License

private static int getWindowScreenWidth() {
    if (GBrain.isIPhone) {
        return getWindowInnerWidth();
    } else {/*from   ww  w.j  a v  a  2 s.  c o m*/
        return Window.getClientWidth();
    }
}

From source file:com.canoo.gwt.contentflow4gwt.client.ContentFlowDemo.java

License:Open Source License

private ContentFlowPopupPanel<Person> doAnimateContentFlowIn() {
    int horizontalMargin = (Window.getClientWidth() - POPUP_WIDTH) / 2;
    int verticalMargin = (Window.getClientHeight() - POPUP_HEIGHT) / 2;
    final int initialLeft = Window.getClientWidth() + horizontalMargin;

    ContentFlow<Person> contentFlow = new ContentFlow<Person>(true, true);
    addItems(contentFlow, PEOPLE.length);
    final ContentFlowPopupPanel<Person> popupPanel = new ContentFlowPopupPanel<Person>(contentFlow);

    popupPanel.setSize(POPUP_WIDTH + "px", POPUP_HEIGHT + "px");
    popupPanel.setPopupPosition(initialLeft, verticalMargin);
    contentFlow.addItemClickListener(new ContentFlowItemClickListener() {
        public void onItemClicked(Widget widget) {
            Window.alert("Clicked: ");
        }//from  w ww  .j a  v a  2 s . co  m
    });
    popupPanel.show();

    animatePopupPanel(popupPanel, initialLeft, horizontalMargin, ANIMATION_DURATION);

    return popupPanel;
}

From source file:com.centretown.planets.client.application.widget.SizeableView.java

License:Apache License

public SizeableView() {
    Window.addResizeHandler(this);
    sizeWidth = Window.getClientWidth();
    sizeHeight = Window.getClientHeight();
    sanityCheck = 0;
}

From source file:com.centretown.planets.client.application.widget.SizeableView.java

License:Apache License

protected void doResize() {
    int top = element.getAbsoluteTop();
    if (top > 0) {
        sizeWidth = Window.getClientWidth();
        sizeHeight = Window.getClientHeight() - top;
        element.getStyle().setWidth(sizeWidth, Unit.PX);
        element.getStyle().setHeight(sizeHeight, Unit.PX);
        sanityCheck = 0;/*  w  ww.j a  v a2s .  co  m*/
    } else {
        initialize(element);
    }
}