Example usage for com.vaadin.ui VerticalLayout setMargin

List of usage examples for com.vaadin.ui VerticalLayout setMargin

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setMargin.

Prototype

@Override
    public void setMargin(boolean enabled) 

Source Link

Usage

From source file:com.save.client.RemoveAccountWindow.java

void getConfirmationWindow(final String str) {
    final Window sub = new Window("Conifrm?");
    sub.setWidth("180px");
    sub.setHeight("150px");
    sub.center();//w  w w. j av a 2s. c o m
    sub.setResizable(false);
    UI.getCurrent().addWindow(sub);

    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setMargin(true);
    vlayout.setSpacing(true);

    vlayout.addComponent(new Label("Client is a Distributor!"));

    Button removeBtn = new Button("REMOVE");
    removeBtn.setWidth("100%");
    removeBtn.addClickListener((Button.ClickEvent event) -> {
        boolean result = clientService.removeAccount(getClientId(), str);
        if (result) {
            sub.close();
            close();
        }
    });
    vlayout.addComponent(removeBtn);

    sub.setContent(vlayout);
    sub.addCloseListener((CloseEvent e) -> {
        close();
    });
}

From source file:com.save.clients.AcknowledgementPromoForm.java

VerticalLayout acknowledgementFormContent() {
    VerticalLayout content = new VerticalLayout();
    content.setSizeFull();/*from w  w w .  j a  v  a2 s. c  o m*/
    content.setMargin(true);
    content.setSpacing(true);

    GridLayout glayout = new GridLayout(4, 5);
    glayout.setWidth("100%");
    glayout.setSpacing(true);

    entryDate = new DateField("Date: ");
    entryDate.setWidth("100%");
    glayout.addComponent(entryDate, 0, 0);

    promoItem = new TextField("Promo Items: ");
    promoItem.setWidth("100%");
    glayout.addComponent(promoItem, 1, 0, 3, 0);

    promoAmount = new TextField("Amount: ");
    promoAmount.setWidth("100%");
    promoAmount.setStyleName("align-right");
    glayout.addComponent(promoAmount, 0, 1);

    quantity = new TextField("Quantity: ");
    quantity.setWidth("100%");
    quantity.setStyleName("align-right");
    glayout.addComponent(quantity, 1, 1);

    productItems = CommonComboBox.productItems();
    productItems.setWidth("100%");
    glayout.addComponent(productItems, 2, 1, 3, 1);

    startDate = new DateField("From: ");
    startDate.setWidth("100%");
    glayout.addComponent(startDate, 0, 2);

    endDate = new DateField("To: ");
    endDate.setWidth("100%");
    glayout.addComponent(endDate, 1, 2);

    salesRep.setWidth("100%");
    glayout.addComponent(salesRep, 2, 2, 3, 2);

    areaSales.setWidth("100%");
    glayout.addComponent(areaSales, 2, 3, 3, 3);

    remarks = new TextArea("Remarks: ");
    remarks.setWidth("100%");
    remarks.setRows(4);
    glayout.addComponent(remarks, 0, 3, 1, 4);

    Button submitBtn = new Button();
    submitBtn.setCaption("SAVE");
    submitBtn.setWidth("100%");
    submitBtn.addClickListener(this);
    glayout.addComponent(submitBtn, 2, 4, 3, 4);
    glayout.setComponentAlignment(submitBtn, Alignment.BOTTOM_CENTER);

    if (getPromoId() != 0) {
        PromoDeals pd = pds.getPromoDealById(getPromoId());
        submitBtn.setCaption("UPDATE");
        entryDate.setValue(pd.getEntryDate());
        startDate.setValue(pd.getStartDate());
        endDate.setValue(pd.getEndDate());
        promoItem.setValue(pd.getPromoItem());
        promoAmount.setValue(String.valueOf(pd.getPromoAmount()));
        quantity.setValue(String.valueOf(pd.getQuantity()));
        productItems.setValue(pd.getProductId());
        areaSales.setValue(pd.getAreaSalesId());
        salesRep.setValue(pd.getSalesRepId());
        remarks.setValue(pd.getRemarks());
    }

    content.addComponent(glayout);
    return content;
}

From source file:com.save.employee.EmployeeInformationTabSheet.java

public EmployeeInformationTabSheet() {
    VerticalLayout v = new VerticalLayout();
    v.setCaption("Personal Information");
    v.setWidth("100%");
    v.setMargin(true);
    v.setSpacing(true);//from w  w  w. j  av  a  2s . co  m
    //        v.addComponent(new PersonalInformationForm(this, getEmployeeId(), null, null));
    addComponent(v);

    v = new VerticalLayout();
    v.setCaption("Employment Information");
    v.setWidth("100%");
    v.setMargin(true);
    v.setSpacing(true);
    //        v.addComponent(new EmploymentInformationForm(this, getEmployeeId()));
    addComponent(v);
}

From source file:com.save.employee.EmployeeInformationTabSheet.java

public EmployeeInformationTabSheet(HorizontalSplitPanel hsplit, int employeeId) {
    this.hsplit = hsplit;
    this.employeeId = employeeId;

    VerticalLayout v = new VerticalLayout();
    v.setCaption("Personal Information");
    v.setWidth("100%");
    v.setMargin(true);
    v.setSpacing(true);//www .  j a  v  a2 s  .  co m
    v.addComponent(new PersonalInformationForm(hsplit, employeeId, null, null));
    addComponent(v);

    v = new VerticalLayout();
    v.setCaption("Employment Information");
    v.setWidth("100%");
    v.setMargin(true);
    v.setSpacing(true);
    v.addComponent(new EmploymentInformationForm(hsplit, employeeId));
    addComponent(v);
}

From source file:com.save.employee.maintenance.MRDataGridProperties.java

Window deletConfirmationWindow(int mrId, Object itemId) {
    Window sub = new Window();
    sub.setCaption("CONFIRM DELETE");
    sub.setWidth("250px");
    sub.setModal(true);//from   w  w w  .jav  a 2s . co m

    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setMargin(true);

    Button deleteBtn = new Button("DELETE?");
    deleteBtn.setWidth("100%");
    deleteBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    deleteBtn.addClickListener((Button.ClickEvent event) -> {
        boolean result = mrs.removeMaintenanceReimbursement(mrId);
        if (result) {
            getContainerDataSource().removeItem(itemId);
            sub.close();
        }
    });
    v.addComponent(deleteBtn);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();
    return sub;
}

From source file:com.save.employee.RemoveAccountWindow.java

VerticalLayout getVLayout() {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setSpacing(true);//from  w  w  w .  j a  va  2 s  . com
    vlayout.setMargin(true);
    vlayout.setSizeFull();

    final TextArea remarks = new TextArea("Remarks: ");
    remarks.setRows(2);
    remarks.setWidth("100%");
    vlayout.addComponent(remarks);

    Button removeBtn = new Button("REMOVE ACCOUNT?");
    removeBtn.setWidth("100%");
    removeBtn.addClickListener((Button.ClickEvent event) -> {
        if (remarks.getValue() == null || remarks.getValue().trim().isEmpty()) {
            Notification.show("Add Remarks!", Notification.Type.ERROR_MESSAGE);
            return;
        }

        boolean result = employeeService.removeAccount(getEmployeeId(),
                remarks.getValue().trim().toLowerCase());
        if (result) {
            close();
        }
    });
    vlayout.addComponent(removeBtn);

    return vlayout;
}

From source file:com.save.employee.request.RequestFormWindow.java

Window deleteRequestForm() {
    Window sub = new Window("DELETE REQUEST");
    sub.setWidth("280px");
    sub.setModal(true);//from  ww  w. j  a  va  2  s . c o m
    sub.center();

    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setMargin(true);

    Button delete = new Button();
    delete.setCaption("CONFIRM DELETE REQUEST?");
    delete.setWidth("100%");
    delete.addStyleName(ValoTheme.BUTTON_PRIMARY);
    delete.addStyleName(ValoTheme.BUTTON_SMALL);
    delete.addClickListener((Button.ClickEvent event) -> {
        boolean result = rls.deleteRequestById(getRequestId());
        if (result) {
            sub.close();
            close();
        }
    });
    v.addComponent(delete);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();

    return sub;
}

From source file:com.save.employee.request.RLDataGridProperties.java

Window deletConfirmationWindow(int rlId, Object itemId) {
    Window sub = new Window();
    sub.setCaption("CONFIRM DELETE");
    sub.setWidth("250px");
    sub.setModal(true);//from w  ww . ja  v a 2s .  c o m

    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setMargin(true);

    Button deleteBtn = new Button("DELETE?");
    deleteBtn.setWidth("100%");
    deleteBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    deleteBtn.addClickListener((Button.ClickEvent event) -> {
        boolean result = rls.deleteRequestById(rlId);
        if (result) {
            getContainerDataSource().removeItem(itemId);
            sub.close();
        }
    });
    v.addComponent(deleteBtn);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();
    return sub;
}

From source file:com.save.global.ErrorLoggedNotification.java

public static void showWarningLoggedOnWindow(String warning, String className) {
    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();/*from  ww w . j a  va  2  s  .c om*/
    v.setMargin(true);

    Window sub = new Window("WARNING MESSAGE!");
    sub.setWidth("500px");
    if (sub.getParent() == null) {
        UI.getCurrent().addWindow(sub);
    }
    sub.setModal(true);

    Panel panel = new Panel();
    panel.setSizeFull();
    panel.addStyleName(ValoTheme.PANEL_BORDERLESS);
    panel.setContent(new Label(warning + " on \n" + className, ContentMode.HTML));
    panel.getContent().setHeightUndefined();
    v.addComponent(panel);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();
}

From source file:com.save.reports.maintenance.MaintenanceReportUI.java

Window exportLargeData() {
    Window sub = new Window("EXPORT LARGE DATA");
    sub.setWidth("300px");
    sub.setModal(true);//from w w w.j a  v a  2  s.c o  m
    sub.center();

    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();
    v.setMargin(true);
    v.setSpacing(true);

    Label status = new Label("Exporting large amount of data will take longer and will eat a lot of memory.",
            ContentMode.HTML);
    status.setContentMode(ContentMode.HTML);
    v.addComponent(status);

    Button b = new CommonButton("PROCEED TO EXPORT?");
    b.addClickListener((Button.ClickEvent e) -> {
        sub.close();
        processExportDataToExcel();
    });
    v.addComponent(b);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();
    return sub;
}