Example usage for com.vaadin.ui Alignment MIDDLE_LEFT

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

Introduction

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

Prototype

Alignment MIDDLE_LEFT

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

Click Source Link

Usage

From source file:com.esofthead.mycollab.vaadin.ui.StyleCalendarExp.java

License:Open Source License

public StyleCalendarExp() {
    this.setWidth("230px");
    this.setHeightUndefined();
    this.setSpacing(false);
    this.setStyleName("stylecalendar-ext");
    this.setMargin(new MarginInfo(true, false, false, false));

    styleCalendar.setRenderHeader(false);
    styleCalendar.setRenderWeekNumbers(false);
    styleCalendar.setImmediate(true);/*from   w w  w  .j  a  v a 2 s . c o  m*/
    styleCalendar.setWidth("100%");
    setDateOptionsGenerator();

    btnShowNextYear = new Button();
    btnShowNextYear.setIcon(MyCollabResource.newResource("icons/16/cal_year_next.png"));
    btnShowNextYear.setStyleName("link");

    btnShowNextMonth = new Button();
    btnShowNextMonth.setIcon(MyCollabResource.newResource("icons/16/cal_month_next.png"));
    btnShowNextMonth.setStyleName("link");

    btnShowPreviousMonth = new Button();
    btnShowPreviousMonth.setIcon(MyCollabResource.newResource("icons/16/cal_month_pre.png"));
    btnShowPreviousMonth.setStyleName("link");

    btnShowPreviousYear = new Button();
    btnShowPreviousYear.setIcon(MyCollabResource.newResource("icons/16/cal_year_pre.png"));
    btnShowPreviousYear.setStyleName("link");

    lbSelectedDate.setValue(AppContext.formatDate(new Date()));
    lbSelectedDate.addStyleName("calendarDateLabel");
    lbSelectedDate.setWidth("80");

    HorizontalLayout layoutControl = new HorizontalLayout();
    layoutControl.setStyleName("calendarHeader");
    layoutControl.setWidth("100%");
    layoutControl.setHeight("35px");

    HorizontalLayout layoutButtonPrevious = new HorizontalLayout();
    layoutButtonPrevious.setSpacing(true);
    layoutButtonPrevious.addComponent(btnShowPreviousYear);
    layoutButtonPrevious.setComponentAlignment(btnShowPreviousYear, Alignment.MIDDLE_LEFT);
    layoutButtonPrevious.addComponent(btnShowPreviousMonth);
    layoutButtonPrevious.setComponentAlignment(btnShowPreviousMonth, Alignment.MIDDLE_LEFT);
    layoutControl.addComponent(layoutButtonPrevious);
    layoutControl.setComponentAlignment(layoutButtonPrevious, Alignment.MIDDLE_LEFT);

    layoutControl.addComponent(lbSelectedDate);
    layoutControl.setComponentAlignment(lbSelectedDate, Alignment.MIDDLE_CENTER);

    HorizontalLayout layoutButtonNext = new HorizontalLayout();
    layoutButtonNext.setSpacing(true);
    layoutButtonNext.addComponent(btnShowNextMonth);
    layoutButtonNext.setComponentAlignment(btnShowNextMonth, Alignment.MIDDLE_RIGHT);
    layoutButtonNext.addComponent(btnShowNextYear);
    layoutButtonNext.setComponentAlignment(btnShowNextYear, Alignment.MIDDLE_RIGHT);
    layoutControl.addComponent(layoutButtonNext);
    layoutControl.setComponentAlignment(layoutButtonNext, Alignment.MIDDLE_RIGHT);

    this.addComponent(layoutControl);
    this.setComponentAlignment(layoutControl, Alignment.TOP_CENTER);

    this.addComponent(styleCalendar);
    this.setExpandRatio(styleCalendar, 1.0f);
}

From source file:com.esofthead.mycollab.vaadin.web.ui.AddViewLayout.java

License:Open Source License

public AddViewLayout(String viewTitle, Resource viewIcon) {
    super("addView");

    this.viewIcon = viewIcon;

    header = new MHorizontalLayout().withFullWidth().withMargin(new MarginInfo(true, false, true, false));
    header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    titleLbl = ELabel.h2("");

    if (!(viewIcon instanceof FontAwesome)) {
        Image icon = new Image(null);
        icon.setIcon(viewIcon);/*from w ww.jav  a2 s  .  c om*/
        icon.addStyleName(UIConstants.BUTTON_ICON_ONLY);
        header.with(icon);
    }
    header.with(titleLbl).expand(titleLbl);
    setHeader(viewTitle);
    addComponent(header, "addViewHeader");
}

From source file:com.esofthead.mycollab.vaadin.web.ui.DefaultGenericSearchPanel.java

License:Open Source License

protected ComponentContainer constructHeader() {
    if (header == null) {
        headerText = buildSearchTitle();
        if (headerText != null) {
            MHorizontalLayout rightComponent = new MHorizontalLayout();
            header = new MHorizontalLayout().withFullWidth()
                    .withMargin(new MarginInfo(true, false, true, false));

            header.with(headerText, rightComponent).withAlign(headerText, Alignment.MIDDLE_LEFT)
                    .withAlign(rightComponent, Alignment.MIDDLE_RIGHT).expand(headerText);
        }//from  www .j ava 2 s .c  o  m

        Component extraControls = buildExtraControls();
        if (extraControls != null) {
            addHeaderRight(extraControls);
        }
        return header;
    } else {
        return header;
    }
}

From source file:com.esofthead.mycollab.vaadin.web.ui.Depot.java

License:Open Source License

public Depot(String title, ComponentContainer content) {
    this.addStyleName("depotComp");
    this.setMargin(false);
    header = new MHorizontalLayout().withHeight("40px").withStyleName("depotHeader");
    bodyContent = content;/*from   w  w w .  j a  v  a  2 s .  com*/
    bodyContent.setWidth("100%");
    headerContent = new MHorizontalLayout().withMargin(true).withFullHeight();
    headerContent.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    headerContent.setVisible(false);
    headerContent.setStyleName("header-elements");
    headerContent.setWidthUndefined();
    this.addComponent(header);

    headerLbl = new Label(title);
    final MHorizontalLayout headerLeft = new MHorizontalLayout(headerLbl).withStyleName("depot-title")
            .withAlign(headerLbl, Alignment.MIDDLE_LEFT).withFullWidth();
    headerLeft.addLayoutClickListener(new LayoutClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void layoutClick(final LayoutClickEvent event) {
            isOpened = !isOpened;
            if (isOpened) {
                bodyContent.setVisible(true);
                removeStyleName("collapsed");
            } else {
                bodyContent.setVisible(false);
                addStyleName("collapsed");
            }
        }
    });
    header.with(headerLeft, headerContent).withAlign(headerLeft, Alignment.MIDDLE_LEFT)
            .withAlign(headerContent, Alignment.MIDDLE_RIGHT).expand(headerLeft);

    final CustomComponent customComp = new CustomComponent(bodyContent);
    customComp.setWidth("100%");
    bodyContent.addStyleName("depotContent");

    this.addComponent(customComp);
    this.setComponentAlignment(customComp, Alignment.TOP_CENTER);
}

From source file:com.esofthead.mycollab.vaadin.web.ui.MultiSelectComp.java

License:Open Source License

@Override
protected Component initContent() {
    MHorizontalLayout content = new MHorizontalLayout().withSpacing(true).withWidth(widthVal)
            .with(componentsText).withAlign(componentsText, Alignment.MIDDLE_LEFT);

    componentPopupSelection.addStyleName(UIConstants.MULTI_SELECT_BG);
    componentPopupSelection.setDirection(Alignment.TOP_LEFT);

    MHorizontalLayout multiSelectComp = new MHorizontalLayout().withSpacing(false)
            .with(componentsText, componentPopupSelection).expand(componentsText);
    content.with(multiSelectComp);/*from www  .j a v  a2 s.c o  m*/

    if (canAddNew) {
        Button newBtn = new Button("New", new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent clickEvent) {
                requestAddNewComp();
            }
        });
        newBtn.setStyleName(UIConstants.BUTTON_LINK);
        newBtn.setWidthUndefined();
        content.with(newBtn);
    }
    content.expand(multiSelectComp);
    return content;
}

From source file:com.esofthead.mycollab.vaadin.web.ui.SavedFilterComboBox.java

License:Open Source License

@Override
protected Component initContent() {
    componentsText = new TextField();
    componentsText.setNullRepresentation("");
    componentsText.setReadOnly(true);//from  w  w w. j ava 2 s  .c om
    componentsText.addStyleName("noBorderRight");
    componentsText.setWidth("100%");
    componentPopupSelection = new PopupButton();
    componentPopupSelection.addStyleName(UIConstants.MULTI_SELECT_BG);
    componentPopupSelection.setDirection(Alignment.TOP_LEFT);
    componentPopupSelection.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final Button.ClickEvent event) {
            SavedFilterComboBox.this.initContentPopup();
        }
    });

    popupContent = new OptionPopupContent();
    componentPopupSelection.setContent(popupContent);

    MHorizontalLayout content = new MHorizontalLayout().withSpacing(true).with(componentsText)
            .withAlign(componentsText, Alignment.MIDDLE_LEFT);

    MHorizontalLayout multiSelectComp = new MHorizontalLayout().withSpacing(false)
            .with(componentsText, componentPopupSelection).expand(componentsText);
    content.with(multiSelectComp);
    return content;
}

From source file:com.esofthead.mycollab.vaadin.web.ui.StyleCalendarExp.java

License:Open Source License

public StyleCalendarExp() {
    this.setWidth("230px");
    this.setHeightUndefined();
    this.setSpacing(false);
    this.setStyleName("stylecalendar-ext");
    this.setMargin(new MarginInfo(true, false, false, false));

    styleCalendar.setRenderHeader(false);
    styleCalendar.setRenderWeekNumbers(false);
    styleCalendar.setImmediate(true);/*www  .  j ava2 s.  co  m*/
    styleCalendar.setWidth("100%");
    setDateOptionsGenerator();

    btnShowNextYear = new Button();
    btnShowNextYear.setIcon(new AssetResource("icons/16/cal_year_next.png"));
    btnShowNextYear.setStyleName(UIConstants.BUTTON_LINK);

    btnShowNextMonth = new Button();
    btnShowNextMonth.setIcon(new AssetResource("icons/16/cal_month_next.png"));
    btnShowNextMonth.setStyleName(UIConstants.BUTTON_LINK);

    btnShowPreviousMonth = new Button();
    btnShowPreviousMonth.setIcon(new AssetResource("icons/16/cal_month_pre.png"));
    btnShowPreviousMonth.setStyleName(UIConstants.BUTTON_LINK);

    btnShowPreviousYear = new Button();
    btnShowPreviousYear.setIcon(new AssetResource("icons/16/cal_year_pre.png"));
    btnShowPreviousYear.setStyleName(UIConstants.BUTTON_LINK);

    lbSelectedDate.setValue(AppContext.formatDate(new Date()));
    lbSelectedDate.addStyleName("calendarDateLabel");
    lbSelectedDate.setWidth("80");

    HorizontalLayout layoutControl = new HorizontalLayout();
    layoutControl.setStyleName("calendarHeader");
    layoutControl.setWidth("100%");
    layoutControl.setHeight("35px");

    HorizontalLayout layoutButtonPrevious = new HorizontalLayout();
    layoutButtonPrevious.setSpacing(true);
    layoutButtonPrevious.addComponent(btnShowPreviousYear);
    layoutButtonPrevious.setComponentAlignment(btnShowPreviousYear, Alignment.MIDDLE_LEFT);
    layoutButtonPrevious.addComponent(btnShowPreviousMonth);
    layoutButtonPrevious.setComponentAlignment(btnShowPreviousMonth, Alignment.MIDDLE_LEFT);
    layoutControl.addComponent(layoutButtonPrevious);
    layoutControl.setComponentAlignment(layoutButtonPrevious, Alignment.MIDDLE_LEFT);

    layoutControl.addComponent(lbSelectedDate);
    layoutControl.setComponentAlignment(lbSelectedDate, Alignment.MIDDLE_CENTER);

    MHorizontalLayout layoutButtonNext = new MHorizontalLayout();
    layoutButtonNext.addComponent(btnShowNextMonth);
    layoutButtonNext.setComponentAlignment(btnShowNextMonth, Alignment.MIDDLE_RIGHT);
    layoutButtonNext.addComponent(btnShowNextYear);
    layoutButtonNext.setComponentAlignment(btnShowNextYear, Alignment.MIDDLE_RIGHT);
    layoutControl.addComponent(layoutButtonNext);
    layoutControl.setComponentAlignment(layoutButtonNext, Alignment.MIDDLE_RIGHT);

    this.addComponent(layoutControl);
    this.setComponentAlignment(layoutControl, Alignment.TOP_CENTER);

    this.addComponent(styleCalendar);
    this.setExpandRatio(styleCalendar, 1.0f);
}

From source file:com.esspl.datagen.ui.ExecutorView.java

License:Open Source License

public ExecutorView(DataGenApplication application) {
    log.debug("ExecutorView - constructor start");
    dataGenApplication = application;/*from  www.j a  va  2 s  .  c o m*/
    setSizeFull();

    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();
    setCompositionRoot(vl);

    splitPanel = new VerticalSplitPanel();
    splitPanel.setSizeFull();

    //Script TextArea
    sqlScript = new TextArea();
    sqlScript.setSizeFull();
    sqlScript.setWordwrap(false);
    sqlScript.setStyleName("noResizeTextArea");

    HorizontalLayout queryOptions = new HorizontalLayout();
    queryOptions.setMargin(false, false, false, true);
    queryOptions.setSpacing(true);
    queryOptions.setWidth("100%");
    queryOptions.setHeight("40px");

    Button executeButton = new Button("Execute", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            log.info("ExecutorView - Execute Button clicked");
            executeScript(sqlScript.getValue().toString());
        }
    });
    executeButton.addStyleName("small");
    executeButton.setIcon(DataGenConstant.EXECUTOR_ICON);
    executeButton.setDescription("Press Ctrl+Enter to execute the query");

    Button clearQueryButton = new Button("Clear SQL", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            log.info("ExecutorView - Clear SQL Button clicked");
            sqlScript.setValue("");
        }
    });
    clearQueryButton.addStyleName("small");
    clearQueryButton.setIcon(DataGenConstant.CLEAR_SMALL);
    clearQueryButton.setDescription("Clears the Sql");

    Button clearConsoleButton = new Button("Clear Console", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            log.info("ExecutorView - Clear Console Button clicked");
            logText.setValue("");
        }
    });
    clearConsoleButton.addStyleName("small");
    clearConsoleButton.setIcon(DataGenConstant.CLEAR_SMALL);
    clearConsoleButton.setDescription("Clears the Console");

    maxRowsBox = new ComboBox(null, Arrays.asList(10, 100, 500, 1000, 5000, 10000));
    maxRowsBox.setDescription("Max number of rows to retrieve");
    maxRowsBox.setWidth(100, UNITS_PIXELS);
    maxRowsBox.setNewItemsAllowed(false);
    maxRowsBox.setNullSelectionAllowed(false);
    maxRowsBox.setValue(100);

    //Bottom section components
    resultSheet = new TabSheet();
    resultSheet.setSizeFull();
    resultSheet.addStyleName(Runo.TABSHEET_SMALL);

    logText = new Label();
    logText.setContentMode(Label.CONTENT_XHTML);
    logText.setSizeFull();

    //Panel to add refresher
    logPanel = new Panel();
    logPanel.setSizeFull();
    logPanel.setScrollable(true);
    logPanel.setStyleName(Runo.PANEL_LIGHT);
    logPanel.addComponent(logText);

    //Refresher added to show instant log messages
    refresher = new Refresher();
    logPanel.addComponent(refresher);

    //Loading image
    loadingImg = new Embedded("", DataGenConstant.LOADING_ICON);
    loadingImg.setVisible(false);
    logPanel.addComponent(loadingImg);

    resultSheet.addTab(logPanel, "Console");
    resultTab = resultSheet.addTab(new Label(), "Results");

    queryOptions.addComponent(executeButton);
    queryOptions.setComponentAlignment(executeButton, Alignment.MIDDLE_LEFT);
    queryOptions.addComponent(clearQueryButton);
    queryOptions.setComponentAlignment(clearQueryButton, Alignment.MIDDLE_LEFT);
    queryOptions.addComponent(clearConsoleButton);
    queryOptions.setComponentAlignment(clearConsoleButton, Alignment.MIDDLE_LEFT);
    queryOptions.setExpandRatio(clearConsoleButton, 1);
    queryOptions.addComponent(maxRowsBox);
    queryOptions.setComponentAlignment(maxRowsBox, Alignment.MIDDLE_RIGHT);

    splitPanel.setFirstComponent(sqlScript);
    splitPanel.setSecondComponent(resultSheet);

    vl.addComponent(queryOptions);
    vl.addComponent(splitPanel);
    vl.setExpandRatio(splitPanel, 1);

    sqlScript.addShortcutListener(new ShortcutListener("Execute Script", null, ShortcutAction.KeyCode.ENTER,
            ShortcutAction.ModifierKey.CTRL) {

        @Override
        public void handleAction(Object sender, Object target) {
            executeScript(sqlScript.getValue().toString());
        }
    });
    log.debug("ExecutorView - constructor end");
}

From source file:com.esspl.datagen.ui.TableDataView.java

License:Open Source License

public TableDataView(final JdbcTable table, final Connection connection, final DataGenApplication dataApp) {
    log.debug("TableDataView - constructor start");
    setCaption("Data");
    dataGenApplication = dataApp;/*w  w w. j  ava  2s .  c  o m*/
    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();
    setCompositionRoot(vl);

    HorizontalLayout hBar = new HorizontalLayout();
    hBar.setWidth("98%");
    hBar.setHeight("40px");

    rows = new TextField();
    rows.setWidth("50px");
    rows.setImmediate(true);
    rows.addValidator(new IntegerValidator("Rows must be an Integer"));
    Label lbl = new Label("Generate ");

    content = new HorizontalLayout();
    content.setHeight("40px");
    content.setMargin(false, false, false, true);
    content.setSpacing(true);
    content.addComponent(lbl);
    content.setComponentAlignment(lbl, Alignment.MIDDLE_CENTER);
    content.addComponent(rows);
    content.setComponentAlignment(rows, Alignment.MIDDLE_CENTER);

    Button addDataButton = new Button("Row(S) Data", new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            log.debug("TableDataView - Generate Data Button clicked");
            populateGenerator(table);
        }
    });
    addDataButton.addStyleName("small");
    addDataButton.setIcon(DataGenConstant.ADD_SMALL);
    content.addComponent(addDataButton);
    content.setComponentAlignment(addDataButton, Alignment.MIDDLE_CENTER);

    Button refreshButton = new Button("Refresh", new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            log.debug("TableDataView - Refresh Button clicked");
            refreshDataView(table, connection);
        }
    });
    refreshButton.addStyleName("small");
    refreshButton.setIcon(DataGenConstant.RESET);
    content.addComponent(refreshButton);
    content.setComponentAlignment(refreshButton, Alignment.MIDDLE_CENTER);

    //Tapas:10/08/2012 - Export feature implementation started
    HorizontalLayout expContainer = new HorizontalLayout();
    expContainer.setSpacing(true);

    PopupButton exportButton = new PopupButton("Export");
    exportButton.setComponent(new DataExportView());
    exportButton.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            //dataApp.getMainWindow().showNotification("Export Button clicked!");
        }
    });
    exportButton.setIcon(DataGenConstant.DATAEXPORT_ICON);
    expContainer.addComponent(exportButton);
    expContainer.setComponentAlignment(exportButton, Alignment.MIDDLE_LEFT);

    //Tapas:10/08/2012 - Import feature implementation started
    PopupButton importButton = new PopupButton("Import");
    importButton.setComponent(new DataImportView());
    importButton.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            //dataApp.getMainWindow().showNotification("Import Button clicked!");
        }
    });
    importButton.setIcon(DataGenConstant.DATAIMPORT_ICON);
    expContainer.addComponent(importButton);
    expContainer.setComponentAlignment(importButton, Alignment.MIDDLE_RIGHT);

    tableContainer = new VerticalLayout();
    tableContainer.setSizeFull();
    hBar.addComponent(content);
    hBar.setComponentAlignment(content, Alignment.MIDDLE_LEFT);
    hBar.addComponent(expContainer);
    hBar.setComponentAlignment(expContainer, Alignment.MIDDLE_RIGHT);
    vl.addComponent(hBar);
    vl.addComponent(tableContainer);
    vl.setExpandRatio(tableContainer, 1f);

    refreshDataView(table, connection);
    log.debug("TableDataView - constructor end");
}

From source file:com.esspl.datagen.util.DataGenEventHandler.java

License:Open Source License

public void addDateFields(Select select, HorizontalLayout addBar) {
    log.debug("DataGenEventHandler - addDateFields() method start");
    PopupDateField startDate = new PopupDateField();
    startDate.setInputPrompt("Start date");
    startDate.setDateFormat(select.getValue().toString());
    startDate.setResolution(PopupDateField.RESOLUTION_DAY);
    startDate.setWidth("120px");
    startDate.setLenient(true);//from w  w w  .ja  v  a 2  s.c o  m

    PopupDateField endDate = new PopupDateField();
    endDate.setInputPrompt("End date");
    endDate.setDateFormat(select.getValue().toString());
    endDate.setResolution(PopupDateField.RESOLUTION_DAY);
    endDate.setWidth("120px");
    endDate.setLenient(true);

    addBar.removeAllComponents();
    addBar.setSpacing(true);
    addBar.addComponent(startDate);
    addBar.setComponentAlignment(startDate, Alignment.MIDDLE_LEFT);
    addBar.addComponent(endDate);
    addBar.setComponentAlignment(endDate, Alignment.MIDDLE_LEFT);
    log.debug("DataGenEventHandler - addDateFields() method end");
}