Example usage for com.vaadin.ui GridLayout setWidth

List of usage examples for com.vaadin.ui GridLayout setWidth

Introduction

In this page you can find the example usage for com.vaadin.ui GridLayout setWidth.

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:com.mycollab.module.crm.ui.components.PeopleInfoComp.java

License:Open Source License

public void displayEntryPeople(ValuedBean bean) {
    this.removeAllComponents();
    this.withMargin(false);

    Label peopleInfoHeader = new Label(
            FontAwesome.USER.getHtml() + " " + UserUIContext.getMessage(CrmCommonI18nEnum.SUB_INFO_PEOPLE),
            ContentMode.HTML);//  w  ww. j  a  va2 s .c om
    peopleInfoHeader.setStyleName("info-hdr");
    this.addComponent(peopleInfoHeader);

    GridLayout layout = new GridLayout(2, 2);
    layout.setSpacing(true);
    layout.setWidth("100%");
    layout.setMargin(new MarginInfo(false, false, false, true));
    try {
        Label createdLbl = new Label(UserUIContext.getMessage(CrmCommonI18nEnum.ITEM_CREATED_PEOPLE));
        createdLbl.setSizeUndefined();
        layout.addComponent(createdLbl, 0, 0);

        String createdUserName = (String) PropertyUtils.getProperty(bean, "createduser");
        String createdUserAvatarId = (String) PropertyUtils.getProperty(bean, "createdUserAvatarId");
        String createdUserDisplayName = (String) PropertyUtils.getProperty(bean, "createdUserFullName");

        UserLink createdUserLink = new UserLink(createdUserName, createdUserAvatarId, createdUserDisplayName);
        layout.addComponent(createdUserLink, 1, 0);
        layout.setColumnExpandRatio(1, 1.0f);

        Label assigneeLbl = new Label(UserUIContext.getMessage(CrmCommonI18nEnum.ITEM_ASSIGN_PEOPLE));
        assigneeLbl.setSizeUndefined();
        layout.addComponent(assigneeLbl, 0, 1);
        String assignUserName = (String) PropertyUtils.getProperty(bean, "assignuser");
        String assignUserAvatarId = (String) PropertyUtils.getProperty(bean, "assignUserAvatarId");
        String assignUserDisplayName = (String) PropertyUtils.getProperty(bean, "assignUserFullName");

        UserLink assignUserLink = new UserLink(assignUserName, assignUserAvatarId, assignUserDisplayName);
        layout.addComponent(assignUserLink, 1, 1);
    } catch (Exception e) {
        LOG.error("Can not build user link {} ", BeanUtility.printBeanObj(bean));
    }

    this.addComponent(layout);

}

From source file:com.mycollab.vaadin.web.ui.MailFormWindow.java

License:Open Source License

private void initUI() {
    GridLayout mainLayout = new GridLayout(1, 5);
    mainLayout.setWidth("100%");
    mainLayout.setMargin(true);//from  w  w w.  j a  va2 s  . c om
    mainLayout.setSpacing(true);

    CssLayout inputPanel = new CssLayout();
    inputPanel.setWidth("100%");
    inputPanel.setStyleName("mail-panel");

    inputLayout = new GridLayout(3, 4);
    inputLayout.setSpacing(true);
    inputLayout.setWidth("100%");
    inputLayout.setColumnExpandRatio(0, 1.0f);

    inputPanel.addComponent(inputLayout);

    mainLayout.addComponent(inputPanel);

    tokenFieldMailTo = new EmailTokenField();

    inputLayout.addComponent(createTextFieldMail("To:", tokenFieldMailTo), 0, 0);

    if (lstMail != null) {
        for (String mail : lstMail) {
            if (StringUtils.isNotBlank(mail)) {
                if (mail.indexOf("<") > -1) {
                    String strMail = mail.substring(mail.indexOf("<") + 1, mail.lastIndexOf(">"));
                    if (strMail != null && !strMail.equalsIgnoreCase("null")) {

                    }
                } else {

                }
            }
        }
    }

    final TextField subject = new TextField();
    subject.setRequired(true);
    subject.setWidth("100%");
    subjectField = createTextFieldMail("Subject:", subject);
    inputLayout.addComponent(subjectField, 0, 1);

    initButtonLinkCcBcc();

    ccField = createTextFieldMail("Cc:", tokenFieldMailCc);
    bccField = createTextFieldMail("Bcc:", tokenFieldMailBcc);

    final RichTextArea noteArea = new RichTextArea();
    noteArea.setWidth("100%");
    noteArea.setHeight("200px");
    mainLayout.addComponent(noteArea, 0, 1);
    mainLayout.setComponentAlignment(noteArea, Alignment.MIDDLE_CENTER);

    final AttachmentPanel attachments = new AttachmentPanel();
    attachments.setWidth("500px");

    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION);

    MButton sendBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_SEND_EMAIL), clickEvent -> {
        if (tokenFieldMailTo.getListRecipient().size() <= 0 || subject.getValue().equals("")) {
            NotificationUtil.showErrorNotification(
                    "To Email field and Subject field must be not empty! Please fulfil them before sending email.");
            return;
        }
        if (UserUIContext.getUser().getEmail() != null && UserUIContext.getUser().getEmail().length() > 0) {
            ExtMailService systemMailService = AppContextUtil.getSpringBean(ExtMailService.class);

            List<File> listFile = attachments.files();
            List<AttachmentSource> attachmentSource = null;
            if (listFile != null && listFile.size() > 0) {
                attachmentSource = new ArrayList<>();
                for (File file : listFile) {
                    attachmentSource.add(new FileAttachmentSource(file));
                }
            }

            systemMailService.sendHTMLMail(UserUIContext.getUser().getEmail(),
                    UserUIContext.getUser().getDisplayName(), tokenFieldMailTo.getListRecipient(),
                    tokenFieldMailCc.getListRecipient(), tokenFieldMailBcc.getListRecipient(),
                    subject.getValue(), noteArea.getValue(), attachmentSource, true);
            close();
        } else {
            NotificationUtil
                    .showErrorNotification("Your email is empty value, please fulfil it before sending email!");
        }
    }).withIcon(FontAwesome.SEND).withStyleName(WebThemes.BUTTON_ACTION);

    MHorizontalLayout controlsLayout = new MHorizontalLayout(attachments, cancelBtn, sendBtn)
            .expand(attachments).withFullWidth();
    mainLayout.addComponent(controlsLayout, 0, 2);
    this.setContent(mainLayout);
}

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

ComponentContainer component() {
    GridLayout glayout = new GridLayout(3, 14);
    glayout.setSpacing(true);//from w  w w .j av  a2 s  . co  m
    glayout.setWidth("600px");
    glayout.setHeight("100%");

    communication = new TextField("Communication Allowance: ");
    communication.setWidth("170px");
    communication.addStyleName("numerical");
    glayout.addComponent(communication, 0, 0);

    communicationEntry = dropDown.populateEmploymentAllowanceEntry("Entry Type: ");
    communicationEntry.setWidth("150px");
    glayout.addComponent(communicationEntry, 1, 0);

    Button communicationBtn = new Button("UPDATE COMMUNICATION ALLOWANCE");
    communicationBtn.setWidth("250px");
    communicationBtn.addListener(buttonClickListener);
    glayout.addComponent(communicationBtn, 2, 0);
    glayout.setComponentAlignment(communicationBtn, Alignment.BOTTOM_LEFT);
    if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) {
        communicationBtn.setEnabled(true);
    } else {
        communicationBtn.setEnabled(false);
    }

    glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 1, 2, 1);

    perDiem = new TextField("Per Diem: ");
    perDiem.setWidth("170px");
    perDiem.addStyleName("numerical");
    glayout.addComponent(perDiem, 0, 2);

    perDiemEntry = dropDown.populateEmploymentAllowanceEntry("Entry Type: ");
    perDiemEntry.setWidth("150px");
    glayout.addComponent(perDiemEntry, 1, 2);

    Button perDiemBtn = new Button("UPDATE PER DIEM");
    perDiemBtn.setWidth("250px");
    perDiemBtn.addListener(buttonClickListener);
    glayout.addComponent(perDiemBtn, 2, 2);
    glayout.setComponentAlignment(perDiemBtn, Alignment.BOTTOM_LEFT);
    if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) {
        perDiemBtn.setEnabled(true);
    } else {
        perDiemBtn.setEnabled(false);
    }

    glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 3, 2, 3);

    cola = new TextField("Cola: ");
    cola.setWidth("170px");
    cola.addStyleName("numerical");
    glayout.addComponent(cola, 0, 4);

    colaEntry = dropDown.populateEmploymentAllowanceEntry("Entry Type: ");
    colaEntry.setWidth("150px");
    glayout.addComponent(colaEntry, 1, 4);

    Button colaBtn = new Button("UPDATE COLA");
    colaBtn.setWidth("250px");
    colaBtn.addListener(buttonClickListener);
    glayout.addComponent(colaBtn, 2, 4);
    glayout.setComponentAlignment(colaBtn, Alignment.BOTTOM_LEFT);
    if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) {
        colaBtn.setEnabled(true);
    } else {
        colaBtn.setEnabled(false);
    }

    glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 5, 2, 5);

    meal = new TextField("Meal Allowance: ");
    meal.setWidth("170px");
    meal.addStyleName("numerical");
    glayout.addComponent(meal, 0, 6);

    mealEntry = dropDown.populateEmploymentAllowanceEntry("Entry Type: ");
    mealEntry.setWidth("150px");
    glayout.addComponent(mealEntry, 1, 6);

    Button mealBtn = new Button("UPDATE MEAL ALLOWANCE");
    mealBtn.setWidth("250px");
    mealBtn.addListener(buttonClickListener);
    glayout.addComponent(mealBtn, 2, 6);
    glayout.setComponentAlignment(mealBtn, Alignment.BOTTOM_LEFT);
    if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) {
        mealBtn.setEnabled(true);
    } else {
        mealBtn.setEnabled(false);
    }

    glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 7, 2, 7);

    transportation = new TextField("Transportation Allowance: ");
    transportation.setWidth("170px");
    transportation.addStyleName("numerical");
    glayout.addComponent(transportation, 0, 8);

    transportationEntry = dropDown.populateEmploymentAllowanceEntry("Entry Type: ");
    transportationEntry.setWidth("150px");
    glayout.addComponent(transportationEntry, 1, 8);

    Button transportationBtn = new Button("UPDATE TRANSPORTATION ALLOWANCE");
    transportationBtn.setWidth("250px");
    transportationBtn.addListener(buttonClickListener);
    glayout.addComponent(transportationBtn, 2, 8);
    glayout.setComponentAlignment(transportationBtn, Alignment.BOTTOM_LEFT);
    if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) {
        transportationBtn.setEnabled(true);
    } else {
        transportationBtn.setEnabled(false);
    }

    glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 9, 2, 9);

    others = new TextField("Other Allowances: ");
    others.setWidth("170px");
    others.addStyleName("numerical");
    glayout.addComponent(others, 0, 10);

    othersEntry = dropDown.populateEmploymentAllowanceEntry("Entry Type: ");
    othersEntry.setWidth("150px");
    glayout.addComponent(othersEntry, 1, 10);

    Button othersBtn = new Button("UPDATE OTHER ALLOWANCES");
    othersBtn.setWidth("250px");
    othersBtn.addListener(buttonClickListener);
    glayout.addComponent(othersBtn, 2, 10);
    glayout.setComponentAlignment(othersBtn, Alignment.BOTTOM_LEFT);
    if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) {
        othersBtn.setEnabled(true);
    } else {
        othersBtn.setEnabled(false);
    }

    glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 11, 2, 11);

    afl = new TextField("Allowance for Liquidation: ");
    afl.setWidth("170px");
    afl.addStyleName("numerical");
    glayout.addComponent(afl, 0, 12);

    Button aflBtn = new Button("UPDATE AFL");
    aflBtn.setWidth("100%");
    aflBtn.addListener(buttonClickListener);
    glayout.addComponent(aflBtn, 1, 12, 2, 12);
    glayout.setComponentAlignment(aflBtn, Alignment.BOTTOM_LEFT);
    if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) {
        aflBtn.setEnabled(true);
    } else {
        aflBtn.setEnabled(false);
    }

    if (getEmployeeId() != null) {
        Allowances a = ais.getAllowancesByEmployee(getEmployeeId());

        communication.setValue(a.getCommunication());
        communicationEntry.setValue(
                Constant.getKeyByValue(Constant.MAP_CONSTANT_EMPLOYMENT_ALLOWANCE_ENTRY, a.getComEntryType()));

        perDiem.setValue(a.getPerDiem());
        perDiemEntry.setValue(Constant.getKeyByValue(Constant.MAP_CONSTANT_EMPLOYMENT_ALLOWANCE_ENTRY,
                a.getPerDiemEntryType()));

        cola.setValue(a.getCola());
        colaEntry.setValue(
                Constant.getKeyByValue(Constant.MAP_CONSTANT_EMPLOYMENT_ALLOWANCE_ENTRY, a.getColaEntryType()));

        meal.setValue(a.getMeal());
        mealEntry.setValue(
                Constant.getKeyByValue(Constant.MAP_CONSTANT_EMPLOYMENT_ALLOWANCE_ENTRY, a.getMealEntryType()));

        transportation.setValue(a.getTransportation());
        transportationEntry.setValue(Constant.getKeyByValue(Constant.MAP_CONSTANT_EMPLOYMENT_ALLOWANCE_ENTRY,
                a.getTransEntryType()));

        others.setValue(a.getOthers());
        othersEntry.setValue(Constant.getKeyByValue(Constant.MAP_CONSTANT_EMPLOYMENT_ALLOWANCE_ENTRY,
                a.getOthersEntryType()));

        afl.setValue(a.getAllowanceForLiquidation());
    }

    return glayout;
}

From source file:com.openhris.employee.others.OtherInformation.java

Component component() {
    GridLayout glayout = new GridLayout(2, 13);
    glayout.setSpacing(true);/*w w w.ja v  a  2 s  .co  m*/
    glayout.setWidth("600px");
    glayout.setHeight("100%");

    tinField = new HRISTextField("TIN: ");
    glayout.addComponent(tinField, 0, 0);

    Button tinBtn = new Button("UPDATE TIN NO.");
    tinBtn.setWidth("100%");
    tinBtn.addListener(buttonClickListener);
    glayout.addComponent(tinBtn, 1, 0);
    glayout.setComponentAlignment(tinBtn, Alignment.BOTTOM_CENTER);
    if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) {
        tinBtn.setEnabled(true);
    } else {
        tinBtn.setEnabled(false);
    }

    glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 1, 1, 1);

    employeeDependent = dropDown.populateTotalDependent("Employee's Dependent");
    employeeDependent.setWidth("100%");
    glayout.addComponent(employeeDependent, 0, 2);

    Button edBtn = new Button("UPDATE EMPLOYEE's DEPENDENT");
    edBtn.setWidth("100%");
    edBtn.addListener(buttonClickListener);
    glayout.addComponent(edBtn, 1, 2);
    glayout.setComponentAlignment(edBtn, Alignment.BOTTOM_CENTER);
    if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) {
        edBtn.setEnabled(true);
    } else {
        edBtn.setEnabled(false);
    }

    glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 3, 1, 3);

    sssField = new HRISTextField("SSS: ");
    glayout.addComponent(sssField, 0, 4);

    Button sssbtn = new Button("UPDATE SSS NO.");
    sssbtn.setWidth("100%");
    sssbtn.addListener(buttonClickListener);
    glayout.addComponent(sssbtn, 1, 4);
    glayout.setComponentAlignment(sssbtn, Alignment.BOTTOM_CENTER);
    if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) {
        sssbtn.setEnabled(true);
    } else {
        sssbtn.setEnabled(false);
    }

    glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 5, 1, 5);

    phicField = new HRISTextField("Philhealth");
    glayout.addComponent(phicField, 0, 6);

    Button phicBtn = new Button("UPDATE PHIC NO.");
    phicBtn.setWidth("100%");
    phicBtn.addListener(buttonClickListener);
    glayout.addComponent(phicBtn, 1, 6);
    glayout.setComponentAlignment(phicBtn, Alignment.BOTTOM_CENTER);
    if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) {
        phicBtn.setEnabled(true);
    } else {
        phicBtn.setEnabled(false);
    }

    glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 7, 1, 7);

    hdmfField = new HRISTextField("HDMF: ");
    glayout.addComponent(hdmfField, 0, 8);

    Button hdmfBtn = new Button("UPDATE HDMF NO.");
    hdmfBtn.setWidth("100%");
    hdmfBtn.addListener(buttonClickListener);
    glayout.addComponent(hdmfBtn, 1, 8);
    glayout.setComponentAlignment(hdmfBtn, Alignment.BOTTOM_CENTER);
    if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) {
        hdmfBtn.setEnabled(true);
    } else {
        hdmfBtn.setEnabled(false);
    }

    glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 9, 1, 9);

    bankAccountNo = new HRISTextField("Bank Account No: ");
    bankAccountNo.setImmediate(true);
    glayout.addComponent(bankAccountNo, 0, 10);

    Button bankAccountBtn = new Button("UPDATE BANK NO.");
    bankAccountBtn.setWidth("100%");
    bankAccountBtn.addListener(buttonClickListener);
    glayout.addComponent(bankAccountBtn, 1, 10);
    glayout.setComponentAlignment(bankAccountBtn, Alignment.BOTTOM_CENTER);
    if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) {
        bankAccountBtn.setEnabled(true);
    } else {
        bankAccountBtn.setEnabled(false);
    }

    if (getEmployeeId() != null) {
        EmploymentInformation ei = si.getEmployeeSalaryInformation(getEmployeeId());

        tinField.setValue(ei.getTinNo());
        sssField.setValue(ei.getSssNo());
        phicField.setValue(ei.getPhicNo());
        hdmfField.setValue(ei.gethdmfNo());
        bankAccountNo.setValue(ei.getBankAccountNo());
        employeeDependent
                .setValue(Constant.getKeyByValue(Constant.MAP_CONSTANT_DEPENDENT, ei.getTotalDependent()));
    }

    return glayout;
}

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

public ComponentContainer layout() {
    GridLayout glayout = new GridLayout(2, 8);
    glayout.setSpacing(true);/*  w  w  w  .  java 2 s. com*/
    glayout.setWidth("600px");
    glayout.setHeight("100%");

    employmentStatus = dropDown.populateEmploymentStatus("Employment Status: ");
    employmentStatus.setWidth("200px");
    glayout.addComponent(employmentStatus, 0, 0);

    Button esBtn = new Button("UPDATE EMPLOYMENT STATUS");
    esBtn.setWidth("100%");
    glayout.addComponent(esBtn, 1, 0);
    esBtn.addListener(buttonClickListener);
    glayout.setColumnExpandRatio(1, 1);
    glayout.setComponentAlignment(esBtn, Alignment.BOTTOM_LEFT);
    if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) {
        esBtn.setEnabled(true);
    } else {
        esBtn.setEnabled(false);
    }

    glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 2, 1, 2);

    employmentWageStatus = dropDown.populateEmploymentWageStatus("Employment Wage Status: ");
    employmentWageStatus.setWidth("200px");
    glayout.addComponent(employmentWageStatus, 0, 3);

    Button ewsBtn = new Button("UPDATE EMPLOYMENT WAGE STATUS");
    ewsBtn.setWidth("100%");
    ewsBtn.addListener(buttonClickListener);
    glayout.addComponent(ewsBtn, 1, 3);
    glayout.setComponentAlignment(ewsBtn, Alignment.BOTTOM_LEFT);
    if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) {
        ewsBtn.setEnabled(true);
    } else {
        ewsBtn.setEnabled(false);
    }

    glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 4, 1, 4);

    employmentWageEntry = dropDown.populateEmploymentWageEntry("Employment Wage Entry: ");
    employmentWageEntry.setWidth("200px");
    glayout.addComponent(employmentWageEntry, 0, 5);

    Button eweBtn = new Button("UPDATE EMPLOYMENT WAGE ENTRY");
    eweBtn.setWidth("100%");
    glayout.addComponent(eweBtn, 1, 5);
    eweBtn.addListener(buttonClickListener);
    glayout.setComponentAlignment(eweBtn, Alignment.BOTTOM_LEFT);
    if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) {
        eweBtn.setEnabled(true);
    } else {
        eweBtn.setEnabled(false);
    }

    glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 6, 1, 6);

    employmentWage = new TextField("Employment Wage");
    employmentWage.setWidth("200px");
    employmentWage.addStyleName("numerical");
    glayout.addComponent(employmentWage, 0, 7);

    Button ewBtn = new Button("UPDATE EMPLOYMENT WAGE");
    ewBtn.setWidth("100%");
    glayout.addComponent(ewBtn, 1, 7);
    ewBtn.addListener(buttonClickListener);
    glayout.setComponentAlignment(ewBtn, Alignment.BOTTOM_LEFT);
    if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) {
        ewBtn.setEnabled(true);
    } else {
        ewBtn.setEnabled(false);
    }

    if (getEmployeeId() != null) {
        EmploymentInformation ei = si.getEmployeeSalaryInformation(getEmployeeId());

        employmentStatus.setValue(
                Constant.getKeyByValue(Constant.MAP_CONSTANT_EMPLOYMENT_STATUS, ei.getEmploymentStatus()));
        employmentWageStatus.setValue(Constant.getKeyByValue(Constant.MAP_CONSTANT_EMPLOYMENT_WAGE_STATUS,
                ei.getEmploymentWageStatus()));
        employmentWageEntry.setValue(Constant.getKeyByValue(Constant.MAP_CONSTANT_EMPLOYMENT_WAGE_ENTRY,
                ei.getEmploymentWageEntry()));
        employmentWage.setValue(ei.getEmploymentWage());
    }

    return glayout;
}

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

public ComponentContainer layout2() {
    GridLayout glayout = new GridLayout(2, 1);
    glayout.setSpacing(true);// ww w.j ava 2 s.  c o  m
    glayout.setWidth("600px");

    TextField employmentStatusField = new HRISTextField("Employment Status: ");
    employmentStatusField.setWidth("200px");
    glayout.addComponent(employmentStatusField, 0, 0);

    Button setContributionBtn = new Button("SET EMPLOYEE'S CONTRIBUTIONS MAIN BRANCH");
    setContributionBtn.setWidth("100%");
    setContributionBtn.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            Window subWindow = setContributionMainBranch();
            if (subWindow.getParent() == null) {
                getWindow().addWindow(subWindow);
            }
            subWindow.setModal(true);
            subWindow.center();
        }
    });
    glayout.addComponent(setContributionBtn, 1, 0);
    glayout.setColumnExpandRatio(1, 1);
    glayout.setComponentAlignment(setContributionBtn, Alignment.BOTTOM_CENTER);
    if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) {
        setContributionBtn.setEnabled(true);
    } else {
        setContributionBtn.setEnabled(false);
    }

    if (getEmployeeId() != null) {
        EmploymentInformation employmentInformation = si.getEmployeeSalaryInformation(getEmployeeId());
        employmentStatusField.setValue(employmentInformation.getCurrentStatus().toUpperCase());
    }
    employmentStatusField.setReadOnly(true);

    return glayout;
}

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

public PayrollAdvancesLedgerUI(int branchId) {
    this.branchId = branchId;

    setSpacing(false);//from ww  w . ja va 2 s.co  m
    setMargin(false);
    setWidth("100%");
    setHeight("100%");
    setImmediate(true);

    final VerticalSplitPanel vsplit = new VerticalSplitPanel();

    vsplit.setImmediate(true);
    vsplit.setMargin(false);
    vsplit.setSizeFull();
    vsplit.setLocked(true);

    vsplit.setSplitPosition(90, Sizeable.UNITS_PIXELS);

    GridLayout glayout = new GridLayout(2, 1);
    glayout.setWidth("60%");
    glayout.setMargin(true);
    glayout.setSpacing(true);

    employeeComboBox(getBranchId());
    glayout.addComponent(employee, 0, 0);

    Button button = new Button();
    button.setWidth("100%");
    button.setCaption("Generate Ledger");
    button.setEnabled(UserAccessControl.isPayroll());
    button.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            System.out.println("employeeId: " + employee.getValue());
        }
    });

    glayout.addComponent(button, 1, 0);
    glayout.setComponentAlignment(button, Alignment.BOTTOM_LEFT);

    vsplit.setFirstComponent(glayout);
    addComponent(vsplit);

    setExpandRatio(vsplit, 1.0f);
}

From source file:com.peergreen.webconsole.scope.system.internal.bundle.BundleTab.java

License:Open Source License

private void init() {

    setMargin(true);/*from  ww  w  .j  av a2  s  . co m*/
    setSpacing(true);

    // ----------------------------------------------------
    // Title
    // ----------------------------------------------------

    HorizontalLayout header = new HorizontalLayout();
    header.setSpacing(true);
    header.setMargin(true);

    Label title = new Label(format("Bundle %d: %s (%s)", bundle.getBundleId(),
            getHeader(bundle, Constants.BUNDLE_NAME), bundle.getVersion()));
    title.addStyleName("h1");
    header.addComponent(title);
    header.setComponentAlignment(title, Alignment.MIDDLE_LEFT);

    addComponent(header);

    // ----------------------------------------------------
    // Action(s) Bar
    // ----------------------------------------------------

    HorizontalLayout actions = new HorizontalLayout();
    if (BundleHelper.isState(bundle, Bundle.INSTALLED) || BundleHelper.isState(bundle, Bundle.RESOLVED)) {
        Button changeState = new Button();
        changeState.addClickListener(new StartBundleClickListener(bundle, notifierService));
        //changeState.addStyleName("no-padding");
        changeState.setCaption("Start");
        changeState.setIcon(new ClassResource(getClass(), "/images/32x32/go-next.png"));
        actions.addComponent(changeState);
    }
    if (BundleHelper.isState(bundle, Bundle.ACTIVE)) {
        Button changeState = new Button();
        changeState.addClickListener(new StopBundleClickListener(bundle, notifierService));
        //changeState.addStyleName("no-padding");
        changeState.setCaption("Stop");
        changeState.setIcon(new ClassResource(getClass(), "/images/32x32/media-record.png"));
        actions.addComponent(changeState);
    }

    // Update
    Button update = new Button();
    update.addClickListener(new UpdateBundleClickListener(bundle, notifierService));
    //update.addStyleName("no-padding");
    update.setCaption("Update");
    update.setIcon(new ClassResource(getClass(), "/images/32x32/view-refresh.png"));
    actions.addComponent(update);

    // Trash
    Button trash = new Button();
    trash.addClickListener(new UninstallBundleClickListener(bundle, notifierService));
    //trash.addStyleName("no-padding");
    trash.setCaption("Remove");
    trash.setIcon(new ClassResource(getClass(), "/images/32x32/user-trash-full.png"));
    actions.addComponent(trash);
    addComponent(actions);
    setComponentAlignment(actions, Alignment.MIDDLE_RIGHT);

    // ----------------------------------------------------
    // Standard Section
    // ----------------------------------------------------

    Table table = new Table();
    table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    table.setWidth("100%");

    Section mainSection = new Section("Standard", table);
    addComponent(mainSection);

    table.addContainerProperty("label", Label.class, null);
    table.addContainerProperty("value", Label.class, null);

    table.addItem(new Object[] { label("Bundle ID"), label(String.valueOf(bundle.getBundleId())) },
            "bundle.id");
    for (Map.Entry<String, String> entry : HEADERS.entrySet()) {
        String value = getHeader(bundle, entry.getKey());
        if (value != null) {
            table.addItem(new Object[] { label(entry.getValue()), label(value) }, entry.getKey());
        }
    }
    table.addItem(new Object[] { label("Location"), label(bundle.getLocation()) }, "bundle.location");
    Date date = new Date(bundle.getLastModified());
    table.addItem(new Object[] { label("Last Modified"), label(date.toString()) }, "last.modified");

    // ----------------------------------------------------
    // Packages Section
    // ----------------------------------------------------

    FilteredPackageTable exported = new FilteredPackageTable("Exported");

    FilteredPackageTable imported = new FilteredPackageTable("Imported");

    GridLayout packages = new GridLayout(2, 1);
    packages.addComponent(exported);
    packages.addComponent(imported);
    packages.setSpacing(true);
    packages.setWidth("100%");

    Section packagesSection = new Section("Packages", packages);
    addComponent(packagesSection);

    BundleWiring wiring = bundle.adapt(BundleWiring.class);
    if (wiring != null) {
        for (BundleCapability capability : wiring.getCapabilities(PackageNamespace.PACKAGE_NAMESPACE)) {
            String name = (String) capability.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE);
            Version version = (Version) capability.getAttributes()
                    .get(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE);
            exported.addPackage(format("%s (%s)", name, version));
        }
        for (BundleRequirement requirement : wiring.getRequirements(PackageNamespace.PACKAGE_NAMESPACE)) {
            String filter = requirement.getDirectives().get(PackageNamespace.REQUIREMENT_FILTER_DIRECTIVE);
            imported.addPackage(filter);
        }
    }

    // ----------------------------------------------------
    // Services Section
    // ----------------------------------------------------

    FilteredServiceTable registered = new FilteredServiceTable("Registered");

    FilteredServiceTable used = new FilteredServiceTable("Used Services");

    VerticalLayout services = new VerticalLayout(registered, used);
    services.setSpacing(true);
    services.setWidth("100%");

    ServiceReference<?>[] registeredServices = bundle.getRegisteredServices();
    if (registeredServices != null) {
        for (ServiceReference<?> reference : registeredServices) {
            registered.addService(reference);
        }
    }

    ServiceReference<?>[] inUseServices = bundle.getServicesInUse();
    if (inUseServices != null) {
        for (ServiceReference<?> reference : inUseServices) {
            used.addService(reference);
        }
    }

    if (!registered.isEmpty() || !used.isEmpty()) {
        Section servicesSection = new Section("Services", services);
        addComponent(servicesSection);
    }

    // ----------------------------------------------------
    // Raw Manifest Section
    // ----------------------------------------------------

    Page.Styles styles = Page.getCurrent().getStyles();
    styles.add(".monospaced-font {font-family: monospace !important; }");

    Table manifest = new Table();
    manifest.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    manifest.setWidth("100%");
    manifest.addStyleName("monospaced-font");
    manifest.setPageLength(15);
    manifest.addContainerProperty("name", String.class, null);
    manifest.addContainerProperty("value", String.class, null);

    Dictionary<String, String> headers = bundle.getHeaders();
    for (String key : Collections.list(headers.keys())) {
        manifest.addItem(new Object[] { key, headers.get(key) }, null);
    }

    Section manifestSection = new Section("Manifest", manifest);
    addComponent(manifestSection);

}

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

VerticalLayout acknowledgementFormContent() {
    VerticalLayout content = new VerticalLayout();
    content.setSizeFull();//from w  w w. j av a 2  s. co  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.scsb.crpro.MessageBox.java

License:Apache License

/**
 * Similar to {@link #MessageBox(Window, String, Icon, String, Alignment, ButtonConfig...)},
 * but the message component is defined explicitly. The component can be even a composite
 * of a layout manager and manager further Vaadin components.
 * /*  w w w.java2s  . co  m*/
 * @param messageComponent a Vaadin component
 */
public MessageBox(String dialogWidth, String dialogHeight, String dialogCaption, Icon dialogIcon,
        Component messageComponent, Alignment buttonsAlignment, ButtonConfig... buttonConfigs) {
    super();
    setResizable(false);
    setClosable(false);
    setSizeUndefined();
    setWidth(dialogWidth);
    //setHeight(dialogHeight);
    setCaption(dialogCaption);

    GridLayout mainLayout = new GridLayout(2, 2);
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);
    mainLayout.setSizeUndefined();
    mainLayout.setWidth(GRID_DEFAULT_WIDTH1);

    // Add Content
    messageComponent.setSizeUndefined();
    messageComponent.setWidth(GRID_DEFAULT_WIDTH2);
    if (dialogIcon == null || Icon.NONE.equals(dialogIcon)) {
        mainLayout.addComponent(messageComponent, 0, 0, 1, 0);
        mainLayout.setRowExpandRatio(0, 1.0f);
        mainLayout.setColumnExpandRatio(0, 1.0f);
    } else {
        mainLayout.addComponent(messageComponent, 1, 0);
        mainLayout.setRowExpandRatio(0, 1.0f);
        mainLayout.setColumnExpandRatio(1, 1.0f);

        Embedded icon = null;
        switch (dialogIcon) {
        case QUESTION:
            icon = new Embedded(null, new ThemeResource("images/question.png"));
            break;
        case INFO:
            icon = new Embedded(null, new ThemeResource("images/info.png"));
            break;
        case WARN:
            icon = new Embedded(null, new ThemeResource("images/warn.png"));
            break;
        case ERROR:
            icon = new Embedded(null, new ThemeResource("images/error.png"));
            break;
        }
        mainLayout.addComponent(icon, 0, 0);
        icon.setWidth(ICON_DEFAULT_SIZE);
        icon.setHeight(ICON_DEFAULT_SIZE);
    }

    // Add Buttons
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    mainLayout.addComponent(buttonLayout, 0, 1, 1, 1);
    mainLayout.setComponentAlignment(buttonLayout, buttonsAlignment);
    for (ButtonConfig buttonConfig : buttonConfigs) {
        Button button = new Button(buttonConfig.getCaption(),
                new ButtonClickListener(buttonConfig.getButtonType()));
        if (buttonConfig.getWidth() != null) {
            button.setWidth(buttonConfig.getWidth());
        }
        if (buttonConfig.getOptionalResource() != null) {
            button.setIcon(buttonConfig.getOptionalResource());
        } else {
            Resource icon = null;
            switch (buttonConfig.getButtonType()) {
            case ABORT:
                icon = new ThemeResource("images/famfamfam/cross.png");
                break;
            case CANCEL:
                icon = new ThemeResource("images/famfamfam/cross.png");
                break;
            case CLOSE:
                icon = new ThemeResource("images/famfamfam/door.png");
                break;
            case HELP:
                icon = new ThemeResource("images/famfamfam/lightbulb.png");
                break;
            case OK:
                icon = new ThemeResource("images/famfamfam/tick.png");
                break;
            case YES:
                icon = new ThemeResource("images/famfamfam/tick.png");
                break;
            case NO:
                icon = new ThemeResource("images/famfamfam/cross.png");
                break;
            case SAVE:
                icon = new ThemeResource("images/famfamfam/disk.png");
                break;
            case RETRY:
                icon = new ThemeResource("images/famfamfam/arrow_refresh.png");
                break;
            case IGNORE:
                icon = new ThemeResource("images/famfamfam/lightning_go.png");
                break;
            }
            button.setIcon(icon);
        }
        buttonLayout.addComponent(button);
    }

    setContent(mainLayout);
}