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:client.reservation.panel.NspReservationCreatePanel.java

License:Open Source License

/**
 * //  ww w.j  a  v a2  s  .c o m
 */
public NspReservationCreatePanel(final String epr) {
    this.add(this.table);

    this.epr = epr;

    this.activity.setVisible(false);

    final Label labelSrc = new Label();
    labelSrc.setText("Src: ");
    this.table.setWidget(0, 0, labelSrc);
    this.table.setWidget(0, 1, this.src);

    final Label labelDst = new Label();
    labelDst.setText("Dst: ");
    this.table.setWidget(0, 2, labelDst);
    this.table.setWidget(0, 3, this.dst);

    final HorizontalPanel buttonPanel = new HorizontalPanel();
    this.button.addClickListener(this.getClickListener());
    this.button.setText("Create");
    buttonPanel.add(this.button);
    buttonPanel.add(this.activity);

    final Label labelBw = new Label();
    labelBw.setText("minBW: ");
    this.minBW.setText(800 + "");
    this.table.setWidget(1, 0, labelBw);
    this.table.setWidget(1, 1, this.minBW);

    final Label labelMaxBw = new Label();
    labelMaxBw.setText("maxBW (leave 0 for unset): ");
    this.maxBW.setText(800 + "");
    this.table.setWidget(1, 2, labelMaxBw);
    this.table.setWidget(1, 3, this.maxBW);

    final Label labelDelay = new Label();
    labelDelay.setText("Delay: ");
    this.delay.setText(8000 + "");
    this.table.setWidget(1, 4, labelDelay);
    this.table.setWidget(1, 5, this.delay);

    this.add(buttonPanel);
}

From source file:client.richedit.RichTextToolbar.java

License:Apache License

protected void showPanelColorsPopup() {
    final BorderedPopup popup = new BorderedPopup();
    FlexTable contents = new FlexTable();
    contents.setCellSpacing(5);/*  w ww.  ja  v a 2s.c  om*/
    contents.setCellPadding(0);
    contents.setText(0, 0, "Enter panel colors (in hex ASCII format, e.g. #FFCC99):");
    contents.getFlexCellFormatter().setColSpan(0, 0, 2);

    contents.setText(1, 0, "Text color:");
    final TextBox tcolor = MsoyUI.createTextBox(_tcolor, 7, 7);
    contents.setWidget(1, 1, tcolor);

    contents.setText(2, 0, "Background color:");
    final TextBox bgcolor = MsoyUI.createTextBox(_bgcolor, 7, 7);
    contents.setWidget(2, 1, bgcolor);

    HorizontalPanel buttons = new HorizontalPanel();
    buttons.add(new Button(_cmsgs.cancel(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            popup.hide();
        }
    }));
    buttons.add(WidgetUtil.makeShim(5, 5));
    buttons.add(new Button(_cmsgs.update(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            setPanelColors(tcolor.getText().trim().toLowerCase(), bgcolor.getText().trim().toLowerCase());
            popup.hide();
        }
    }));
    contents.setWidget(3, 0, buttons);
    contents.getFlexCellFormatter().setColSpan(3, 0, 2);
    contents.getFlexCellFormatter().setHorizontalAlignment(3, 0, HasAlignment.ALIGN_RIGHT);

    popup.setWidget(contents);
    popup.show();
}

From source file:client.template.page.CrudPage.java

License:Open Source License

/**
 * @param text//www.  j  av  a 2  s .  c o  m
 */
public void showDetail(final PathItem[] text) {
    final HorizontalPanel panel = new HorizontalPanel();
    panel.setStyleName("gui-Pathbar");

    final HorizontalPanel innerPanel = new HorizontalPanel();
    innerPanel.setStyleName("gui-PathbarContent");

    for (int x = 0; x < text.length; x++) {
        innerPanel.add(text[x].toHTML());
    }

    panel.add(innerPanel);

    this.vertPanel.add(panel);
}

From source file:client.template.page.DefaultPage.java

License:Open Source License

/**
 * Creates a default page with title + describing text
 *//*from   www  .  ja v  a 2 s .c  om*/
public DefaultPage(final String title, final String text) {
    final FlexTable table = new FlexTable();

    final HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setStyleName("gui-DefaultPage");

    hPanel.add(new Image("phosphoruslogo.png"));

    final VerticalPanel vPanel = new VerticalPanel();

    final Label titleLabel = new Label(title);
    titleLabel.setStyleName("gui-DefaultPage-Title");
    vPanel.add(titleLabel);

    final HTML ruler = new HTML("<hr />");
    ruler.setStyleName("gui-DefaultPage-Ruler");
    vPanel.add(ruler);

    final Label textLabel = new Label(text);
    textLabel.setStyleName("gui-DefaultPage-Text");
    vPanel.add(textLabel);

    hPanel.add(vPanel);

    table.setWidget(0, 0, hPanel);
    table.setWidth("100%");
    table.setHeight("100%");
    table.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER,
            HasVerticalAlignment.ALIGN_MIDDLE);

    this.initWidget(table);
}

From source file:co.fxl.gui.gwt.GWTLayout.java

License:Open Source License

@Override
public IHorizontalPanel horizontal() {
    setComponent(new HorizontalPanel());
    return (IHorizontalPanel) (panel.element = new GWTHorizontalPanel(panel));
}

From source file:com.acme.gwt.client.TvGuide.java

License:Apache License

public void onModuleLoad() {

    //code from jnorthrup's fork, will be moved to a presenter soon enough
    EventBus eventBus = GWT.create(SimpleEventBus.class);
    final MyRequestFactory rf = GWT.create(MyRequestFactory.class);
    rf.initialize(eventBus);//from   w ww .j  a  va2s  .com
    final GateKeeper gateKeeper = new GateKeeper();
    new DialogBox() {
        {
            final TextBox email = new TextBox() {
                {
                    setText("you@example.com");
                }
            };
            final PasswordTextBox passwordTextBox = new PasswordTextBox();
            setText("please log in");
            setWidget(new VerticalPanel() {
                {
                    add(new HorizontalPanel() {
                        {
                            add(new Label("email"));
                            add(email);
                        }
                    });
                    add(new HorizontalPanel() {
                        {
                            add(new Label("Password"));
                            add(passwordTextBox);
                        }
                    });
                    add(new Button("OK!!") {
                        {
                            addClickHandler(new ClickHandler() {
                                @Override
                                public void onClick(ClickEvent event) {
                                    String text = passwordTextBox.getText();
                                    String digest = Md5.md5Hex(text);
                                    Request<TvViewerProxy> authenticate = rf.reqViewer()
                                            .authenticate(email.getText(), digest);
                                    authenticate
                                            .with("geo", "name", "favoriteShows.name",
                                                    "favoriteShows.description")
                                            .to(gateKeeper).fire(new Receiver<Void>() {
                                                @Override
                                                public void onSuccess(Void response) {
                                                    hide(); //todo: review for a purpose
                                                    removeFromParent();
                                                }
                                            });
                                }
                            });
                        }
                    });
                }
            });
            center();
            show();
        }
    };
}

From source file:com.Administration.client.Administration.java

License:Apache License

/**
 * ?   UI//from  w w w  . j a v  a  2s.c o  m
 */
public void onModuleLoad() {

    label = new HTML(); //   ?  ?  
    label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    loginLabel = new HTML(); //   ?  ?    
    loginLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    dialog = new PasswordDialog(); //   
    list = new LinkedList<>(); //  ? ? 

    ProvidesKey<LinkData> KEY_PROVIDER = new ProvidesKey<LinkData>() { //    -   ??   
        @Override
        public Object getKey(LinkData item) {
            return item == null ? null : item.getId();
        }
    };
    cellTable = new CellTable<>(KEY_PROVIDER); //  ? 

    dataProvider = new ListDataProvider<>(); //    
    dataProvider.addDataDisplay(cellTable); // ?,   ????   ? 

    sortHandler = new ListHandler<>(list); //  ?
    cellTable.addColumnSortHandler(sortHandler); //  ?   

    SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
    pager = new SimplePager(SimplePager.TextLocation.CENTER, pagerResources, false, 0, true); //  pager -  ?
    pager.setDisplay(cellTable); // ?,  pager ?  ? 

    initTable(); //   ? 
    cellTable.setWidth("100%");
    cellTable.setHeight("80%");
    cellTable.setAutoHeaderRefreshDisabled(true);
    cellTable.setAutoFooterRefreshDisabled(true);

    //  ?  
    VerticalPanel VP = new VerticalPanel();
    VP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    VP.add(cellTable);
    VP.add(pager);

    logoutButton = new Button("Logout");

    //  ? 
    HorizontalPanel loginHP = new HorizontalPanel();
    loginHP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    loginHP.setSpacing(5);
    loginHP.add(loginLabel);
    loginHP.add(logoutButton);

    logoutButton.addClickHandler(new ClickHandler() { //  
        @Override
        public void onClick(ClickEvent event) { //  

            Cookies.removeCookie(cookieName); // ?   

            //  ?  ???
            loginLabel.setHTML("");
            loginLabel.setVisible(false);
            label.setHTML("");
            cellTable.setVisible(false);
            pager.setVisible(false);
            logoutButton.setVisible(false);

            dataProvider.getList().clear(); // ? 

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

        }
    });
    logoutButton.setVisible(false);

    //  
    RootPanel.get("Login").add(loginHP);
    RootPanel.get("Data").add(VP);
    RootPanel.get("Data").add(label);

    //    ? 
    cellTable.setVisible(false);
    pager.setVisible(false);

    dialog.Login();
}

From source file:com.ait.toolkit.ace.examples.client.AceDemo.java

License:Open Source License

/**
 * This method builds the UI. It creates UI widgets that exercise most/all of the AceEditor methods, so it's a bit of a kitchen sink.
 *//*from   www.  java  2  s .  com*/
private void buildUI() {
    VerticalPanel mainPanel = new VerticalPanel();
    mainPanel.setWidth("100%");

    mainPanel.add(new Label("Label above!"));

    mainPanel.add(editor1);

    // Label to display current row/column
    rowColLabel = new InlineLabel("");
    mainPanel.add(rowColLabel);

    // Create some buttons for testing various editor APIs
    HorizontalPanel buttonPanel = new HorizontalPanel();

    // Add button to insert text at current cursor position
    Button insertTextButton = new Button("Insert");
    insertTextButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            // Window.alert("Cursor at: " + editor1.getCursorPosition());
            editor1.insertAtCursor("inserted text!");
        }
    });
    buttonPanel.add(insertTextButton);

    // Add check box to enable/disable soft tabs
    final CheckBox softTabsBox = new CheckBox("Soft tabs");
    softTabsBox.setValue(true); // I think soft tabs is the default
    softTabsBox.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            editor1.setUseSoftTabs(softTabsBox.getValue());
        }
    });
    buttonPanel.add(softTabsBox);

    // add text box and button to set tab size
    final TextBox tabSizeTextBox = new TextBox();
    tabSizeTextBox.setWidth("4em");
    Button setTabSizeButton = new Button("Set tab size");
    setTabSizeButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            editor1.setTabSize(Integer.parseInt(tabSizeTextBox.getText()));
        }
    });
    buttonPanel.add(new InlineLabel("Tab size: "));
    buttonPanel.add(tabSizeTextBox);
    buttonPanel.add(setTabSizeButton);

    // add text box and button to go to a given line
    final TextBox gotoLineTextBox = new TextBox();
    gotoLineTextBox.setWidth("4em");
    Button gotoLineButton = new Button("Go to line");
    gotoLineButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            editor1.gotoLine(Integer.parseInt(gotoLineTextBox.getText()));
        }
    });
    buttonPanel.add(new InlineLabel("Go to line: "));
    buttonPanel.add(gotoLineTextBox);
    buttonPanel.add(gotoLineButton);

    // checkbox to set whether or not horizontal scrollbar is always visible
    final CheckBox hScrollBarAlwaysVisibleBox = new CheckBox("H scrollbar: ");
    hScrollBarAlwaysVisibleBox.setValue(true);
    hScrollBarAlwaysVisibleBox.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            editor1.setHScrollBarAlwaysVisible(hScrollBarAlwaysVisibleBox.getValue());
        }
    });
    buttonPanel.add(hScrollBarAlwaysVisibleBox);

    // checkbox to show/hide gutter
    final CheckBox showGutterBox = new CheckBox("Show gutter: ");
    showGutterBox.setValue(true);
    showGutterBox.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            editor1.setShowGutter(showGutterBox.getValue());
        }
    });
    buttonPanel.add(showGutterBox);

    // checkbox to set/unset readonly mode
    final CheckBox readOnlyBox = new CheckBox("Read only: ");
    readOnlyBox.setValue(false);
    readOnlyBox.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            editor1.setReadOnly(readOnlyBox.getValue());
        }
    });
    buttonPanel.add(readOnlyBox);

    // checkbox to show/hide print margin
    final CheckBox showPrintMarginBox = new CheckBox("Show print margin: ");
    showPrintMarginBox.setValue(true);
    showPrintMarginBox.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            editor1.setShowPrintMargin(showPrintMarginBox.getValue());
        }
    });
    buttonPanel.add(showPrintMarginBox);

    mainPanel.add(buttonPanel);

    mainPanel.add(editor2);
    mainPanel.add(new Label("Label below!"));

    RootPanel.get().add(mainPanel);
}

From source file:com.akjava.gwt.volumegraph.client.VolumeGraph.java

License:Apache License

@Override
protected void init(TestPreference preferences) {

    Hangout.setInjectHangoutService(injector.getHangoutService());
    StyleInjector.inject(".grey{color:#666}");

    HorizontalPanel root = new HorizontalPanel();
    root.setSize("100%", "100%");
    RootPanel.get().add(root);//from   www . j av a2 s. c o  m

    VerticalPanel mainPanel = new VerticalPanel();
    mainPanel.setSize("100%", "100%");

    HorizontalPanel controler = new HorizontalPanel();
    mainPanel.add(controler);

    Label label = new Label("Emulate Participant");
    label.setStylePrimaryName("grey");
    controler.add(label);

    Button plus = new Button("+");
    plus.setStylePrimaryName("grey");
    controler.add(plus);
    plus.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            dummyParticipant++;
        }
    });
    Button clear = new Button("remove");
    clear.setStylePrimaryName("grey");
    controler.add(clear);
    clear.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            dummyParticipant = 0;
        }
    });

    root.add(mainPanel);

    canvas = Canvas.createIfSupported();

    canvas.setSize("100%", "400px");
    canvas.getContext2d().setFillStyle(CssColor.make("#fff"));

    mainPanel.add(canvas);
    int w = canvas.getOffsetWidth();
    int h = canvas.getOffsetHeight();
    canvas.setCoordinateSpaceWidth(w);
    canvas.setCoordinateSpaceHeight(h);

    addReady();
}

From source file:com.algorithmstudy.visualizer.client.AlgorithmSelectionPanel.java

License:Open Source License

public AlgorithmSelectionPanel(VerticalPanel contentsPanel) {
    this.contentsPanel = contentsPanel;

    selectBoxPanel = new HorizontalPanel();
    add(selectBoxPanel);/*  w  w w  .j ava2 s.c  o  m*/

    algorithmChoice = new ListBox();
    algorithmChoice.addItem("Select Algorithm Class ...");
    algorithmChoice.addItem("Sorting");
    selectBoxPanel.add(algorithmChoice);

    algorithmChoice.addChangeListener(new ChangeListener() {
        public void onChange(Widget w) {
            algorithmChoiceChange(w);
        }
    });

    lastAlgorithmChoice = 0;
}