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.mechanicshop.components.DataEntryLayout.java

private void buildLayout() {
    FormLayout formLayout1 = new FormLayout();

    formLayout1.setMargin(new MarginInfo(false, false, false, true));
    formLayout1.setSpacing(true);/*from  w  ww.  ja  v a  2s  .c o m*/

    FormLayout formLayout2 = new FormLayout();
    formLayout2.setMargin(new MarginInfo(false, false, false, true));
    formLayout2.setSpacing(true);

    FormLayout formLayout3 = new FormLayout();
    formLayout3.setMargin(new MarginInfo(false, true, false, true));
    formLayout3.setSpacing(true);

    tfTag.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfTag.setWidth("180px");
    tfTag.setMaxLength(3);
    tfTag.setNullRepresentation("");
    tfPhone.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfPhone.setWidth("180px");
    tfPhone.setNullRepresentation("");
    tfPhone.setMaxLength(11);
    tfName.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfName.setWidth("180px");
    tfName.setMaxLength(50);
    tfName.setNullRepresentation("");
    tfVehicle.setWidth("180px");
    tfVehicle.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfVehicle.setMaxLength(75);
    tfVehicle.setNullRepresentation("");
    tfLicensePlate.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfLicensePlate.setWidth("180px");
    tfLicensePlate.setMaxLength(10);
    tfLicensePlate.setNullRepresentation("");
    tfVin.setWidth("180px");
    tfVin.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfVin.setMaxLength(17);
    tfVin.setNullRepresentation("");
    dfInShop.setImmediate(true);
    dfInShop.addStyleName(ValoTheme.DATEFIELD_TINY);
    dfInShop.setInputPrompt("Select");
    dfInShop.setWidth("120px");

    dfOutShop.setImmediate(true);
    dfOutShop.addStyleName(ValoTheme.DATEFIELD_TINY);
    dfOutShop.setInputPrompt("Select");
    dfOutShop.setWidth("120px");

    nsStatus.addItems("In", "Out", "Pending", "Ready", "Comeback");
    nsStatus.setImmediate(true);
    nsStatus.setWidth("120px");
    nsStatus.setStyleName(ValoTheme.COMBOBOX_TINY);
    nsStatus.setValue("In");
    tfMileage.setWidth("120px");
    tfMileage.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfMileage.setMaxLength(6);
    tfMileage.setNullRepresentation("");
    tfPicked.setWidth("120px");
    tfPicked.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfPicked.setMaxLength(3);
    tfPicked.setNullRepresentation("");
    tfPayment.setWidth("180px");
    tfPayment.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfPayment.setMaxLength(50);
    tfPayment.setNullRepresentation("");
    taRemarks.setWidth("500px");
    taRemarks.setStyleName(ValoTheme.TEXTFIELD_TINY);
    taRemarks.setMaxLength(500);
    taRemarks.setNullRepresentation("");
    tfRebuilder.setWidth("180px");
    tfRebuilder.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfRebuilder.setMaxLength(20);
    tfRebuilder.setNullRepresentation("");
    tfInstaller.setWidth("180px");
    tfInstaller.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfInstaller.setMaxLength(20);
    tfInstaller.setNullRepresentation("");
    tfFirstCheckBy.setWidth("500px");
    tfFirstCheckBy.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfFirstCheckBy.setMaxLength(100);
    tfFirstCheckBy.setNullRepresentation("");
    tfSecondCheckBy.setWidth("500px");
    tfSecondCheckBy.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfSecondCheckBy.setMaxLength(100);
    tfSecondCheckBy.setNullRepresentation("");
    dfFirstCheckDate.setImmediate(true);
    dfFirstCheckDate.addStyleName(ValoTheme.DATEFIELD_TINY);
    dfFirstCheckDate.setInputPrompt("Select");
    dfFirstCheckDate.setWidth("120px");

    dfSecondCheckDate.setImmediate(true);
    dfSecondCheckDate.addStyleName(ValoTheme.DATEFIELD_TINY);
    dfSecondCheckDate.setInputPrompt("Select");
    dfSecondCheckDate.setWidth("120px");

    taMedia.setWidth("500px");
    taMedia.setStyleName(ValoTheme.TEXTFIELD_TINY);
    taMedia.setNullRepresentation("");
    taMedia2.setWidth("500px");
    taMedia2.setStyleName(ValoTheme.TEXTFIELD_TINY);
    taMedia2.setNullRepresentation("");
    tfReferedBy.setWidth("180px");
    tfReferedBy.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfReferedBy.setMaxLength(20);
    tfReferedBy.setNullRepresentation("");
    tfWarrantyLimit.setWidth("180px");
    tfWarrantyLimit.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfWarrantyLimit.setMaxLength(5);
    tfWarrantyLimit.setNullRepresentation("");
    nsWarranty.setWidth("120px");
    nsWarranty.setStyleName(ValoTheme.TEXTFIELD_TINY);
    nsWarranty.addItems("YES", "NO");
    nsWarranty.setValue("NO");
    nsWarranty.setStyleName(ValoTheme.COMBOBOX_TINY);

    nsSMS.setWidth("120px");
    nsSMS.setStyleName(ValoTheme.TEXTFIELD_TINY);
    nsSMS.addItems("YES", "NO");
    nsSMS.setValue("NO");
    nsComeback.setWidth("120px");
    nsComeback.setStyleName(ValoTheme.TEXTFIELD_TINY);
    nsComeback.addItems("YES", "NO");
    nsComeback.setValue("NO");
    nsComeback.setStyleName(ValoTheme.COMBOBOX_TINY);

    formLayout1.addComponents(tfTag, tfPhone, tfName, tfVehicle, tfPayment, tfRebuilder, tfInstaller,
            tfLicensePlate, tfVin, tfReferedBy, tfWarrantyLimit);

    formLayout2.addComponents(nsWarranty, dfInShop, dfOutShop, nsStatus, nsSMS, nsComeback, tfMileage, tfPicked,
            dfFirstCheckDate, dfSecondCheckDate);

    formLayout3.addComponents(tfFirstCheckBy, tfSecondCheckBy, taRemarks, taMedia, taMedia2);

    HorizontalLayout layoutButtons = new HorizontalLayout();
    layoutButtons.setMargin(new MarginInfo(false, true, false, true));

    sendBtn.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {

            Integer tag = null;
            Integer mileage = null;
            if (tfTag.getValue() != null)
                if (!tfTag.getValue().isEmpty()) {
                    tag = (Integer.parseInt(tfTag.getValue()));
                } else
                    tag = null;

            if (tfMileage.getValue() != null)
                if (!tfMileage.getValue().isEmpty()) {
                    mileage = (Integer.parseInt(tfMileage.getValue()));
                } else
                    mileage = null;

            Object[] args = new Object[] { tag, tfPhone.getValue(), tfName.getValue(), tfVehicle.getValue(),
                    tfLicensePlate.getValue(), tfVin.getValue(), dfInShop.getValue(), dfOutShop.getValue(),
                    nsStatus.getValue(), mileage, tfPicked.getValue(), tfPayment.getValue(),
                    taRemarks.getValue(), tfRebuilder.getValue(), tfInstaller.getValue(),
                    tfFirstCheckBy.getValue(), tfSecondCheckBy.getValue(), dfFirstCheckDate.getValue(),
                    dfSecondCheckDate.getValue(), taMedia.getValue(), taMedia2.getValue(),
                    tfReferedBy.getValue(), tfWarrantyLimit.getValue(), nsWarranty.getValue(), nsSMS.getValue(),
                    nsComeback.getValue() };

            if (sendBtn.getCaption().equals("Add")) {
                try {
                    String status = nsStatus.getValue().toString();
                    searchService.insertCar(args, status);
                    Notification.show("Entry inserted succesfully");
                    close();
                } catch (Exception e) {
                    e.printStackTrace();
                    Notification.show("An error has occurred", Notification.Type.ERROR_MESSAGE);
                }
            } else {
                try {
                    searchService.editCar(args, tableName, no);
                    Notification.show("Entry edited succesfully");
                    close();
                } catch (Exception e) {
                    e.printStackTrace();
                    Notification.show("An error has occurred", Notification.Type.ERROR_MESSAGE);
                }

            }
        }

    });
    sendBtn.setImmediate(true);
    sendBtn.setStyleName(ValoTheme.BUTTON_TINY);
    sendBtn.addStyleName(ValoTheme.BUTTON_FRIENDLY);

    layoutButtons.setSizeUndefined();
    layoutButtons.setSpacing(true);
    layoutButtons.addComponents(sendBtn);

    hLayoutForms.addComponents(formLayout1, formLayout2, formLayout3);

    mainLayout.addComponent(hLayoutForms);
    mainLayout.addComponent(layoutButtons);
    mainLayout.setComponentAlignment(hLayoutForms, Alignment.MIDDLE_CENTER);
    mainLayout.setComponentAlignment(layoutButtons, Alignment.MIDDLE_LEFT);
    mainLayout.setExpandRatio(hLayoutForms, 3);

}

From source file:com.mechanicshop.components.MaintenanceLayout.java

private void buildLayout() {
    HorizontalLayout layoutTitle = new HorizontalLayout();
    layoutTitle.setSizeUndefined();//from  w  w w . j a  va 2  s .com
    layoutTitle.setWidth("100%");
    layoutTitle.setSpacing(false);
    layoutTitle.setMargin(false);
    titleLabel.addStyleName(ValoTheme.LABEL_H2);
    titleLabel.addStyleName(ValoTheme.LABEL_COLORED);
    titleLabel.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    titleLabel.addStyleName(ValoTheme.LABEL_BOLD);
    titleLabel.setSizeUndefined();

    layoutTitle.addComponent(titleLabel);
    layoutTitle.setComponentAlignment(titleLabel, Alignment.MIDDLE_CENTER);

    VerticalLayout layoutTable = new VerticalLayout();

    layoutTable.setSizeFull();

    layoutTable.setSpacing(true);
    HorizontalLayout layoutButtons = new HorizontalLayout();
    layoutButtons.setMargin(false);
    layoutButtons.setSpacing(true);
    layoutButtons.setSizeUndefined();
    Button passwordBtn = new Button("Edit Password");
    passwordBtn.addClickListener(passwordListener);
    passwordBtn.setImmediate(true);
    passwordBtn.setIcon(FontAwesome.EDIT);
    passwordBtn.setStyleName(ValoTheme.BUTTON_TINY);
    Button media1Btn = new Button("Media 1 Default Text");
    media1Btn.setStyleName(ValoTheme.BUTTON_TINY);
    media1Btn.setImmediate(true);
    media1Btn.setIcon(FontAwesome.EDIT);
    media1Btn.addClickListener(media1Listener);
    Button media2Btn = new Button("Media 2 Default Text");
    media2Btn.setStyleName(ValoTheme.BUTTON_TINY);
    media2Btn.setImmediate(true);
    media2Btn.setIcon(FontAwesome.EDIT);
    media2Btn.addClickListener(media2Listener);
    layoutButtons.addComponents(passwordBtn, media1Btn, media2Btn);

    layoutButtons.setComponentAlignment(passwordBtn, Alignment.MIDDLE_LEFT);
    layoutButtons.setComponentAlignment(media1Btn, Alignment.MIDDLE_LEFT);
    layoutButtons.setComponentAlignment(media2Btn, Alignment.MIDDLE_LEFT);

    addComponent(layoutTitle);
    addComponent(layoutTable);
    layoutTable.addComponent(layoutButtons);
    layoutTable.addComponent(table);
    layoutTable.setComponentAlignment(table, Alignment.TOP_CENTER);
    layoutTable.setExpandRatio(table, 3);
    setComponentAlignment(layoutTitle, Alignment.TOP_CENTER);
    setComponentAlignment(layoutTable, Alignment.TOP_CENTER);
    setExpandRatio(layoutTable, 3);
    setSpacing(true);
    setMargin(true);

}

From source file:com.mechanicshop.components.TableLayout.java

private void buildLayout() {
    HorizontalLayout layoutTitle = new HorizontalLayout();
    layoutTitle.setSizeUndefined();//from   w  w w .j  a  va 2 s. c om
    layoutTitle.setWidth("100%");
    layoutTitle.setSpacing(false);
    layoutTitle.setMargin(false);
    titleLabel.addStyleName(ValoTheme.LABEL_H2);
    titleLabel.addStyleName(ValoTheme.LABEL_COLORED);
    titleLabel.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    titleLabel.addStyleName(ValoTheme.LABEL_BOLD);
    titleLabel.setSizeUndefined();

    layoutTitle.addComponent(titleLabel);
    layoutTitle.setComponentAlignment(titleLabel, Alignment.MIDDLE_CENTER);

    VerticalLayout layoutTable = new VerticalLayout();

    layoutTable.addComponent(table);
    layoutTable.setComponentAlignment(table, Alignment.TOP_CENTER);
    layoutTable.setSizeFull();

    layoutTable.setSpacing(true);
    HorizontalLayout layoutButtons = new HorizontalLayout();
    layoutButtons.setMargin(false);
    layoutButtons.setSpacing(true);
    layoutButtons.setSizeUndefined();
    layoutButtons.setWidth("100%");
    Button addBtn = new Button("Add new Car");
    addBtn.addClickListener(addBtnListener);
    addBtn.setImmediate(true);
    addBtn.setStyleName(ValoTheme.BUTTON_TINY);
    addBtn.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    Button deleteBtn = new Button("Delete Selected");
    deleteBtn.setStyleName(ValoTheme.BUTTON_TINY);
    deleteBtn.addStyleName(ValoTheme.BUTTON_DANGER);
    deleteBtn.setImmediate(true);
    deleteBtn.addClickListener(removeListener);

    btnSendSMS.setStyleName(ValoTheme.BUTTON_TINY);
    btnSendSMS.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    btnSendSMS.setImmediate(true);
    btnSendSMS.addClickListener(sendSMSBtnListener);

    searchTextField.setImmediate(true);
    searchTextField.addStyleName(ValoTheme.TEXTFIELD_TINY);
    searchTextField.addTextChangeListener(filterChangeListener);
    Label lbSearch = new Label("Search");
    lbSearch.addStyleName(ValoTheme.LABEL_TINY);
    lbSearch.setSizeUndefined();
    layoutButtons.addComponents(lbSearch, searchTextField, addBtn, deleteBtn, btnSendSMS);

    layoutButtons.setComponentAlignment(lbSearch, Alignment.MIDDLE_LEFT);
    layoutButtons.setComponentAlignment(searchTextField, Alignment.BOTTOM_LEFT);
    layoutButtons.setComponentAlignment(addBtn, Alignment.BOTTOM_RIGHT);
    layoutButtons.setComponentAlignment(deleteBtn, Alignment.BOTTOM_RIGHT);
    layoutButtons.setComponentAlignment(btnSendSMS, Alignment.BOTTOM_RIGHT);
    layoutButtons.setExpandRatio(addBtn, 3);
    addComponent(layoutTitle);
    addComponent(layoutTable);
    layoutTable.addComponent(layoutButtons);
    layoutTable.setExpandRatio(table, 3);
    setComponentAlignment(layoutTitle, Alignment.TOP_CENTER);
    setComponentAlignment(layoutTable, Alignment.TOP_CENTER);
    setExpandRatio(layoutTable, 3);
    setSpacing(true);
    setMargin(true);

}

From source file:com.mechanicshop.components.TableLayout.java

public void createCustomMessage() {
    final TextArea textArea = new TextArea();
    textArea.setImmediate(true);/*from ww w .  j  a v a  2  s  .c o m*/
    textArea.setColumns(30);
    textArea.setRows(10);
    textArea.addStyleName(ValoTheme.TEXTAREA_SMALL);
    textArea.setRequired(true);
    final Window subWindow = new Window();
    subWindow.setModal(true);
    subWindow.setHeight("350px");
    subWindow.setWidth("500px");
    subWindow.setCaption("Insert Message");
    subWindow.setStyleName(ValoTheme.WINDOW_TOP_TOOLBAR);
    subWindow.setClosable(false);
    subWindow.setResizable(false);

    HorizontalLayout layoutButtons = new HorizontalLayout();
    layoutButtons.setMargin(false);
    Button sendBtn = new Button("Send");
    sendBtn.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                textArea.validate();
                String message = textArea.getValue();
                smsSenderService.sendMessageMassive(message);
                subWindow.close();
                Notification.show("Message Sent");
            } catch (Exception e) {

            }
        }
    });
    sendBtn.setImmediate(true);
    sendBtn.setStyleName(ValoTheme.BUTTON_TINY);
    sendBtn.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    Button cancelBtn = new Button("Cancel");
    cancelBtn.setStyleName(ValoTheme.BUTTON_TINY);
    cancelBtn.addStyleName(ValoTheme.BUTTON_DANGER);
    cancelBtn.setImmediate(true);
    cancelBtn.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            subWindow.close();

        }
    });

    layoutButtons.setSizeUndefined();
    layoutButtons.setSpacing(true);
    layoutButtons.addComponents(cancelBtn, sendBtn);

    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);
    layout.addComponent(textArea);
    layout.addComponent(layoutButtons);
    layout.setComponentAlignment(textArea, Alignment.MIDDLE_CENTER);
    layout.setComponentAlignment(layoutButtons, Alignment.MIDDLE_RIGHT);
    layout.setExpandRatio(textArea, 3);

    layout.setSizeFull();

    subWindow.setContent(layout);
    subWindow.center();

    getUI().addWindow(subWindow);
}

From source file:com.moscaville.ui.CsvVaadinUI.java

private void buildTemplateGridHeader() {
    HorizontalLayout templateGridHeaderLayout = new HorizontalLayout();
    templateGridHeaderLayout.setSpacing(true);
    templateGridHeaderLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

    Button btnNew = new Button("New", FontAwesome.FILE);
    btnNew.setDescription("New template file");
    btnNew.addClickListener((Button.ClickEvent event) -> {
        templateManager.newTemplate();/*w w  w.j  a  v a 2  s. c  om*/
    });
    templateGridHeaderLayout.addComponent(btnNew);

    Button btnOpen = new Button("Open", FontAwesome.FILE_O);
    btnOpen.setDescription("Open template file");
    btnOpen.addClickListener((Button.ClickEvent event) -> {
        fileChooser.setFileExtension(FileChooser.FILE_EXTENSION_TEMPLATE);
        addWindow(fileChooser);
    });
    templateGridHeaderLayout.addComponent(btnOpen);

    Button btnSave = new Button("Save", FontAwesome.SAVE);
    tfTemplateFileName = new TextField();
    tfTemplateFileName.setDescription("template file name");
    tfTemplateFileName.setInputPrompt("template file name");
    tfTemplateFileName.setImmediate(true);
    tfTemplateFileName.addValueChangeListener((Property.ValueChangeEvent event) -> {
        btnSave.setEnabled(tfTemplateFileName.getValue() != null && tfTemplateFileName.getValue().length() > 0);
    });
    templateGridHeaderLayout.addComponent(tfTemplateFileName);

    FieldGroup binder = new FieldGroup(templateManager.getTemplateBeanItem());
    binder.setBuffered(false);
    binder.bind(tfTemplateFileName, "templateFileName");

    btnSave.setDescription("Save template file");
    btnSave.setImmediate(true);
    btnSave.setEnabled(false);
    btnSave.addClickListener((Button.ClickEvent event) -> {
        templateManager.saveTemplate();
    });
    templateGridHeaderLayout.addComponent(btnSave);

    Button btnData = new Button("Data", FontAwesome.DATABASE);
    btnData.setDescription("Load data");
    btnData.addClickListener((Button.ClickEvent event) -> {
        fileChooser.setFileExtension(FileChooser.FILE_EXTENSION_CSV);
        addWindow(fileChooser);
    });
    templateGridHeaderLayout.addComponent(btnData);

    Button btnImport = new Button("Import", FontAwesome.DOWNLOAD);

    templateGridHeaderLayout.addComponent(btnImport);
    mainLayout.addComponent(templateGridHeaderLayout);
}

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

License:Open Source License

public VerticalLayout createButtonControls(int buttonEnableFlags, final String permissionItem) {
    boolean canWrite = true;
    boolean canAccess = true;
    if (permissionItem != null) {
        canWrite = UserUIContext.canWrite(permissionItem);
        canAccess = UserUIContext.canAccess(permissionItem);
    }/*from w  ww  . jav  a2  s . co m*/

    if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) {
        MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> {
            final T item = previewForm.getBean();
            previewForm.fireEditForm(item);
        }).withVisible(canWrite);
        editButtons.addComponent(editBtn);
        editButtons.setComponentAlignment(editBtn, Alignment.MIDDLE_CENTER);
    }

    if ((buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) {
        Button deleteBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_DELETE), clickEvent -> {
            final T item = previewForm.getBean();
            previewForm.fireDeleteForm(item);
        });
        editButtons.addComponent(deleteBtn);
        editButtons.setComponentAlignment(deleteBtn, Alignment.MIDDLE_CENTER);
        deleteBtn.setEnabled(canAccess);
    }

    if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) {
        Button cloneBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLONE), clickEvent -> {
            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.mycollab.mobile.module.project.ui.TimeLogEditView.java

License:Open Source License

private void initUI() {
    headerPanel = new MHorizontalLayout().withFullWidth().withMargin(new MarginInfo(true, false, true, false));
    content.addComponent(headerPanel);//from  w  w w  .  j ava 2 s  .  co m

    constructSpentTimeEntryPanel();
    constructRemainTimeEntryPanel();

    tableItem = new DefaultPagedBeanList<ItemTimeLoggingService, ItemTimeLoggingSearchCriteria, SimpleItemTimeLogging>(
            AppContextUtil.getSpringBean(ItemTimeLoggingService.class), new TimeLogRowHandler()) {
        private static final long serialVersionUID = -4549910960891655297L;

        @Override
        protected void renderRows() {
            int i = 0;
            Date currentDate = new GregorianCalendar(2100, 1, 1).getTime();
            for (final SimpleItemTimeLogging item : currentListData) {
                if (!DateUtils.isSameDay(item.getLogforday(), currentDate)) {
                    listContainer.addComponent(new ELabel(UserUIContext.formatDate(item.getLogforday()))
                            .withStyleName(UIConstants.FIELD_NOTE).withWidthUndefined());
                    currentDate = item.getLogforday();
                }
                final Component row = getRowDisplayHandler().generateRow(tableItem, item, i);
                listContainer.addComponent(row);
                i++;
            }
        }
    };

    content.with(ELabel.hr(), tableItem).expand(tableItem);

    MVerticalLayout controlBtns = new MVerticalLayout().withFullWidth();
    controlBtns.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

    MButton addNewEntryBtn = new MButton(
            UserUIContext.getMessage(TimeTrackingI18nEnum.M_DIALOG_ADD_TIME_LOG_ENTRY),
            clickEvent -> UI.getCurrent().addWindow(new NewTimeLogEntryWindow())).withFullWidth();
    controlBtns.addComponent(addNewEntryBtn);

    MButton updateRemainTimeBtn = new MButton(
            UserUIContext.getMessage(TimeTrackingI18nEnum.M_DIALOG_UPDATE_REMAIN_HOURS),
            clickEvent -> UI.getCurrent().addWindow(new UpdateRemainTimeWindow())).withFullWidth();
    controlBtns.addComponent(updateRemainTimeBtn);

    NavigationBarQuickMenu editBtn = new NavigationBarQuickMenu();
    editBtn.setContent(controlBtns);
    this.setRightComponent(editBtn);
}

From source file:com.mycollab.mobile.mvp.view.NotPresenterView.java

License:Open Source License

void display() {
    setContent(new MVerticalLayout().withFullWidth()
            .with(new MVerticalLayout(ELabel.fontIcon(FontAwesome.WARNING),
                    new ELabel(UserUIContext.getMessage(LicenseI18nEnum.FEATURE_NOT_AVAILABLE)))
                            .alignAll(Alignment.MIDDLE_CENTER)));
}

From source file:com.mycollab.mobile.ui.ConfirmDialog.java

License:Open Source License

private void constructUI(final String message, final String okCaption, final String cancelCaption) {
    VerticalLayout layout = new VerticalLayout();
    layout.setWidth("100%");
    layout.setHeightUndefined();/*from   ww w.  j a v a 2 s . c om*/
    layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

    VerticalLayout messageWrapper = new VerticalLayout();
    messageWrapper.setStyleName("message-wrapper");
    messageWrapper.setWidth("100%");
    messageWrapper.setMargin(true);

    final Label messageDisplay = new Label(message);
    messageDisplay.setWidth("100%");
    messageWrapper.addComponent(messageDisplay);
    layout.addComponent(messageWrapper);

    HorizontalLayout controlBtn = new HorizontalLayout();
    controlBtn.setWidth("100%");

    final Button okBtn = new Button(okCaption);
    okBtn.setWidth("100%");
    okBtn.setHeight("35px");
    final Button cancelBtn = new Button(cancelCaption);
    cancelBtn.setWidth("100%");
    cancelBtn.setHeight("35px");

    ClickListener listener = (clickEvent) -> {
        ConfirmDialog.this.setConfirmed(clickEvent.getButton() == okBtn);
        if (ConfirmDialog.this.getListener() != null) {
            ConfirmDialog.this.getListener().onClose(ConfirmDialog.this);
        }
        close();
    };

    okBtn.addClickListener(listener);
    cancelBtn.addClickListener(listener);

    controlBtn.addComponent(cancelBtn);
    controlBtn.addComponent(okBtn);

    layout.addComponent(controlBtn);
    this.setContent(layout);
}

From source file:com.mycollab.module.crm.view.account.AccountSimpleSearchPanel.java

License:Open Source License

private void createBasicSearchLayout() {
    layoutSearchPanel = new GridLayout(3, 3);
    layoutSearchPanel.setSpacing(true);/*  w  ww  .  j  a v a  2 s.c  om*/
    group = new ValueComboBox(false, "Name", "Email", "Website", "Phone",
            AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE));
    group.select("Name");
    group.setImmediate(true);
    group.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            removeComponents();
            String searchType = (String) group.getValue();
            if (searchType.equals("Name")) {
                addTextFieldSearch();
            } else if (searchType.equals("Email")) {
                addTextFieldSearch();
            } else if (searchType.equals("Website")) {
                addTextFieldSearch();
            } else if (searchType.equals("Phone")) {
                addTextFieldSearch();
            } else if (searchType.equals(AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE))) {
                addUserListSelectField();
            }
        }
    });

    layoutSearchPanel.addComponent(group, 1, 0);
    layoutSearchPanel.setComponentAlignment(group, Alignment.MIDDLE_CENTER);

    addTextFieldSearch();

    Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH));
    searchBtn.setStyleName(UIConstants.BUTTON_ACTION);
    searchBtn.setIcon(FontAwesome.SEARCH);
    searchBtn.setDescription("Search");

    searchBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            doSearch();
        }
    });
    layoutSearchPanel.addComponent(searchBtn, 2, 0);
    layoutSearchPanel.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER);
    this.setCompositionRoot(layoutSearchPanel);
}