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

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

Introduction

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

Prototype

public HorizontalPanel() 

Source Link

Document

Creates an empty horizontal panel.

Usage

From source file:com.google.code.gwt.storage.sample.hellostorage.client.HelloStorage.java

License:Apache License

private Widget createStorageTab(final Storage storage, final boolean isSupported) {
    VerticalPanel p = new VerticalPanel();

    if (isSupported) {
        HorizontalPanel hp = new HorizontalPanel();
        p.add(hp);//  w  ww .j a v  a 2s.  c  o m
        hp.add(new Label("key:"));
        final TextBox keyInput = new TextBox();
        hp.add(keyInput);
        hp.add(new Label("data:"));
        final TextBox dataInput = new TextBox();
        hp.add(dataInput);

        final Grid grid = new Grid();
        grid.setCellPadding(5);
        grid.setBorderWidth(1);
        renderGrid(grid, storage);

        hp.add(new Button("Put in storage", new ClickHandler() {
            public void onClick(ClickEvent event) {
                storage.setItem(keyInput.getText(), dataInput.getText());
                renderGrid(grid, storage);
            }
        }));

        p.add(new Button("Clear storage", new ClickHandler() {
            public void onClick(ClickEvent event) {
                storage.clear();
                renderGrid(grid, storage);
            }
        }));

        p.add(grid);
    } else {
        p.add(new Label("This Storage is NOT supported in this browser."));
    }

    return p;
}

From source file:com.google.code.p.gwtchismes.client.GWTCIntervalSelector.java

License:Apache License

private void drawLayout2() {
    int idx = 0;/*ww  w . j a v a  2 s.com*/

    mainGrid.getRowFormatter().addStyleName(idx, CHECKIN_ROW);
    HorizontalPanel checkinInfo = new HorizontalPanel();
    mainGrid.setWidget(idx, 0, checkinLabel);
    checkinInfo.add(checkinDateValue);
    checkinInfo.add(checkinWeekValue);
    checkinInfo.add(checkinButton);
    mainGrid.setWidget(idx, 1, checkinInfo);

    idx++;
    mainGrid.getRowFormatter().addStyleName(idx, CHECKOUT_ROW);
    HorizontalPanel checkoutInfo = new HorizontalPanel();
    mainGrid.setWidget(idx, 0, checkoutLabel);
    checkoutInfo.add(checkoutDateValue);
    checkoutInfo.add(checkoutWeekValue);
    checkoutInfo.add(checkoutButton);
    mainGrid.setWidget(idx, 1, checkoutInfo);
    checkoutDateValue.addClickHandler(clickListener);
    checkoutWeekValue.addClickHandler(clickListener);

    idx++;
    mainGrid.getRowFormatter().addStyleName(idx, NIGHTS_ROW);
    HorizontalPanel nightsInfo = new HorizontalPanel();
    mainGrid.setWidget(idx, 0, intervalLabel);
    mainGrid.setWidget(idx, 1, nightsInfo);
    nightsInfo.add(nightsValue);
    nightsInfo.add(nightsLabel);
}

From source file:com.google.code.p.gwtchismes.client.GWTCIntervalSelector.java

License:Apache License

private void drawLayout3() {
    int idx = 0;//from   w  w w  . j  av  a2 s .  c  o  m

    mainGrid.getRowFormatter().addStyleName(idx, CHECKIN_ROW);
    HorizontalPanel checkinInfo = new HorizontalPanel();
    mainGrid.setWidget(idx, 0, checkinLabel);
    checkinInfo.add(checkinDateValue);
    checkinInfo.add(checkinWeekValue);
    checkinInfo.add(checkinButton);
    mainGrid.setWidget(idx, 1, checkinInfo);
    idx++;

    mainGrid.getRowFormatter().addStyleName(idx, NIGHTS_ROW);
    HorizontalPanel nightsInfo = new HorizontalPanel();
    mainGrid.setWidget(idx, 1, nightsInfo);
    nightsInfo.add(nightsListBox);
    mainGrid.setWidget(idx, 0, intervalLabel);
    nightsInfo.add(nightsLabel);
}

From source file:com.google.code.p.gwtchismes.client.GWTCIntervalSelector.java

License:Apache License

private void drawLayout4() {
    int idx = 0;/*from w w  w  .ja  v a2s.c o  m*/

    mainGrid.getRowFormatter().addStyleName(idx, CHECKIN_ROW);
    HorizontalPanel checkinInfo = new HorizontalPanel();
    mainGrid.setWidget(idx, 0, checkinLabel);
    checkinInfo.add(checkinDateValue);
    checkinInfo.add(checkinWeekValue);
    checkinInfo.add(checkinButton);
    mainGrid.setWidget(idx, 1, checkinInfo);
    idx++;

    mainGrid.getCellFormatter().addStyleName(idx, 0, NIGHTS_ROW);
    mainGrid.setWidget(idx, 0, nightsLabel);
    nightsLabel.addStyleName(LABELS);

    FlexTable nightsInfo = new FlexTable();
    mainGrid.setWidget(idx, 1, nightsInfo);
    nightsInfo.setWidget(0, 0, nightsListBox);
    nightsInfo.getCellFormatter().addStyleName(0, 0, NIGHTS_ROW);

    nightsInfo.setWidget(0, 1, checkoutLabel);
    nightsInfo.getCellFormatter().addStyleName(0, 1, CHECKOUT_ROW);
    nightsInfo.setWidget(0, 2, checkoutDateValue);
    nightsInfo.getCellFormatter().addStyleName(0, 2, CHECKOUT_ROW);
}

From source file:com.google.code.p.gwtchismes.client.GWTCIntervalSelector.java

License:Apache License

private void drawLayout5() {
    int idx = 0;/*w  ww.j  a v  a2s . com*/

    mainGrid.getRowFormatter().addStyleName(idx, CHECKIN_ROW);
    mainGrid.setWidget(idx, 0, checkinLabel);
    idx++;

    mainGrid.getRowFormatter().addStyleName(idx, CHECKIN_ROW);
    HorizontalPanel checkinInfo = new HorizontalPanel();
    checkinInfo.add(checkinDateValue);
    checkinInfo.add(checkinWeekValue);
    checkinInfo.add(checkinButton);
    mainGrid.setWidget(idx, 0, checkinInfo);
    idx++;

    mainGrid.getRowFormatter().addStyleName(idx, NIGHTS_ROW);
    mainGrid.setWidget(idx, 0, nightsLabel);
    nightsLabel.addStyleName(LABELS);
    idx++;

    mainGrid.getRowFormatter().addStyleName(idx, NIGHTS_ROW);
    mainGrid.setWidget(idx, 0, nightsListBox);
    idx++;

    mainGrid.getRowFormatter().addStyleName(idx, CHECKOUT_ROW);
    HorizontalPanel nightsInfo = new HorizontalPanel();
    nightsInfo.add(checkoutLabel);
    nightsInfo.add(checkoutDateValue);
    mainGrid.setWidget(idx, 0, nightsInfo);
}

From source file:com.google.code.p.gwtchismes.client.GWTCIntervalSelector.java

License:Apache License

private void drawLayout6() {
    int idx = 0;//ww  w . jav  a2s . co  m

    mainGrid.getRowFormatter().addStyleName(idx, CHECKIN_ROW);
    HorizontalPanel checkinInfo = new HorizontalPanel();
    mainGrid.setWidget(idx, 0, checkinLabel);
    checkinInfo.add(checkinDateValue);
    checkinInfo.add(checkinWeekValue);
    checkinInfo.add(checkinButton);
    mainGrid.setWidget(idx, 1, checkinInfo);
    idx++;

    mainGrid.getRowFormatter().addStyleName(idx, NIGHTS_ROW);
    HorizontalPanel nightsInfo = new HorizontalPanel();
    mainGrid.setWidget(idx, 1, nightsInfo);
    nightsInfo.add(nightsListBox);
    mainGrid.setWidget(idx, 0, nightsLabel);
    nightsLabel.addStyleName(LABELS);
    idx++;

    mainGrid.getRowFormatter().addStyleName(idx, CHECKOUT_ROW);
    mainGrid.setWidget(idx, 0, checkoutLabel);
    mainGrid.setWidget(idx, 1, checkoutDateValue);
}

From source file:com.google.code.p.gwtcsample.client.CustomIntervalSelector.java

License:Apache License

@Override
public void drawIntervalWidget() {
    configureDatePickers(customOptions, "< m >;;;- x;", 2, 2, 2, 24);
    addStyleDependentName("custom");

    showWeekNumbers(true);/*w  ww.  j  a v  a2  s  .co m*/
    addValueChangeHandler(new ValueChangeHandler<GWTCIntervalSelector>() {
        public void onValueChange(ValueChangeEvent<GWTCIntervalSelector> event) {
            nightsLabel.setVisible(true);
            nightsValue.setVisible(true);
        }
    });

    int idx = 0;
    getGrid().setWidget(idx, 0, checkinLabel);
    getGrid().setWidget(idx, 1, checkoutLabel);
    getGrid().setWidget(idx, 2, nightsLabel);
    nightsLabel.addStyleName(LABELS);

    idx++;
    HorizontalPanel checkinInfo = new HorizontalPanel();
    checkinInfo.addStyleName(CHECKIN_ROW);
    checkinInfo.add(checkinDateValue);
    checkinInfo.add(checkinButton);
    checkinInfo.setCellHorizontalAlignment(checkinButton, HasHorizontalAlignment.ALIGN_RIGHT);

    getGrid().setWidget(idx, 0, checkinInfo);

    HorizontalPanel checkoutInfo = new HorizontalPanel();
    checkoutInfo.addStyleName(CHECKOUT_ROW);
    checkoutInfo.add(checkoutDateValue);
    checkoutInfo.add(checkoutButton);
    checkoutInfo.setCellHorizontalAlignment(checkoutButton, HasHorizontalAlignment.ALIGN_RIGHT);
    checkoutDateValue.addClickHandler(clickListener);

    getGrid().setWidget(idx, 1, checkoutInfo);
    getGrid().setWidget(idx, 2, nightsValue);

    super.setDatePickerPosition(PICKER_POSITION_NEAR_DATEVALUES);

    nightsLabel.setVisible(false);
    nightsValue.setVisible(false);
}

From source file:com.google.code.p.gwtcsample.client.GWTCSample.java

License:Apache License

void setupLanguageLinks() {
    final Label english = new Label("English");
    final Label spanish = new Label("Spanish");
    final Label japanese = new Label("Japanese");
    final ClickHandler changeLocale = new ClickHandler() {
        public void onClick(ClickEvent event) {
            Widget sender = (Widget) event.getSource();
            if (sender == english) {
                Window.Location.assign("?locale=en");
            } else if (sender == spanish) {
                Window.Location.assign("?locale=es");
            } else if (sender == japanese) {
                Window.Location.assign("?locale=ja");
            }//w w w  .ja va  2s  .  c o  m
        }
    };

    HorizontalPanel langPanel = new HorizontalPanel() {
        {
            setStyleName("langPanel");
            String loc = Window.Location.getParameter("locale");
            if (loc != null && !"en".equals(loc))
                add(english);
            if (!"es".equals(loc))
                add(spanish);
            if (!"ja".equals(loc))
                add(japanese);
            english.addClickHandler(changeLocale);
            spanish.addClickHandler(changeLocale);
            japanese.addClickHandler(changeLocale);

            if ("ja".equals(loc))
                alert.alert("This application has not been translated into Japanese yet.\n"
                        + "Nevertheless you can see how dates are displayed in japanese because DatePicker uses GWT DateTimeFormat");
        }
    };
    RootPanel.get().add(langPanel);
}

From source file:com.google.code.p.gwtcsample.client.GWTCSample.java

License:Apache License

public void testRoundedBox(GWTCBox box) {
    box.setTitle("GWTCBox");

    final GWTCBox styleBox = new GWTCBox();
    styleBox.setText(i18n.box_msg());//from  www .j av a2s.  c  o  m
    final GWTCButton button = new GWTCButton(i18n.click_button(), new ClickHandler() {
        int t = 0;

        public void onClick(ClickEvent event) {
            for (int i = 0; i < 3; i++) {
                styleBox.removeStyleName(styles[i]);
            }
            t = t >= 2 ? 0 : t + 1;
            styleBox.setStyleName(styles[0]);
            styleBox.addStyleName(styles[t]);
        }
    });
    HorizontalPanel horPanel = new HorizontalPanel() {
        {
            add(button);
            add(styleBox);
            setSpacing(2);
        }
    };
    box.add(createPanelWithDescription(horPanel, i18n.descr_box_1()));

    GWTCBox distributionBox = new GWTCBox(GWTCBox.STYLE_BLUE);
    distributionBox.addStyleName("sampleBox");
    distributionBox.setTitle("Title");
    distributionBox.setText("Text");
    distributionBox.add(new Label("NORTH 1"), DockPanel.NORTH);
    distributionBox.add(new Label("SOUTH 1"), DockPanel.SOUTH);
    distributionBox.add(new Label("WEST 1"), DockPanel.WEST);
    distributionBox.add(new Label("EAST 1"), DockPanel.EAST);
    distributionBox.add(new Label("CENTER"), DockPanel.CENTER);
    distributionBox.add(new Label("NORTH 2"), DockPanel.NORTH);
    distributionBox.add(new Label("NORTH 3"), DockPanel.NORTH);
    distributionBox.add(new Label("SOUTH 2"), DockPanel.SOUTH);
    distributionBox.add(new Label("SOUTH 3"), DockPanel.SOUTH);
    distributionBox.add(new Label("WEST 2"), DockPanel.WEST);
    distributionBox.add(new Label("WEST 3"), DockPanel.WEST);
    distributionBox.add(new Label("EAST 2"), DockPanel.EAST);
    distributionBox.add(new Label("EAST 3"), DockPanel.EAST);
    box.add(createPanelWithDescription(distributionBox, i18n.descr_box_2()));
}

From source file:com.google.gerrit.client.account.MyProfileScreen.java

License:Apache License

@Override
protected void onInitUI() {
    super.onInitUI();

    HorizontalPanel h = new HorizontalPanel();
    add(h);/*from   w w  w  .j  a v  a  2s  . c o m*/

    VerticalPanel v = new VerticalPanel();
    v.addStyleName(Gerrit.RESOURCES.css().avatarInfoPanel());
    h.add(v);
    avatar = new AvatarImage();
    v.add(avatar);
    changeAvatar = new Anchor(Util.C.changeAvatar(), "", "_blank");
    changeAvatar.setVisible(false);
    v.add(changeAvatar);

    if (LocaleInfo.getCurrentLocale().isRTL()) {
        labelIdx = 1;
        fieldIdx = 0;
    } else {
        labelIdx = 0;
        fieldIdx = 1;
    }

    info = new Grid((Gerrit.getConfig().siteHasUsernames() ? 1 : 0) + 4, 2);
    info.setStyleName(Gerrit.RESOURCES.css().infoBlock());
    info.addStyleName(Gerrit.RESOURCES.css().accountInfoBlock());
    h.add(info);

    int row = 0;
    if (Gerrit.getConfig().siteHasUsernames()) {
        infoRow(row++, Util.C.userName());
    }
    infoRow(row++, Util.C.fullName());
    infoRow(row++, Util.C.preferredEmail());
    infoRow(row++, Util.C.registeredOn());
    infoRow(row++, Util.C.accountId());

    final CellFormatter fmt = info.getCellFormatter();
    fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
    fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
    fmt.addStyleName(row - 1, 0, Gerrit.RESOURCES.css().bottomheader());
}