Example usage for com.google.gwt.user.client.ui HorizontalPanel add

List of usage examples for com.google.gwt.user.client.ui HorizontalPanel add

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui HorizontalPanel add.

Prototype

@Override
    public void add(Widget w) 

Source Link

Usage

From source file:com.google.gwt.maps.sample.hellomaps.client.InfoWindowDemo.java

License:Apache License

public InfoWindowDemo() {

    VerticalPanel vertPanel = new VerticalPanel();
    vertPanel.setStyleName("hm-panel");

    map = new MapWidget(ATLANTA, 13);
    vertPanel.add(map);//from   w ww  .  j av  a 2 s.c o  m

    actionListBox = new ListBox();
    actionListBox.addItem(TEST_DEFAULT);
    actionListBox.addItem(TEST_IMAGE);
    actionListBox.addItem(TEST_NO_CLICK);
    actionListBox.addItem(TEST_TABS);
    actionListBox.addItem(TEST_MAX_CONTENT);
    actionListBox.addItem(TEST_MAX_TITLE_CONTENT_WIDGET);
    actionListBox.addItem(TEST_MAP_BLOWUP);

    actionListBox.addChangeListener(new ChangeListener() {
        public void onChange(Widget sender) {
            displayInfoWindow();
        }
    });

    map.setSize("500px", "450px");

    HorizontalPanel horizPanel = new HorizontalPanel();
    horizPanel.add(new Label("Choose Action:"));
    horizPanel.add(actionListBox);
    horizPanel.setSpacing(10);

    vertPanel.add(horizPanel);

    vertPanel.add(map);
    initWidget(vertPanel);
}

From source file:com.google.gwt.maps.sample.hellomaps.client.InfoWindowDemo.java

License:Apache License

private InfoWindowContent displayInfoWindowMaxWidget() {
    final InfoWindowContent content = new InfoWindowContent("There's more to see (hit the maximize button)");
    content.setMaxTitle(new HTML("<i>Maximized Italic Boots</i>"));
    VerticalPanel panel = new VerticalPanel();
    panel.add(new Image("boot.jpg"));
    Button b = new Button("Click for Message");
    final Label l = new Label();
    HorizontalPanel hp = new HorizontalPanel();
    hp.add(b);
    hp.add(l);//from  w ww . j a v  a  2  s  . c  o m
    l.getElement().getStyle().setPropertyPx("margin", 7);
    b.addClickListener(new ClickListener() {
        public void onClick(Widget w) {
            GWT.log("Got click in maximized window.", null);
            if (l.getText().equals("")) {
                l.setText("Hello World!");
            } else {
                l.setText("");
            }
        }
    });
    panel.add(hp);
    panel.setSpacing(10);
    content.setMaxContent(panel);
    return content;
}

From source file:com.google.gwt.maps.sample.hellomaps.client.MapEventDemo.java

License:Apache License

public MapEventDemo() {
    VerticalPanel vp = new VerticalPanel();

    // Center the new map on Midtown Atlanta
    map = new MapWidget(ATLANTA, 13);
    map.setSize("500px", "300px");
    map.addControl(new SmallMapControl());
    map.addControl(new MapTypeControl());

    MarkerOptions opt = MarkerOptions.newInstance();
    opt.setDraggable(true);/* w  ww . j  a v  a  2 s  . c o  m*/
    marker = new Marker(ATLANTA, opt);

    Panel hp1 = createActionButtons();

    HorizontalPanel hp2 = createListenerListBox();

    // Make a spacer
    HorizontalPanel hp3 = new HorizontalPanel();
    hp3.add(new Label(" "));
    hp3.setSize("1em", "1em");

    handlerTable = new FlexTable();
    clearListenerTable();

    vp.add(map);
    vp.add(hp1);
    vp.add(hp2);
    vp.add(hp3);
    vp.add(handlerTable);

    initWidget(vp);
}

From source file:com.google.gwt.maps.sample.hellomaps.client.MapEventDemo.java

License:Apache License

/**
 * Create a panel of buttons to use to perform various actions on the marker.
 *//*from   w  ww . j  ava2s  . c om*/
private Panel createActionButtons() {
    VerticalPanel vp = new VerticalPanel();
    HorizontalPanel hp = new HorizontalPanel();
    hp.setSpacing(10);

    vp.add(hp);

    // Create a button to hide/show the marker
    final Button hideButton = new Button("Hide Marker");
    hideButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            boolean state = !marker.isVisible();
            marker.setVisible(state);
            if (state) {
                hideButton.setText("Hide Marker");
            } else {
                hideButton.setText("Show Marker");
            }
        }
    });
    hp.add(hideButton);

    // Create a button to remove the marker from the map.
    final Button removeButton = new Button("Remove Marker");
    removeButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            if (!markerRemoved) {
                map.removeOverlay(marker);
                removeButton.setText("Add Marker");
            } else {
                map.addOverlay(marker);
                removeButton.setText("Remove Marker");
            }
            hideButton.setEnabled(markerRemoved);
            markerRemoved = !markerRemoved;
        }
    });
    hp.add(removeButton);

    // Create a button to hide/show the polygon
    final Button hidePolygonButton = new Button("Hide Polygon");
    hidePolygonButton.setEnabled(false);
    hidePolygonButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            boolean state = !polygon.isVisible();
            polygon.setVisible(state);
            if (state) {
                hidePolygonButton.setText("Hide Polygon");
            } else {
                hidePolygonButton.setText("Show Polygon");
            }
        }
    });
    hp.add(hidePolygonButton);

    // Create a button to remove the polygon from the map.
    final Button removePolygonButton = new Button("Add Polygon");
    removePolygonButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            if (!polygonRemoved) {
                map.removeOverlay(polygon);
                removePolygonButton.setText("Add Polygon");
            } else {
                map.addOverlay(polygon);
                removePolygonButton.setText("Remove Polygon");
            }
            hidePolygonButton.setEnabled(polygonRemoved);
            polygonRemoved = !polygonRemoved;
        }
    });
    hp.add(removePolygonButton);

    // Create a button to hide/show the polyline
    final Button hidePolylineButton = new Button("Hide Polyline");
    hidePolylineButton.setEnabled(false);
    hidePolylineButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            boolean state = !polyline.isVisible();
            polyline.setVisible(state);
            if (state) {
                hidePolylineButton.setText("Hide Polyline");
            } else {
                hidePolylineButton.setText("Show Polyline");
            }
        }
    });
    hp.add(hidePolylineButton);

    // Create a button to remove the polyline from the map.
    final Button removePolylineButton = new Button("Add Polyline");
    removePolylineButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            if (!polylineRemoved) {
                map.removeOverlay(polyline);
                removePolylineButton.setText("Add Polyline");
            } else {
                map.addOverlay(polyline);
                removePolylineButton.setText("Remove Polyline");
            }
            hidePolylineButton.setEnabled(polylineRemoved);
            polylineRemoved = !polylineRemoved;
        }
    });
    hp.add(removePolylineButton);

    final Button clearOverlaysButton = new Button("Clear Overlays");
    clearOverlaysButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            map.clearOverlays();
        }
    });

    hp.add(clearOverlaysButton);

    hp = new HorizontalPanel();
    hp.setSpacing(10);
    vp.add(hp);

    final Button infoWindowButton = new Button("Show InfoWindow");
    infoWindowButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            InfoWindow info = map.getInfoWindow();
            InfoWindowContent content = new InfoWindowContent("Hello Maps!");
            content.setMaxContent("Hello Maps - more content");
            content.setMaxTitle("Hello Maps");
            info.open(map.getCenter(), content);
        }
    });
    hp.add(infoWindowButton);

    final Button mInfoWindowButton = new Button("Marker InfoWindow");
    mInfoWindowButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            InfoWindow info = map.getInfoWindow();
            InfoWindowContent content = new InfoWindowContent("Hello Maps!");
            content.setMaxContent("Hello Maps - more content");
            content.setMaxTitle("Hello Maps");
            info.open(marker, content);
        }
    });
    hp.add(mInfoWindowButton);

    final Button mapTypeButton = new Button("Add Map Type");
    mapTypeButton.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            if (!mapTypeRemoved) {
                map.addMapType(MapType.getSkyVisibleMap());
                mapTypeButton.setText("Remove MapType");
            } else {
                map.removeMapType(MapType.getSkyVisibleMap());
                mapTypeButton.setText("Add MapType");
            }
            mapTypeRemoved = !mapTypeRemoved;
        }

    });
    hp.add(mapTypeButton);

    // Create a button to clear out the table.
    final Button clearTableButton = new Button("Clear Table");
    clearTableButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            clearListenerTable();
        }
    });
    hp.add(clearTableButton);

    return vp;
}

From source file:com.google.gwt.maps.sample.hellomaps.client.MapEventDemo.java

License:Apache License

/**
 * Create a drop down list that shows all the different types of listeners
 * that can be added.//w  w w.ja  v a2  s .  c om
 * 
 * @return a ListBox populated with the ListenerActions values
 */
private HorizontalPanel createListenerListBox() {
    HorizontalPanel h = new HorizontalPanel();

    final ListBox listenerBox = new ListBox();
    for (HandlerActions a : HandlerActions.values()) {
        listenerBox.addItem(a.valueOf());
    }
    h.add(listenerBox);

    Button b = new Button("Add Handler");
    b.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            int selectedIndex = listenerBox.getSelectedIndex();
            HandlerActions a = HandlerActions.values()[selectedIndex];
            addListenerToMarker(a);
        }

    });
    h.add(b);

    return h;
}

From source file:com.google.gwt.maps.sample.hellomaps.client.OverlayDemo.java

License:Apache License

public OverlayDemo() {

    VerticalPanel vertPanel = new VerticalPanel();
    vertPanel.setStyleName("hm-panel");

    actionListBox = new ListBox();
    for (OverlayDemos od : OverlayDemos.values()) {
        actionListBox.addItem(od.valueOf());
    }// w w  w .  j av a  2s .  c  o m
    actionListBox.addChangeListener(new ChangeListener() {
        public void onChange(Widget sender) {
            displayOverlay();
        }

    });

    HorizontalPanel horizPanel = new HorizontalPanel();
    horizPanel.add(new Label("Choose Action:"));
    horizPanel.add(actionListBox);
    horizPanel.setSpacing(10);

    vertPanel.add(horizPanel);

    map = new MapWidget(LatLng.newInstance(37.4419, -122.1419), 13);
    map.setSize("500px", "300px");
    map.addControl(new SmallMapControl());
    map.addControl(new MapTypeControl());
    vertPanel.add(map);

    initWidget(vertPanel);
}

From source file:com.google.gwt.maps.testing.client.maps.AutocompletePlacesMapWidget.java

License:Apache License

private void draw() {

    pWidget.clear();//from   w  ww  . j  a v a2  s . c  o  m

    HTML html = new HTML("<br><br>Map with autocomplete places &nbsp;&nbsp;");
    tbPlaces = new TextBox();
    tbPlaces.setWidth("350px");

    HorizontalPanel hp = new HorizontalPanel();
    hp.add(html);
    hp.add(tbPlaces);

    pWidget.add(hp);

    hp.setCellVerticalAlignment(tbPlaces, HorizontalPanel.ALIGN_BOTTOM);

    drawMap();

    drawAutoComplete();
}

From source file:com.google.gwt.maps.testing.client.maps.BasicMapWidget.java

License:Apache License

private void draw() {
    Button addBounceMarkerButton = new Button("Add Marker with Bounce");
    addBounceMarkerButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            if (markerBouncing != null) {
                markerBouncing.clear();//from  www . ja  v a 2s . c  om
            }
            drawMarkerWithBounceAnimation();
        }
    });

    Button addDropMarkerButton = new Button("Add Marker with Drop");
    addDropMarkerButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            if (markerDrop != null) {
                markerDrop.clear();
            }
            drawMarkerWithDropAnimation();
        }
    });

    Button stopAnimationsButton = new Button("Stop Animations");
    stopAnimationsButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            if (markerBasic != null) {
                markerBasic.setAnimation(Animation.STOPANIMATION);
            }
            if (markerBouncing != null) {
                markerBouncing.setAnimation(Animation.STOPANIMATION);
            }
            if (markerDrop != null) {
                markerDrop.setAnimation(Animation.STOPANIMATION);
            }
        }
    });

    Button startAnimationsButton = new Button("Start Animations");
    startAnimationsButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            if (markerBasic != null) {
                markerBasic.setAnimation(Animation.BOUNCE);
            }
            if (markerBouncing != null) {
                markerBouncing.setAnimation(Animation.BOUNCE);
            }
            if (markerDrop != null) {
                markerDrop.setAnimation(Animation.DROP);
            }
        }
    });

    // basic controls to test markers
    HorizontalPanel hp = new HorizontalPanel();
    hp.add(new HTML("<br>Basic Map Example. With an AdUnit"));
    hp.add(addBounceMarkerButton);
    hp.add(new HTML("&nbsp;"));
    hp.add(addDropMarkerButton);
    hp.add(new HTML("&nbsp;"));
    hp.add(startAnimationsButton);
    hp.add(new HTML("&nbsp;"));
    hp.add(stopAnimationsButton);
    hp.setCellVerticalAlignment(addBounceMarkerButton, VerticalPanel.ALIGN_BOTTOM);
    hp.setCellVerticalAlignment(addDropMarkerButton, VerticalPanel.ALIGN_BOTTOM);
    hp.setCellVerticalAlignment(startAnimationsButton, VerticalPanel.ALIGN_BOTTOM);
    hp.setCellVerticalAlignment(stopAnimationsButton, VerticalPanel.ALIGN_BOTTOM);

    pWidget.clear();
    pWidget.add(hp);

    drawMap();
    drawMapAds();
    drawBasicMarker();
}

From source file:com.google.gwt.maps.testing.client.maps.DirectionsServiceMapWidget.java

License:Apache License

private void draw() {
    pWidget.clear();//from  ww w.  jav a2s . c o m
    pWidget.add(new HTML("<br/>"));

    HorizontalPanel hp = new HorizontalPanel();
    pWidget.add(hp);
    hp.add(new HTML("Directions Service&nbsp;&nbsp;&nbsp;&nbsp;"));
    hp.add(htmlDistanceMatrixService);

    drawMap();
    drawDirectionsWithMidPoint();
}

From source file:com.google.gwt.maps.testing.client.maps.KmlMapWidget.java

License:Apache License

private void draw() {

    pWidget.clear();//from w  ww . j a v  a  2s. com

    pWidget.add(new HTML("&nbsp;"));

    HorizontalPanel hp = new HorizontalPanel();
    hp.add(new HTML("Kml Example - Try clicking on marker &nbsp;&nbsp;&nbsp;"));

    pWidget.add(hp);

    drawMap();

    // draw kmls
    // changeKmlState();

    drawKml2();
}