Example usage for com.vaadin.ui Alignment MIDDLE_RIGHT

List of usage examples for com.vaadin.ui Alignment MIDDLE_RIGHT

Introduction

In this page you can find the example usage for com.vaadin.ui Alignment MIDDLE_RIGHT.

Prototype

Alignment MIDDLE_RIGHT

To view the source code for com.vaadin.ui Alignment MIDDLE_RIGHT.

Click Source Link

Usage

From source file:org.lunifera.mobile.vaadin.ecview.presentation.internal.NavigationPagePresentation.java

License:Open Source License

/**
 * Sets the alignment to the component./*w ww  .  j a  v  a  2  s  . c o m*/
 * 
 * @param child
 * @param yAlignment
 */
protected void applyAlignment(Component child, YAlignment yAlignment) {

    if (yAlignment != null) {
        child.setSizeUndefined();
        switch (yAlignment) {
        case BOTTOM_CENTER:
            verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_CENTER);
            break;
        case BOTTOM_FILL:
            verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
            child.setWidth("100%");
            break;
        case BOTTOM_LEFT:
            verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
            break;
        case BOTTOM_RIGHT:
            verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_RIGHT);
            break;
        case MIDDLE_CENTER:
            verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_CENTER);
            break;
        case MIDDLE_FILL:
            verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
            child.setWidth("100%");
            break;
        case MIDDLE_LEFT:
            verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
            break;
        case MIDDLE_RIGHT:
            verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_RIGHT);
            break;
        case TOP_CENTER:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_CENTER);
            break;
        case TOP_FILL:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setWidth("100%");
            break;
        case TOP_LEFT:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            break;
        case TOP_RIGHT:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
            break;
        case FILL_CENTER:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_CENTER);
            child.setHeight("100%");
            break;
        case FILL_FILL:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setWidth("100%");
            child.setHeight("100%");
            break;
        case FILL_LEFT:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setHeight("100%");
            break;
        case FILL_RIGHT:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
            child.setHeight("100%");
            break;
        default:
            break;
        }
    }
}

From source file:org.lunifera.runtime.web.ecview.presentation.vaadin.internal.FormLayoutPresentation.java

License:Open Source License

/**
 * Sets the alignment to the component.// w w w  .j  a va  2s . c o m
 * 
 * @param child
 * @param yAlignment
 */
protected void applyAlignment(Component child, YAlignment yAlignment) {

    if (yAlignment != null) {
        child.setWidth("-1%");
        child.setHeight("-1%");
        switch (yAlignment) {
        case BOTTOM_CENTER:
            formLayout.setComponentAlignment(child, Alignment.BOTTOM_CENTER);
            break;
        case BOTTOM_FILL:
            formLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
            child.setWidth("100%");
            break;
        case BOTTOM_LEFT:
            formLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
            break;
        case BOTTOM_RIGHT:
            formLayout.setComponentAlignment(child, Alignment.BOTTOM_RIGHT);
            break;
        case MIDDLE_CENTER:
            formLayout.setComponentAlignment(child, Alignment.MIDDLE_CENTER);
            break;
        case MIDDLE_FILL:
            formLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
            child.setWidth("100%");
            break;
        case MIDDLE_LEFT:
            formLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
            break;
        case MIDDLE_RIGHT:
            formLayout.setComponentAlignment(child, Alignment.MIDDLE_RIGHT);
            break;
        case TOP_CENTER:
            formLayout.setComponentAlignment(child, Alignment.TOP_CENTER);
            break;
        case TOP_FILL:
            formLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setWidth("100%");
            break;
        case TOP_LEFT:
            formLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            break;
        case TOP_RIGHT:
            formLayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
            break;
        case FILL_CENTER:
            formLayout.setComponentAlignment(child, Alignment.TOP_CENTER);
            child.setHeight("100%");
            break;
        case FILL_FILL:
            formLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setWidth("100%");
            child.setHeight("100%");
            break;
        case FILL_LEFT:
            formLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setHeight("100%");
            break;
        case FILL_RIGHT:
            formLayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
            child.setHeight("100%");
            break;
        default:
            break;
        }
    }
}

From source file:org.lunifera.runtime.web.ecview.presentation.vaadin.internal.GridLayoutPresentation.java

License:Open Source License

/**
 * Sets the alignment to the component.//from  ww w  . ja v a 2s.  c om
 * 
 * @param child
 * @param yAlignment
 */
protected void applyAlignment(Component child, YAlignment yAlignment) {

    if (yAlignment != null) {
        child.setWidth("-1%");
        child.setHeight("-1%");
        switch (yAlignment) {
        case BOTTOM_CENTER:
            gridlayout.setComponentAlignment(child, Alignment.BOTTOM_CENTER);
            break;
        case BOTTOM_FILL:
            gridlayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
            child.setWidth("100%");
            break;
        case BOTTOM_LEFT:
            gridlayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
            break;
        case BOTTOM_RIGHT:
            gridlayout.setComponentAlignment(child, Alignment.BOTTOM_RIGHT);
            break;
        case MIDDLE_CENTER:
            gridlayout.setComponentAlignment(child, Alignment.MIDDLE_CENTER);
            break;
        case MIDDLE_FILL:
            gridlayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
            child.setWidth("100%");
            break;
        case MIDDLE_LEFT:
            gridlayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
            break;
        case MIDDLE_RIGHT:
            gridlayout.setComponentAlignment(child, Alignment.MIDDLE_RIGHT);
            break;
        case TOP_CENTER:
            gridlayout.setComponentAlignment(child, Alignment.TOP_CENTER);
            break;
        case TOP_FILL:
            gridlayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setWidth("100%");
            break;
        case TOP_LEFT:
            gridlayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            break;
        case TOP_RIGHT:
            gridlayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
            break;
        case FILL_CENTER:
            gridlayout.setComponentAlignment(child, Alignment.TOP_CENTER);
            child.setHeight("100%");
            break;
        case FILL_FILL:
            gridlayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setWidth("100%");
            child.setHeight("100%");
            break;
        case FILL_LEFT:
            gridlayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setHeight("100%");
            break;
        case FILL_RIGHT:
            gridlayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
            child.setHeight("100%");
            break;
        default:
            break;
        }
    }
}

From source file:org.lunifera.runtime.web.ecview.presentation.vaadin.internal.HorizontalLayoutPresentation.java

License:Open Source License

/**
 * Sets the alignment to the component.//  w  w  w.j  av  a2 s .co m
 * 
 * @param child
 * @param yAlignment
 */
protected void applyAlignment(Component child, YAlignment yAlignment) {

    if (yAlignment != null) {
        child.setWidth("-1%");
        child.setHeight("-1%");
        switch (yAlignment) {
        case BOTTOM_CENTER:
            horizontalLayout.setComponentAlignment(child, Alignment.BOTTOM_CENTER);
            break;
        case BOTTOM_FILL:
            horizontalLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
            child.setWidth("100%");
            break;
        case BOTTOM_LEFT:
            horizontalLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
            break;
        case BOTTOM_RIGHT:
            horizontalLayout.setComponentAlignment(child, Alignment.BOTTOM_RIGHT);
            break;
        case MIDDLE_CENTER:
            horizontalLayout.setComponentAlignment(child, Alignment.MIDDLE_CENTER);
            break;
        case MIDDLE_FILL:
            horizontalLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
            child.setWidth("100%");
            break;
        case MIDDLE_LEFT:
            horizontalLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
            break;
        case MIDDLE_RIGHT:
            horizontalLayout.setComponentAlignment(child, Alignment.MIDDLE_RIGHT);
            break;
        case TOP_CENTER:
            horizontalLayout.setComponentAlignment(child, Alignment.TOP_CENTER);
            break;
        case TOP_FILL:
            horizontalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setWidth("100%");
            break;
        case TOP_LEFT:
            horizontalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            break;
        case TOP_RIGHT:
            horizontalLayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
            break;
        case FILL_CENTER:
            horizontalLayout.setComponentAlignment(child, Alignment.TOP_CENTER);
            child.setHeight("100%");
            break;
        case FILL_FILL:
            horizontalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setWidth("100%");
            child.setHeight("100%");
            break;
        case FILL_LEFT:
            horizontalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setHeight("100%");
            break;
        case FILL_RIGHT:
            horizontalLayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
            child.setHeight("100%");
            break;
        default:
            break;
        }
    }
}

From source file:org.lunifera.runtime.web.ecview.presentation.vaadin.internal.VerticalLayoutPresentation.java

License:Open Source License

/**
 * Sets the alignment to the component./*  w ww  .ja  v a 2  s. c  om*/
 * 
 * @param child
 * @param yAlignment
 */
protected void applyAlignment(Component child, YAlignment yAlignment) {

    if (yAlignment != null) {
        child.setWidth("-1%");
        child.setHeight("-1%");
        switch (yAlignment) {
        case BOTTOM_CENTER:
            verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_CENTER);
            break;
        case BOTTOM_FILL:
            verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
            child.setWidth("100%");
            break;
        case BOTTOM_LEFT:
            verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
            break;
        case BOTTOM_RIGHT:
            verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_RIGHT);
            break;
        case MIDDLE_CENTER:
            verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_CENTER);
            break;
        case MIDDLE_FILL:
            verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
            child.setWidth("100%");
            break;
        case MIDDLE_LEFT:
            verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
            break;
        case MIDDLE_RIGHT:
            verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_RIGHT);
            break;
        case TOP_CENTER:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_CENTER);
            break;
        case TOP_FILL:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setWidth("100%");
            break;
        case TOP_LEFT:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            break;
        case TOP_RIGHT:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
            break;
        case FILL_CENTER:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_CENTER);
            child.setHeight("100%");
            break;
        case FILL_FILL:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setWidth("100%");
            child.setHeight("100%");
            break;
        case FILL_LEFT:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setHeight("100%");
            break;
        case FILL_RIGHT:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
            child.setHeight("100%");
            break;
        default:
            break;
        }
    }
}

From source file:org.opencms.ui.components.CmsBasicDialog.java

License:Open Source License

/**
 * Creates new instance.<p>//ww  w  .  j  av a2s. c o  m
 */
public CmsBasicDialog() {
    addStyleName(OpenCmsTheme.DIALOG);
    setMargin(true);
    setSpacing(true);
    setWidth("100%");

    m_mainPanel = new VerticalLayout();
    m_mainPanel.addStyleName(OpenCmsTheme.DIALOG_CONTENT);
    m_mainPanel.setSpacing(true);
    m_mainPanel.setSizeFull();

    m_contentPanel = new Panel();
    m_contentPanel.setSizeFull();
    m_contentPanel.addStyleName("v-scrollable");

    m_mainPanel.addComponent(m_contentPanel);
    m_mainPanel.setExpandRatio(m_contentPanel, 3);

    Panel panel = new Panel();
    panel.setContent(m_mainPanel);
    panel.setSizeFull();
    addComponent(panel);
    setExpandRatio(panel, 1);
    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setWidth("100%");
    buttons.addStyleName(OpenCmsTheme.DIALOG_BUTTON_BAR);
    addComponent(buttons);
    m_buttonPanelLeft = new HorizontalLayout();
    m_buttonPanelLeft.setSpacing(true);
    buttons.addComponent(m_buttonPanelLeft);
    buttons.setComponentAlignment(m_buttonPanelLeft, Alignment.MIDDLE_LEFT);
    m_buttonPanelLeft.setVisible(false);
    m_buttonPanelRight = new HorizontalLayout();
    m_buttonPanelRight.setSpacing(true);
    buttons.addComponent(m_buttonPanelRight);
    buttons.setComponentAlignment(m_buttonPanelRight, Alignment.MIDDLE_RIGHT);
    enableMaxHeight();
}

From source file:org.opencms.ui.dialogs.history.CmsHistoryDialog.java

License:Open Source License

/**
 * Creates a new instance.<p>//from  w w  w  . j  a  va 2s  . com
 *
 * @param context the dialog context
 */
public CmsHistoryDialog(I_CmsDialogContext context) {
    m_context = context;
    m_resource = context.getResources().get(0);
    setWidth("100%");
    CmsVaadinUtils.readAndLocalizeDesign(this,
            OpenCms.getWorkplaceManager().getMessages(A_CmsUI.get().getLocale()), null);
    CmsResource resource = context.getResources().get(0);

    CmsVfsService vfsService = new CmsVfsService();
    vfsService.setCms(context.getCms());
    try {
        CmsHistoryResourceCollection historyList = vfsService
                .getResourceHistoryInternal(resource.getStructureId());

        Table historyTable = buildHistoryTable(historyList);

        historyTable.setWidth("100%");
        m_listContainer.setWidth("100%");
        Button compareButton = new Button(CmsVaadinUtils.getMessageText(Messages.GUI_HISTORY_DIALOG_COMPARE_0));
        m_listContainer.addComponent(compareButton);
        m_listContainer.setComponentAlignment(compareButton, Alignment.MIDDLE_RIGHT);

        compareButton.addClickListener(new ClickListener() {

            private static final long serialVersionUID = 1L;

            @SuppressWarnings("synthetic-access")
            public void buttonClick(ClickEvent event) {

                try {
                    tryCompare();
                } catch (Exception e) {
                    LOG.error(e.getLocalizedMessage(), e);
                    m_context.error(e);
                }
            }
        });
        m_compareButton.set(compareButton);
        m_group1.setChangeListener(new CmsLogicalCheckboxGroup.I_ChangeListener() {

            @SuppressWarnings("synthetic-access")
            public void onSelect(CheckBox box) {

                m_selected1.set(box);
                m_compareButton.get().setEnabled(canCompare(m_selected1.get(), m_selected2.get()));

            }
        });

        m_group2.setChangeListener(new CmsLogicalCheckboxGroup.I_ChangeListener() {

            @SuppressWarnings("synthetic-access")
            public void onSelect(CheckBox box) {

                m_selected2.set(box);
                m_compareButton.get().setEnabled(canCompare(m_selected1.get(), m_selected2.get()));
            }
        });
        m_compareButton.get().setEnabled(false);
        m_listContainer.addComponent(historyTable);
    } catch (CmsException e) {
        LOG.error(e.getLocalizedMessage(), e);
    }
    addButton(createCloseButton());
    displayResourceInfo(m_context.getResources());
}

From source file:org.opencms.ui.dialogs.history.diff.CmsShowVersionButtons.java

License:Open Source License

/**
 * @see org.opencms.ui.dialogs.history.diff.I_CmsDiffProvider#diff(org.opencms.file.CmsObject, org.opencms.gwt.shared.CmsHistoryResourceBean, org.opencms.gwt.shared.CmsHistoryResourceBean)
 */// w w  w  .  j a  v a2  s. c o  m
public Optional<Component> diff(CmsObject cms, CmsHistoryResourceBean v1, CmsHistoryResourceBean v2) {

    Panel panel = new Panel("");
    panel.addStyleName(ValoTheme.PANEL_BORDERLESS);
    HorizontalLayout hl = new HorizontalLayout();
    panel.setContent(hl);
    hl.addComponent(createButton(cms, v1));
    hl.addComponent(createButton(cms, v2));
    VerticalLayout outerContainer = new VerticalLayout();
    outerContainer.addComponent(hl);
    outerContainer.setComponentAlignment(hl, Alignment.MIDDLE_RIGHT);
    outerContainer.setMargin(true);
    hl.setSpacing(true);
    return Optional.fromNullable((Component) outerContainer);
}

From source file:org.opencms.ui.dialogs.history.diff.CmsValueDiff.java

License:Open Source License

/**
 * @see org.opencms.ui.dialogs.history.diff.I_CmsDiffProvider#diff(org.opencms.file.CmsObject, org.opencms.gwt.shared.CmsHistoryResourceBean, org.opencms.gwt.shared.CmsHistoryResourceBean)
 *///from w w w.j ava  2 s  .  c o m
public Optional<Component> diff(final CmsObject cms, CmsHistoryResourceBean v1, CmsHistoryResourceBean v2)
        throws CmsException {

    CmsResource resource1 = A_CmsAttributeDiff.readResource(cms, v1);
    I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(resource1);
    CmsMacroResolver resolver = new CmsVersionMacroResolver(v1, v2);
    if ((type instanceof CmsResourceTypeXmlContent) || (type instanceof CmsResourceTypeXmlPage)) {
        CmsResource resource2 = A_CmsAttributeDiff.readResource(cms, v2);
        final Panel panel = new Panel(
                CmsVaadinUtils.getMessageText(Messages.GUI_HISTORY_DIALOG_CONTENT_VALUE_TABLE_CAPTION_0));

        final CmsFile file1 = cms.readFile(resource1);

        final CmsFile file2 = cms.readFile(resource2);
        VerticalLayout vl = new VerticalLayout();
        vl.setMargin(true);
        vl.setSpacing(true);
        Table table = buildValueComparisonTable(cms, panel, file1, file2, resolver);
        if (table.getContainerDataSource().size() == 0) {
            return Optional.absent();
        }
        Button fileTextCompareButton = new Button(
                CmsVaadinUtils.getMessageText(Messages.GUI_HISTORY_DIALOG_COMPARE_WHOLE_FILE_0));
        vl.addComponent(fileTextCompareButton);
        vl.setComponentAlignment(fileTextCompareButton, Alignment.MIDDLE_RIGHT);
        fileTextCompareButton.addClickListener(new ClickListener() {

            private static final long serialVersionUID = 1L;

            @SuppressWarnings("synthetic-access")
            public void buttonClick(ClickEvent event) {

                Component diffView = buildWholeFileDiffView(cms, file1, file2);
                CmsHistoryDialog.openChildDialog(panel, diffView,
                        CmsVaadinUtils.getMessageText(Messages.GUI_HISTORY_DIALOG_COMPARE_WHOLE_FILE_0));
            }
        });
        vl.addComponent(table);
        panel.setContent(vl);
        Component result = panel;
        return Optional.fromNullable(result);
    } else {
        return Optional.absent();
    }
}