private void setResults(HashMap<String, ArrayList<ClSelectionItem>> result) { result = result == null ? new HashMap<String, ArrayList<ClSelectionItem>>() : result; addrComp = new AddressComponent(true, true, result.get("" + ClSelection.T_REGION)); setSelectItems(siCustomerType, result.get("" + ClSelection.T_CUST_TYPE)); addrComp.getSiRegion().setTitle("Region"); addrComp.getSiSubregion().setTitle("Sub Region"); addrComp.getSiCity().setTitle("City"); addrComp.getSiStreet().setTitle("Street"); biSaveData.setStartRow(false); biSaveData.setEndRow(false); FormItem[] items = new FormItem[] { addrComp.getSiRegion(), addrComp.getSiSubregion(), addrComp.getSiCity(), addrComp.getSiStreet(), siZones, siCustomerType, tiNewZone, biSaveData }; dmCriteria.setFields(items); ChangedHandler addressChange = new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { if (event.getItem().equals(addrComp.getSiRegion()) || event.getItem().equals(addrComp.getSiSubregion())) { setZoneValue(); } creteriaChanged(); } }; addrComp.getSiRegion().addChangedHandler(addressChange); addrComp.getSiSubregion().addChangedHandler(addressChange); addrComp.getSiCity().addChangedHandler(addressChange); addrComp.getSiStreet().addChangedHandler(addressChange); Criteria cr = new Criteria(); addZoneCriteria(cr, addrComp.getSiRegion(), "regionid"); cr.addCriteria("uniq", SC.generateID()); siZones.setOptionCriteria(cr); setZoneValue(); biSaveData.addClickHandler( new com.smartgwt.client.widgets.form.fields.events.ClickHandler() { @Override public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) { saveData(); } }); }
private void setResults(HashMap<String, ArrayList<ClSelectionItem>> result) { result = result == null ? new HashMap<String, ArrayList<ClSelectionItem>>() : result; addrComp = new AddressComponent(false, true, result.get("" + ClSelection.T_REGION)); setStatuses(); addrComp.getSiRegion().setTitle("Region"); addrComp.getSiSubregion().setTitle("Sub Region"); addrComp.getSiCity().setTitle("City"); stDocCount.setTitleOrientation(TitleOrientation.LEFT); stDocCount.setRequired(true); FormItem[] items = new FormItem[] { diStart, diEnd, tiUserName, addrComp.getSiRegion(), addrComp.getSiSubregion(), addrComp.getSiCity(), iiZona, siDocStatus, iiCustomer, tiContent, tiDocId, tiCancelary, findItem, showStatusItem, bashConfirm, stDocCount }; // if (showStatusItem != null) { // FormItem[] itemsTmp = new FormItem[items.length + 1]; // for (int i = 0; i < items.length; i++) { // itemsTmp[i] = items[i]; // } // itemsTmp[items.length] = showStatusItem; // items = itemsTmp; // } setFields(items); // showStatusItem.hide(); // if (!DocFlow.hasPermition("CAN_SEE_STATUSES")) { // showStatusItem.hide(); // } }
public void clearFields() { LinkedHashMap<String, String> map = new LinkedHashMap<String, String>(); map.put("-1", "---"); try { siCustomerType.setValueMap(map); siCustomerType.setValue("-1"); addrComp.getSiRegion().setValue("-1"); addrComp.getSiSubregion().setValueMap(map); addrComp.getSiSubregion().setValue("-1"); addrComp.getSiCity().setValueMap(map); addrComp.getSiCity().setValue("-1"); addrComp.getSiStreet().setValueMap(map); addrComp.getSiStreet().setValue("-1"); } catch (Exception e) { // TODO: handle exception } }
private void creteriaChanged() { siZones.setValue((Integer) null); Criteria cr = new Criteria(); addZoneCriteria(cr, addrComp.getSiRegion(), "regionid"); addZoneCriteria(cr, addrComp.getSiSubregion(), "subregionid"); addZoneCriteria(cr, addrComp.getSiCity(), "cityid"); addZoneCriteria(cr, addrComp.getSiStreet(), "streetid"); cr.addCriteria("uniq", SC.generateID()); siZones.setOptionCriteria(cr); siZones.fetchData( new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { if (response.getData() != null && response.getData().length > 0) siZones.setValue(response.getData()[0].getAttributeAsDouble(siZones.getValueField())); } }); }
public ArrayList<String> createCriteria() { ArrayList<String> criterias = new ArrayList<String>(); criterias.add("system_id=" + DocFlow.system_id); addCriteria(criterias, tiUserName, "user_name='%s'", ""); addCriteria(criterias, addrComp.getSiRegion(), "regionid=%s", "-1"); addCriteria(criterias, addrComp.getSiSubregion(), "subregionid=%s", "-1"); addCriteria(criterias, addrComp.getSiCity(), "cityid=%s", "-1"); addCriteria(criterias, iiZona, "czona=%s", ""); addCriteria(criterias, siDocStatus, "doc_status_id=%s", "-1"); addCriteria(criterias, iiCustomer, "cust_id=%s", ""); addCriteria(criterias, tiContent, "content_xml like '%%s%'", ""); addCriteria(criterias, tiDocId, "id::character varying like '%s%'", ""); addCriteria(criterias, tiCancelary, "cancelary_nom like '%%s%'", ""); String doctypeFilter = "doc_type_id=" + docTypeId; if (docTypeId <= 0) doctypeFilter = "group_id=" + Math.abs(docTypeId); criterias.add(doctypeFilter); if (!DocFlow.hasPermition(PermissionNames.VIEW_ALL_DOCUMENTS)) criterias.add("user_id=" + DocFlow.user_id); return criterias; }
private void setZoneValue() { int regionId = getItemValue(addrComp.getSiRegion()); int subRegionId = getItemValue(addrComp.getSiSubregion()); setNewZone(regionId, subRegionId); }