Example usage for com.vaadin.ui VerticalLayout setSizeUndefined

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

Introduction

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

Prototype

@Override
    public void setSizeUndefined() 

Source Link

Usage

From source file:com.purebred.core.view.entityselect.EntitySelect.java

License:Open Source License

public void open() {
    popupWindow = new Window(getEntityCaption());
    popupWindow.addStyleName("p-entity-select-window");
    popupWindow.addStyleName("opaque");
    VerticalLayout layout = (VerticalLayout) popupWindow.getContent();
    layout.setMargin(true);/*from ww  w  .j  ava2s. c om*/
    layout.setSpacing(true);
    layout.setSizeUndefined();
    popupWindow.setSizeUndefined();
    popupWindow.setModal(true);
    popupWindow.setClosable(true);

    getResults().getEntityQuery().clear();
    getResults().selectPageSize(5);
    getResults().search();
    configurePopupWindow(popupWindow);
    popupWindow.addComponent(this);

    MainApplication.getInstance().getMainWindow().addWindow(popupWindow);
}

From source file:com.purebred.core.view.FormComponent.java

License:Open Source License

/**
 * Called after Spring constructs this bean. Overriding methods should call super.
 *//*from   www . j  av  a 2s.c o  m*/
@PostConstruct
public void postConstruct() {
    setSizeUndefined();
    form = new ConfigurableForm();
    form.setSizeUndefined();

    form.setWriteThrough(true);
    form.setInvalidCommitted(true);
    form.setImmediate(true);
    form.setValidationVisibleOnCommit(true);
    form.addStyleName("p-form-component");

    configureFields(getFormFields());
    form.setFormFieldFactory(new EntityFieldFactory(getFormFields()));

    final GridLayout gridLayout = getFormFields().createGridLayout();
    form.setLayout(gridLayout);

    form.getFooter().addStyleName("p-form-component-footer");
    createFooterButtons((HorizontalLayout) form.getFooter());

    VerticalLayout tabsAndForm = new VerticalLayout();
    tabsAndForm.setSizeUndefined();
    if (getFormFields().hasTabs()) {
        initializeTabs(tabsAndForm);
        if (getFormFields().hasOptionalTabs()) {
            initializeOptionalTabs(tabsAndForm);
        }
    }
    tabsAndForm.addComponent(form);

    Label spaceLabel = new Label("</br>", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();
    tabsAndForm.addComponent(spaceLabel);

    VerticalLayout formComponentLayout = new VerticalLayout();
    formComponentLayout.addComponent(animate(tabsAndForm));

    setCompositionRoot(formComponentLayout);
    setCustomSizeUndefined();

    labelDepot.trackLabels(getFormFields());
}

From source file:com.purebred.core.view.ResultsConnectedEntityForm.java

License:Open Source License

private HorizontalLayout createNavigationFormLayout() {
    HorizontalLayout navigationFormLayout = new HorizontalLayout();
    navigationFormLayout.setSizeUndefined();

    VerticalLayout previousButtonLayout = new VerticalLayout();
    previousButtonLayout.setSizeUndefined();
    previousButtonLayout.setMargin(false);
    previousButtonLayout.setSpacing(false);
    Label spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();/*from  ww  w .  j  a v a  2 s . co m*/
    previousButtonLayout.addComponent(spaceLabel);

    previousButton = new Button(null, this, "previousItem");
    previousButton.setDescription(entityForm.uiMessageSource.getMessage("entityForm.previous.description"));
    previousButton.setSizeUndefined();
    previousButton.addStyleName("borderless");
    previousButton.setIcon(new ThemeResource("icons/16/previous.png"));

    if (entityForm.getViewableToManyRelationships().size() == 0) {
        HorizontalLayout previousButtonHorizontalLayout = new HorizontalLayout();
        previousButtonHorizontalLayout.setSizeUndefined();
        Label horizontalSpaceLabel = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML);
        horizontalSpaceLabel.setSizeUndefined();
        previousButtonHorizontalLayout.addComponent(previousButton);
        previousButtonHorizontalLayout.addComponent(horizontalSpaceLabel);
        previousButtonLayout.addComponent(previousButtonHorizontalLayout);
    } else {
        previousButtonLayout.addComponent(previousButton);
    }

    navigationFormLayout.addComponent(previousButtonLayout);
    navigationFormLayout.setComponentAlignment(previousButtonLayout, Alignment.TOP_LEFT);

    navigationFormLayout.addComponent(entityForm);

    VerticalLayout nextButtonLayout = new VerticalLayout();
    nextButtonLayout.setSizeUndefined();
    nextButtonLayout.setMargin(false);
    nextButtonLayout.setSpacing(false);
    spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();
    previousButtonLayout.addComponent(spaceLabel);
    nextButtonLayout.addComponent(spaceLabel);

    nextButton = new Button(null, this, "nextItem");
    nextButton.setDescription(entityForm.uiMessageSource.getMessage("entityForm.next.description"));
    nextButton.setSizeUndefined();
    nextButton.addStyleName("borderless");
    nextButton.setIcon(new ThemeResource("icons/16/next.png"));

    HorizontalLayout nextButtonHorizontalLayout = new HorizontalLayout();
    nextButtonHorizontalLayout.setSizeUndefined();
    Label horizontalSpaceLabel = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML);
    horizontalSpaceLabel.setSizeUndefined();
    nextButtonHorizontalLayout.addComponent(horizontalSpaceLabel);
    nextButtonHorizontalLayout.addComponent(nextButton);

    nextButtonLayout.addComponent(nextButtonHorizontalLayout);
    navigationFormLayout.addComponent(nextButtonLayout);
    navigationFormLayout.setComponentAlignment(nextButtonLayout, Alignment.TOP_RIGHT);

    navigationFormLayout.setSpacing(false);
    navigationFormLayout.setMargin(false);

    return navigationFormLayout;
}

From source file:com.skysql.manager.ui.LoginView.java

License:Open Source License

/**
 * Instantiates a new login view.//from  w ww. ja  v  a 2  s  .com
 *
 * @param aboutRecord the about record
 */
public LoginView() {

    setSizeFull();
    setMargin(true);
    setSpacing(true);
    addStyleName("loginView");

    VerticalLayout logoLayout = new VerticalLayout();
    addComponent(logoLayout);
    setComponentAlignment(logoLayout, Alignment.BOTTOM_CENTER);
    setExpandRatio(logoLayout, 1.0f);

    Embedded logo = new Embedded(null, new ThemeResource("img/loginlogo.png"));
    logoLayout.addComponent(logo);
    logoLayout.setComponentAlignment(logo, Alignment.BOTTOM_CENTER);

    Label releaseInfo = new Label("Version " + ManagerUI.GUI_RELEASE);
    releaseInfo.setSizeUndefined();
    releaseInfo.addStyleName("releaseInfo");
    logoLayout.addComponent(releaseInfo);
    logoLayout.setComponentAlignment(releaseInfo, Alignment.TOP_CENTER);

    VerticalLayout spacer = new VerticalLayout();
    spacer.setHeight("20px");
    logoLayout.addComponent(spacer);

    VerticalLayout loginBox = new VerticalLayout();
    loginBox.addStyleName("loginBox");
    loginBox.setSizeUndefined();
    loginBox.setMargin(true);
    loginBox.setSpacing(true);
    addComponent(loginBox);
    setComponentAlignment(loginBox, Alignment.MIDDLE_CENTER);

    VerticalLayout loginFormLayout = new VerticalLayout();
    loginFormLayout.addStyleName("loginForm");
    loginFormLayout.setMargin(true);
    loginFormLayout.setSpacing(true);
    loginBox.addComponent(loginFormLayout);

    // userName.focus();
    userName.setStyleName("loginControl");
    userName.setInputPrompt("Username");
    userName.setImmediate(true);
    userName.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void valueChange(ValueChangeEvent event) {
            password.focus();
            login.setClickShortcut(KeyCode.ENTER);
        }
    });
    loginFormLayout.addComponent(userName);
    loginFormLayout.setComponentAlignment(userName, Alignment.MIDDLE_CENTER);

    // spacer
    loginFormLayout.addComponent(new Label(""));

    password.setStyleName("loginControl");
    password.setInputPrompt("Password");
    password.setImmediate(true);
    password.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void valueChange(ValueChangeEvent event) {
            login.focus();
        }
    });
    loginFormLayout.addComponent(password);
    loginFormLayout.setComponentAlignment(password, Alignment.MIDDLE_CENTER);

    // spacer
    loginFormLayout.addComponent(new Label(" "));

    login.setStyleName("loginControl");
    login.setEnabled(false);

    loginFormLayout.addComponent(login);
    loginFormLayout.setComponentAlignment(login, Alignment.BOTTOM_CENTER);

    VerticalLayout filler = new VerticalLayout();
    addComponent(filler);
    setExpandRatio(filler, 1.0f);

    preload();

}

From source file:com.skysql.manager.ui.PanelTools.java

License:Open Source License

/**
 * Instantiates a new panel tools./*  w ww  . j a v a  2 s . com*/
 */
PanelTools() {

    // thisTab.setSizeFull();
    // thisTab.setWidth(Sizeable.SIZE_UNDEFINED, 0); // Default
    setHeight("200px");
    setSpacing(true);

    // External Tools Vertical Module
    SystemInfo systemInfo = getSession().getAttribute(SystemInfo.class);
    LinkedHashMap<String, String> properties = systemInfo.getCurrentSystem().getProperties();
    if (properties != null) {
        VerticalLayout externalsLayout = new VerticalLayout();
        externalsLayout.setWidth("150px");
        externalsLayout.addStyleName("externalsLayout");
        externalsLayout.setSpacing(true);

        String EIP = properties.get(SystemInfo.PROPERTY_EIP);
        String MONyog = properties.get(SystemInfo.PROPERTY_MONYOG);
        if (EIP != null && MONyog != null) {
            String url = "http://" + EIP + MONyog;
            monyogLink = new Link("MONyog", new ExternalResource(url));
            monyogLink.setTargetName("_blank");
            monyogLink.setDescription("Open MONyog for the whole system");
            monyogLink.setIcon(new ThemeResource("img/externalLink.png"));
            monyogLink.addStyleName("icon-after-caption");
            externalsLayout.addComponent(monyogLink);
            externalsLayout.setComponentAlignment(monyogLink, Alignment.BOTTOM_CENTER);
        }

        phpUrl = properties.get(SystemInfo.PROPERTY_PHPMYADMIN);
        if (phpUrl != null) {
            phpLink = new Link("phpMyAdmin", null);
            phpLink.setTargetName("_blank");
            phpLink.setDescription("Open phpMyAdmin for the selected node");
            phpLink.setIcon(new ThemeResource("img/externalLink.png"));
            phpLink.addStyleName("icon-after-caption");
            externalsLayout.addComponent(phpLink);
            externalsLayout.setComponentAlignment(phpLink, Alignment.BOTTOM_CENTER);
        }

        addComponent(externalsLayout);
        setComponentAlignment(externalsLayout, Alignment.MIDDLE_CENTER);

    }

    {
        Label spacer = new Label();
        spacer.setWidth("40px");
        addComponent(spacer);
    }

    // Scripting layout placeholder
    VerticalLayout placeholderLayout = new VerticalLayout();
    placeholderLayout.addStyleName("placeholderLayout");
    placeholderLayout.setSizeUndefined();

    Label placeholderLabel = new Label("Links to external tools");
    placeholderLabel.addStyleName("instructions");
    placeholderLayout.addComponent(placeholderLabel);

    addComponent(placeholderLayout);
    setComponentAlignment(placeholderLayout, Alignment.MIDDLE_CENTER);

}

From source file:com.snowy.UsersList.java

public UsersList(data d) {
    this.d = d;/*www .jav a2  s.  c o m*/
    c.addContainerProperty("id", Integer.class, "");
    retrieveActiveUsers();
    //this.addItem("Chase");
    //this.addItem("Cole");

    //ll.addComponent(ll);
    //PopupView pop = new PopupView(null,ll);
    //pop.s
    //pop.addPopupVisibilityListener(e->{
    //   ll.addComponent(hl);
    //});

    //TODO add the select listener
    ls.addValueChangeListener(e -> {
        if (e.getProperty().getValue() != null) {
            Window w = new Window("Confirm Challenge");
            int id = Integer.parseInt(c.getItem(e.getProperty().getValue().toString()).getItemProperty("id")
                    .getValue().toString());
            String Username = e.getProperty().getValue().toString();
            //Logger.getLogger(UsersList.class.getName()).info(Username);
            //Logger.getLogger(UsersList.class.getName()).info(id+"");
            VerticalLayout ll = new VerticalLayout();
            VerticalLayout bb = new VerticalLayout();
            HorizontalLayout hl = new HorizontalLayout();
            Label la = new Label("Send challenge to " + Username + "?");
            bb.addComponent(la);
            ll.addComponent(bb);

            ll.setSizeUndefined();
            bb.setComponentAlignment(la, Alignment.MIDDLE_CENTER);

            ll.addComponent(hl);
            ll.setSpacing(true);
            ll.setMargin(new MarginInfo(true, true, false, true));
            hl.setMargin(new MarginInfo(false, true, true, true));
            hl.setSpacing(true);
            Button cancle = new Button("Cancel", b -> {
                w.close();
            });
            Button send = new Button("Send", c -> {
                if (d.sendChallenge(id)) {
                    ll.removeAllComponents();
                    ll.addComponent(new Label("Challenge Sent Succesfully!"));
                    ll.addComponent(new Button("Close", dd -> {
                        w.close();
                    }));
                    w.setCaption("Success");
                    ll.setSpacing(true);
                    ll.setMargin(true);
                } else {
                    ll.removeAllComponents();
                    ll.addComponent(new Label("Challenge Dend Failed"));
                    ll.addComponent(new Button("Close", dd -> {
                        w.close();
                    }));
                    w.setCaption("Failure");
                    ll.setSpacing(true);
                    ll.setMargin(true);
                }
            });
            hl.addComponents(cancle, send);
            //      this.addComponent(pop);
            //    ll.addComponent(la);
            //   pop.setPopupVisible(true);
            //w.setPosition(null, null);
            w.center();
            w.setModal(true);
            w.setClosable(false);
            w.setResizable(false);
            w.setContent(ll);
            this.getUI().addWindow(w);

        }
    });

    this.setSizeFull();
    this.addStyleName("mine");
    this.addComponent(ls);
    ls.setContainerDataSource(c);
    //ls.setContainerDataSource((Container) hm.keySet());
    ls.setSizeFull();
    ls.setImmediate(true);

}

From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java

public VerticalLayout getUserDetailsContainer(String strUID, String strAction, Window pop, Object xrid,
        IndexedContainer xcontainer) {//from w  ww  . ja va  2 s. c  o  m
    this.xrid = xrid;
    this.xcontainer = xcontainer;
    curUser = strUID;
    cpop = pop;
    cUDetails = new VerticalLayout();
    cUDetails.setMargin(new MarginInfo(false, false, false, false));

    cUDetails.setStyleName("c_u_details");
    cUDetails.setSizeFull();

    VerticalLayout cCHeader = new VerticalLayout();
    cCHeader.setSizeUndefined();
    cCHeader.setStyleName("c_c_header");
    cCHeader.setMargin(new MarginInfo(false, true, false, false));
    String strCHeader;

    if (boolEditStatus) {
        strCHeader = "Edit Details of " + strUID;
    } else {
        strCHeader = "Showing Details of " + strUID;

    }

    Label lbCHeader = new Label(strCHeader);
    lbCHeader.setStyleName("label_c_header");
    lbCHeader.setSizeUndefined();
    cCHeader.addComponent(lbCHeader);

    cPerAccAuthInfo = new HorizontalLayout();
    cPerAccAuthInfo.setStyleName("c_per_acc_auth_info");
    cPerAccAuthInfo.setSizeUndefined();

    VerticalLayout cTabLike = null;

    cTabLike = getManageUserMenu();
    cTabLike.setSizeUndefined();

    cCHeader.addComponent(cTabLike);
    cUDetails.addComponent(cCHeader);
    cUDetails.setComponentAlignment(cCHeader, Alignment.MIDDLE_CENTER);

    cUDetails.addComponent(cPerAccAuthInfo);
    cUDetails.setComponentAlignment(cPerAccAuthInfo, Alignment.MIDDLE_CENTER);
    // cUDetails.setExpandRatio(cPerAccAuthInfo, 1.0f);

    HorizontalLayout cUDetailsAndOperations = setDetailsForm(strUID,

            strAction);

    cP = cUDetailsAndOperations;
    cPerAccAuthInfo.addComponent(cUDetailsAndOperations);

    return cUDetails;
}

From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java

private VerticalLayout getManageUserMenu() {

    VerticalLayout cManageUserMenu = new VerticalLayout();
    cManageUserMenu.setStyleName("c_u_manage_menu");
    cManageUserMenu.setSizeUndefined();

    HorizontalLayout cManageAndAddTab = new HorizontalLayout();

    final BtnTabLike btnPersonal = new BtnTabLike("Basic", null);
    btnPersonal.setStyleName("btn_tab_like btn_tab_like_active");
    btnPersonal.setEnabled(false);/*from w w  w .j a  v  a 2  s.c o  m*/

    final BtnTabLike btnLinks = new BtnTabLike("Manage Downlines", null);

    final BtnTabLike btnProfile = new BtnTabLike("User Profile", null);

    final BtnTabLike btnAccount = new BtnTabLike("Account", null);
    // BtnTabLike btnAuth = new BtnTabLike("Authentication", null);
    final BtnTabLike btnLog = new BtnTabLike("Log", null);
    cManageAndAddTab.addComponent(btnPersonal);
    cManageAndAddTab.addComponent(btnAccount);
    if (xcontainer.getItem(xrid).getItemProperty("Profile Type").getValue().toString()
            .equals("MATS_DEALER_USER_PROFILE"))
        cManageAndAddTab.addComponent(btnLinks);

    cManageAndAddTab.addComponent(btnProfile);

    // cManageAndAddTab.addComponent(btnAuth);
    cManageAndAddTab.addComponent(btnLog);

    // arrLTabBtns.add(btnAuth);

    btnPersonal.setEnabled(false);

    ArrayList<HorizontalLayout> arrLSubTabs = new ArrayList<HorizontalLayout>();

    final HorizontalLayout cManUserSubMenu = getAddUserSubMenu(btnLog, btnPersonal, btnAccount, btnLinks,
            btnProfile);

    arrLSubTabs.add(cManUserSubMenu);

    cManageUserMenu.addComponent(cManageAndAddTab);
    cManageUserMenu.addComponent(cManUserSubMenu);

    btnPersonal.addClickListener(new Button.ClickListener() {

        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {

            btnPersonal.setEnabled(false);
            btnPersonal.setStyleName("btn_tab_like btn_tab_like_active");

            if (!btnAccount.isEnabled())
                p = cA;
            if (!btnLinks.isEnabled())
                p = cL;

            if (!btnProfile.isEnabled())
                p = cProf;

            btnAccount.setEnabled(true);
            btnAccount.setStyleName("btn_tab_like");

            btnLinks.setEnabled(true);
            btnLinks.setStyleName("btn_tab_like");

            btnProfile.setEnabled(true);
            btnProfile.setStyleName("btn_tab_like");

            if (!isfromsub) {
                p = (HorizontalLayout) cPerAccAuthInfo.getComponent(0);
                cPerAccAuthInfo.replaceComponent(p, cP);
            } else {
                prevL = (HorizontalLayout) cPerAccAuthInfo.getComponent(0);
                cPerAccAuthInfo.replaceComponent(prevL, cP);

                btnLog.setEnabled(true);
                btnLog.setStyleName("btn_tab_like");
                cManUserSubMenu.setStyleName("c_sub_menu_invisible");
                isfromsub = false;
            }

            cpop.center();

        }
    });

    btnAccount.addClickListener(new Button.ClickListener() {

        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {

            btnAccount.setEnabled(false);
            btnAccount.setStyleName("btn_tab_like btn_tab_like_active");

            if (!btnPersonal.isEnabled())
                p = cP;
            if (!btnLinks.isEnabled())
                p = cL;

            if (!btnProfile.isEnabled())
                p = cProf;

            btnPersonal.setEnabled(true);
            btnPersonal.setStyleName("btn_tab_like");

            btnLinks.setEnabled(true);
            btnLinks.setStyleName("btn_tab_like");

            btnProfile.setEnabled(true);
            btnProfile.setStyleName("btn_tab_like");

            if (!isfromsub) {
                if (cA == null)
                    cA = getADC();
                p = (HorizontalLayout) cPerAccAuthInfo.getComponent(0);
                cPerAccAuthInfo.replaceComponent(p, cA);

            } else {
                if (cA == null)
                    cA = getADC();
                prevL = (HorizontalLayout) cPerAccAuthInfo.getComponent(0);
                cPerAccAuthInfo.replaceComponent(prevL, cA);

                isfromsub = false;
                btnLog.setEnabled(true);
                btnLog.setStyleName("btn_tab_like");
                cManUserSubMenu.setStyleName("c_sub_menu_invisible");

            }

            cpop.center();

        }
    });

    btnLinks.addClickListener(new Button.ClickListener() {

        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            btnLinks.setEnabled(false);
            btnLinks.setStyleName("btn_tab_like btn_tab_like_active");

            if (!btnPersonal.isEnabled())
                p = cP;
            if (!btnAccount.isEnabled())
                p = cA;
            if (!btnProfile.isEnabled())
                p = cProf;

            btnPersonal.setEnabled(true);
            btnPersonal.setStyleName("btn_tab_like");

            btnAccount.setEnabled(true);
            btnAccount.setStyleName("btn_tab_like");

            btnProfile.setEnabled(true);
            btnProfile.setStyleName("btn_tab_like");

            if (!isfromsub) {
                if (cL == null)
                    cL = getLC();

                p = (HorizontalLayout) cPerAccAuthInfo.getComponent(0);
                cPerAccAuthInfo.replaceComponent(p, cL);

            } else {
                if (cL == null)
                    cL = getLC();
                prevL = (HorizontalLayout) cPerAccAuthInfo.getComponent(0);
                cPerAccAuthInfo.replaceComponent(prevL, cL);

                isfromsub = false;
                btnLog.setEnabled(true);
                btnLog.setStyleName("btn_tab_like");
                cManUserSubMenu.setStyleName("c_sub_menu_invisible");

            }

            cpop.center();

        }
    });

    btnProfile.addClickListener(new Button.ClickListener() {

        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            btnProfile.setEnabled(false);
            btnProfile.setStyleName("btn_tab_like btn_tab_like_active");

            if (!btnPersonal.isEnabled())
                p = cP;
            if (!btnAccount.isEnabled())
                p = cA;
            if (!btnLinks.isEnabled())
                p = cL;
            if (btnProfile.isEnabled()) {
                return;
            }

            btnPersonal.setEnabled(true);
            btnPersonal.setStyleName("btn_tab_like");

            btnAccount.setEnabled(true);
            btnAccount.setStyleName("btn_tab_like");

            btnLinks.setEnabled(true);
            btnLinks.setStyleName("btn_tab_like");

            if (!isfromsub) {
                if (cProf == null)
                    cProf = getPC();

                p = (HorizontalLayout) cPerAccAuthInfo.getComponent(0);
                cPerAccAuthInfo.replaceComponent(p, cProf);

            } else {
                if (cProf == null)
                    cProf = getPC();
                prevL = (HorizontalLayout) cPerAccAuthInfo.getComponent(0);
                cPerAccAuthInfo.replaceComponent(prevL, cProf);

                isfromsub = false;
                btnLog.setEnabled(true);
                btnLog.setStyleName("btn_tab_like");
                cManUserSubMenu.setStyleName("c_sub_menu_invisible");

            }

            cpop.center();

        }
    });

    cManUserSubMenu.setSizeUndefined();

    return cManageUserMenu;

}

From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java

private VerticalLayout getUDContainer(String strUID) {

    if (bee == null)
        bee = new UserDetailsBackEnd();

    hm = bee.getUD(strUID);//from w  w w .  jav  a2  s .  c o m

    String strProf = hm.get("Profile Type");

    VerticalLayout cAgentInfo = new VerticalLayout();
    cAgentInfo.setMargin(new MarginInfo(true, false, true, false));
    cAgentInfo.setStyleName("c_details_test");
    cAgentInfo.setSizeUndefined();

    FormLayout cBasic = new FormLayout();

    // cBasic.setSpacing(true);
    Label lbB = new Label();
    lbB.setCaption("General");
    lbB.setStyleName("label_search_user u_d_t");

    cBasic.addComponent(lbB);
    String cap = "First Name";
    TextField tF = new TextField(cap);
    tFFN = tF;
    tFFN.setRequired(true);
    tF.setValue(hm.get(cap));

    addDatum("Username", hm.get("Username"), cBasic);
    addDatum("Profile", strProf, cBasic);
    addDatum("Account Status", hm.get("Status"), cBasic);
    addDatum("First Name", hm.get("First Name"), cBasic);

    tF = new TextField("Middle Name");
    addDatum("Middle Name", hm.get("Middle Name"), cBasic);
    addDatum("Last Name", hm.get("Last Name"), cBasic);
    addDatum("Gender", hm.get("Gender"), cBasic);
    addDatum("Occupation", hm.get("Occupation"), cBasic);
    addDatum("Date of Birth", hm.get("Date of Birth"), cBasic);
    addDatum("Country", hm.get("Country"), cBasic);
    addDatum("State", hm.get("State"), cBasic);
    addDatum("Local Government", hm.get("Local Government"), cBasic);

    VerticalLayout cC = new VerticalLayout();

    HorizontalLayout cBAndCAndAcc = new HorizontalLayout();
    cBAndCAndAcc.addComponent(cBasic);
    cBAndCAndAcc.addComponent(cC);

    FormLayout cCompany = new FormLayout();
    // Label lbC = new Label("Company");
    Label lbC = new Label();
    lbC.setCaption("Identification");
    lbC.setStyleName("label_search_user lb_frm_add_user u_d_t");

    combo = new ComboBox("ID Type");

    combo.addItem("Passport Number");
    combo.addItem("National Registration Identification Number");
    combo.addItem("Drivers License Number");
    combo.addItem("Identification Card");
    combo.addItem("Employer Identification Number");
    combo.select("Passport Number");
    comboIDType = combo;
    comboIDType.setRequired(true);

    cCompany.addComponent(lbC);
    addDatum("ID Type", hm.get("ID Type"), cCompany);
    addDatum("ID No.", hm.get("ID No."), cCompany);
    addDatum("Issuer", hm.get("Issuer"), cCompany);
    addDatum("Issue Date", hm.get("Issue Date"), cCompany);
    addDatum("Expiry Date", hm.get("Expiry Date"), cCompany);
    cC.addComponent(cCompany);

    FormLayout pC = new FormLayout();
    lbC = new Label();
    lbC.setCaption("Primary Contacts");
    lbC.setStyleName("label_search_user u_d_t");
    pC.addComponent(lbC);
    addDatum("Mobile Phone No.", hm.get("P-Mobile Phone No."), pC);
    addDatum("Alt. Phone No.", hm.get("P-Alt. Phone No."), pC);
    addDatum("Email Address", hm.get("Email"), pC);
    cC.addComponent(pC);

    FormLayout sC = new FormLayout();
    lbC = new Label();
    lbC.setCaption("Secondary Contacts");
    lbC.setStyleName("label_search_user lb_frm_add_user u_d_t");
    sC.addComponent(lbC);
    addDatum("Mobile Phone No.", hm.get("S-Mobile Phone No."), sC);
    addDatum("Alt. Phone No.", hm.get("S-Alt. Phone No."), sC);
    addDatum("Email Address", hm.get("Email"), sC);
    cC.addComponent(sC);

    FormLayout physicalC = new FormLayout();
    lbC = new Label();
    lbC.setCaption("Physical Address");
    lbC.setStyleName("label_search_user lb_frm_add_user u_d_t");
    physicalC.addComponent(lbC);
    StringBuilder sbAddr = new StringBuilder();

    String strp = hm.get("Postal Code");
    sbAddr.append((strp == null || strp.trim().isEmpty()) ? "" : "P.O.Box " + strp + ", ");
    strp = hm.get("Street");
    sbAddr.append((strp == null || strp.trim().isEmpty()) ? "" : strp + ", ");
    strp = hm.get("Province");
    sbAddr.append((strp == null || strp.trim().isEmpty()) ? "" : strp + ", ");

    strp = hm.get("State");
    sbAddr.append((strp == null || strp.trim().isEmpty()) ? "" : strp + ", ");

    strp = hm.get("Country");
    sbAddr.append((strp == null || strp.trim().isEmpty()) ? "." : strp);

    Label lb = new Label();
    lbC.setContentMode(ContentMode.HTML);

    lb.setStyleName("label_ud");
    lb.setCaption(sbAddr.toString());

    physicalC.addComponent(lb);

    cC.addComponent(physicalC);
    cC.addComponent(cBtnEditCancel);

    cC.setMargin(new MarginInfo(false, true, false, true));
    cAgentInfo.addComponent(cBAndCAndAcc);

    return cAgentInfo;
}

From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java

private VerticalLayout getEUDContainer() {

    if (cBtnEditCancel != null)
        cBtnEditCancel.setVisible(false);

    HashMap<Integer, String> profToID = new HashMap<>();

    profToID.put(1, "MATS_ADMIN_USER_PROFILE");
    profToID.put(3, "MATS_FINANCIAL_CONTROLLER_USER_PROFILE");
    profToID.put(4, "MATS_CUSTOMER_CARE_USER_PROFILE");
    profToID.put(6, "MATS_SUPER_AGENT_USER_PROFILE");
    profToID.put(7, "MATS_SUB_AGENT_USER_PROFILE");
    profToID.put(11, "MATS_DEALER_USER_PROFILE");
    profToID.put(15, "MATS_SERVICE_PROVIDER_USER_PROFILE");

    VerticalLayout cAgentInfo = new VerticalLayout();
    cAgentInfo.setMargin(new MarginInfo(true, false, true, false));
    cAgentInfo.setStyleName("c_details_test");
    cAgentInfo.setSizeUndefined();
    VerticalLayout cBasic = new VerticalLayout();
    Label lbB = new Label("Basic");
    lbB.setStyleName("lb_frm_add_user");
    cBasic.addComponent(lbB);//from w  w w .j ava2s .c o m

    TextField tF = new TextField("First Name");
    tFFN = tF;
    tFFN.setRequired(true);
    tF.setValue("Paul");
    arrLAllFormFields.add(tF);
    arrLAllEditableFields.add(tF);
    arrLTfEditableVals.add(tF.getValue());
    cBasic.addComponent(tF);

    tF = new TextField("Middle Name");
    tF.setValue("Pwndz");
    tFMN = tF;
    tFMN.setRequired(true);
    cBasic.addComponent(tF);

    tF = new TextField("Last Name");
    tF.setValue("Kigozi");
    tFLN = tF;
    tFLN.setRequired(true);
    arrLAllFormFields.add(tF);
    arrLAllEditableFields.add(tF);
    arrLTfEditableVals.add(tF.getValue());
    cBasic.addComponent(tF);

    OptionGroup opt = new OptionGroup("Gender");

    opt.addItem("FEMALE");
    // opt.setItemCaption(1, "Female");

    opt.addItem("MALE");
    // opt.setItemCaption(2, "Male");
    opt.select("MALE");
    optSex = opt;
    optSex.setRequired(true);
    arrLAllFormFields.add(opt);
    arrLAllEditableFields.add(opt);
    arrLTfEditableVals.add(opt.getValue().toString());
    cBasic.addComponent(opt);

    ComboBox combo = new ComboBox("Prefix");
    combo.addItem("Mr. ");
    combo.addItem("Mrs. ");
    combo.addItem("Dr. ");
    combo.addItem("Eng. ");
    combo.addItem("Prof. ");
    comboPref = combo;
    comboPref.select("Eng. ");

    arrLAllFormFields.add(combo);
    arrLAllEditableFields.add(combo);
    arrLTfEditableVals.add((combo.getValue() == null) ? "" : combo.getValue().toString());
    cBasic.addComponent(combo);

    combo = new ComboBox("Suffix");
    combo.addItem("Ph.D");
    combo.addItem("M.B.A");
    combo.addItem("RA");
    combo.addItem("CISA ");
    combo.select("Ph.D");
    comboSuff = combo;
    arrLAllFormFields.add(combo);
    arrLAllEditableFields.add(combo);
    arrLTfEditableVals.add((combo.getValue() == null) ? "" : combo.getValue().toString());
    cBasic.addComponent(combo);

    combo = new ComboBox("Language");
    combo.addItem(1);
    combo.select(1);
    combo.setItemCaption(1, "en-US");
    combo.addItem(2);
    combo.setItemCaption(2, "en-UK");
    combo.addItem(3);
    combo.setItemCaption(3, "fr");
    comboLang = combo;
    comboLang.setRequired(true);
    arrLAllFormFields.add(combo);
    arrLAllEditableFields.add(combo);
    arrLTfEditableVals.add((combo.getValue() == null) ? "" : combo.getValue().toString());
    cBasic.addComponent(combo);

    tF = new TextField("Occupation");
    tF.setValue("Software Engineer");
    tFOcc = tF;
    tFOcc.setRequired(true);
    arrLAllFormFields.add(tF);
    arrLAllEditableFields.add(tF);
    arrLTfEditableVals.add(tF.getValue());
    cBasic.addComponent(tF);

    tF = new TextField("Employer");
    tF.setValue("Swifta");
    tFEmp = tF;
    arrLAllFormFields.add(tF);
    arrLAllEditableFields.add(tF);
    arrLTfEditableVals.add(tF.getValue());
    cBasic.addComponent(tF);

    PopupDateField dF = new PopupDateField("DoB");
    cal = Calendar.getInstance();
    cal.set(1988, 11, 12);
    dF.setValue(cal.getTime());
    dFDoB = dF;
    arrLAllFormFields.add(dF);
    arrLAllEditableFields.add(dF);
    arrLTfEditableVals.add(dF.getValue().toString());
    cBasic.addComponent(dF);

    combo = new ComboBox("Country");

    comboCountry = combo;
    comboCountry.setRequired(true);
    cBasic.addComponent(combo);

    combo = new ComboBox("State");
    comboState = combo;
    comboState.setRequired(true);
    comboState.setNullSelectionAllowed(false);
    arrLAllFormFields.add(combo);
    arrLAllEditableFields.add(combo);
    arrLTfEditableVals.add((combo.getValue() == null) ? "" : combo.getValue().toString());
    cBasic.addComponent(combo);

    combo = new ComboBox("Local Government");
    // combo.addItem(1);
    // combo.setItemCaption(1, "Ca. LG");
    // combo.select(1);
    comboLG = combo;
    comboLG.setRequired(true);
    arrLAllFormFields.add(combo);
    arrLAllEditableFields.add(combo);
    arrLTfEditableVals.add((combo.getValue() == null) ? "" : combo.getValue().toString());
    cBasic.addComponent(combo);

    /*
     * if (!(strUserType.equals("CCO") || strUserType.equals("BA"))) {
     * 
     * cBasic.addComponent(dF);
     * 
     * combo.addItem("Passport"); combo.addItem("Voter's Card");
     * combo.addItem("Driving License"); combo.addItem("National ID");
     * combo.addItem("Residential ID"); cBasic.addComponent(combo);
     * 
     * tF = new TextField("ID No."); cBasic.addComponent(tF);
     * 
     * combo = new ComboBox("State"); cBasic.addComponent(combo);
     * 
     * combo = new ComboBox("Country"); cBasic.addComponent(combo); }
     */

    VerticalLayout cC = new VerticalLayout();

    HorizontalLayout cBAndCAndAcc = new HorizontalLayout();
    cBAndCAndAcc.addComponent(cBasic);
    cBAndCAndAcc.addComponent(cC);

    VerticalLayout cCompany = new VerticalLayout();
    // Label lbC = new Label("Company");
    Label lbC = new Label("Identification");
    lbC.setStyleName("lb_frm_add_user");

    combo = new ComboBox("ID Type");

    combo.addItem("Passport Number");
    combo.addItem("National Registration Identification Number");
    combo.addItem("Drivers License Number");
    combo.addItem("Identification Card");
    combo.addItem("Employer Identification Number");
    combo.select("Passport Number");
    comboIDType = combo;
    comboIDType.setRequired(true);

    arrLAllFormFields.add(combo);
    arrLAllEditableFields.add(combo);
    arrLTfEditableVals.add((combo.getValue() == null) ? "" : combo.getValue().toString());
    cCompany.addComponent(combo);

    tF = new TextField("ID No.");
    tF.setValue("001");
    tFIDNo = tF;
    tFIDNo.setRequired(true);
    arrLAllFormFields.add(tF);
    arrLAllEditableFields.add(tF);
    arrLTfEditableVals.add(tF.getValue());
    cCompany.addComponent(tF);

    tF = new TextField("Issuer");
    tFIssuer = tF;
    tFIssuer.setValue("Republic of Uganda");
    arrLAllFormFields.add(tF);
    arrLAllEditableFields.add(tF);
    arrLTfEditableVals.add(tF.getValue());
    cCompany.addComponent(tF);

    dF = new PopupDateField("Issue Date");
    // cal = Calendar.getInstance();
    cal.set(12, 12, 12);
    dF.setValue(cal.getTime());
    dFDoI = dF;
    arrLAllFormFields.add(dF);
    arrLAllEditableFields.add(dF);
    arrLTfEditableVals.add(dF.getValue().toString());
    cCompany.addComponent(dF);

    dF = new PopupDateField("Expiry Date");
    // cal = Calendar.getInstance();
    cal.set(14, 12, 12);
    dF.setValue(cal.getTime());
    dF.setValue(cal.getTime());
    dFDoE = dF;
    dFDoE.setRequired(true);
    dFDoE.setImmediate(true);
    arrLAllFormFields.add(dF);
    arrLAllEditableFields.add(dF);
    arrLTfEditableVals.add(dF.getValue().toString());
    cCompany.addComponent(dF);

    cC.addComponent(cCompany);

    VerticalLayout pC = new VerticalLayout();
    lbC = new Label("Primary Contacts");
    HorizontalLayout cLbc = new HorizontalLayout();
    cLbc.setSizeUndefined();
    cLbc.setMargin(new MarginInfo(true, false, false, false));
    cLbc.addComponent(lbC);
    pC.addComponent(cLbc);

    tF = new TextField("Mobile Phone No.");
    tF.setValue("+256704191152");
    arrLAllFormFields.add(tF);
    arrLAllEditableFields.add(tF);
    arrLTfEditableVals.add(tF.getValue());
    tFPMNo = tF;

    pC.addComponent(tF);

    tF = new TextField("Alt. Phone No.");
    tF.setValue("+1704191152");
    tFPANo = tF;
    arrLAllFormFields.add(tF);
    arrLAllEditableFields.add(tF);
    arrLTfEditableVals.add(tF.getValue());
    pC.addComponent(tF);

    tF = new TextField("Email Address");
    tF.setValue("pwndz172@gmail.com");
    tFPEmail = tF;
    arrLAllFormFields.add(tF);
    arrLAllEditableFields.add(tF);
    arrLTfEditableVals.add(tF.getValue());
    pC.addComponent(tF);
    cC.addComponent(pC);

    VerticalLayout sC = new VerticalLayout();
    lbC = new Label("Secondary Contacts");
    cLbc = new HorizontalLayout();
    cLbc.setSizeUndefined();
    cLbc.setMargin(new MarginInfo(true, false, false, false));
    cLbc.addComponent(lbC);
    sC.addComponent(cLbc);

    tF = new TextField("Mobile Phone No.");
    tF.setValue("+256804191152");
    tFSMNo = tF;
    arrLAllFormFields.add(tF);
    arrLAllEditableFields.add(tF);
    arrLTfEditableVals.add(tF.getValue());
    sC.addComponent(tF);

    tF = new TextField("Alt. Phone No.");
    tF.setValue("+1804191152");
    tFSANo = tF;
    arrLAllFormFields.add(tF);
    arrLAllEditableFields.add(tF);
    arrLTfEditableVals.add(tF.getValue());
    sC.addComponent(tF);

    tF = new TextField("E-mail Address");
    tF.setValue("pkigozi@swifta.com");
    tFSEmail = tF;
    arrLAllFormFields.add(tF);
    arrLAllEditableFields.add(tF);
    arrLTfEditableVals.add(tF.getValue());
    sC.addComponent(tF);

    cC.addComponent(sC);

    VerticalLayout physicalC = new VerticalLayout();
    lbC = new Label("Physical Address");
    cLbc = new HorizontalLayout();
    cLbc.setSizeUndefined();
    cLbc.setMargin(new MarginInfo(true, false, false, false));
    cLbc.addComponent(lbC);
    physicalC.addComponent(cLbc);

    tF = new TextField("Street");
    tF.setValue("Yusuf Lule Rd.");
    tFStreet = tF;
    tFStreet.setRequired(true);
    physicalC.addComponent(tF);

    tF = new TextField("Postal Code");
    tF.setValue("23");
    tFPostalCode = tF;
    physicalC.addComponent(tF);

    tF = new TextField("City");
    tF.setValue("Kampala");
    tFCity = tF;
    arrLAllFormFields.add(tF);
    arrLAllEditableFields.add(tF);
    arrLTfEditableVals.add(tF.getValue());
    tFCity.setRequired(true);
    physicalC.addComponent(tF);

    tF = new TextField("Province");
    tF.setValue("Central");
    tFProv = tF;
    arrLAllFormFields.add(tF);
    arrLAllEditableFields.add(tF);
    arrLTfEditableVals.add(tF.getValue());
    physicalC.addComponent(tF);

    cC.addComponent(physicalC);

    /*
     * || strUserType.equals("BA"))) { tF = new TextField("Fax");
     * cC.addComponent(tF); // strAccTypeCaption = Hierarch }
     */

    /*
     * tF = new TextField("E-mail Address"); cC.addComponent(tF);
     * 
     * tF = new TextField("Physical Address"); cC.addComponent(tF);
     */

    VerticalLayout cAcc = new VerticalLayout();
    Label lbAcc = new Label("Account");
    lbAcc.setStyleName("lb_frm_add_user");
    cAcc.addComponent(lbAcc);
    ComboBox comboHierarchy = null;

    comboHierarchy = new ComboBox("Profile");

    Set<Entry<Integer, String>> set = profToID.entrySet();
    for (Entry<Integer, String> e : set) {
        comboHierarchy.addItem(e.getKey());
        comboHierarchy.setItemCaption(e.getKey(), e.getValue());
    }

    comboHierarchy.select(1);
    comboProfile = comboHierarchy;
    comboProfile.setRequired(true);
    arrLAllFormFields.add(comboProfile);
    arrLAllEditableFields.add(comboProfile);
    arrLTfEditableVals.add((comboProfile.getValue() == null) ? "" : comboProfile.getValue().toString());
    cAcc.addComponent(comboHierarchy);

    final VerticalLayout cLBody = new VerticalLayout();

    tF = new TextField("Username");
    tF.setValue("Livepwndz");
    tFUN = tF;
    tFUN.setRequired(true);
    arrLAllFormFields.add(tF);
    arrLAllEditableFields.add(tF);
    arrLTfEditableVals.add(tF.getValue());
    cLBody.addComponent(tF);

    tF = new TextField("MSISDN");
    tF.setValue("+256774191152");
    tFMSISDN = tF;
    tFMSISDN.setRequired(true);
    arrLAllFormFields.add(tF);
    arrLAllEditableFields.add(tF);
    arrLTfEditableVals.add(tF.getValue());
    cLBody.addComponent(tF);

    // / tF = new TextField("PIN");
    // / cLBody.addComponent(tF);

    tF = new TextField("Email");
    tFAccEmail = tF;
    tFAccEmail.setRequired(true);
    tFAccEmail.setValue("ppounds1@gmail.com");
    arrLAllFormFields.add(tF);
    arrLAllEditableFields.add(tF);
    arrLTfEditableVals.add(tF.getValue());
    cLBody.addComponent(tF);

    combo = new ComboBox("Bank Domain");
    combo.addItem("Stanbic Bank");
    combo.select("Stanbic Bank");
    comboBDomain = combo;
    arrLAllFormFields.add(combo);
    arrLAllEditableFields.add(combo);
    arrLTfEditableVals.add((combo.getValue() == null) ? "" : combo.getValue().toString());
    cLBody.addComponent(combo);

    combo = new ComboBox("Bank Code ID");
    combo.addItem("001");
    combo.select("001");
    comboBID = combo;
    arrLAllFormFields.add(combo);
    arrLAllEditableFields.add(combo);
    arrLTfEditableVals.add((combo.getValue() == null) ? "" : combo.getValue().toString());
    cLBody.addComponent(combo);

    tF = new TextField("Bank Account");
    tF.setValue("00232333452315");
    tFBAcc = tF;

    arrLAllFormFields.add(tF);
    arrLAllEditableFields.add(tF);
    arrLTfEditableVals.add(tF.getValue());
    // tFBAcc.setValidationVisible(true);
    // tFBAcc.addValidator(new NoNull());
    cLBody.addComponent(tF);

    combo.addItem(1);
    combo.setItemCaption(1, "US Dollars");
    combo.select(1);
    comboCur = combo;
    arrLAllFormFields.add(combo);
    arrLAllEditableFields.add(combo);
    arrLTfEditableVals.add((combo.getValue() == null) ? "" : combo.getValue().toString());
    cLBody.addComponent(combo);

    tF = new TextField("Clearing Number");
    tF.setValue("00212");
    tFClrNo = tF;
    arrLAllFormFields.add(tF);
    arrLAllEditableFields.add(tF);
    arrLTfEditableVals.add(tF.getValue());
    cLBody.addComponent(tF);

    Label lbAccRec = new Label("Account Recovery");

    HorizontalLayout cLbAccRec = new HorizontalLayout();
    cLbAccRec.setSizeUndefined();
    cLbAccRec.setMargin(new MarginInfo(true, false, false, false));
    cLbAccRec.addComponent(lbAccRec);
    // cLBody.addComponent(cLbAccRec);

    combo = new ComboBox("Security Question");
    combo.addItem(1);
    combo.addItem(2);
    combo.addItem(3);
    combo.setItemCaption(1, "What is your grandfather's last name?");
    combo.setItemCaption(2, "What was your favorite junior school teacher's name?");
    combo.setItemCaption(3, "What was one of your nicknames in school?");
    combo.select(2);
    comboSecQn = combo;
    arrLAllFormFields.add(combo);
    arrLAllEditableFields.add(combo);
    arrLTfEditableVals.add((combo.getValue() == null) ? "" : combo.getValue().toString());
    // cLBody.addComponent(combo);

    tF = new TextField("Answer");
    tF.setValue("Mrs. X");
    tFSecAns = tF;
    arrLAllFormFields.add(tF);
    arrLAllEditableFields.add(tF);
    arrLTfEditableVals.add(tF.getValue());
    // cLBody.addComponent(tF);

    CheckBox chk = new CheckBox("I accept the terms" + " and conditons.");
    chcTAndC = chk;
    chk.setStyleName("check_t_and_c");
    chk.addValueChangeListener(new ValueChangeListener() {

        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            // Notification.show(event.getProperty().getValue().toString());

        }

    });

    comboCountry.addFocusListener(new FocusListener() {

        private static final long serialVersionUID = -5162384967736354225L;

        @Override
        public void focus(FocusEvent event) {
            if (isCSelected)
                return;
            Set<Entry<Integer, String>> es = (Set<Entry<Integer, String>>) getCountries().entrySet();
            if (es.size() == 0)
                return;
            Iterator<Entry<Integer, String>> itr = es.iterator();
            comboCountry.setNullSelectionAllowed(false);
            while (itr.hasNext()) {
                Entry<Integer, String> e = (Entry<Integer, String>) itr.next();
                comboCountry.addItem(e.getKey());
                comboCountry.setItemCaption(e.getKey(), e.getValue());
            }

            comboCountry.select(null);

            isCSelected = true;

        }

    });

    comboCountry.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = -404551290095133508L;

        @Override
        public void valueChange(ValueChangeEvent event) {

            comboState.removeAllItems();
            comboLG.removeAllItems();

            if (comboCountry.getValue() == null)
                return;

            Set<Entry<Integer, String>> es = (Set<Entry<Integer, String>>) getStates(
                    Integer.valueOf(comboCountry.getValue().toString())).entrySet();

            if (es.isEmpty()) {
                return;
            }

            Iterator<Entry<Integer, String>> itr = es.iterator();
            while (itr.hasNext()) {
                Entry<Integer, String> e = itr.next();
                comboState.addItem(e.getKey());
                comboState.setItemCaption(e.getKey(), e.getValue());
            }

            comboState.select(null);

        }

    });

    comboState.addFocusListener(new FocusListener() {

        private static final long serialVersionUID = 892516817835461278L;

        @Override
        public void focus(FocusEvent event) {
            Object c = comboCountry.getValue();

            if (c == null) {
                Notification.show("Please select country first", Notification.Type.WARNING_MESSAGE);
                comboCountry.focus();
                return;

            }

        }

    });

    comboState.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = 8849241310354979908L;

        @Override
        public void valueChange(ValueChangeEvent event) {

            comboLG.removeAllItems();
            if (comboState.getValue() == null)
                return;
            Set<Entry<Integer, String>> esl = (Set<Entry<Integer, String>>) getLGs(
                    Integer.valueOf(comboState.getValue().toString())).entrySet();
            if (esl.isEmpty()) {
                return;
            }

            Iterator<Entry<Integer, String>> itrl = esl.iterator();
            while (itrl.hasNext()) {
                Entry<Integer, String> e = itrl.next();
                comboLG.addItem(e.getKey());
                comboLG.setItemCaption(e.getKey(), e.getValue());
            }

        }

    });

    comboLG.addFocusListener(new FocusListener() {

        private static final long serialVersionUID = 8925916817835461278L;

        @Override
        public void focus(FocusEvent event) {

            Object s = comboState.getValue();
            if (comboCountry.getValue() == null) {
                Notification.show("Please select country first", Notification.Type.WARNING_MESSAGE);
                comboCountry.focus();
                return;

            }

            if (s == null) {
                Notification.show("Please select state first", Notification.Type.WARNING_MESSAGE);
                comboState.focus();
                return;

            }

        }

    });

    HorizontalLayout cChk = new HorizontalLayout();
    cChk.setSizeUndefined();
    cChk.setMargin(new MarginInfo(true, false, true, false));
    cChk.addComponent(chk);
    // cLBody.addComponent(cChk);

    final VerticalLayout cRBody = new VerticalLayout();
    String strNameCap = "Username";

    tF = new TextField(strNameCap);
    arrLAllFormFields.add(tF);
    arrLAllEditableFields.add(tF);
    arrLTfEditableVals.add(tF.getValue());
    cRBody.addComponent(tF);

    HorizontalLayout cAccBody = new HorizontalLayout();
    cAccBody.addComponent(cLBody);
    cAccBody.addComponent(cRBody);
    cLBody.setStyleName("c_body_visible");
    cRBody.setStyleName("c_body_invisible");
    cAcc.addComponent(cAccBody);

    cBAndCAndAcc.addComponent(cAcc);

    cC.setMargin(new MarginInfo(false, true, false, true));
    cAgentInfo.addComponent(cBAndCAndAcc);

    final String btnSaveId = "save";
    final String btnEditId = "edit";

    final Button btnEdit = new Button();
    btnEdit.setIcon(FontAwesome.SAVE);
    btnEdit.setId(btnSaveId);
    btnEdit.setStyleName("btn_link");

    final Button btnCancel = new Button();
    btnCancel.setVisible(true);
    btnCancel.setIcon(FontAwesome.UNDO);
    btnCancel.setStyleName("btn_link");

    final HorizontalLayout cBtnSR = new HorizontalLayout();
    cBtnSR.addComponent(btnEdit);
    cBtnSR.addComponent(btnCancel);

    // cBtnEditCancel

    cAcc.addComponent(cBtnSR);

    btnEdit.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = -935880570210949227L;

        @Override
        public void buttonClick(ClickEvent event) {

            /*
             * Prepare all Editable fields (Entire form) for editing.
             */
            if (event.getButton().getId().equals(btnEditId)) {

                /*
                 * By Default, btnCancel is not visible, until btnEdit is
                 * clicked. Only until then is it added and visible.
                 */

                if (!btnCancel.isVisible()) {
                    event.getButton().setId(btnSaveId);
                    event.getButton().setIcon(FontAwesome.SAVE);
                    btnCancel.setVisible(true);
                    cBtnSR.addComponent(btnCancel);
                }

                enableEditableFormFields(arrLAllEditableFields);

            } else {
                if (event.getButton().getId().equals(btnSaveId)) {
                    /*
                     * 
                     * 
                     * 
                     * 
                     * commit (save) changes i.e, send changes back to the
                     * server.
                     */

                    try {

                        validateAndSave();
                        // cUPersonalDetails.removeAllComponents();
                        // cUPersonalDetails.addComponent(getUDContainer());
                        // Notification.show("Details successfully saved.",
                        // Notification.Type.WARNING_MESSAGE);

                    } catch (Exception e) {
                        // Notification.show("Hello");
                        return;
                    }

                    // Remove undo button (btnCancel)
                    btnCancel.setVisible(false);

                    // Reset all Editable fields to readOnly after saving to
                    // the server
                    // disableEditableFields(arrLAllEditableFields);

                    // Reset btnEdit id to btnIdEdit and caption(icon) to
                    // FontAwesome.EDIT
                    btnEdit.setId(btnEditId);
                    btnEdit.setIcon(FontAwesome.EDIT);
                    btnEdit.setVisible(false);

                    // Reset Edit status to false
                    uDetailsEditStatus = false;

                }
            }

        }
    });

    btnCancel.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = -8179030387969880920L;

        @Override
        public void buttonClick(ClickEvent event) {
            resetForm(arrLAllEditableFields, arrLTfEditableVals);
            btnEdit.setId(btnEditId);
            btnEdit.setIcon(FontAwesome.EDIT);
            btnEdit.setVisible(false);
            btnCancel.setVisible(false);

        }
    });

    return cAgentInfo;
}