|
|
|
@ -10,6 +10,8 @@ import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.dao.DataIntegrityViolationException;
|
|
|
|
|
import org.springframework.security.access.AccessDeniedException;
|
|
|
|
|
import org.zkoss.bind.BindUtils;
|
|
|
|
@ -44,7 +46,7 @@ public class ListViewModel<T extends DataModel> {
|
|
|
|
|
protected Class<T> dataClass;
|
|
|
|
|
protected String formZul;
|
|
|
|
|
protected Filter<T> dataFilter;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<T> getDataList() {
|
|
|
|
|
if (dataList == null) {
|
|
|
|
|
dataList = new ArrayList<T>();
|
|
|
|
@ -266,10 +268,36 @@ public class ListViewModel<T extends DataModel> {
|
|
|
|
|
newRec = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, String[]> map = Executions.getCurrent().getParameterMap();
|
|
|
|
|
int id = -1;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (map.get("select") != null) {
|
|
|
|
|
id = Integer.parseInt(map.get("select")[0]);
|
|
|
|
|
}
|
|
|
|
|
} catch (NumberFormatException e) {
|
|
|
|
|
Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
|
|
|
logger.warn("ID is not number: " + map.get("select")[0]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (id > 0) {
|
|
|
|
|
for (int i = 0; i < dataList.size(); i++) {
|
|
|
|
|
if (dataList.get(i).getId() == id) {
|
|
|
|
|
selIndex = i;
|
|
|
|
|
beforeSelectViaUrl();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (selIndex > -1) {
|
|
|
|
|
this.setDataBean(dataList.get(selIndex));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void beforeSelectViaUrl() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Command
|
|
|
|
|
@NotifyChange("dataBean")
|
|
|
|
|