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

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

Introduction

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

Prototype

public void setCellHorizontalAlignment(IsWidget w, HorizontalAlignmentConstant align) 

Source Link

Document

Overloaded version for IsWidget.

Usage

From source file:org.onecmdb.ui.gwt.toolkit.client.view.screen.header.HeaderScreen.java

License:Apache License

public HeaderScreen() {
    HorizontalPanel outer = new HorizontalPanel();
    VerticalPanel inner = new VerticalPanel();
    outer.setWidth("100%");
    outer.setHeight("3em");

    //outer.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
    inner.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
    inner.setWidth("100%");
    inner.setHeight("100%");

    HorizontalPanel authInfo = new HorizontalPanel();
    //authInfo.setSpacing(4);
    logout.setStyleName("logout-style");
    authInfo.add(welcomeString);/* w w w  .  j a  va2s. c  o m*/
    authInfo.add(logout);
    logout.setVisible(false);
    logout.addClickListener(this);
    inner.add(authInfo);

    HorizontalPanel actionPanel = new HorizontalPanel();
    actionPanel.setStyleName("onecmdb-header-label");
    actionPanel.setSpacing(10);
    actionPanel.add(getFeedbackWidget());
    actionPanel.add(getCheckUpdateWidget());

    actionPanel.add(getHomeWidegt());
    actionPanel.add(getHelpWidget());

    inner.add(actionPanel);
    inner.setCellVerticalAlignment(actionPanel, VerticalPanel.ALIGN_BOTTOM);
    inner.setCellVerticalAlignment(authInfo, VerticalPanel.ALIGN_TOP);

    //DockPanel iconPanel = new DockPanel();
    //iconPanel.setWidth("100%");
    //welcomePanel.setSpacing(10);
    //iconPanel.add(icon,DockPanel.EAST);
    //    welcomePanel.add(new HTML("<b>&nbsp;</b>"),DockPanel.CENTER);
    outer.add(icon);
    outer.setCellHorizontalAlignment(icon, HorizontalPanel.ALIGN_LEFT);
    outer.add(inner);
    outer.setCellHorizontalAlignment(inner, HorizontalPanel.ALIGN_RIGHT);

    // Show welcome page.
    icon.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            getBaseEntryScreen().showScreen(OneCMDBApplication.WELCOME_SCREEN);
        }
    });

    initWidget(outer);
    //outer.setStyleName("one-top-panel");
}

From source file:org.onecmdb.ui.gwt.toolkit.client.view.table.CITablePageControlPanel.java

License:Open Source License

public CITablePageControlPanel(final CITablePanel table) {
    this.table = table;
    table.addLoadListener(this);
    HorizontalPanel root = new HorizontalPanel();
    root.setStyleName("onecmdb-table-page-search-panel");
    root.setWidth("100%");
    HorizontalPanel actions = new HorizontalPanel();
    root.add(actions);/*from w ww.j a  v a  2 s. c  o  m*/
    root.setCellHorizontalAlignment(actions, HorizontalPanel.ALIGN_LEFT);

    HorizontalPanel paging = new HorizontalPanel();
    root.add(paging);
    root.setCellHorizontalAlignment(paging, HorizontalPanel.ALIGN_RIGHT);

    reload = new Image("images/reload.gif");

    reload.addClickListener(getSearchClickListener());
    // Enable 'return key' to start search.
    search.addKeyboardListener(new KeyboardListener() {

        public void onKeyDown(Widget sender, char keyCode, int modifiers) {
        }

        public void onKeyPress(Widget sender, char keyCode, int modifiers) {
            if (keyCode == KeyboardListener.KEY_ENTER) {
                getSearchClickListener().onClick(sender);
            }
        }

        public void onKeyUp(Widget sender, char keyCode, int modifiers) {
        }

    });
    prevImage = new Image("images/prev.gif");
    nextImage = new Image("images/next.gif");
    nextImage.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            setNextPage();
            table.reload();
        }

    });

    prevImage.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            setPrevPage();
            table.reload();
        }
    });

    paging.add(prevImage);
    paging.add(firstItemNumber);
    paging.add(new Label("-"));
    paging.add(lastItemNumber);
    paging.add(new Label("("));
    paging.add(currentRows);
    paging.add(new Label(")"));
    paging.add(nextImage);

    actions.add(new Label("Search"));

    actions.add(search);
    actions.add(reload);

    /*
    actions.add(new Label("PageSize"));
    TextBox pageSize = new TextBox();
    pageSize.setVisibleLength(2);
    actions.add(pageSize);
    */

    table.addLoadListener(this);

    initWidget(root);
}

From source file:org.openelis.gwt.widget.MenuItem.java

License:Open Source License

public static Widget createTableHeader(String icon, Widget wid) {
    HorizontalPanel hp = new HorizontalPanel();
    //hp.setStyleName("TopHeaderRowContainer");
    hp.add(wid);//from  w  w w. jav a  2  s .  c o  m
    wid.setStyleName("HeaderLabel");
    hp.setCellWidth(wid, "100%");
    AbsolutePanel ap = new AbsolutePanel();
    hp.add(ap);
    hp.setCellWidth(ap, "16px");
    ap.setHeight("18px");
    ap.setWidth("16px");
    hp.setCellHorizontalAlignment(ap, HasAlignment.ALIGN_RIGHT);
    hp.setCellHorizontalAlignment(wid, HasAlignment.ALIGN_CENTER);
    return hp;
}

From source file:org.openelis.gwt.widget.ScreenWindow.java

License:Open Source License

public void init(Mode mode, boolean noBorder) {
    this.mode = mode;

    setWidget(outer);//from   ww w. j ava  2  s  . com
    setVisible(false);

    if (browser != null)
        zIndex = browser.index;

    if (!noBorder) {
        tlCorner.addStyleName("WindowTL");
        trCorner.addStyleName("WindowTR");
        blCorner.addStyleName("WindowBL");
        brCorner.addStyleName("WindowBR");
        leftSide.addStyleName("WindowLeft");
        rightSide.addStyleName("WindowRight");

        HorizontalPanel hp = new HorizontalPanel();
        hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
        titleButtonsContainer = new HorizontalPanel();
        titleButtonsContainer.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

        hp.setWidth("100%");
        titleButtonsContainer.addStyleName("Caption");
        titleButtonsContainer.setWidth("100%");

        cap.addMouseDownHandler(this);
        winLabel.setStyleName("ScreenWindowLabel");
        cap.add(winLabel);
        cap.setWidth("100%");
        cap.setHeight("100%");
        cap.setCellVerticalAlignment(winLabel, HasAlignment.ALIGN_MIDDLE);
        close.addClickHandler(this);
        close.setStyleName("CloseButton");
        collapse.addClickHandler(this);
        collapse.setStyleName("MinimizeButton");
        hp.add(tlCorner);
        titleButtonsContainer.add(cap);
        titleButtonsContainer.setCellWidth(cap, "100%");
        hp.add(titleButtonsContainer);
        hp.setCellWidth(titleButtonsContainer, "100%");

        if (mode == Mode.SCREEN || mode == Mode.LOOK_UP) {
            HorizontalPanel hp2 = new HorizontalPanel();
            hp2.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
            hp2.add(collapse);
            hp2.add(close);
            titleButtonsContainer.add(hp2);
            titleButtonsContainer.setCellHorizontalAlignment(hp2, HasAlignment.ALIGN_RIGHT);
            hp.setCellWidth(hp2, "32px");
            hp.setCellHorizontalAlignment(hp2, HasAlignment.ALIGN_RIGHT);
        }
        hp.add(trCorner);
        statusImg.addMouseOverHandler(this);
        statusImg.addMouseOutHandler(this);
        status.setStyleName("StatusBar");
        status.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

        status.add(statusImg);
        status.add(message);
        status.add(progressBar);
        progressBar.setVisible(false);
        status.setWidth("100%");

        status.setCellWidth(message, "100%");
        message.setStyleName("ScreenWindowLabel");
        outer.add(hp);

        bottomRow.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

        bottomRow.setWidth("100%");
        bottomRow.setSpacing(0);

        middleGrid.setCellPadding(0);
        middleGrid.setCellSpacing(0);
        middleGrid.getCellFormatter().addStyleName(0, 0, "WindowLeft");
        middleGrid.setWidget(0, 1, body);
        middleGrid.getCellFormatter().addStyleName(0, 2, "WindowRight");

        bottomRow.add(blCorner);
        bottomRow.add(status);
        bottomRow.add(brCorner);

        bottomRow.setCellWidth(status, "100%");

        body.addStyleName("WindowBody");

        outer.add(middleGrid);
        outer.add(bottomRow);
        outer.addStyleName("WindowPanel");
        outer.sinkEvents(Event.ONCLICK);
        outer.setWidth("auto");
    } else {
        outer.add(body);
        outer.addStyleName("WindowPanel");
        outer.sinkEvents(Event.ONCLICK);
        outer.setWidth("auto");
    }

    Window.addResizeHandler(this);
    if (browser != null) {
        browser.dragController.makeDraggable(this, cap);
        return;
    }
    if (mode == Mode.LOOK_UP || mode == Mode.DIALOG) {
        modalGlass = new AbsolutePanel();
        modalGlass.setStyleName("GlassPanel");
        modalGlass.setHeight(Window.getClientHeight() + "px");
        modalGlass.setWidth(Window.getClientWidth() + "px");

        RootPanel.get().add(modalGlass);
        RootPanel.get().setWidgetPosition(modalGlass, 0, 0);
        modalPanel = new AbsolutePanel();
        modalPanel.setStyleName("ModalPanel");
        modalPanel.setHeight(Window.getClientHeight() + "px");
        modalPanel.setWidth(Window.getClientWidth() + "px");
        modalPanel.add(this, position, position);
        RootPanel.get().add(modalPanel);
        RootPanel.get().setWidgetPosition(modalPanel, 0, 0);
        setVisible(true);
        dragController = new PickupDragController(modalPanel, true);
        dropController = new AbsolutePositionDropController(modalPanel);
        dragController.registerDropController(dropController);
        dragController.makeDraggable(this, cap);
        dragController.setBehaviorDragProxy(true);
    } else {
        RootPanel.get().add(this);
        RootPanel.get().setWidgetPosition(this, position, position);
        setVisible(true);
        dragController = new PickupDragController(RootPanel.get(), true);
        dropController = new AbsolutePositionDropController(RootPanel.get());
        dragController.registerDropController(dropController);
        dragController.makeDraggable(this, cap);
        dragController.setBehaviorDragProxy(true);
    }
}

From source file:org.openxdata.designer.client.view.LocalesDialog.java

/**
 * Creates a new instance of the locale dialog box.
 *//*from   w w  w.jav  a  2s . c o m*/
public LocalesDialog() {
    super(false, true);

    VerticalPanel panel = new VerticalPanel();
    panel.setSpacing(5);
    setWidget(panel);

    table.setWidget(0, 0, new Label("Name"));
    table.setWidget(0, 1, new Label("Key"));
    table.setWidget(0, 2, new Label("Delete"));

    table.getCellFormatter().setStyleName(0, 0, "getting-started-label");
    table.getCellFormatter().setStyleName(0, 1, "getting-started-label");
    table.getCellFormatter().setStyleName(0, 2, "getting-started-label");

    table.setStyleName("cw-FlexTable");
    panel.add(table);

    HorizontalPanel horzPanel = new HorizontalPanel();
    FormUtil.maximizeWidget(horzPanel);
    panel.add(horzPanel);

    Button btn = new Button(i18n.save(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            save();
            hide();
        }
    });

    horzPanel.add(btn);
    horzPanel.setCellHorizontalAlignment(btn, HasAlignment.ALIGN_LEFT);

    btn = new Button(i18n.cancel(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            hide();
        }
    });

    horzPanel.add(btn);
    horzPanel.setCellHorizontalAlignment(btn, HasAlignment.ALIGN_RIGHT);

    setText(i18n.languages());

    loadLocales();

    btnAdd.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            addNewLocale();
        }
    });
}

From source file:org.openxdata.designer.client.view.SkipQtnsDialog.java

/**
 * Sets up the header labels for the all and selected questions list boxes.
 *//*from w ww.  j  ava  2  s  .c om*/
private void setupHeaderLabels() {
    HorizontalPanel horzPanel = new HorizontalPanel();
    Label lblAllQtns = new Label(formsConstants.allQuestions());
    Label lblSelQtns = new Label(formsConstants.selectedQuestions());

    horzPanel.add(lblAllQtns);
    horzPanel.add(lblSelQtns);

    horzPanel.setCellHorizontalAlignment(lblAllQtns, HasAlignment.ALIGN_CENTER);
    horzPanel.setCellHorizontalAlignment(lblSelQtns, HasAlignment.ALIGN_CENTER);
    FormUtil.maximizeWidget(horzPanel);

    mainPanel.add(horzPanel);
}

From source file:org.openxdata.designer.client.view.SkipQtnsDialog.java

/**
 * Sets up the Ok and Cancel buttons./*  ww w. java2 s.c o m*/
 */
private void setupOkCancelButtons() {
    btnOk.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            hide();
            qtnSelListener.onQuestionsSelected(getSelectedQtns());
        }
    });

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

    HorizontalPanel horzPanel = new HorizontalPanel();

    horzPanel.add(btnOk);
    horzPanel.add(btnCancel);

    horzPanel.setCellHorizontalAlignment(btnOk, HasAlignment.ALIGN_CENTER);
    horzPanel.setCellHorizontalAlignment(btnCancel, HasAlignment.ALIGN_CENTER);
    FormUtil.maximizeWidget(horzPanel);

    btnOk.setEnabled(false);

    mainPanel.add(horzPanel);
}

From source file:org.openxdata.sharedlib.client.view.OpenFileDialog.java

/**
 * Sets up the widgets./*from   w w  w.j  ava  2  s. c  om*/
 * 
 * @param url the url to post to.
 */
public void initWidgets(String url) {
    actionUrl = url;
    form.setAction(actionUrl);
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setMethod(FormPanel.METHOD_POST);

    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setSpacing(20);
    form.add(verticalPanel);

    fileUpload = new FileUpload();
    fileUpload.setName("filecontents");
    verticalPanel.add(fileUpload);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setWidth("100%");
    horizontalPanel.setHeight("100%");
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);

    Button button = new Button(constants.open(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            String action = actionUrl;
            if (action.contains("?"))
                action += "&";
            else
                action += "?";
            action += "pathname=" + fileUpload.getFilename();
            //action += "&time="+ new java.util.Date().getTime();

            form.setAction(action);
            form.submit();
            //hide();

            FormUtil.dlg.setText(constants.processingMsg());
            FormUtil.dlg.center();
        }
    });

    horizontalPanel.add(button);
    horizontalPanel.setCellHorizontalAlignment(button, HasHorizontalAlignment.ALIGN_LEFT);

    button = new Button(constants.cancel(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            hide();
            FormUtil.dlg.hide();
        }
    });

    horizontalPanel.add(button);
    horizontalPanel.setCellHorizontalAlignment(button, HasHorizontalAlignment.ALIGN_RIGHT);

    verticalPanel.add(horizontalPanel);

    setWidget(form);

    form.addSubmitCompleteHandler(new SubmitCompleteHandler() {
        public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) {
            eventListener.onSetFileContents(event.getResults());
            hide();
            FormUtil.dlg.hide();
        }
    });

    setText(constants.openFile());
}

From source file:org.openxdata.sharedlib.client.view.SaveFileDialog.java

public void initWidgets(String url, String data, String fileName) {
    actionUrl = url;/* ww w .  j  a v a 2 s .  co m*/
    form.setAction(actionUrl);
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setMethod(FormPanel.METHOD_POST);

    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setSpacing(10);
    form.add(verticalPanel);

    txtArea = new TextArea();
    txtArea.setText(data);
    txtArea.setName("filecontents");
    txtArea.setVisible(false);

    txtName = new TextBox();
    txtName.setText(fileName);
    txtName.setName("filename");
    txtName.setWidth("250" + OpenXdataConstants.UNITS);

    verticalPanel.add(txtName);
    verticalPanel.add(txtArea);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setWidth("100%");
    horizontalPanel.setHeight("100%");
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);

    Button button = new Button(constants.save(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            String fileName = txtName.getText();
            if (fileName != null && fileName.trim().length() > 0) {
                String action = actionUrl;
                if (action.contains("?"))
                    action += "&";
                else
                    action += "?";
                action += "filename=" + fileName;

                form.setAction(action);
                ((VerticalPanel) txtName.getParent()).add(txtArea);
                form.submit();
                //hide();

                FormUtil.dlg.setText(constants.processingMsg());
                FormUtil.dlg.center();
            }
        }
    });

    horizontalPanel.add(button);
    horizontalPanel.setCellHorizontalAlignment(button, HasHorizontalAlignment.ALIGN_LEFT);

    button = new Button(constants.cancel(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            hide();
            FormUtil.dlg.hide();
        }
    });

    horizontalPanel.add(button);
    horizontalPanel.setCellHorizontalAlignment(button, HasHorizontalAlignment.ALIGN_RIGHT);

    verticalPanel.add(horizontalPanel);

    setWidget(form);

    form.addSubmitCompleteHandler(new SubmitCompleteHandler() {
        public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) {
            hide();
            FormUtil.dlg.hide();
            Window.Location.replace(form.getAction());
        }
    });

    setText(constants.saveFileAs());
}

From source file:org.overlord.sramp.ui.client.views.ArtifactView.java

License:Apache License

/**
 * @see org.overlord.sramp.ui.client.views.IArtifactView#onArtifactLoaded(org.overlord.sramp.ui.shared.beans.ArtifactDetails)
 *//*  ww w.ja  v a 2  s.c  om*/
@Override
public void onArtifactLoaded(ArtifactDetails artifact) {
    main.clear();

    HorizontalPanel twoColContent = new HorizontalPanel();
    twoColContent.setStyleName("artifactView-content");
    twoColContent.setWidth("100%");
    main.add(twoColContent);

    VerticalPanel leftCol = new VerticalPanel();
    leftCol.setStyleName("leftCol");
    VerticalPanel rightCol = new VerticalPanel();
    rightCol.setStyleName("rightCol");
    leftCol.setWidth("100%");
    rightCol.setWidth("100%");
    twoColContent.add(leftCol);
    twoColContent.add(rightCol);
    twoColContent.setCellWidth(leftCol, "70%");
    twoColContent.setCellWidth(rightCol, "30%");
    twoColContent.setCellHorizontalAlignment(rightCol, HorizontalPanel.ALIGN_RIGHT);

    // Artifact details
    DisclosurePanel details = new DisclosurePanel(i18n().translate("views.artifact.details.label"));
    details.setStyleName("dpanel");
    details.setOpen(true);
    details.add(createDetailsForm(artifact));

    // Artifact description
    DisclosurePanel description = new DisclosurePanel(i18n().translate("views.artifact.description.label"));
    description.setStyleName("dpanel");
    description.setOpen(true);
    description.add(createDescriptionForm(artifact));

    // Relationships
    DisclosurePanel relationships = new DisclosurePanel(i18n().translate("views.artifact.relationships.label"));
    relationships.setStyleName("dpanel");
    relationships.setOpen(true);
    relationships.add(createRelationshipsForm(artifact));

    leftCol.add(details);
    leftCol.add(description);
    leftCol.add(relationships);
    leftCol.setCellWidth(details, "100%");
    leftCol.setCellWidth(description, "100%");
    leftCol.setCellWidth(relationships, "100%");

    // Artifact properties
    DisclosurePanel properties = new DisclosurePanel(i18n().translate("views.artifact.properties.label"));
    properties.setStyleName("dpanel");
    properties.setOpen(true);
    properties.add(createPropertiesForm(artifact));

    // Classifications
    DisclosurePanel classifications = new DisclosurePanel(
            i18n().translate("views.artifact.classifications.label"));
    classifications.setStyleName("dpanel");
    classifications.setOpen(true);
    classifications.add(createClassificationsForm(artifact));

    // Artifact links/urls
    DisclosurePanel links = new DisclosurePanel(i18n().translate("views.artifact.links.label"));
    links.setStyleName("dpanel");
    links.setOpen(true);
    links.add(createLinks(artifact));

    rightCol.add(properties);
    rightCol.add(classifications);
    rightCol.add(links);
    rightCol.setCellWidth(details, "100%");
}