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

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

Introduction

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

Prototype

public void setHorizontalAlignment(HorizontalAlignmentConstant align) 

Source Link

Document

Sets the default horizontal alignment to be used for widgets added to this panel.

Usage

From source file:com.sun.labs.aura.music.wsitm.client.WebLib.java

License:Open Source License

public static Widget getSunLoaderWidget(boolean whiteBack) {
    HorizontalPanel hP = new HorizontalPanel();
    hP.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
    if (whiteBack) {
        hP.add(new Image(WebLib.ICON_WAIT_SUN));
    } else {/*from w w  w  . j a  v a  2s. com*/
        hP.add(new Image(WebLib.ICON_WAIT_SUN_BACK));
    }

    return hP;
}

From source file:com.unilorraine.projetdevie.client.ui.ApplicationPanelViewImpl.java

License:Open Source License

public ApplicationPanelViewImpl() {
    setSize("800px", "800px");

    verticalPanel = new VerticalPanel();

    verticalPanel.setSize("800px", "800px");

    HorizontalPanel logoutPanel = new HorizontalPanel();
    logoutPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    nameLabel = new Label();
    //nameLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    logoutPanel.add(nameLabel);//  w  w  w.  java 2s.c  o  m
    //logoutPanel.setVisible(false);
    logoutPanel.add(logoutAnchor);
    logoutAnchor.setWidth("118px");

    logPanel = new VerticalPanel();
    logPanel.setSize("750px", "25px");
    logPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);

    logPanel.add(logoutPanel);

    verticalPanel.add(logPanel);
    verticalPanel.setWidth("776px");

    btnMenu = new Button("Dashboard");
    btnMenu.setWidth("75px");

    btnMenu.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            listener.connectModuleHandler();
        }
    });
    verticalPanel.add(btnMenu);

    DockLayoutPanel mainPluginPanel = new DockLayoutPanel(Unit.EM);
    verticalPanel.add(mainPluginPanel);
    mainPluginPanel.setSize("100%", "800px");

    FlowPanel pluginFlowPanel = new FlowPanel();
    mainPluginPanel.addWest(pluginFlowPanel, 14.2);

    menuTitle = new Label("Menu");
    menuTitle.setStyleName("subtitle");
    pluginFlowPanel.add(menuTitle);
    menuTitle.setHeight("10px");
    menuTitle.setVisible(false);

    menutTree = new Tree();
    pluginFlowPanel.add(menutTree);
    menutTree.setWidth("127px");

    pluginPanel = new FlowPanel();
    mainPluginPanel.add(pluginPanel);
    pluginPanel.setSize("", "100%");

    popup = new PopupLoadingView();
}

From source file:de.eckhartarnold.client.GalleryWidget.java

License:Apache License

@Override
public void onResized() {
    Widget parent = getParent();//from w  w w .  ja  v a2  s  .com
    if (parent == null)
        return;
    int width = parent.getOffsetWidth();
    HorizontalPanel row = null;
    int columns = (width - paddingH) / (edgeWidth + paddingH);
    if (columns <= 0)
        columns = 1;
    int rows = thumbnails.size() / columns;
    if (thumbnails.size() % columns != 0)
        rows++;

    if (imageRows != null) {
        if (rows == imageRows.length && imageRows[0].getWidgetCount() == columns) {
            return; // layout did not change!
        }

        for (HorizontalPanel p : imageRows) {
            panel.remove(p);
        }
    }

    imageRows = new HorizontalPanel[rows];

    for (int i = 0; i < thumbnails.size(); i++) {
        if (i % columns == 0) {
            row = new HorizontalPanel();
            row.setStyleName("galleryRow");
            //row.setSpacing(paddingV);
            row.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
            row.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
            imageRows[i / columns] = row;
        }
        Image img = thumbnails.get(i);
        if (captions[i].asString().length() > 0) {
            Tooltip.addToWidget(new Tooltip(captions[i]), img); // sometimes wrong tooltip position!?
        }
        row.add(img);
        //int delta = 0;
        //if (paddingH > paddingV) delta = 2*(paddingH-paddingV);
        row.setCellWidth(img, edgeWidth + 2 * paddingH + "px");
        row.setCellHeight(img, edgeHeight + 2 * paddingV + "px");
    }

    for (HorizontalPanel r : imageRows) {
        panel.add(r);
    }
}

From source file:de.novanic.gwteventservice.demo.conversationapp.client.conversation.ui.GWTConversationChannelCreatorDialog.java

License:Open Source License

private Panel createContentPanel() {
    final Button theCreateChannelButton = new Button("Create");
    final Button theCancelButton = new Button("Cancel");

    final TextBox theChannelNameText = new TextBox();
    theChannelNameText.setMaxLength(30);
    theChannelNameText.addKeyUpHandler(new KeyUpHandler() {
        public void onKeyUp(KeyUpEvent aKeyUpEvent) {
            switch (aKeyUpEvent.getNativeKeyCode()) {
            case 13:
                theCreateChannelButton.click();
                break;
            case 27:
                theCancelButton.click();
            }//  w  w w  .  j a v a 2 s  .c  o  m
        }
    });
    theChannelNameText.setFocus(true);

    theCreateChannelButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent aClickEvent) {
            String theChannelName = theChannelNameText.getText();
            close(theChannelName);
        }
    });

    theCancelButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent aClickEvent) {
            close(null);
        }
    });

    HorizontalPanel theActionPanel = new HorizontalPanel();
    theActionPanel.setSpacing(5);
    theActionPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    theActionPanel.add(theCreateChannelButton);
    theActionPanel.add(theCancelButton);

    VerticalPanel theContentPanel = new VerticalPanel();
    theContentPanel.setSpacing(5);
    theContentPanel.add(theChannelNameText);
    theContentPanel.add(theActionPanel);

    return theContentPanel;
}

From source file:de.novanic.gwteventservice.demo.conversationapp.client.conversation.ui.message.GWTMessageBox.java

License:Open Source License

private Panel createContent(MessageButtonListener.Button... aMessageButtons) {
    HorizontalPanel theButtonPanel = new HorizontalPanel();
    theButtonPanel.setSpacing(5);/*from  ww w.ja  v a 2 s. c  om*/
    theButtonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    myMessageButtons = new HashMap<MessageButtonListener.Button, Button>(aMessageButtons.length);
    for (MessageButtonListener.Button theMessageButton : aMessageButtons) {
        final Button theButton = new Button(theMessageButton.getDescription());
        myMessageButtons.put(theMessageButton, theButton);
        theButtonPanel.add(theButton);
    }
    return theButtonPanel;
}

From source file:de.spartusch.nasfvi.client.MessageBox.java

License:Apache License

/**
 * Sets the content and a caption of this MessageBox.
 * @param caption New caption of the box
 * @param content New content of the box
 *//*from  w  w  w  .ja va 2  s .  c o  m*/
public final void set(final String caption, final Widget content) {
    box.setText(caption);

    HorizontalPanel hori = new HorizontalPanel();
    VerticalPanel verti = new VerticalPanel();

    hori.setHorizontalAlignment(Label.ALIGN_CENTER);
    hori.add(ok);
    hori.setWidth("100%");

    verti.add(content);
    verti.add(hori);
    verti.setWidth("100%");
    verti.setSpacing(10);

    box.add(verti);
    box.center();
}

From source file:edu.caltech.ipac.firefly.ui.GwtUtil.java

public static HorizontalPanel makeHoriPanel(HasHorizontalAlignment.HorizontalAlignmentConstant halign,
        HasVerticalAlignment.VerticalAlignmentConstant valign, Widget... widgets) {
    HorizontalPanel hp = new HorizontalPanel();
    for (Widget w : widgets) {
        hp.add(w);/*from   w w w .  j  a  v a  2s. c  o m*/
    }
    if (halign != null) {
        hp.setHorizontalAlignment(halign);
        hp.setWidth("100%");
    }
    if (valign != null) {
        hp.setVerticalAlignment(valign);
    }
    return hp;
}

From source file:edu.caltech.ipac.firefly.ui.GwtUtil.java

public static Widget centerAlign(Widget w) {
    HorizontalPanel hp = new HorizontalPanel();
    hp.setWidth("100%");
    hp.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
    hp.add(w);/* ww w  .  jav a 2  s.  c om*/
    return hp;
}

From source file:edu.caltech.ipac.firefly.ui.GwtUtil.java

public static Widget leftRightAlign(Widget[] wLeft, Widget[] wRight) {
    HorizontalPanel hp = new HorizontalPanel();
    hp.setWidth("100%");
    hp.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
    HorizontalPanel hpLeft = new HorizontalPanel();
    hpLeft.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
    hpLeft.setWidth("100%");
    for (Widget w : wLeft)
        hpLeft.add(w);/*  www  .java  2  s  .  c om*/
    HorizontalPanel hpRight = new HorizontalPanel();
    hpRight.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
    hpRight.setWidth("100%");
    for (Widget w : wRight)
        hpRight.add(w);

    hp.add(hpLeft);
    hp.add(hpRight);
    return hp;
}

From source file:edu.caltech.ipac.firefly.visualize.ui.ImageSelectDropDown.java

private Widget createContents(PlotWidgetFactory plotFactory) {

    if (useNewPanel) {
        imSelPanel2 = new ImageSelectPanel2(new DropDownComplete(), plotter);
    } else {//from w w w  .j  av a2s  .co m
        imSelPanel = new ImageSelectPanel(null, true, null, new DropDownComplete(), plotFactory);
    }
    HorizontalPanel buttons = new HorizontalPanel();
    buttons.addStyleName("base-dialog-buttons");
    buttons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    GwtUtil.setStyle(buttons, "paddingRight", "80px");

    Button ok = new Button("Load");
    ok.addStyleName("highlight-text");
    ok.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent ev) {
            doOK();
        }
    });

    buttons.add(ok);
    buttons.add(HelpManager.makeHelpIcon("basics.catalog"));

    VerticalPanel vp = new VerticalPanel();
    Widget content;
    if (useNewPanel) {
        content = GwtUtil.centerAlign(imSelPanel2.getMainPanel());
    } else {
        content = GwtUtil.centerAlign(imSelPanel.getMainPanel());
    }
    vp.add(content);
    vp.add(buttons);

    vp.setCellHorizontalAlignment(content, VerticalPanel.ALIGN_CENTER);
    vp.setSize("95%", "450px");
    vp.setSpacing(3);
    content.setSize("95%", "95%");
    content.addStyleName("component-background");

    if (useNewPanel) {
        addKeyPressToAll(imSelPanel2.getMainPanel());
    } else {
        addKeyPressToAll(imSelPanel.getMainPanel());
    }

    return vp;
}