this.templateFile = "mobile/grid/GridList.ftl";
}
public Map<String, Object> putData(DOIModel doimodel) {
DOGridModel gm = (DOGridModel) doimodel;
if (gm.getService() == null) {
return null;
}
List cols = gm.getNormalGridFormLinks();
if(cols.size() < 1){
return null;
}
// ///Mobile特殊代码点击链接的面板
String linkPaneName = "#";
List topForms = gm.getTopOutGridFormLinks();
DOPaneModel browseModel = DOPaneModel.getPaneModelByName("pm_"
+ gm.getCategory().getName() + "_browse");
DOFormModel lastModel = (DOFormModel)cols.get(cols.size() - 1);
if("查看".equals(lastModel.getL10n())){
if(lastModel.getLinkPaneModel()!=null){
linkPaneName = lastModel.getLinkPaneModel().getName();
}
}
List lastLinkForms = lastModel.getLinkForms();
if(lastLinkForms!=null){
for(Iterator it = lastLinkForms.iterator(); it.hasNext();){
DOFormModel aFm = (DOFormModel)it.next();
if("查看".equals(aFm.getL10n()) || "Browse".equals(aFm.getL10n()) ){
if(aFm.getLinkPaneModel()!=null){
linkPaneName = aFm.getLinkPaneModel().getName();
break;
}
}
}
}
if (linkPaneName.equals("#") && browseModel != null) {
linkPaneName = browseModel.getName();
}
if (linkPaneName.equals("#")) {
if (topForms != null && topForms.size() > 0) {
DOFormModel aFm = (DOFormModel) topForms.get(0);
if (aFm.getLinkPaneModel() != null) {
linkPaneName = aFm.getLinkPaneModel().getName();
}
}
}
try{
if(gm.getService().getBo().getMainPaneModel()!=null){
linkPaneName = gm.getService().getBo().getMainPaneModel().getName();
}
}catch(Exception e){
}
// /////////////Mobile显示的列
// ////下一步可以用户定义列
// //DOGlobals.getInstance()
// .getSessoinContext().getFormInstance().getValue(
// "cols")
List showCols = new ArrayList();
List controCols = new ArrayList();
if (cols.size() > 3) {
splitCols(showCols, controCols, (DOFormModel)cols.get(0));
splitCols(showCols, controCols, (DOFormModel)cols.get(1));
splitCols(showCols, controCols, (DOFormModel)cols.get(cols.size() - 1));
/////如果最后一列是控制列,则再显示一列
if(controCols.size() >0 ){
splitCols(showCols, controCols, (DOFormModel)cols.get(2));
}
} else {
for(Iterator it = cols.iterator(); it.hasNext();){
DOFormModel aFm = (DOFormModel)it.next();
splitCols(showCols, controCols, aFm);
}
}
List bottomForms = gm.getBottomOutGridFormLinks();
for(Iterator it = topForms.iterator(); it.hasNext();){
DOFormModel aFm = (DOFormModel)it.next();
if(!aFm.getController().getName().toLowerCase().contains("selected")){
bottomForms.add(aFm);
}
}
Map<String, Object> data = new HashMap<String, Object>();
data.put("model", gm);
data.put("showCols", showCols);
data.put("controCols", controCols);
data.put("bottomForms", bottomForms);
data.put("linkPaneName", linkPaneName);
data.put("data", getListData(gm, data));
data.put("webmodule", DOGlobals.URL);
data.put("contextPath", DOGlobals.PRE_FULL_FOLDER);
if (gm.getContainerPane() != null) {
data.put("pmlName", gm.getContainerPane().getName());
}
data.put("formName", "a" + gm.getObjUid());
if (gm.getContainerPane() != null
&& gm.getContainerPane().getParent() != null) {
// //自动判断条件面板
List children = gm.getContainerPane().getParent()
.retrieveChildren();
if (children != null && children.size() == 2) {
DOPaneModel conditionPane = (DOPaneModel) children.get(0);
DOPaneModel resultModel = (DOPaneModel) children.get(1);
if (conditionPane != null) {
if (conditionPane.getDOGridModel() != null) {
String formName = "a"
+ conditionPane.getDOGridModel().getObjUid();
data.put("formName", formName);
}
}
}
// //如果配置了隐藏面板(这里的含义是 拥有表单的面板)
DOPaneModel hpm = gm.getContainerPane().getHiddenPane();
if (hpm != null) {
if (hpm.getDOGridModel() != null) {
String formName = "a" + hpm.getDOGridModel().getObjUid();
data.put("formName", formName);
}