Example usage for com.vaadin.ui TextField TextField

List of usage examples for com.vaadin.ui TextField TextField

Introduction

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

Prototype

public TextField(ValueChangeListener<String> valueChangeListener) 

Source Link

Document

Constructs a new TextField with a value change listener.

Usage

From source file:com.peergreen.webconsole.core.vaadin7.BaseUI.java

License:Open Source License

/**
 * Build login view//from www  .  j  a  v a2 s  .c o  m
 *
 * @param exit
 */
private void buildLoginView(final boolean exit) {
    if (exit) {
        root.removeAllComponents();
    }
    notifierService.closeAll();

    addStyleName("login");

    VerticalLayout loginLayout = new VerticalLayout();
    loginLayout.setId("webconsole_loginlayout_id");
    loginLayout.setSizeFull();
    loginLayout.addStyleName("login-layout");
    root.addComponent(loginLayout);

    final CssLayout loginPanel = new CssLayout();
    loginPanel.addStyleName("login-panel");

    HorizontalLayout labels = new HorizontalLayout();
    labels.setWidth(MAX_WIDTH);
    labels.setMargin(true);
    loginPanel.addComponent(labels);

    Label welcome = new Label("Welcome");
    welcome.addStyleName("h4");
    labels.addComponent(welcome);
    labels.setComponentAlignment(welcome, Alignment.MIDDLE_LEFT);

    Label title = new Label(consoleName);
    //title.setSizeUndefined();
    title.addStyleName("h2");
    title.addStyleName("light");
    labels.addComponent(title);
    labels.setComponentAlignment(title, Alignment.MIDDLE_RIGHT);

    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);
    fields.setMargin(true);
    fields.addStyleName("fields");

    final TextField username = new TextField("Username");
    username.focus();
    username.setId("webconsole_login_username");
    fields.addComponent(username);

    final PasswordField password = new PasswordField("Password");
    password.setId("webconsole_login_password");
    fields.addComponent(password);

    final Button signin = new Button("Sign In");
    signin.setId("webconsole_login_signin");
    signin.addStyleName("default");
    fields.addComponent(signin);
    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

    final ShortcutListener enter = new ShortcutListener("Sign In", ShortcutAction.KeyCode.ENTER, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            signin.click();
        }
    };

    signin.addShortcutListener(enter);
    loginPanel.addComponent(fields);

    HorizontalLayout bottomRow = new HorizontalLayout();
    bottomRow.setWidth(MAX_WIDTH);
    bottomRow.setMargin(new MarginInfo(false, true, false, true));
    final CheckBox keepLoggedIn = new CheckBox("Keep me logged in");
    bottomRow.addComponent(keepLoggedIn);
    bottomRow.setComponentAlignment(keepLoggedIn, Alignment.MIDDLE_LEFT);
    // Add new error message
    final Label error = new Label("Wrong username or password.", ContentMode.HTML);
    error.setId("webconsole_login_error");
    error.addStyleName("error");
    error.setSizeUndefined();
    error.addStyleName("light");
    // Add animation
    error.addStyleName("v-animate-reveal");
    error.setVisible(false);
    bottomRow.addComponent(error);
    bottomRow.setComponentAlignment(error, Alignment.MIDDLE_RIGHT);
    loginPanel.addComponent(bottomRow);

    signin.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (authenticate(username.getValue(), password.getValue())) {
                //                    if (keepLoggedIn.getValue()) {
                //                        //Cookie userCookie = getCookieByName(PEERGREEN_USER_COOKIE_NAME);
                //                       if (getCookieByName(PEERGREEN_USER_COOKIE_NAME) == null) {
                //                            // Get a token for this user and create a cooki
                //                            Page.getCurrent().getJavaScript().execute( String.format("document.cookie = '%s=%s; path=%s'",
                //                                    PEERGREEN_USER_COOKIE_NAME, token, VaadinService.getCurrentRequest().getContextPath()));
                //                        } else {
                //                            // update token
                //                            userCookie.setValue(token);
                //                            userCookie.setPath(VaadinService.getCurrentRequest().getContextPath());
                //                        }
                //                    }

                buildMainView();
            } else {
                error.setVisible(true);
            }
        }
    });

    loginLayout.addComponent(loginPanel);
    loginLayout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER);
}

From source file:com.pms.component.ganttchart.DemoUI.java

License:Apache License

private void openStepEditor(AbstractStep step) {
    final Window win = new Window("Step Editor");
    win.setResizable(false);/*from  w ww  .j  a va2s .  c om*/
    win.center();

    final Collection<Component> hidden = new ArrayList<Component>();

    BeanItem<AbstractStep> item = new BeanItem<AbstractStep>(step);

    final FieldGroup group = new FieldGroup(item);
    group.setBuffered(true);

    TextField captionField = new TextField("Caption");
    captionField.setNullRepresentation("");
    group.bind(captionField, "caption");

    TextField descriptionField = new TextField("Description");
    descriptionField.setNullRepresentation("");
    group.bind(descriptionField, "description");
    descriptionField.setVisible(false);
    hidden.add(descriptionField);

    NativeSelect captionMode = new NativeSelect("Caption Mode");
    captionMode.addItem(Step.CaptionMode.TEXT);
    captionMode.addItem(Step.CaptionMode.HTML);
    group.bind(captionMode, "captionMode");
    captionMode.setVisible(false);
    hidden.add(captionMode);

    final NativeSelect parentStepSelect = new NativeSelect("Parent Step");
    parentStepSelect.setEnabled(false);
    if (!gantt.getSteps().contains(step)) {
        // new step
        parentStepSelect.setEnabled(true);
        for (Step parentStepCanditate : gantt.getSteps()) {
            parentStepSelect.addItem(parentStepCanditate);
            parentStepSelect.setItemCaption(parentStepCanditate, parentStepCanditate.getCaption());
            if (step instanceof SubStep) {
                if (parentStepCanditate.getSubSteps().contains(step)) {
                    parentStepSelect.setValue(parentStepCanditate);
                    parentStepSelect.setEnabled(false);
                    break;
                }
            }
        }
    }
    parentStepSelect.setVisible(false);
    hidden.add(parentStepSelect);

    TextField bgField = new TextField("Background color");
    bgField.setNullRepresentation("");
    group.bind(bgField, "backgroundColor");
    bgField.setVisible(false);
    hidden.add(bgField);

    DateField startDate = new DateField("Start date");
    startDate.setLocale(gantt.getLocale());
    startDate.setTimeZone(gantt.getTimeZone());
    startDate.setResolution(Resolution.SECOND);
    startDate.setConverter(new DateToLongConverter());
    group.bind(startDate, "startDate");

    DateField endDate = new DateField("End date");
    endDate.setLocale(gantt.getLocale());
    endDate.setTimeZone(gantt.getTimeZone());
    endDate.setResolution(Resolution.SECOND);
    endDate.setConverter(new DateToLongConverter());
    group.bind(endDate, "endDate");

    CheckBox showMore = new CheckBox("Show all settings");
    showMore.addValueChangeListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            for (Component c : hidden) {
                c.setVisible((Boolean) event.getProperty().getValue());
            }
            win.center();
        }
    });

    VerticalLayout content = new VerticalLayout();
    content.setMargin(true);
    content.setSpacing(true);
    win.setContent(content);

    content.addComponent(captionField);
    content.addComponent(captionMode);
    content.addComponent(descriptionField);
    content.addComponent(parentStepSelect);
    content.addComponent(bgField);
    content.addComponent(startDate);
    content.addComponent(endDate);
    content.addComponent(showMore);

    HorizontalLayout buttons = new HorizontalLayout();
    content.addComponent(buttons);

    Button ok = new Button("Ok", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                group.commit();
                AbstractStep step = ((BeanItem<AbstractStep>) group.getItemDataSource()).getBean();
                gantt.markStepDirty(step);
                if (parentStepSelect.isEnabled() && parentStepSelect.getValue() != null) {
                    SubStep subStep = addSubStep(parentStepSelect, step);
                    step = subStep;
                }
                if (step instanceof Step && !gantt.getSteps().contains(step)) {
                    gantt.addStep((Step) step);
                }
                if (ganttListener != null && step instanceof Step) {
                    ganttListener.stepModified((Step) step);
                }
                win.close();
            } catch (CommitException e) {
                Notification.show("Commit failed", e.getMessage(), Type.ERROR_MESSAGE);
                e.printStackTrace();
            }
        }

        private SubStep addSubStep(final NativeSelect parentStepSelect, AbstractStep dataSource) {
            SubStep subStep = new SubStep();
            subStep.setCaption(dataSource.getCaption());
            subStep.setCaptionMode(dataSource.getCaptionMode());
            subStep.setStartDate(dataSource.getStartDate());
            subStep.setEndDate(dataSource.getEndDate());
            subStep.setBackgroundColor(dataSource.getBackgroundColor());
            subStep.setDescription(dataSource.getDescription());
            subStep.setStyleName(dataSource.getStyleName());
            ((Step) parentStepSelect.getValue()).addSubStep(subStep);
            return subStep;
        }
    });
    Button cancel = new Button("Cancel", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            group.discard();
            win.close();
        }
    });
    Button delete = new Button("Delete", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            AbstractStep step = ((BeanItem<AbstractStep>) group.getItemDataSource()).getBean();
            if (step instanceof SubStep) {
                SubStep substep = (SubStep) step;
                substep.getOwner().removeSubStep(substep);
            } else {
                gantt.removeStep((Step) step);
                if (ganttListener != null) {
                    ganttListener.stepDeleted((Step) step);
                }
            }
            win.close();
        }
    });
    buttons.addComponent(ok);
    buttons.addComponent(cancel);
    buttons.addComponent(delete);
    win.setClosable(true);

    DashboardUI.getCurrent().getUI().addWindow(win);
}

From source file:com.pms.component.ganttchart.scheduletask.TaskGanntChart.java

License:Apache License

private void openStepEditor(AbstractStep step) {
    final Window win = new Window("More Info");
    win.setResizable(false);/*from  w  ww.ja v a 2s  .com*/
    win.center();

    VerticalLayout content = new VerticalLayout();
    content.setMargin(true);
    content.setSpacing(true);
    win.setContent(content);

    String taskName = step.getCaption();
    UserStoryDAO userStoryDAO = (UserStoryDAO) DashboardUI.context.getBean("UserStory");
    UserStory userStory = userStoryDAO.getCurrentWorkingUserStory(project);

    TaskDAO taskDAO = (TaskDAO) DashboardUI.context.getBean("Task");
    Task task1 = taskDAO.getTaskFromUserStroyNameAndTaskName(userStory.getName(), taskName);

    TextField userStoryNameField = new TextField("Task Name");
    userStoryNameField.setValue(task1.getName());

    TextField userStoryPriority = new TextField("Priority");
    userStoryPriority.setValue(String.valueOf(task1.getPriority()));

    TextField userStoryState = new TextField("State");
    userStoryState.setValue(task1.getState());

    TextField projectName = new TextField("Project Name");
    projectName.setValue(project.getName());

    TextField userStoryName = new TextField("UserStoryName Name");
    userStoryName.setValue(userStory.getName());

    content.addComponent(userStoryNameField);
    content.addComponent(userStoryPriority);
    content.addComponent(userStoryState);
    content.addComponent(projectName);
    content.addComponent(userStoryName);

    Button ok = new Button("Ok", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {

            win.close();
        }

    });

    content.addComponent(ok);
    win.setClosable(true);

    DashboardUI.getCurrent().getUI().addWindow(win);
}

From source file:com.pms.component.ganttchart.scheduletask.UserStoryGanntChart.java

License:Apache License

private void openStepEditor(AbstractStep step) {
    final Window win = new Window("More Info");
    win.setResizable(false);/*from   ww w.j  a  v  a  2  s  .  c o m*/
    win.center();

    VerticalLayout content = new VerticalLayout();
    content.setMargin(true);
    content.setSpacing(true);
    win.setContent(content);

    String userStoryName = step.getCaption();
    UserStoryDAO userStoryDAO = (UserStoryDAO) DashboardUI.context.getBean("UserStory");
    UserStory userStory = userStoryDAO.getUserStoryFormProjectNameAndUserStoryName(project.getName(),
            userStoryName);

    TextField userStoryNameField = new TextField("User Story Name");
    userStoryNameField.setValue(userStory.getName());

    TextField userStoryPriority = new TextField("Priority");
    userStoryPriority.setValue(String.valueOf(userStory.getPriority()));

    TextField userStoryState = new TextField("State");
    userStoryState.setValue(userStory.getState());

    TextField projectName = new TextField("Project Name");
    projectName.setValue(project.getName());

    content.addComponent(userStoryNameField);
    content.addComponent(userStoryPriority);
    content.addComponent(userStoryState);
    content.addComponent(projectName);

    Button ok = new Button("Ok", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {

            win.close();
        }

    });

    content.addComponent(ok);
    win.setClosable(true);

    DashboardUI.getCurrent().getUI().addWindow(win);
}

From source file:com.pow.ui.user.LoginFormFieldFactory.java

License:Apache License

@Override
public Field createField(Item item, Object propertyId, Component uiContext) {
    String pid = (String) propertyId;
    if (pid.equals("password")) {
        TextField passwordField = new TextField(app.getMessage("LoginFormFieldFactory.password"));
        passwordField.setSecret(true);/*w w  w.  j av  a 2s .c o m*/
        return passwordField;
    } else if (pid.equals("email")) {
        return new TextField(app.getMessage("LoginFormFieldFactory.email"));
    }
    return null;
}

From source file:com.rdonasco.security.application.views.ApplicationEditorView.java

License:Apache License

public ApplicationEditorView() {
    applicationInfoPanel = new Panel(I18NResource.localize("Application Editor"));
    hostViewContainer = new VerticalLayout();
    nameField = new TextField(I18NResource.localize("Name"));
    tokenField = new TextField(I18NResource.localize("Token"));
    buttonsLayout = new HorizontalLayout();
    cancelButton = new Button();
    saveButton = new Button();
    editButton = new Button();
    generateTokenButton = new Button();
}

From source file:com.save.area.CreateNewAreaWindow.java

VerticalLayout getVlayout() {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setSizeFull();//from   ww w.j a  v a  2s  .  c  om
    vlayout.setMargin(true);
    vlayout.setSpacing(true);

    final TextField areaField = new TextField("Create Area: ");
    areaField.setWidth("100%");
    areaField.setRequired(true);
    areaField.setRequiredError("*Required Field");
    vlayout.addComponent(areaField);

    Button createBtn = new Button("CREATE NEW AREA");
    createBtn.setWidth("100%");
    createBtn.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (as.isAreaExist(areaField.getValue().trim().toLowerCase())) {
                Notification.show("Area already Exist!", Notification.Type.WARNING_MESSAGE);
                return;
            }

            if (areaField.getValue() == null || areaField.getValue().trim().isEmpty()) {
                Notification.show("Area Field cannot be empty!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            boolean result = as.createNewArea(areaField.getValue().trim().toLowerCase());
            if (result) {
                Notification.show("Done!");
                close();
            }
        }
    });
    createBtn.setImmediate(true);

    vlayout.addComponent(createBtn);

    return vlayout;
}

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

FormLayout clientInformationForm() {
    form.setMargin(false);/*  ww  w.ja  v  a 2 s  .c  o m*/
    form.setWidth("100%");
    form.addStyleName("light");
    form.setReadOnly(readOnly);
    form.setImmediate(true);

    editClientBtn = new Button(EDIT_BUTTON_CAPTION, editBtnListener);
    editClientBtn.setEnabled(false);

    cancelBtn = new Button(CANCEL_BUTTON_CAPTION, cancelBtnListener);
    cancelBtn.setEnabled(false);

    newClientBtn = new Button(NEW_BUTTON_CAPTION, newBtnListener);

    client = new TextField("Name: ");
    client.setWidth("50%");
    client.setRequired(true);
    client.setRequiredError("Required Name!");
    form.addComponent(client);

    province.setInputPrompt("Select Province..");
    province.setRequired(true);
    province.setRequiredError("Required Province!");

    city.setInputPrompt("Select City..");
    city.setRequired(true);
    city.setRequiredError("Required City/Town!");

    province.addValueChangeListener(new ProvincePropertyChangeListener(city));
    province.setWidth("100%");
    form.addComponent(province);

    city.setWidth("100%");
    form.addComponent(city);

    address = new TextField("Street/Brgy: ");
    address.setWidth("50%");
    address.setRequired(true);
    address.setRequiredError("Required Street/Brgy!");
    form.addComponent(address);

    landline = new TextField("Landline No: ");
    landline.setWidth("50%");
    landline.setRequired(true);
    landline.setRequiredError("Required Contact No!");
    form.addComponent(landline);

    mobile = new TextField("Mobile No: ");
    mobile.setWidth("50%");
    mobile.setRequired(true);
    mobile.setRequiredError("Required Contact No!");
    form.addComponent(mobile);

    setAsDistributor = new OptionGroup("Distributor");
    setAsDistributor.addItems("Yes", "No");
    setAsDistributor.addStyleName("horizontal");
    setAsDistributor.setRequired(readOnly);
    setAsDistributor.setRequiredError("Set option(Y/N) As Distrbutor!");
    setAsDistributor.addValueChangeListener(distributorCheckboxListener);
    form.addComponent(setAsDistributor);

    clientType.setWidth("90%");
    clientType.setRequired(true);
    clientType.setRequiredError("Required Client Type!");
    clientType.setVisible(false);
    form.addComponent(clientType);

    if (getClientId() != 0) {
        editClientBtn.setEnabled(true);
        Client c = clientService.getClientDataById(getClientId());

        client.setValue(c.getClientName().toUpperCase());
        province.setValue(c.getProvince().getProvinceId());
        city.setValue(c.getCityId());
        address.setValue(c.getStreet());
        landline.setValue(c.getLandline());
        mobile.setValue(c.getMobile());

        if (c.getAsDistributor() == 0) {
            setAsDistributor.setValue("No");
            clientType.setVisible(true);
            clientType.setValue(c.getClientType());
        } else {
            setAsDistributor.setValue("Yes");
            clientType.setVisible(false);
            clientType.setValue("distributor");
        }
    }

    form.setReadOnly(true);

    HorizontalLayout footer = new HorizontalLayout();
    footer.setMargin(new MarginInfo(true, true, true, false));
    footer.setSpacing(true);
    footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    form.addComponent(footer);
    footer.addComponent(editClientBtn);
    footer.addComponent(cancelBtn);
    footer.addComponent(newClientBtn);

    removeBtn = new Button("Remove Account");
    removeBtn.addClickListener(removeBtnListener);
    form.addComponent(removeBtn);

    disableFields(false);
    return form;
}

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

VerticalLayout acknowledgementFormContent() {
    VerticalLayout content = new VerticalLayout();
    content.setSizeFull();/* www  .j  a v  a  2  s  . c  om*/
    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.CreateNewAccountWindow.java

FormLayout getLayout() {
    FormLayout f = new FormLayout();
    f.setReadOnly(false);// w  w  w . j  av a 2 s . c o m
    f.setSpacing(true);
    f.setMargin(true);

    final TextField employeeNo = new TextField("Employee No: ");
    employeeNo.setWidth("100%");
    employeeNo.setRequired(true);
    employeeNo.setNullSettingAllowed(false);
    f.addComponent(employeeNo);

    final TextField firstname = new TextField("Firstname: ");
    firstname.setWidth("100%");
    firstname.setRequired(true);
    firstname.setNullSettingAllowed(false);
    f.addComponent(firstname);

    final TextField middlename = new TextField("Middlename: ");
    middlename.setWidth("100%");
    middlename.setRequired(true);
    middlename.setNullSettingAllowed(false);
    f.addComponent(middlename);

    final TextField lastname = new TextField("Lastname: ");
    lastname.setWidth("100%");
    lastname.setRequired(true);
    lastname.setNullSettingAllowed(false);
    f.addComponent(lastname);

    final OptionGroup gender = new OptionGroup("Gender: ");
    gender.addItem("Female");
    gender.addItem("Male");
    gender.addStyleName("horizontal");
    gender.setValue("Female");
    f.addComponent(gender);

    final ComboBox status = new ComboBox("Status: ");
    status.setWidth("100%");
    status.setNullSelectionAllowed(false);
    status.addItem("Single");
    status.addItem("Married");
    status.addItem("Widow");
    status.addItem("Separated");
    f.addComponent(status);

    Button saveBtn = new Button("SAVE");
    saveBtn.setWidth("100%");
    saveBtn.addClickListener((Button.ClickEvent event) -> {
        //TODO
        if (employeeNo.getValue().isEmpty() || employeeNo.getValue() == null) {
            Notification.show("Requried Emloyee ID", Notification.Type.WARNING_MESSAGE);
            return;
        }

        if (firstname.getValue().isEmpty() || firstname.getValue() == null) {
            Notification.show("Requried Firstname", Notification.Type.WARNING_MESSAGE);
            return;
        }

        if (middlename.getValue().isEmpty() || middlename.getValue() == null) {
            Notification.show("Requried Middlename", Notification.Type.WARNING_MESSAGE);
            return;
        }

        if (lastname.getValue().isEmpty() || lastname.getValue() == null) {
            Notification.show("Requried Lastname", Notification.Type.WARNING_MESSAGE);
            return;
        }

        if (status.getValue() == null) {
            Notification.show("Requried Status", Notification.Type.WARNING_MESSAGE);
        }

        if (employeeService.checkIfEmployeeNoExist(employeeNo.getValue().trim().toLowerCase())) {
            Notification.show("EmployeeId already Exist!", Notification.Type.ERROR_MESSAGE);
            return;
        }

        Employee e = new Employee();
        e.setEmployeeNo(employeeNo.getValue().trim().toLowerCase());
        e.setFirstname(firstname.getValue().trim().toLowerCase());
        e.setMiddlename(middlename.getValue().trim().toLowerCase());
        e.setLastname(lastname.getValue().trim().toLowerCase());
        e.setGender(gender.getValue().toString().trim().toLowerCase());
        e.setPersonalStatus(status.getValue().toString());

        boolean result = employeeService.createNewAccount(e);
        if (result) {
            close();
            getHsplit().setFirstComponent(new EmployeesDataGridProperties(getHsplit(), "personal"));
        }
    });
    f.addComponent(saveBtn);

    return f;
}