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.gwt.maps.testing.client.maps.StreetViewSideBySideMapWidget.java

License:Apache License

/**
 * render the components in the widget// w w  w.  j a  v a  2  s. c  o  m
 */
private void draw() {
    pWidget.clear();

    pWidget.add(new HTML("<br>Street View Demo - click on the map"));

    hp = new HorizontalPanel();
    pWidget.add(hp);

    drawMap();

    drawStreeView();

    // allow for things to setup, otherwise getting pano gets null
    Timer t = new Timer() {
        public void run() {
            setupStartingMarker();
        }
    };
    t.schedule(1500); // b/c this widget is first and I have so many loading on
                      // page.
}

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

License:Apache License

private void draw() {
    pWidget.clear();/*  ww w.ja v a 2s . c om*/
    pWidget.add(new HTML("<br/>"));

    HorizontalPanel hp = new HorizontalPanel();
    pWidget.add(hp);
    hp.add(new HTML("Transit Directions Service&nbsp;&nbsp;&nbsp;&nbsp;"));
    hp.add(htmlStatus);
    drawMap();
    htmlSummary = new HTML();
    pWidget.add(htmlSummary);

    nRequests = 0;
    Timer directionsTimer = new Timer() {
        @Override
        public void run() {
            drawRandomDirections();
            /*
             * We do not want to make the client to be blacklisted by Google if its browser window is left open for too
             * long... :)
             */
            if (nRequests++ > 10)
                cancel();
        }
    };
    directionsTimer.scheduleRepeating(10000);
    drawRandomDirections();
}

From source file:com.google.gwt.sample.ContactApplication.client.ExistingUser.java

public void putedit(int r) {
    int row = r;// w w  w. j  av  a 2 s.c o  m
    Button editcontactButton = new Button("Edit");
    editcontactButton.removeStyleName("gwt-Button");
    editcontactButton.addStyleName("contactButton");
    editcontactButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            int rowIndex = contactsFlexTable.getCellForEvent(event).getRowIndex();
            final String edit = contactsFlexTable.getFlexCellFormatter().getElement(rowIndex, 0).getInnerText();
            contacts = Sorted.get(edit);
            dialogedit = new DialogBox();
            dialogedit.setGlassEnabled(true);
            dialogedit.setText("Edit Contact Details : ");
            VerticalPanel panel = new VerticalPanel();
            panel.setSpacing(10);
            panel.setHeight("100");
            panel.setWidth("400");

            HorizontalPanel HP = new HorizontalPanel();

            newTextBox = new TextBox();
            newTextBox.setValue(edit);

            Label label = new Label("Name: ");

            HP.add(label);
            newTextBox.setName("textBoxFormElement");
            String original = newTextBox.getValue();

            HP.add(newTextBox);
            panel.add(HP);
            HP = new HorizontalPanel();
            label = new Label("Job Title: ");

            HP.add(label);
            jobedit = new TextBox();
            jobedit.setWidth("220");
            jobedit.setValue(contacts.get(0));
            jobedit.setName("textBoxFormElement");
            HP.add(jobedit);
            panel.add(HP);
            HP = new HorizontalPanel();
            label = new Label("Age:  ");
            HP.add(label);
            lbedit = new ListBox();
            lbedit.setName("Age: ");
            for (int i = 15; i <= 100; i++) {
                String ll = "" + i;
                lbedit.addItem(ll);
            }
            lbedit.setWidth("220");
            int k = lbedit.getItemCount();
            for (int i = 0; i < k; i++) {
                if (contacts.get(1) == lbedit.getItemText(i)) {
                    lbedit.setSelectedIndex(i);
                }
            }

            HP.add(lbedit);
            panel.add(HP);
            HP = new HorizontalPanel();
            label = new Label("Group: ");
            HP.add(label);

            groupedit = new ListBox();
            groupedit.setName("Group");
            groupedit.addItem("Engineering");
            groupedit.addItem("Finance");
            groupedit.addItem("Front Office");
            groupedit.addItem("Management");
            groupedit.addItem("IT");
            groupedit.addItem("Sales");
            HP.add(groupedit);
            panel.add(HP);
            k = groupedit.getItemCount();
            for (int i = 0; i < k; i++) {
                if (contacts.get(2) == groupedit.getItemText(i)) {
                    groupedit.setSelectedIndex(i);
                }
            }
            checkedit = new CheckBox("Manager");
            if (contacts.get(3) == "Y") {
                checkedit.setValue(true);
            } else {
                checkedit.setValue(false);
            }
            panel.add(checkedit);
            buttonPaneledit.clear();
            Button submit = new Button("Save");
            buttonPaneledit.add(submit);
            Button cancel = new Button("Cancel");
            buttonPaneledit.add(cancel);
            buttonPaneledit.setSpacing(10);
            panel.add(buttonPaneledit);
            addPanel.add(panel);
            dialogedit.addStyleName("displayed");

            dialogedit.add(panel);
            dialogedit.addStyleName("DialogBox");
            addPanel.add(dialogedit);

            dialogedit.show();
            dialogedit.center();

            newTextBox.setFocus(true);
            cancel.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                    if (newTextBox.getValue().equalsIgnoreCase(original)) {
                        dialogedit.hide();
                    } else if (Sorted.containsKey(newTextBox.getValue())) {
                        Window.alert("Contact Already Present");
                        dialogedit.show();
                    } else {
                        dialogedit.hide();
                    }
                }
            });

            submit.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                    dialogedit.hide();
                    if (newTextBox.getText().length() == 0 || jobedit.getText().length() == 0) {
                        if (newTextBox.getText().length() == 0) {
                            Window.alert("The Name Field must not be empty");
                        } else {
                            Window.alert("The Job Field must not be empty");
                        }
                        dialogedit.show();
                    } else {

                        Sorted.remove(edit);

                        String names = newTextBox.getText();
                        String name = SafeHtmlUtils.htmlEscape(names);
                        final String jobs = jobedit.getText();
                        final String age = lbedit.getSelectedItemText();

                        final String gredit = groupedit.getSelectedItemText();
                        String manager = "N";
                        if (checkedit.getValue()) {
                            final String val = "Y";
                            manager = val;
                        } else {
                            final String val = "N";
                            manager = val;
                        }

                        if (Sorted.containsKey(name)) {
                            Window.alert("Contact Already Present");
                            dialogedit.show();
                        } else {
                            contacts = parsearraylist(jobs, age, gredit, manager);
                            Sorted.put(name, contacts);
                            for (int i = 1; i < contactsFlexTable.getRowCount(); i++) {
                                contactsFlexTable.removeRow(i);
                            }
                            int row = 1;
                            for (String key : Sorted.keySet()) {
                                contacts = Sorted.get(key);
                                contactsFlexTable.setText(row, 0, key);
                                contactsFlexTable.setText(row, 1, contacts.get(0));
                                contactsFlexTable.setText(row, 2, contacts.get(1));
                                contactsFlexTable.setText(row, 3, contacts.get(2));
                                contactsFlexTable.setText(row, 4, contacts.get(3));
                                putdelete(row);
                                putedit(row);
                                row = row + 1;
                            }
                            applyDataRowStyles();
                        }
                    }
                }
            });
        }
    });
    contactsFlexTable.setWidget(row, 5, editcontactButton);
}

From source file:com.google.gwt.sample.ContactApplication.client.NewUser.java

public NewUser() {
    dialog = new DialogBox();
    dialog.setGlassEnabled(true);// w ww.ja  va2 s. com
    dialog.setText("New Contact Details : ");

    HorizontalPanel HP = new HorizontalPanel();
    VerticalPanel panel = new VerticalPanel();
    panel.setSpacing(10);
    panel.setHeight("100");
    panel.setWidth("300");

    //NAME TEXTBOX
    newSymbolTextBox = new TextBox();
    Label label = new Label("Name: ");
    panel.add(label);
    newSymbolTextBox.setWidth("220");
    HP.add(label);

    newSymbolTextBox.setName("textBoxFormElement");
    HP.add(newSymbolTextBox);
    panel.add(HP);

    //JOB TEXTBOX
    HP = new HorizontalPanel();
    label = new Label("Job Title: ");
    HP.add(label);

    job = new TextBox();
    job.setWidth("220");

    HP.add(job);
    job.setName("textBoxFormElement");
    panel.add(HP);

    HP = new HorizontalPanel();
    label = new Label("Age: ");
    HP = new HorizontalPanel();

    //AGE DROPDOWN
    lb = new ListBox();
    lb.setName("Age:");
    for (int i = 15; i <= 100; i++) {
        String ll = "" + i;
        lb.addItem(ll);
    }

    lb.setWidth("220");

    HP.add(label);
    HP.add(lb);
    panel.add(HP);

    //GROUP DROPDOWN
    HP = new HorizontalPanel();
    label = new Label("Group: ");
    HP.add(label);

    group = new ListBox();
    group.setName("Group");
    group.addItem("Engineering");
    group.addItem("Finance");
    group.addItem("Front Office");
    group.addItem("Management");
    group.addItem("IT");
    group.addItem("Sales");

    HP.add(group);
    panel.add(HP);

    //MANAGER CHECKBOX

    check = new CheckBox("Manager");
    check.setValue(false);
    panel.add(check);

    buttonPanel.clear();
    Button submit = new Button("Submit");
    buttonPanel.add(submit);

    Button cancel = new Button("Cancel");
    buttonPanel.add(cancel);
    buttonPanel.setSpacing(10);
    panel.add(buttonPanel);

    addPanel.add(panel);
    dialog.addStyleName("displayed");
    dialog.add(panel);
    addPanel.add(dialog);

    dialog.show();
    dialog.center();

    dialog.addStyleDependentName("buttonstyle");
    newSymbolTextBox.setFocus(true);

    //ONClick Method for Cancel Button

    cancel.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            dialog.hide();
        }
    });

    // ONClick method for SUBMIT BUTTON        
    submit.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            dialog.hide();
            if (newSymbolTextBox.getText().length() == 0 || job.getText().length() == 0) {
                if (newSymbolTextBox.getText().length() == 0) {
                    Window.alert("The Name Field must not be empty");
                } else {
                    Window.alert("The Job Field must not be empty");
                }
                dialog.show();
            } else {
                String names = newSymbolTextBox.getText();
                String name = SafeHtmlUtils.htmlEscape(names);
                final String jobs = job.getText();
                final String age = lb.getSelectedItemText();
                final String gr = group.getSelectedItemText();
                String manager = "N";

                if (check.getValue()) {
                    final String val = "Y";
                    manager = val;
                } else {
                    final String val = "N";
                    manager = val;
                }
                if (Sorted.containsKey(name)) {
                    Window.alert("Contact Already Present");
                    dialog.show();
                } else {
                    contacts = parsearraylist(jobs, age, gr, manager);
                    Sorted.put(name, contacts);
                    for (int i = 1; i < contactsFlexTable.getRowCount(); i++) {
                        contactsFlexTable.removeRow(i);
                    }
                    int row = 1;
                    for (String key : Sorted.keySet()) {
                        contacts = Sorted.get(key);
                        contactsFlexTable.setText(row, 0, key);
                        contactsFlexTable.setText(row, 1, contacts.get(1));
                        contactsFlexTable.setText(row, 2, contacts.get(1));
                        contactsFlexTable.setText(row, 3, contacts.get(2));
                        contactsFlexTable.setText(row, 4, contacts.get(3));
                        ExistingUser del = new ExistingUser();
                        del.putdelete(row);
                        ExistingUser ed = new ExistingUser();
                        ed.putedit(row);
                        row = row + 1;
                    }
                    applyDataRowStyles();
                }
            }
        }
    });
}

From source file:com.google.gwt.sample.contacts.client.view.EditContactView.java

public EditContactView() {
    DecoratorPanel contentDetailsDecorator = new DecoratorPanel();
    contentDetailsDecorator.setWidth("18em");
    initWidget(contentDetailsDecorator);

    VerticalPanel contentDetailsPanel = new VerticalPanel();
    contentDetailsPanel.setWidth("100%");

    // Create the contacts list
    ////  w w w .j  a va2  s  . com
    detailsTable = new FlexTable();
    detailsTable.setCellSpacing(0);
    detailsTable.setWidth("100%");
    detailsTable.addStyleName("contacts-ListContainer");
    detailsTable.getColumnFormatter().addStyleName(1, "add-contact-input");
    firstName = new TextBox();
    lastName = new TextBox();
    emailAddress = new TextBox();
    initDetailsTable();
    contentDetailsPanel.add(detailsTable);

    HorizontalPanel menuPanel = new HorizontalPanel();
    saveButton = new Button("Save");
    cancelButton = new Button("Cancel");
    menuPanel.add(saveButton);
    menuPanel.add(cancelButton);
    contentDetailsPanel.add(menuPanel);
    contentDetailsDecorator.add(contentDetailsPanel);
}

From source file:com.google.gwt.sample.dynatable.client.DayFilterWidget.java

License:Apache License

public DayFilterWidget(SchoolCalendarWidget calendar) {
    this.calendar = calendar;
    initWidget(outer);//from   ww w .  j a  va  2s. c  o m
    setStyleName("DynaTable-DayFilterWidget");
    outer.add(new DayCheckBox("Sunday", 0));
    outer.add(new DayCheckBox("Monday", 1));
    outer.add(new DayCheckBox("Tuesday", 2));
    outer.add(new DayCheckBox("Wednesday", 3));
    outer.add(new DayCheckBox("Thursday", 4));
    outer.add(new DayCheckBox("Friday", 5));
    outer.add(new DayCheckBox("Saturday", 6));

    Button buttonAll = new Button("All", new ClickHandler() {
        public void onClick(ClickEvent event) {
            setAllCheckBoxes(true);
        }
    });

    Button buttonNone = new Button("None", new ClickHandler() {
        public void onClick(ClickEvent event) {
            setAllCheckBoxes(false);
        }
    });

    HorizontalPanel hp = new HorizontalPanel();
    hp.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
    hp.add(buttonAll);
    hp.add(buttonNone);

    outer.add(hp);
    outer.setCellVerticalAlignment(hp, HasAlignment.ALIGN_BOTTOM);
    outer.setCellHorizontalAlignment(hp, HasAlignment.ALIGN_CENTER);
}

From source file:com.google.gwt.sample.dynatable.client.ui.DayFilterWidget.java

License:Apache License

@UiConstructor
public DayFilterWidget(SchoolCalendarWidget calendar) {
    this.calendar = calendar;
    initWidget(outer);//from   w  w w .  ja v a 2s. c o m
    setStyleName("DynaTable-DayFilterWidget");
    outer.add(new DayCheckBox("Sunday", 0));
    outer.add(new DayCheckBox("Monday", 1));
    outer.add(new DayCheckBox("Tuesday", 2));
    outer.add(new DayCheckBox("Wednesday", 3));
    outer.add(new DayCheckBox("Thursday", 4));
    outer.add(new DayCheckBox("Friday", 5));
    outer.add(new DayCheckBox("Saturday", 6));

    Button buttonAll = new Button("All", new ClickHandler() {
        public void onClick(ClickEvent event) {
            setAllCheckBoxes(true);
        }
    });

    Button buttonNone = new Button("None", new ClickHandler() {
        public void onClick(ClickEvent event) {
            setAllCheckBoxes(false);
        }
    });

    HorizontalPanel hp = new HorizontalPanel();
    hp.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
    hp.add(buttonAll);
    hp.add(buttonNone);

    outer.add(hp);
    outer.setCellVerticalAlignment(hp, HasAlignment.ALIGN_BOTTOM);
    outer.setCellHorizontalAlignment(hp, HasAlignment.ALIGN_CENTER);
}

From source file:com.google.gwt.sample.expenses.client.DenialPopup.java

License:Apache License

public DenialPopup() {
    super(false, true);
    setStyleName(Styles.common().popupPanel());
    setGlassEnabled(true);/* w  w w  .j av  a  2  s.  c om*/
    confirmButton.setWidth("11ex");
    cancelButton.setWidth("11ex");
    reasonBox.getElement().getStyle().setMarginLeft(10.0, Unit.PX);
    reasonBox.getElement().getStyle().setMarginRight(10.0, Unit.PX);

    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hPanel.add(new HTML("<b>Reason:</b>"));
    hPanel.add(reasonBox);
    hPanel.add(confirmButton);
    hPanel.add(cancelButton);
    setWidget(hPanel);
    cancelButton.getElement().getParentElement().getStyle().setPaddingLeft(5.0, Unit.PX);
}

From source file:com.google.gwt.sample.gwtguestbook.client.GuestSignaturePanel.java

License:Apache License

/**
 * Creates a guest signature panel, with components fully instantiated and
 * attached. /*w  w w .ja v a  2s .  c o m*/
 * 
 */
public GuestSignaturePanel() {
    entryUpdateHandlers = new ArrayList<EntryUpdateHandler>();
    guestSignaturePanel = new HorizontalPanel();

    // Create guest signature panel widgets
    guestNameBox = new TextBox();
    guestMessageBox = new TextBox();
    guestNameLabel = new Label("Your Name:");
    guestMessageLabel = new Label("Message:");
    signButton = new Button("Sign!");

    // Set up the widget guest signature panel widget styles (additional to
    // standard styles)
    guestNameLabel.addStyleName("gb-Label");
    guestMessageLabel.addStyleName("gb-Label");
    guestNameBox.addStyleName("gb-NameBox");
    guestMessageBox.addStyleName("gb-MessageBox");

    // Attach components together
    guestSignaturePanel.add(guestNameLabel);
    guestSignaturePanel.add(guestNameBox);
    guestSignaturePanel.add(guestMessageLabel);
    guestSignaturePanel.add(guestMessageBox);
    guestSignaturePanel.add(signButton);

    signButton.addClickHandler(this);

    /* The initWidget(Widget) method inherited from the Composite class must be
     * called exactly once in the constructor to declare the widget that this 
     * composite class is wrapping. */
    initWidget(guestSignaturePanel);
}

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

License:Apache License

private void createMap() {
    // Set the map up in a Dialog box, just for fun.
    final DialogBox dialog = new DialogBox(false, false);
    final Map theMap = new Map();
    final Button findButton = new Button("Address:");
    final TextBox tb = new TextBox();
    tb.addKeyboardListener(new KeyboardListenerAdapter() {
        @Override//ww  w .j a  va2 s. com
        public void onKeyPress(Widget sender, char keyCode, int modifiers) {
            if (keyCode == KEY_ENTER) {
                theMap.setLocation(((TextBox) sender).getText());
            } else if (keyCode == KEY_ESCAPE) {
                dialog.removeFromParent();
            }
        }
    });
    findButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            theMap.setLocation(tb.getText());
        }
    });
    tb.setWidth("100%");

    final HorizontalPanel hp = new HorizontalPanel();
    hp.add(findButton);
    hp.setCellWidth(findButton, "15%");
    hp.add(tb);
    hp.setCellWidth(tb, "85%");

    final VerticalPanel vp = new VerticalPanel();
    vp.add(hp);
    vp.add(theMap);

    dialog.setText("Drag me!");
    dialog.setWidget(vp);
    dialog.center();
}