Example usage for com.vaadin.ui VerticalLayout setSpacing

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

Introduction

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

Prototype

@Override
    public void setSpacing(boolean spacing) 

Source Link

Usage

From source file:com.openhris.employee.allowance.EmployeeAllowanceInformation.java

Window remarks(final String buttonCaption) {
    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setMargin(true);// w  ww. ja va 2 s.c om
    v.setSpacing(true);

    remarksSubWindow = new Window("REMARKS", v);
    remarksSubWindow.setWidth("400px");
    remarksSubWindow.setModal(true);
    remarksSubWindow.center();

    remarks = new TextArea("Add Remarks: ");
    remarks.setWidth("100%");
    remarks.setRows(3);
    remarksSubWindow.addComponent(remarks);

    Button b = new Button(buttonCaption);
    b.setWidth("100%");
    b.addListener(updateClickListener);
    remarksSubWindow.addComponent(b);

    return remarksSubWindow;
}

From source file:com.openhris.employee.EmployeeAddress.java

private Window removeAddressWindow(final int addressId) {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setSpacing(true);
    vlayout.setMargin(true);/*  w  ww. j  ava 2s . c o  m*/

    final Window window = new Window("REMOVE POSITION", vlayout);
    window.setWidth("300px");

    Button removeBtn = new Button("Remove Address?");
    removeBtn.setWidth("100%");
    removeBtn.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            boolean result = eaService.removeEmployeeAddress(addressId);
            if (result) {
                employeeAddressTable();
                (window.getParent()).removeWindow(window);
                clearFields();
            } else {
                getWindow().showNotification("Cannot Remove Address, Contact your DBA!",
                        Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    removeBtn.setImmediate(true);

    window.addComponent(removeBtn);

    return window;
}

From source file:com.openhris.employee.EmployeeCharacterReference.java

private Window removeCharacterReferenceWindow(final int characterReferenceId) {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setSpacing(true);
    vlayout.setMargin(true);// ww  w .  ja  v  a  2 s .c o m

    final Window window = new Window("REMOVE REFERENCE", vlayout);
    window.setWidth("300px");

    Button removeBtn = new Button("Remove Character Reference?");
    removeBtn.setWidth("100%");
    removeBtn.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            boolean result = charRefService.removeEmployeeCharacterReferenceC(characterReferenceId);

            if (result) {
                characterReferenceTable();
                (window.getParent()).removeWindow(window);
                clearFields();
            } else {
                getWindow().showNotification("Cannot Remove Reference, Contact your DBA!",
                        Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    window.addComponent(removeBtn);

    return window;
}

From source file:com.openhris.employee.EmployeePersonalInformation.java

private Window getRemoveWindow(String employeeId) {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setSpacing(true);
    vlayout.setMargin(true);/*from  w  ww.  j  av  a  2  s.c  om*/

    final Window window = new Window("REMOVE EMPLOYEE", vlayout);
    window.setWidth("350px");

    Button removeBtn = new Button("Are you sure your want to remove this Employee?");
    removeBtn.setWidth("100%");
    removeBtn.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            EmployeeMainUI employeeMainUI = new EmployeeMainUI(GlobalVariables.getUserRole(), 0);
            boolean result = employeeCurrentStatusService.removeEmployee(getEmployeeId());
            if (result) {
                clearFields();
                employeeMainUI.employeesTable(getEmployeeList(0));
                (window.getParent()).removeWindow(window);
            } else {
                getWindow().showNotification("Cannot Remove Employee, Contact your DBA!",
                        Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    window.addComponent(removeBtn);

    return window;
}

From source file:com.openhris.employee.EmployeePersonalInformation.java

private Window updatePersonalInformationConfirmation(final PersonalInformation pi) {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setSpacing(true);
    vlayout.setMargin(true);/*from w w w  .j a  va2s .co m*/

    final Window window = new Window("UPDATE WINDOW", vlayout);
    window.setWidth("350px");

    final TextArea remarks = new TextArea("Remarks");
    remarks.setWidth("100%");
    remarks.setRows(3);
    window.addComponent(remarks);

    Button removeBtn = new Button("UPDATE EMPLOYEE?");
    removeBtn.setWidth("100%");
    removeBtn.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (remarks.getValue() == null || remarks.getValue().toString().trim().isEmpty()) {
                getWindow().showNotification("Add remarks!", Window.Notification.TYPE_ERROR_MESSAGE);
                return;
            }

            boolean result = piService.updatePersonalInformation(pi, remarks.getValue().toString().trim());
            if (result) {
                getWindow().showNotification("Information Updated", Window.Notification.TYPE_TRAY_NOTIFICATION);
                (window.getParent()).removeWindow(window);
            } else {
                getWindow().showNotification("SQL Error", Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }

    });
    window.addComponent(removeBtn);

    return window;
}

From source file:com.openhris.employee.RemovePositionWindow.java

public RemovePositionWindow(int id) {
    this.id = id;
    setCaption("REMOVE POSITION");
    setWidth("300px");

    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setSpacing(true);
    vlayout.setMargin(true);//w  w w .  j  av a  2 s. co m

    final Window window = new Window("REMOVE POSITION", vlayout);
    window.setWidth("300px");

    Button removeBtn = new Button("Remove Position?");
    removeBtn.setWidth("100%");
    removeBtn.addListener(this);
    addComponent(removeBtn);
}

From source file:com.openhris.employee.salary.EmployeeSalaryInformation.java

private Window setContributionMainBranch() {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setMargin(true);// w ww.  j  a va 2 s.  com
    vlayout.setSpacing(true);

    final Window subWindow = new Window("Set Branch", vlayout);
    subWindow.setWidth("300px");

    corporate = dropDown.populateCorporateComboBox(new ComboBox());
    corporate.addListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            if (corporate.getValue() == null) {
            } else {
                corporateId = companyService.getCorporateId(corporate.getValue().toString());
                trade = dropDown.populateTradeComboBox(trade, corporateId);
            }
        }
    });
    corporate.setWidth("100%");
    subWindow.addComponent(corporate);

    trade.addListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            if (trade.getValue() == null) {
            } else {
                tradeId = companyService.getTradeId(trade.getValue().toString(), corporateId);
                branch = dropDown.populateBranchComboBox(branch, tradeId, corporateId);
            }
        }
    });
    trade.setWidth("100%");
    subWindow.addComponent(trade);

    branch.setWidth("100%");
    branch.addListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            if (branch.getValue() == null) {
            } else {
                branchId = companyService.getBranchId(tradeId, branch.getValue().toString());
            }
        }
    });
    subWindow.addComponent(branch);

    final ComboBox remarks = new ComboBox("Remarks");
    remarks.setWidth("100%");
    remarks.setNullSelectionItemId(false);
    remarks.addItem("Transfer to new Branch.");
    remarks.addItem("Wrong Entry");
    subWindow.addComponent(remarks);

    Button updateBtn = new Button("SET BRANCH for CONTRIBUTION");
    updateBtn.setWidth("100%");
    updateBtn.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (corporate.getValue() == null) {
                getWindow().showNotification("Select Corporation!", Window.Notification.TYPE_ERROR_MESSAGE);
                return;
            }

            if (trade.getValue() == null) {
                getWindow().showNotification("Select Trade!", Window.Notification.TYPE_ERROR_MESSAGE);
                return;
            }

            if (branch.getValue() == null) {
                getWindow().showNotification("Select Branch!", Window.Notification.TYPE_ERROR_MESSAGE);
                return;
            }

            if (remarks.getValue() == null) {
                getWindow().showNotification("Remarks required!", Window.Notification.TYPE_ERROR_MESSAGE);
                return;
            }

            boolean result = si.updateEmployeeContributionBranch(getEmployeeId(), branchId,
                    remarks.getValue().toString(), corporateId);
            if (result) {
                getWindow().showNotification("Successfully transferred to new Branch!");
                (subWindow.getParent()).removeWindow(subWindow);
            } else {
                getWindow().showNotification("SQL Error, Contact your DBA!");
                (subWindow.getParent()).removeWindow(subWindow);
            }
        }
    });
    subWindow.addComponent(updateBtn);

    return subWindow;
}

From source file:com.openhris.employee.salary.EmployeeSalaryInformation.java

private Window editDateEntryWindow(final String entryDate) {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setWidth("100%");
    vlayout.setMargin(true);//from  w w  w  .  j  av a  2s  .co m
    vlayout.setSpacing(true);

    final Window window = new Window("EDIT DATE ENTRY", vlayout);
    window.setResizable(false);

    Button editBtn = new Button("EDIT DATE ENTRY?");
    editBtn.setWidth("100%");
    editBtn.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            boolean result = si.editEmploymentDateEntry(getEmployeeId(), entryDate);
            if (result) {
                getWindow().showNotification("Update Entry Date.", Window.Notification.TYPE_TRAY_NOTIFICATION);
                (window.getParent()).removeWindow(window);
            }
        }
    });
    window.addComponent(editBtn);

    return window;
}

From source file:com.openhris.payroll.AdjustmentWindow.java

public AdjustmentWindow(int payrollId, double amountToBeReceive, double amountReceived, double adjustment) {
    this.payrollId = payrollId;
    this.amountToBeReceive = amountToBeReceive;
    this.amountReceived = amountReceived;
    this.adjustment = adjustment;

    setCaption("ADJUSTMENTS");
    setWidth("400px");

    TabSheet ts = new TabSheet();
    ts.addStyleName("bar");

    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setMargin(true);/*from  www.  j  a  v  a 2s . co  m*/
    vlayout.setSpacing(true);
    vlayout.setCaption("Post Adjustments");

    final TextField amount = new TextField("Amount: ");
    amount.setWidth("100%");
    vlayout.addComponent(amount);

    final TextField remarks = new TextField("Remarks");
    remarks.setWidth("100%");
    vlayout.addComponent(remarks);

    Button saveAdjustments = new Button("POST ADJUSTMENTS");
    saveAdjustments.setWidth("100%");
    saveAdjustments.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (amount.getValue() == null || amount.getValue().toString().trim().isEmpty()) {
                getWindow().showNotification("Enter Amount for adjustment.",
                        Window.Notification.TYPE_WARNING_MESSAGE);
                return;
            } else {
                if (!utilities.checkInputIfDouble(amount.getValue().toString().trim())) {
                    getWindow().showNotification("Enter a numeric value for amount.",
                            Window.Notification.TYPE_ERROR_MESSAGE);
                    return;
                }
            }

            if (remarks.getValue() == null || remarks.getValue().toString().trim().isEmpty()) {
                getWindow().showNotification("Add remarks for adjustment.",
                        Window.Notification.TYPE_ERROR_MESSAGE);
                return;
            }

            double amountForAdjustment = utilities.convertStringToDouble(amount.getValue().toString().trim());
            String remarksForAdjustment = remarks.getValue().toString().trim().toLowerCase();
            boolean result = payrollService.insertAdjustmentToPayroll(getPayrollId(), getAmountToBeReceive(),
                    getAmountReceived(), amountForAdjustment, remarksForAdjustment);
            if (result) {
                adjustmentTable();
                close();
                getWindow().showNotification("Successfully added adjustment.",
                        Window.Notification.TYPE_HUMANIZED_MESSAGE);
            }
        }
    });
    vlayout.addComponent(saveAdjustments);

    ts.addComponent(vlayout);

    vlayout = new VerticalLayout();
    vlayout.setMargin(true);
    vlayout.setSpacing(true);
    vlayout.setCaption("Adjustments Table");

    Label label = new Label("Remarks: Click ID Column to delete Adjustment");
    vlayout.addComponent(label);

    vlayout.addComponent(adjustmentTable());

    Button closeBtn = new Button("CLOSE");
    closeBtn.setWidth("100%");
    closeBtn.addListener(closeBtnListener);
    vlayout.addComponent(closeBtn);

    ts.addComponent(vlayout);
    addComponent(ts);
}

From source file:com.openhris.payroll.AdjustmentWindow.java

private Window removeAdjustment(final int adjustmentId, final double amountToBeReceive,
        final double amountReceived, final double adjustment, final int payrollId) {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setMargin(true);/*from w w  w.j  a  va2s  .co  m*/
    vlayout.setSpacing(true);

    final Window subWindow = new Window("REMOVE ADVANCES", vlayout);
    subWindow.setWidth("200px");

    Button removeAdjBtn = new Button("REMOVE ADJUSTMENT?");
    removeAdjBtn.setWidth("100%");
    removeAdjBtn.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            boolean result = payrollService.removeAdjustmentById(adjustmentId, amountToBeReceive,
                    amountReceived, adjustment, payrollId);
            if (result) {
                (subWindow.getParent()).removeWindow(subWindow);
                adjustmentTable();
            }
        }
    });
    subWindow.addComponent(removeAdjBtn);

    return subWindow;
}