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.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);//  w  ww .  j  a v  a  2s . c  om
        }
    } 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  ww .j  a  va2s . c  o  m
    } 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 w  ww.j  av a2 s. c o m*/

    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

public CommandPrompt(CommandEnteredCallback callback) {
    panel = new HorizontalPanel();
    prompt = new Label();
    prompt.setStyleName("prompt");
    panel.add(prompt);//from w w  w  . j a  v  a 2 s.c om

    inputArea = new TextArea();
    inputArea.setStyleName("script");
    inputArea.setVisibleLines(2);
    inputAreaDiv = new SimplePanel();
    inputAreaDiv.add(inputArea);
    inputAreaDiv.getElement().getStyle().setProperty("width", "100%");
    panel.add(inputAreaDiv);
    panel.setCellWidth(inputAreaDiv, "100%");

    updatePromptText();

    inputArea.addKeyDownHandler(new KeyDownHandler() {
        public void onKeyDown(KeyDownEvent event) {
            onInputAreaKeyDown(event);
        }
    });

    history = new CommandHistory();
    commandEnteredCallback = callback;
}

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./*from w w  w  . j av  a 2 s  . co  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.beyobe.client.widgets.Carousel.java

License:Apache License

/**
 * Construct a carousel widget with a given css
 * //from  ww  w. j a  v  a  2  s.  c o m
 * @param css the css to use
 */
public Carousel(CarouselCss css) {
    this.css = css;
    this.css.ensureInjected();

    //    childToHolder = new HashMap<Widget, Widget>();
    main = new FlowPanel();
    initWidget(main);

    main.addStyleName(css.carousel());

    scrollPanel = new ScrollPanel();

    scrollPanel.addStyleName(css.carouselScroller());

    main.add(scrollPanel);

    container = new HorizontalPanel();
    container.addStyleName(css.carouselContainer());

    scrollPanel.setWidget(container);

    scrollPanel.setSnap(true);
    scrollPanel.setMomentum(true);
    scrollPanel.setShowScrollBarX(true);
    scrollPanel.setShowScrollBarY(false);
    scrollPanel.setScrollingEnabledX(true);
    scrollPanel.setScrollingEnabledY(false);
    scrollPanel.setAutoHandleResize(true);

    currentPage = 0;

    scrollPanel.addScrollEndHandler(new ScrollEndEvent.Handler() {

        @Override
        public void onScrollEnd(ScrollEndEvent event) {
            int page;
            page = scrollPanel.getCurrentPageX();
            if (page >= 0) {
                currentPage = page;
                //           log.info("Carousel: scrolled to Day# " + currentPage + " = " + container.getWidget(currentPage));
                SelectionEvent.fire(Carousel.this, currentPage);
            }
        }
    });

    //    MGWT.addOrientationChangeHandler(new OrientationChangeHandler() {
    //
    //      @Override
    //      public void onOrientationChanged(OrientationChangeEvent event) {
    //        Scheduler.get().scheduleDeferred(new ScheduledCommand() {
    //
    //          @Override
    //          public void execute() {
    //            refresh();
    //
    //          }
    //        });
    //
    //      }
    //    });

    addSelectionHandler(new SelectionHandler<Integer>() {

        @Override
        public void onSelection(SelectionEvent<Integer> event) {
            int page = scrollPanel.getCurrentPageX();
        }
    });

    if (MGWT.getOsDetection().isDesktop()) {
        Window.addResizeHandler(new ResizeHandler() {

            @Override
            public void onResize(ResizeEvent event) {
                Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                    @Override
                    public void execute() {
                        refresh();

                    }
                });

            }
        });
    }

}

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   w w  w .j av  a2 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();//from w  w w  .j a v a2 s .c o  m

    //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();/*from w w  w .  ja  v a2  s .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 ww  .  j  a va2s . c o m
    hp.setWidth("100%");
    hp.setCellWidth(hr, "100%");
    addWidget(hp);
    hp.setStyleName("emite-ChatPanel-HorizDelimiter");
}