Example usage for com.vaadin.ui Alignment MIDDLE_CENTER

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

Introduction

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

Prototype

Alignment MIDDLE_CENTER

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

Click Source Link

Usage

From source file:com.cms.view.ServicesView.java

public ServicesView() {

    layoutMain.setMargin(true);//from w w w.  j a  v a  2  s  . c o m
    layoutMain.setSpacing(true);
    buildSearchLayout();
    layoutMain.addComponent(searchLayout);
    panelMain.setCaption(BundleUtils.getString("title.Services"));

    GridManyButton gridManyButton = new GridManyButton(
            new String[] { Constants.BUTTON_SEARCH, Constants.BUTTON_REFRESH });
    btnSearch = gridManyButton.getBtnCommon().get(0);
    btnRefresh = gridManyButton.getBtnCommon().get(1);
    layoutMain.addComponent(gridManyButton);
    layoutMain.setComponentAlignment(gridManyButton, Alignment.MIDDLE_CENTER);
    tblServices = new CommonTableFilterPanel();
    tblServices.setImmediate(true);
    tblServices.setWidth("100%");
    tblServices.setHeight("-1px");
    tblServices.getHorizoltalLayout().setVisible(false);
    layoutMain.addComponent(tblServices);

    //        btnPrintBB.setEnabled(false);
    ServicesController servicesController = new ServicesController(this);
}

From source file:com.cms.view.TaxAuthorityView.java

public TaxAuthorityView() {

    layoutMain.setMargin(true);//  w w w .jav a  2  s  .c om
    layoutMain.setSpacing(true);
    buildSearchLayout();
    layoutMain.addComponent(searchLayout);
    panelMain.setCaption(BundleUtils.getString("title.TaxAuthority"));

    GridManyButton gridManyButton = new GridManyButton(
            new String[] { Constants.BUTTON_SEARCH, Constants.BUTTON_REFRESH });
    btnSearch = gridManyButton.getBtnCommon().get(0);
    btnRefresh = gridManyButton.getBtnCommon().get(1);
    layoutMain.addComponent(gridManyButton);
    layoutMain.setComponentAlignment(gridManyButton, Alignment.MIDDLE_CENTER);
    tblTaxAuthority = new CommonTableFilterPanel();
    tblTaxAuthority.setImmediate(true);
    tblTaxAuthority.setWidth("100%");
    tblTaxAuthority.setHeight("-1px");
    tblTaxAuthority.getHorizoltalLayout().setVisible(false);
    layoutMain.addComponent(tblTaxAuthority);

    //        btnPrintBB.setEnabled(false);
    TaxAuthorityController taxAuthorityController = new TaxAuthorityController(this);
}

From source file:com.compomics.sigpep.webapp.MyVaadinApplication.java

License:Apache License

@Override
public void init() {
    iApplication = this;
    iSigPepSessionFactory = ApplicationLocator.getInstance().getApplication().getSigPepSessionFactory();

    //add theme/*from  www .j  a v a 2  s .  c  om*/
    setTheme("sigpep");

    //add main window
    Window lMainwindow = new Window("Sigpep Application");
    setMainWindow(lMainwindow);
    lMainwindow.addStyleName("v-app-my");

    //add notification component
    iNotifique = new Notifique(Boolean.FALSE);
    CustomOverlay lCustomOverlay = new CustomOverlay(iNotifique, getMainWindow());
    getMainWindow().addComponent(lCustomOverlay);

    //add form help
    iFormHelp = new FormHelp();
    iFormHelp.setFollowFocus(Boolean.TRUE);
    this.getMainWindow().getContent().addComponent(iFormHelp);

    //add panels
    iCenterLeft = new Panel();
    iCenterLeft.addStyleName(Reindeer.PANEL_LIGHT);
    iCenterLeft.setHeight("400px");
    iCenterLeft.setWidth("100%");

    iCenterRight = new Panel();
    iCenterRight.addStyleName(Reindeer.PANEL_LIGHT);
    iCenterRight.setHeight("400px");
    iCenterRight.setWidth("75%");

    //add form tabs
    iFormTabSheet = new FormTabSheet(this);
    iCenterLeft.addComponent(iFormTabSheet);

    iBottomLayoutResults = new VerticalLayout();

    if (PropertiesConfigurationHolder.showTestDemoFolder()) {
        Button lButton = new Button("load test data");
        lButton.addListener(new Button.ClickListener() {
            public void buttonClick(Button.ClickEvent event) {
                new BackgroundThread().run();
            }
        });
        iBottomLayoutResults.addComponent(lButton);
    }

    // Add the selector component
    iSelectionComponent = new TransitionSelectionComponent(MyVaadinApplication.this);
    iCenterRight.addComponent(iSelectionComponent);

    iHeaderLayout = new HorizontalLayout();
    iHeaderLayout.setSizeFull();
    iHeaderLayout.setHeight("100px");
    iHeaderLayout.addStyleName("v-header");

    VerticalLayout lVerticalLayout = new VerticalLayout();

    GridLayout lGridLayout = new GridLayout(2, 1);
    lGridLayout.setSpacing(true);
    lGridLayout.setSizeFull();

    lGridLayout.addComponent(iCenterLeft, 0, 0);
    lGridLayout.setComponentAlignment(iCenterLeft, Alignment.TOP_LEFT);

    lGridLayout.addComponent(iCenterRight, 1, 0);
    lGridLayout.setComponentAlignment(iCenterRight, Alignment.TOP_CENTER);

    lVerticalLayout.addComponent(iHeaderLayout);
    lVerticalLayout.addComponent(lGridLayout);
    lVerticalLayout.addComponent(iBottomLayoutResults);

    lVerticalLayout.setComponentAlignment(iHeaderLayout, Alignment.MIDDLE_CENTER);
    lVerticalLayout.setComponentAlignment(lGridLayout, Alignment.MIDDLE_CENTER);
    lVerticalLayout.setComponentAlignment(iBottomLayoutResults, Alignment.MIDDLE_CENTER);

    lMainwindow.addComponent(lVerticalLayout);
    lMainwindow.addComponent(pusher);

    // Create a tracker for vaadin.com domain.
    String lDomainName = PropertiesConfigurationHolder.getInstance().getString("analytics.domain");
    String lPageId = PropertiesConfigurationHolder.getInstance().getString("analytics.page");

    GoogleAnalyticsTracker tracker = new GoogleAnalyticsTracker("UA-26252212-1", lDomainName);
    lMainwindow.addComponent(tracker);
    tracker.trackPageview(lPageId);

    /**
     * Sets an UncaughtExceptionHandler and executes the thread by the ExecutorsService
     */
    Thread.setDefaultUncaughtExceptionHandler(new MyUncaughtExceptionHandler());

    parseSessionId();
}

From source file:com.dungnv.streetfood.ui.CommonSearchPagedUI.java

private final void init() {

    setWidth("100%");
    setStyleName("item-search-box");
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);/*from  ww w  .j av  a 2 s.  com*/
    this.addComponent(layout);

    FormLayout form = new FormLayout();
    //        form.setWidth("100%");
    form.setMargin(false);
    layout.addComponent(form);
    layout.setComponentAlignment(form, Alignment.MIDDLE_CENTER);

    cbRecordPerPage = new ComboBox();
    cbRecordPerPage.setWidth("65px");
    cbRecordPerPage.setStyleName(ValoTheme.COMBOBOX_TINY);
    cbRecordPerPage.setCaption(BundleUtils.getLanguage("lbl.recordsPerPage"));
    cbRecordPerPage.setTextInputAllowed(false);
    cbRecordPerPage.addItem(10);
    cbRecordPerPage.addItem(20);
    cbRecordPerPage.addItem(30);
    cbRecordPerPage.addItem(50);
    cbRecordPerPage.addItem(100);
    cbRecordPerPage.addItem(200);
    cbRecordPerPage.select(10);
    form.addComponent(cbRecordPerPage);
    cbRecordPerPage.setNullSelectionAllowed(false);

    btnFastBackward = new Button();
    btnFastBackward.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnFastBackward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnFastBackward.setIcon(FontAwesome.FAST_BACKWARD);
    layout.addComponent(btnFastBackward);
    layout.setComponentAlignment(btnFastBackward, Alignment.MIDDLE_CENTER);

    btnBackward = new Button();
    btnBackward.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnBackward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnBackward.setIcon(FontAwesome.BACKWARD);
    layout.addComponent(btnBackward);
    layout.setComponentAlignment(btnBackward, Alignment.MIDDLE_CENTER);

    cbPaged = new ComboBox();
    cbPaged.setTextInputAllowed(false);
    for (int i = 1; i <= pageCount; i++) {
        cbPaged.addItem(i);
    }

    cbPaged.setNullSelectionAllowed(false);
    cbPaged.select(1);
    cbPaged.addStyleName(ValoTheme.COMBOBOX_TINY);
    cbPaged.setWidth("60px");
    layout.addComponent(cbPaged);
    layout.setComponentAlignment(cbPaged, Alignment.MIDDLE_CENTER);

    btnFoward = new Button();
    btnFoward.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnFoward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnFoward.setIcon(FontAwesome.FORWARD);
    layout.addComponent(btnFoward);
    layout.setComponentAlignment(btnFoward, Alignment.MIDDLE_CENTER);

    btnFastFoward = new Button();
    btnFastFoward.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnFastFoward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnFastFoward.setIcon(FontAwesome.FAST_FORWARD);
    layout.addComponent(btnFastFoward);
    layout.setComponentAlignment(btnFastFoward, Alignment.MIDDLE_CENTER);
    enableComponent();
}

From source file:com.esofthead.mycollab.community.ui.chart.GenericChartWrapper.java

License:Open Source License

public void setSearchCriteria(final S criteria) {
    this.searchCriteria = criteria;

    final JFreeChart chart = createChart();
    final JFreeChartWrapper chartWrapper = new JFreeChartWrapper(chart);

    removeAllComponents();//  w w w  .  ja va2s  . co  m
    final CssLayout borderWrap = new CssLayout();
    borderWrap.addComponent(chartWrapper);
    borderWrap.setStyleName("chart-wrapper");
    borderWrap.setHeight(height + "px");
    borderWrap.setWidth(width + "px");
    chartWrapper.setHeight(height + "px");
    chartWrapper.setWidth(width + "px");
    chartWrapper.setGraphHeight(height);
    chartWrapper.setGraphWidth(width);
    this.addComponent(borderWrap);
    this.setComponentAlignment(borderWrap, Alignment.MIDDLE_CENTER);
    final Component legendBox = createLegendBox();
    this.addComponent(legendBox);
    this.setComponentAlignment(legendBox, Alignment.MIDDLE_CENTER);
}

From source file:com.esofthead.mycollab.community.ui.chart.PieChartWrapper.java

License:Open Source License

@Override
protected final ComponentContainer createLegendBox() {
    final CustomLayout boxWrapper = CustomLayoutExt.createLayout("legendBox");
    final CssLayout mainLayout = new CssLayout();

    mainLayout.setSizeUndefined();/*from   www  . j  av a  2  s. co  m*/
    final List keys = pieDataSet.getKeys();

    for (int i = 0; i < keys.size(); i++) {
        final HorizontalLayout layout = new HorizontalLayout();
        layout.setMargin(new MarginInfo(false, false, false, true));
        layout.addStyleName("inline-block");
        final Comparable key = (Comparable) keys.get(i);
        final String color = "<div style = \" width:8px;height:8px;border-radius:5px;background: #"
                + GenericChartWrapper.CHART_COLOR_STR[i % GenericChartWrapper.CHART_COLOR_STR.length] + "\" />";
        final Label lblCircle = new Label(color);
        lblCircle.setContentMode(ContentMode.HTML);

        String btnCaption;
        if (enumKeyCls == null) {
            btnCaption = String.format("%s(%d)", key, pieDataSet.getValue(key).intValue());
        } else {
            btnCaption = String.format("%s(%d)", AppContext.getMessage(enumKeyCls, key.toString()),
                    pieDataSet.getValue(key).intValue());
        }
        final Button btnLink = new Button(btnCaption, new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                PieChartWrapper.this.onClickedDescription(key.toString());
            }
        });
        btnLink.addStyleName("link");
        layout.addComponent(lblCircle);
        layout.setComponentAlignment(lblCircle, Alignment.MIDDLE_CENTER);
        layout.addComponent(btnLink);
        layout.setComponentAlignment(btnLink, Alignment.MIDDLE_CENTER);
        layout.setSizeUndefined();
        mainLayout.addComponent(layout);
    }
    boxWrapper.setWidth("100%");
    boxWrapper.addComponent(mainLayout, "legendBoxContent");
    return boxWrapper;
}

From source file:com.esofthead.mycollab.community.vaadin.web.ui.field.PopupFieldBuilder.java

License:Open Source License

public PopupView build() {
    view = new PopupView(new PopupView.Content() {
        @Override/*from w w w . j  a va  2s .c o m*/
        public String getMinimizedValueAsHTML() {
            return captionHtml;
        }

        @Override
        public Component getPopupComponent() {
            MVerticalLayout layout = new MVerticalLayout();
            layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
            Label infoLbl = new Label(
                    AppContext.getMessage(GenericI18Enum.NOTIFICATION_FEATURE_NOT_AVAILABLE_IN_VERSION));

            Button requestFeatureBtn = new Button("Buy the premium edition", new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent event) {
                    UI.getCurrent().addWindow(new AdWindow());
                    view.setPopupVisible(false);
                }
            });
            requestFeatureBtn.addStyleName(UIConstants.BUTTON_ACTION);

            layout.with(infoLbl, requestFeatureBtn);
            return layout;
        }
    });
    view.setDescription(description);
    view.setStyleName("block-popupedit");
    return view;
}

From source file:com.esofthead.mycollab.community.view.NotPresentedView.java

License:Open Source License

public NotPresentedView() {
    this.setHeight("370px");
    this.setWidth("100%");
    VerticalLayout layoutWapper = new VerticalLayout();
    layoutWapper.setWidth("100%");

    VerticalLayout layout = new VerticalLayout();
    final Embedded titleIcon = new Embedded();
    titleIcon.setSource(MyCollabResource.newResource("icons/not_present.png"));
    layout.addComponent(titleIcon);/*from  w w w.  j  ava 2  s  . c  o  m*/
    layout.setComponentAlignment(titleIcon, Alignment.MIDDLE_CENTER);

    Label label = new Label("Module is not presented for community edition");
    label.setStyleName("h2_community");
    layout.addComponent(label);
    layout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);

    layoutWapper.addComponent(layout);
    layoutWapper.setComponentAlignment(layout, Alignment.MIDDLE_CENTER);
    this.addComponent(layoutWapper);
    this.setComponentAlignment(layoutWapper, Alignment.MIDDLE_CENTER);
}

From source file:com.esofthead.mycollab.mobile.module.crm.ui.CrmPreviewFormControlsGenerator.java

License:Open Source License

public VerticalLayout createButtonControls(int buttonEnableFlags, final String permissionItem) {

    boolean canRead = true;
    boolean canWrite = true;
    boolean canAccess = true;
    if (permissionItem != null) {
        canRead = AppContext.canRead(permissionItem);
        canWrite = AppContext.canWrite(permissionItem);
        canAccess = AppContext.canAccess(permissionItem);
    }//w w w .  ja  va2s .  c om

    if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) {
        editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT));
        editBtn.addClickListener(new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final Button.ClickEvent event) {
                final T item = previewForm.getBean();
                previewForm.fireEditForm(item);
            }
        });
        editBtn.setWidth("100%");
        editButtons.addComponent(editBtn);
        editButtons.setComponentAlignment(editBtn, Alignment.MIDDLE_CENTER);
        editBtn.setEnabled(canWrite);
    }

    if ((buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) {
        deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                final T item = previewForm.getBean();
                previewForm.fireDeleteForm(item);
            }
        });
        deleteBtn.setWidth("100%");
        editButtons.addComponent(deleteBtn);
        editButtons.setComponentAlignment(deleteBtn, Alignment.MIDDLE_CENTER);
        deleteBtn.setEnabled(canAccess);
    }

    if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) {
        cloneBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLONE));
        cloneBtn.addClickListener(new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final Button.ClickEvent event) {
                final T item = previewForm.getBean();
                previewForm.fireCloneForm(item);
            }
        });
        cloneBtn.setWidth("100%");
        editButtons.addComponent(cloneBtn);
        editButtons.setComponentAlignment(cloneBtn, Alignment.MIDDLE_CENTER);
        cloneBtn.setEnabled(canWrite);
    }

    return editButtons;
}

From source file:com.esofthead.mycollab.mobile.module.project.ui.ProjectPreviewFormControlsGenerator.java

License:Open Source License

public ProjectPreviewFormControlsGenerator(final PreviewBeanForm<T> editForm) {
    this.previewForm = editForm;

    editButtons = new VerticalLayout();
    editButtons.setSpacing(true);//www .j av a 2 s .  co m
    editButtons.setWidth("100%");
    editButtons.setMargin(true);
    editButtons.addStyleName("edit-btn-layout");
    editButtons.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
}