List of usage examples for com.vaadin.server VaadinSession getCurrent
public static VaadinSession getCurrent()
From source file:com.anphat.customer.controller.CustomerManagementController.java
private void getDatas() { lstAppParamsAll = DataUtil.getListAppParamsDTOs(); staff = (StaffDTO) VaadinSession.getCurrent().getAttribute("staff"); }
From source file:com.anphat.customer.controller.SearchCustomerController.java
public CustomerDTO getDTO2Search() { searchDTO = new CustomerDTO(); //Lay ma so thue taxCode = searchForm.getTaxCode().getValue(); name = searchForm.getName().getValue(); telNumber = searchForm.getTelNumber().getValue(); email = searchForm.getEmail().getValue(); // officeAddress = searchForm.getDeployAddress().getValue(); // taxAuthority = searchForm.getDeployAddress().getValue(); // officeAddress = searchForm.getDeployAddress().getValue(); // mineName = searchForm.getMineName().getValue(); // mineName = cboMineName.getValue(); statusDTO = (AppParamsDTO) cboStatus.getValue(); //Neu du lieu khac null thi set vao doi tuong de tim kiem if (statusDTO != null && !DataUtil.isStringNullOrEmpty(statusDTO.getParCode())) { searchDTO.setStatus(statusDTO.getParCode()); }/*from w w w . j a v a 2s.c o m*/ //Lay du lieu nha cung cap // Collection collectionProvider = (Collection) searchForm.getCboMulProvider().getValue(); // List<AppParamsDTO> listProvider = Lists.newArrayList(collectionProvider); String serviceStr = getServiceToSearch(); if (!DataUtil.isStringNullOrEmpty(serviceStr)) { searchDTO.setService(serviceStr); } if (!DataUtil.isStringNullOrEmpty(taxCode)) { searchDTO.setTaxCode(taxCode); } if (!DataUtil.isStringNullOrEmpty(name)) { searchDTO.setName(name); } if (!DataUtil.isStringNullOrEmpty(telNumber)) { searchDTO.setTelNumber(telNumber); } if (!DataUtil.isStringNullOrEmpty(email)) { searchDTO.setEmail(email); } CategoryListDTO categoryList = (CategoryListDTO) cboMineName.getValue(); if (!DataUtil.isNullObject(categoryList)) { searchDTO.setMineName(categoryList.getId()); } Collection collectionCity = (Collection) cboMultiCity.getValue(); List<AppParamsDTO> listCity = Lists.newArrayList(collectionCity); List<String> taxAuthority = null; try { taxAuthority = DataUtil.getListValueFromList(listCity, Constants.TAXAUTHORITY.MA_CQT); } catch (NoSuchMethodException | IllegalAccessException ex) { ex.printStackTrace(); } if (!DataUtil.isListNullOrEmpty(taxAuthority)) { String taxAuthorityCondition = DataUtil.convertList2StringToSearchConditionIN(taxAuthority); searchDTO.setTaxAuthority(taxAuthorityCondition); } Collection coProvider = (Collection) cboMultiProvider.getValue(); List<AppParamsDTO> providerDTOs = new ArrayList<>(); providerDTOs.addAll(coProvider); List<String> provider = null; try { provider = DataUtil.getListValueFromList(providerDTOs, Constants.APP_PARAMS.PAR_CODE); } catch (NoSuchMethodException | IllegalAccessException ex) { ex.printStackTrace(); } if (!DataUtil.isListNullOrEmpty(provider)) { String multiProvider = DataUtil.convertList2StringToSearchConditionIN(provider); searchDTO.setProvider(multiProvider); } StaffDTO staff = (StaffDTO) VaadinSession.getCurrent().getAttribute("staff"); if (!cboStaff.isVisible()) { searchDTO.setStaffId(staff.getStaffId()); } else { staff = (StaffDTO) cboStaff.getValue(); if (!DataUtil.isNullObject(staff)) { searchDTO.setStaffId(staff.getStaffId()); } } String custCareCreatedDate = DataUtil.getDateNullOrZero(searchForm.getDfContactCreatedDate()); if (!DataUtil.isStringNullOrEmpty(custCareCreatedDate)) { searchDTO.setCustCareHistoryCreatedDate(custCareCreatedDate); } return searchDTO; }
From source file:com.anphat.customer.ui.CustomerCareHistoryDialog.java
private void buildGridCareHistory() { gridCareHistoryLayout = new GridLayout(2, 4); CommonUtils.setBasicAttributeLayout(gridCareHistoryLayout, BundleUtils.getString("label.history.care.caption"), false); locale = (Locale) VaadinSession.getCurrent().getAttribute("locale"); if (locale == null) { locale = new Locale("vi"); }// w ww . ja v a2 s . c om dfDateTracking = new DateField(BundleUtils.getString("customerCareHistoryForm.dateTracking")); dfDateTracking.setWidth("100%"); dfDateTracking.setImmediate(true); dfDateTracking.setLocale(locale); gridCareHistoryLayout.addComponent(dfDateTracking, 0, 3); taNotes = new TextArea(BundleUtils.getString("customerCareHistoryForm.notes")); taNotes.setRequired(true); taNotes.setWidth("100%"); gridCareHistoryLayout.addComponent(taNotes, 0, 2, 1, 2); cbxService = CommonUtils.buildComboBox(BundleUtils.getString("term.information.service")); cbxService.setNullSelectionAllowed(true); gridCareHistoryLayout.addComponent(cbxService, 0, 0); cbxCustomerServiceStatus = CommonUtils.buildComboBox(BundleUtils.getString("customerStatusForm.status")); cbxCustomerServiceStatus.setNullSelectionAllowed(true); gridCareHistoryLayout.addComponent(cbxCustomerServiceStatus, 1, 3); f9Contact = new MappingCombobox(BundleUtils.getString("customer.contact.name"), BundleUtils.getString("customerCareHistoryForm.telNumber")); gridCareHistoryLayout.addComponent(f9Contact.getLayout(), 1, 0); btnAddContact = new Button(BundleUtils.getString("label.customer.contact.addNew")); btnAddContact.addStyleName("v-button-link"); btnAddContact.setDisableOnClick(true); ShortcutUtils.setShortkeyF2(btnAddContact); gridCareHistoryLayout.addComponent(btnAddContact, 1, 1); mainLayout.addComponent(gridCareHistoryLayout); GridManyButton gridManyButton = CommonUtils.getCommonButtonDialog(this); btnSave = gridManyButton.getBtnCommon().get(0); mainLayout.addComponent(gridManyButton); DataUtil.addFocusWindow(this, taNotes); }
From source file:com.anphat.customer.ui.CustomerCareHistoryDialog.java
public CustomerCareHistoryDTO getInputObject(CustomerDTO customer) { StaffDTO staff = (StaffDTO) VaadinSession.getCurrent().getAttribute("staff"); CustomerCareHistoryDTO careHistoryDTO = new CustomerCareHistoryDTO(); //24/04/2017 - Them truong mineName careHistoryDTO.setMineName(customer.getMineName()); careHistoryDTO.setCustId(customer.getCustId()); careHistoryDTO.setTaxCode(customer.getTaxCode()); careHistoryDTO.setStaffId(staff.getStaffId()); careHistoryDTO.setStaffCode(staff.getCode()); careHistoryDTO.setDateTracking(DataUtil.getDateNullOrZero(dfDateTracking)); careHistoryDTO.setCreateDate(DateUtil.date2ddMMyyyyHHMMss(new Date())); careHistoryDTO.setNotes(DataUtil.getStringNullOrZero(taNotes.getValue())); CustomerContactDTO contactDTO = (CustomerContactDTO) f9Contact.codeCombo.getValue(); if (!DataUtil.isNullObject(contactDTO)) { careHistoryDTO.setContact(contactDTO.getName()); careHistoryDTO.setTelNumber(contactDTO.getTelNumber()); }//from w w w . j a v a 2s. c o m AppParamsDTO service = (AppParamsDTO) cbxService.getValue(); if (service != null) { careHistoryDTO.setService(service.getParCode()); } // AppParamsDTO service = (AppParamsDTO) ; if (service != null) { careHistoryDTO.setService(service.getParCode()); } AppParamsDTO customerStatus = (AppParamsDTO) cbxCustomerServiceStatus.getValue(); if (customerStatus != null) { careHistoryDTO.setStatus(customerStatus.getParCode()); } return careHistoryDTO; }
From source file:com.anphat.customer.ui.CustomerContactDialog.java
private void buildGridCustomerContact() { gridCustomerContact = new GridLayout(4, 1); gridCareHistory = new GridLayout(6, 3); locale = (Locale) VaadinSession.getCurrent().getAttribute("locale"); if (locale == null) { locale = new Locale("vi"); }/* w w w . j av a 2 s .c o m*/ CommonUtils.setBasicAttributeLayout(gridCustomerContact, "", false); CommonUtils.setBasicAttributeLayout(gridCareHistory, BundleUtils.getString("label.history.care.caption"), true); txtName = CommonUtils.buildTextField(BundleUtils.getString("customer.contact.name"), 100); txtEmail = CommonUtils.buildTextField(BundleUtils.getString("customer.contact.email"), 100); txtTelNumber = CommonUtils.buildTextField(BundleUtils.getString("customer.contact.telNumber"), 100); txtRegency = CommonUtils.buildTextField(BundleUtils.getString("customer.contact.regency"), 100); dfDateTracking = new DateField(BundleUtils.getString("customerCareHistoryForm.dateTracking")); dfDateTracking.setWidth("100%"); dfDateTracking.setImmediate(true); dfDateTracking.setLocale(locale); taNotes = new TextArea(BundleUtils.getString("customerCareHistoryForm.notes")); taNotes.setRequired(true); taNotes.setWidth("100%"); // cboStatus = CommonUtils.buildComboBox(BundleUtils.getString("customerStatusForm.status")); // cboStatus.setNullSelectionAllowed(true); cboRegency = CommonUtils.buildComboBox("customer.contact.regency"); gridStatusButton = new GridLayout(1, 2); // gridStatusButton.setWidth("100%"); gridCustomerContact.addComponent(txtName, 0, 0); gridCustomerContact.addComponent(txtEmail, 1, 0); gridCustomerContact.addComponent(txtTelNumber, 2, 0); gridCustomerContact.addComponent(cboRegency, 3, 0); gridStatusButton.addComponent(dfDateTracking, 0, 1); ogCustStatus = getCustomerStatus(); ogCustStatus.setMultiSelect(false); ogCustStatus.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); ogCustStatus.setItemCaptionPropertyId("parName"); ogCustStatus.addStyleName("horizontal"); gridStatusButton.addComponent(ogCustStatus, 0, 0); gridCareHistory.addComponent(gridStatusButton, 0, 0, 5, 0); gridCareHistory.addComponent(taNotes, 0, 2, 5, 2); mainLayout.addComponent(gridCustomerContact); mainLayout.addComponent(gridCareHistory); lstRegency = DataUtil.getListApParams(Constants.APP_PARAMS.CUSTOMER_CONTACT_REGENCY); String valueRegencyDefault = Constants.NULL; if (!DataUtil.isListNullOrEmpty(lstRegency)) { valueRegencyDefault = lstRegency.get(0).getParCode(); } combo = new ComboComponent(); combo.fillDataCombo(cboRegency, Constants.NULL, valueRegencyDefault, lstRegency, Constants.APP_PARAMS.CUSTOMER_CONTACT_REGENCY); // combo.fillDataCombo(cboStatus, Constants.NULL, valueRegencyDefault, lstCustomerStatus, Constants.APP_PARAMS.CUSTOMER_SERVICE_STATUS); GridManyButton gridManyButton = CommonUtils.getCommonButtonDialog(this); btnSave = gridManyButton.getBtnCommon().get(0); mainLayout.addComponent(gridManyButton); // DataUtil.addFocusWindow(this, txtName); }
From source file:com.anphat.customer.ui.CustomerContactDialog.java
/** * Get input object from input form and from customer * * @param customerDTO customer is selected by staff * @return CustomerContactDTO object will be save to db *//* ww w . j av a2 s . c o m*/ public CustomerContactDTO getInputContactObject(CustomerDTO customerDTO) { String phoneNumber = DataUtil.getStringNullOrZero(txtTelNumber.getValue()); String name = DataUtil.getStringNullOrZero(txtName.getValue()); CustomerContactDTO contactDTO; contactDTO = getContactExisted(phoneNumber, name); if (DataUtil.isNullObject(contactDTO)) { contactDTO = new CustomerContactDTO(); contactDTO.setTelNumber(phoneNumber); contactDTO.setStatus(Constants.ACTIVE); contactDTO.setName(name); contactDTO.setEmail(DataUtil.getStringNullOrZero(txtEmail.getValue())); AppParamsDTO regency = (AppParamsDTO) cboRegency.getValue(); contactDTO.setRegency(DataUtil.getStringNullOrZero(regency.getParCode())); contactDTO.setTaxCode(customerDTO.getTaxCode()); contactDTO.setCustId(customerDTO.getCustId()); } else { contactDTO.setName(name); contactDTO.setEmail(DataUtil.getStringNullOrZero(txtEmail.getValue())); AppParamsDTO regency = (AppParamsDTO) cboRegency.getValue(); contactDTO.setRegency(DataUtil.getStringNullOrZero(regency.getParCode())); } StaffDTO staff = (StaffDTO) VaadinSession.getCurrent().getAttribute("staff"); contactDTO.setStaffCode(staff.getCode()); return contactDTO; }
From source file:com.anphat.customer.ui.CustomerContactDialog.java
public CustomerCareHistoryDTO getInputCustomerCareObject(CustomerDTO customer) { if (custCareDTO != null) { AppParamsDTO customerStatus = (AppParamsDTO) ogCustStatus.getValue(); if (customerStatus != null) { custCareDTO.setStatus(customerStatus.getParCode()); }//from w w w .j av a 2 s.co m custCareDTO.setNotes(DataUtil.getStringNullOrZero(taNotes.getValue())); custCareDTO.setDateTracking(DataUtil.getDateNullOrZero(dfDateTracking)); custCareDTO.setCreateDate(DateUtil.date2ddMMyyyyHHMMss(new Date())); return custCareDTO; } else { StaffDTO staff = (StaffDTO) VaadinSession.getCurrent().getAttribute("staff"); CustomerCareHistoryDTO careHistoryDTO = new CustomerCareHistoryDTO(); //24/04/2017 - Them truong mineName careHistoryDTO.setMineName(customer.getMineName()); careHistoryDTO.setCustId(customer.getCustId()); careHistoryDTO.setTaxCode(customer.getTaxCode()); careHistoryDTO.setStaffId(staff.getStaffId()); careHistoryDTO.setStaffCode(staff.getCode()); careHistoryDTO.setService(customer.getService()); careHistoryDTO.setDateTracking(DataUtil.getDateNullOrZero(dfDateTracking)); careHistoryDTO.setCreateDate(DateUtil.date2ddMMyyyyHHMMss(new Date())); careHistoryDTO.setNotes(DataUtil.getStringNullOrZero(taNotes.getValue())); // AppParamsDTO customerStatus = (AppParamsDTO) cboStatus.getValue(); // if (customerStatus != null) { // careHistoryDTO.setStatus(customerStatus.getParCode()); // } AppParamsDTO customerStatus = (AppParamsDTO) ogCustStatus.getValue(); if (customerStatus != null) { careHistoryDTO.setStatus(customerStatus.getParCode()); } careHistoryDTO.setContact(DataUtil.getStringNullOrZero(txtName.getValue())); careHistoryDTO.setTelNumber(DataUtil.getStringNullOrZero(txtTelNumber.getValue())); return careHistoryDTO; } }
From source file:com.anphat.list.controller.CategoryListController.java
public void getDataWS() { lstAllAppParams = DataUtil.getListAppParamsDTOs(); staff = (StaffDTO) VaadinSession.getCurrent().getAttribute("staff"); lstServices = DataUtil.getListApParams(lstAllAppParams, Constants.APP_PARAMS.SERVICE_TYPE); lstCustomerStatus = DataUtil.getListApParams(lstAllAppParams, Constants.APP_PARAMS.CUSTOMER_SERVICE_STATUS); try {/*from w w w .j a va 2s . c o m*/ mapServices = DataUtil.buildHasmap(lstServices, Constants.APP_PARAMS.PAR_CODE, Constants.APP_PARAMS.PAR_NAME); mapCustServiceStatus = DataUtil.buildHasmap(lstCustomerStatus, Constants.APP_PARAMS.PAR_CODE, Constants.APP_PARAMS.PAR_NAME); } catch (NoSuchMethodException | IllegalAccessException | IllegalArgumentException ex) { Logger.getLogger(MapStaffCustomerController.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.anphat.list.controller.StatisticStaffPointUploader.java
@Override public void uploadFile() { try {//from www . j a v a2s . c o m List lstUpload; List<ValidateCells> lstValidateCells = Lists.newArrayList(); lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 20));//Ma nhan vien lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 100));// Ten nhan vien lstValidateCells.add(new ValidateCells(DataUtil.LONG, false, 10));// So luong data giao lstValidateCells.add(new ValidateCells(DataUtil.LONG, false, 10));// So luong goi lstValidateCells.add(new ValidateCells(DataUtil.DOUBLE, false, 5));// Diem tuan 1 lstValidateCells.add(new ValidateCells(DataUtil.DOUBLE, false, 5));// Diem tuan 2 lstValidateCells.add(new ValidateCells(DataUtil.DOUBLE, false, 5));// Diem tuan 3 lstValidateCells.add(new ValidateCells(DataUtil.DOUBLE, false, 5));// Diem tuan 4 lstValidateCells.add(new ValidateCells(DataUtil.DOUBLE, false, 5));// Diem tuan 5 lstValidateCells.add(new ValidateCells(DataUtil.DOUBLE, false, 5));// Diem huy lstUpload = DataUtil.isValidExcells(mimeType, tempFile, 0, 1, 0, 10, 3, lstValidateCells); if (lstUpload == null) { Notification.show(BundleUtils.getString("valid.import.file"), Notification.Type.WARNING_MESSAGE); return; } staff = (StaffDTO) VaadinSession.getCurrent().getAttribute("staff"); //LAY DANH DACH DU LIEU - CELL DA NHAP Object[] tmp; String staffCode; String staffName; String numberData; String numberCall; String w1Point; String w2Point; String w3Point; String w4Point; String w5Point; String monthPoint; String cancelPoint; String totalPoint; lstUploaded = new ArrayList<>(); StatisticStaffPointDTO tempObject; for (Object object : lstUpload) { tmp = (Object[]) object; if (!DataUtil.isNullObject(tmp) && !"null".equalsIgnoreCase(String.valueOf(tmp[0]))) { staffCode = DataUtil.getStringNullOrZero(String.valueOf(tmp[0])); staffName = DataUtil.getStringNullOrZero(String.valueOf(tmp[1])); numberData = DataUtil.getStringNullOrZero(String.valueOf(tmp[2])); numberCall = DataUtil.getStringNullOrZero(String.valueOf(tmp[3])); w1Point = DataUtil.getStringNullOrZero(String.valueOf(tmp[4])); w2Point = DataUtil.getStringNullOrZero(String.valueOf(tmp[5])); w3Point = DataUtil.getStringNullOrZero(String.valueOf(tmp[6])); w4Point = DataUtil.getStringNullOrZero(String.valueOf(tmp[7])); w5Point = DataUtil.getStringNullOrZero(String.valueOf(tmp[8])); cancelPoint = DataUtil.getStringNullOrZero(String.valueOf(tmp[9])); tempObject = new StatisticStaffPointDTO(staffCode, staffName, numberData, numberCall, w1Point, w2Point, w3Point, w4Point, w5Point, cancelPoint); lstUploaded.add(tempObject); } } container = new BeanItemContainer(StatisticStaffPointDTO.class); container.addAll(lstUploaded); CommonFunctionTableFilter.refreshTable(tblPanel, HEADER_TABLE, container); } catch (Exception e) { e.printStackTrace(); } finally { wp.close(); UI.getCurrent().setPollInterval(-1); } }
From source file:com.cbnserver.gwtp4vaadin.core.MVP.java
License:Apache License
public void init() { VaadinSession.getCurrent().setAttribute("mvp", this); rootPresenter = rootPresenterProvider.get(); Set<Class<? extends Proxy>> proxies = getSubTypesOf(Proxy.class); proxies.addAll(getSubTypesOf(ProxyImpl.class)); proxies.addAll(getSubTypesOf(ProxyPlaceImpl.class)); proxies.addAll(getSubTypesOf(TabContentProxyPlaceImpl.class)); for (Class<? extends Proxy> proxy : proxies) { Set<Bean<?>> beans = beanManager.getBeans(proxy); if (beans.size() == 1) { Bean<?> bean = beans.iterator().next(); beanManager.getReference(bean, bean.getBeanClass(), beanManager.createCreationalContext(bean)); }/* www . j a va 2 s. c o m*/ } placeManagerProvider.get().revealCurrentPlace(); }