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.audata.client.widgets.ClassField.java

License:Open Source License

public ClassField() {
    HorizontalPanel main = new HorizontalPanel();
    main.setSpacing(2);//  w  ww.j  a va  2s .c  o m

    this.tb = new ClassTextBox();
    this.tb.setEnabled(false);
    this.select = new Button("...");
    this.select.addClickListener(this);
    main.add(this.tb);
    main.add(this.select);

    this.initWidget(main);
}

From source file:com.audata.client.widgets.KeywordField.java

License:Open Source License

public KeywordField(String hierarchy, String title) {
    this.hierarchy = hierarchy;
    HorizontalPanel main = new HorizontalPanel();
    main.setSpacing(2);/*from  w w  w .  j av  a2 s.  co  m*/

    this.tb = new KeywordTextBox(this.hierarchy, title);
    this.tb.setEnabled(false);
    this.select = new Button("...");
    this.select.addClickListener(this);
    main.add(this.tb);
    main.add(this.select);

    this.initWidget(main);
}

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

License:Apache License

private void showConfirmDialog(String message, final ClickHandler okHandler) {
    if (GBrain.isIPhone) {
        if (Window.confirm(message)) {
            okHandler.onClick(null);//from  w  w  w  .  j  a  va  2  s.c o  m
        }
    } else {
        final DialogBox dialog = new DialogBox();
        dialog.setModal(true);
        dialog.setGlassEnabled(true);
        dialog.setText("Confirm");
        Label label = new Label(message);
        HorizontalPanel buttonPanel = new HorizontalPanel();
        buttonPanel.setSpacing(5);
        Button ok = new Button("OK");
        buttonPanel.add(ok);
        Button cancel = new Button("Cancel");
        buttonPanel.add(cancel);
        VerticalPanel basePanel = new VerticalPanel();
        basePanel.setSpacing(10);
        basePanel.add(label);
        basePanel.add(buttonPanel);
        dialog.add(basePanel);
        ok.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                okHandler.onClick(event);
                dialog.hide();
            }
        });
        cancel.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                dialog.hide();
            }
        });
        dialog.center();
    }
}

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

License:Apache License

private void showPromptDialog(String message, final PromptHandler promptHandler) {
    if (GBrain.isIPhone) {
        String input = Window.prompt(message, "");
        if (input != null) {
            promptHandler.handleResult(input);
        }/*from   w  w w  . ja v a2  s . c om*/
    } else {
        final DialogBox dialog = new DialogBox();
        dialog.setModal(true);
        dialog.setGlassEnabled(true);
        dialog.setText("Prompt");
        Label label = new Label(message);
        final TextBox textBox = new TextBox();
        HorizontalPanel buttonPanel = new HorizontalPanel();
        buttonPanel.setSpacing(5);
        Button ok = new Button("OK");
        buttonPanel.add(ok);
        Button cancel = new Button("Cancel");
        buttonPanel.add(cancel);
        VerticalPanel basePanel = new VerticalPanel();
        basePanel.setSpacing(10);
        basePanel.add(label);
        basePanel.add(textBox);
        basePanel.add(buttonPanel);
        dialog.add(basePanel);
        ok.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                promptHandler.handleResult(textBox.getText());
                dialog.hide();
            }
        });
        cancel.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                dialog.hide();
            }
        });
        dialog.center();
    }
}

From source file:com.badlogic.gdx.backends.gwt.widgets.TextInputDialogBox.java

License:Apache License

public TextInputDialogBox(String title, String text, String placeholder) {
    // Set the dialog box's caption.
    setText(title);//from   ww  w.j  a v a  2 s  .c  om

    VerticalPanel vPanel = new VerticalPanel();
    HorizontalPanel hPanel = new HorizontalPanel();

    // Enable animation.
    setAnimationEnabled(true);

    // Enable glass background.
    setGlassEnabled(true);

    // Center this bad boy.
    center();

    vPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);

    Button ok = new Button("OK");
    ok.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            TextInputDialogBox.this.onPositive();
        }
    });

    Button cancel = new Button("Cancel");
    cancel.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            TextInputDialogBox.this.onNegative();
        }
    });

    hPanel.add(ok);
    hPanel.add(cancel);

    textBox = new PlaceholderTextBox();
    textBox.setPlaceholder(placeholder);
    textBox.setWidth("97%");
    textBox.setText(text);
    vPanel.add(textBox);
    vPanel.add(hPanel);

    setWidget(vPanel);
}

From source file:com.bedatadriven.renjin.appengine.client.CommandPrompt.java

License:Apache License

/**
 * This creates an immutable copy of the prompt and input area suitable for
 * adding to the page.// w  w  w.  ja  v a2s . c  o m
 */
public Widget createImmutablePanel() {
    HorizontalPanel panelCopy = new HorizontalPanel();

    Label promptCopy = new Label(prompt.getText());
    promptCopy.setStyleName(prompt.getStyleName());
    promptCopy.getElement().getStyle().setProperty("width",
            prompt.getElement().getStyle().getProperty("width"));
    panelCopy.add(promptCopy);

    final InterpreterType t = type;
    final String scriptText = inputArea.getText();

    TextArea inputAreaCopy = new TextArea();
    inputAreaCopy.setStyleName(inputArea.getStyleName());
    inputAreaCopy.setText(removeTrailingNewLines(scriptText));
    inputAreaCopy.setVisibleLines(countLines(inputArea));
    inputAreaCopy.setReadOnly(true);

    SimplePanel inputAreaDivCopy = new SimplePanel();

    inputAreaDivCopy.add(inputAreaCopy);

    inputAreaDivCopy.getElement().setAttribute("style", inputAreaDiv.getElement().getAttribute("style"));

    panelCopy.add(inputAreaDivCopy);
    panelCopy.setCellWidth(inputAreaDivCopy, "100%");

    return panelCopy;
}

From source file:com.bradrydzewski.gwt.calendar.client.monthview.MonthView.java

License:Open Source License

/**
 * Configures a single day in the month grid of this <code>MonthView</code>.
 *
 * @param row/*from ww  w . j  a  v  a 2  s .c o m*/
 *            The row in the grid on which the day will be set
 * @param col
 *            The col in the grid on which the day will be set
 * @param date
 *            The Date in the grid
 * @param isToday
 *            Indicates whether the day corresponds to today in the month
 *            view
 * @param notInCurrentMonth
 *            Indicates whether the day is in the current visualized month
 *            or belongs to any of the two adjacent months of the current
 *            month
 * @param weekNumber
 *            The weekNumber to show in the cell, only appears in the first col.
 */
private void configureDayInGrid(int row, int col, Date date, boolean isToday, boolean notInCurrentMonth,
        int weekNumber) {
    HorizontalPanel panel = new HorizontalPanel();
    String text = String.valueOf(date.getDate());
    Label label = new Label(text);

    StringBuilder headerStyle = new StringBuilder(CELL_HEADER_STYLE);
    StringBuilder cellStyle = new StringBuilder(CELL_STYLE);
    boolean found = false;

    for (Date day : getSettings().getHolidays()) {
        if (DateUtils.areOnTheSameDay(day, date)) {
            headerStyle.append("-holiday");
            cellStyle.append("-holiday");
            found = true;
            break;
        }
    }

    if (isToday) {
        headerStyle.append("-today");
        cellStyle.append("-today");
    } else if (!found && DateUtils.isWeekend(date)) {
        headerStyle.append("-weekend");
        cellStyle.append("-weekend");
    }

    if (notInCurrentMonth) {
        headerStyle.append("-disabled");
    }

    label.setStyleName(headerStyle.toString());
    addDayClickHandler(label, (Date) date.clone());

    if (col == 0 && getSettings().isShowingWeekNumbers()) {
        Label weekLabel = new Label(String.valueOf(weekNumber));
        weekLabel.setStyleName(WEEKNUMBER_LABEL_STYLE);

        panel.add(weekLabel);
        panel.setCellWidth(weekLabel, "25px");
        DOM.setStyleAttribute(label.getElement(), "paddingLeft", "5px");
        addWeekClickHandler(weekLabel, (Date) date.clone());
    }
    panel.add(label);

    appointmentCanvas.add(panel);
    dayLabels.add(label);
    dayPanels.add(panel);

    //monthCalendarGrid.setWidget(row, col, panel);
    monthCalendarGrid.getCellFormatter().setVerticalAlignment(row, col, HasVerticalAlignment.ALIGN_TOP);
    monthCalendarGrid.getCellFormatter().setStyleName(row, col, cellStyle.toString());
}

From source file:com.brainz.wokhei.client.about.AboutModulePart.java

@Override
public void loadModulePart() {

    History.addValueChangeHandler(this);

    HarnessStringsFromHTML();/* w ww .  ja  v a 2s .  com*/

    //MAIN LAYOUT
    VerticalPanel leftColumnPanel = new VerticalPanel();
    leftColumnPanel.setWidth("280px");
    leftColumnPanel.setHorizontalAlignment(VerticalPanel.ALIGN_LEFT);

    VerticalPanel rightColumnPanel = new VerticalPanel();
    rightColumnPanel.setWidth("400px");
    rightColumnPanel.setHorizontalAlignment(VerticalPanel.ALIGN_LEFT);

    DOM.setStyleAttribute(_text.getElement(), "whiteSpace", "pre");
    _text.setWidth("370px");
    _text.setWordWrap(true);
    HorizontalPanel main = new HorizontalPanel();
    main.add(leftColumnPanel);
    main.add(new Image("../images/stuff2.png"));
    main.add(getWhiteSpace(30));
    main.add(rightColumnPanel);

    //RIGHT COLUMN 
    _title.setStyleName("sectionTitle");
    _title.addStyleName("fontAR");
    _title.setText(_aboutUsTitle);
    _text.setStyleName("sectionText");
    _text.setHTML(_aboutUsText);

    _contactUsPanel = getContactUsPanel();
    _contactUsPanel.setVisible(false);

    _licensesPanel = getLicensesPanel();
    _licensesPanel.setVisible(false);

    _panels.add(_contactUsPanel);
    _panels.add(_licensesPanel);

    rightColumnPanel.add(_title);
    rightColumnPanel.add(getWhiteSpace(20));
    rightColumnPanel.add(_text);
    rightColumnPanel.add(_contactUsPanel);
    rightColumnPanel.add(_licensesPanel);

    //LEFT COLUMN
    Label aboutWokhei = new Label(_aboutTitle);
    aboutWokhei.setStyleName("pageTitle");
    aboutWokhei.addStyleName("fontAR");

    VerticalPanel menu = new VerticalPanel();
    menu.setSpacing(10);

    addMenuItem(menu, _aboutUsTitle, _aboutUsText, "aboutUs");
    addMenuItem(menu, _whatWokheiTitle, _whatWokheiText, "whatWokhei");
    addMenuItem(menu, _differentWokheiTitle, _differentWokheiText, "whatDifferent");
    addMenuItem(menu, _licensesTitle, _licensesPanel, "licenses");
    addMenuItem(menu, _restaurantTitle, _restaurantText, "whyRestaurant");
    addMenuItem(menu, _networkTitle, _networkText, "network");
    addMenuItem(menu, _contactUsTitle, _contactUsPanel, "contactUs");

    leftColumnPanel.add(aboutWokhei);
    leftColumnPanel.add(getWhiteSpace(10));
    leftColumnPanel.add(menu);

    RootPanel.get("aboutBodyPart").add(main);
    applyCufon();

    History.fireCurrentHistoryState();
}

From source file:com.calclab.emite.widgets.client.chat.GWTAbstractChatWidget.java

License:Open Source License

public GWTAbstractChatWidget() {
    this.onSendMessage = new Event<String>("widgets:room:sendMessage");
    this.area = new TextArea();
    this.input = new TextBox();

    input.addKeyPressHandler(new KeyPressHandler() {
        public void onKeyPress(final KeyPressEvent event) {
            if (event.getNativeEvent().getKeyCode() == 13) {
                sendMessage();// w  w w .  ja  v  a  2s  .com
            }
        }
    });

    this.send = new Button("send", new ClickHandler() {
        public void onClick(final ClickEvent event) {
            sendMessage();
        }
    });
    final HorizontalPanel inputBar = new HorizontalPanel();
    inputBar.add(input);
    inputBar.add(send);

    add(area, DockPanel.CENTER);
    add(inputBar, DockPanel.SOUTH);
}

From source file:com.calclab.emiteuimodule.client.chat.ChatUIPanel.java

License:Open Source License

public void addDelimiter(final String datetime) {
    final HorizontalPanel hp = new HorizontalPanel();
    final HorizontalLine hr = new HorizontalLine();
    hp.add(new Label(datetime));
    hp.add(hr);/*from w w w .j a v  a  2 s . c  om*/
    hp.setWidth("100%");
    hp.setCellWidth(hr, "100%");
    addWidget(hp);
    hp.setStyleName("emite-ChatPanel-HorizDelimiter");
}