Commit d2e08146 by s_guodong

多頁簽

parent b4221c36
......@@ -13,6 +13,8 @@ public interface IPanel extends IBaseObject {
IModule getModule();
void setTitleI18nKey(String tittle);
String getTitleI18nKey();
void setWindow(Object paramObject);
......
......@@ -5,6 +5,9 @@ import com.brilliance.mda.runtime.mda.*;
import com.brilliance.mda.runtime.mda.impl.EnvConfig;
import com.brilliance.mda.runtime.mda.snapshot.SnapshotService;
import com.brilliance.mda.runtime.mda.snapshot.bo.ValueVo;
import com.brilliance.mda.runtime.mda.snapshot.bo.pack.*;
import com.brilliance.mda.runtime.mda.snapshot.bo.unpack.DocumentBo;
import com.brilliance.mda.runtime.mda.util.XmlUtil;
import com.brilliance.mda.runtime.request.BaseVO;
import java.util.*;
......@@ -247,11 +250,50 @@ public class MdaContext implements IContext {
@Override
public boolean saveDisplay(IPanel[] panels, String fileName) {
boolean f = false;
List<PackTabpanelBo> tabpanelsList = new ArrayList<>();
List<PackTabBo> tabList = new ArrayList<>();
Map<String, Object> valueMap = new HashMap<>();
for (IPanel panel : panels) {
f = saveDisplay(panel, fileName);
// 解析标准模板
DocumentBo documentBo = snapshotService.unpackTemplate(panel.getPath());
// 获取组装xml的实体
PackDocumentBo packDocumentBo = snapshotService.packTemplate(documentBo, panel.getParent());
PackBorderlayoutBo borderlayoutBo = packDocumentBo.getBorderlayoutBo();
PackTabpanelBo packTabpanelBo = new PackTabpanelBo();
packTabpanelBo.setBorderlayoutBo(borderlayoutBo);
tabpanelsList.add(packTabpanelBo);
// 获取填充值的key
Set<ValueVo> keySet = snapshotService.getKeySet();
// 获取填充的值
valueMap.putAll(snapshotService.getValueMap(keySet, panel.getParent()));
// 設置頁簽標題
String titleI18nKey = panel.getTitleI18nKey();
PackTabBo packTabBo = new PackTabBo();
packTabBo.setLabel(titleI18nKey);
tabList.add(packTabBo);
}
return f;
PackDocumentBo document = new PackDocumentBo();
PackTabboxBo tabbox = new PackTabboxBo();
document.setTabboxBo(tabbox);
// tabs
PackTabsBo tabs = new PackTabsBo();
tabs.setTabBo(tabList);
tabbox.setTabsBo(tabs);
// tabpanels
PackTabpanelsBo tabpanels = new PackTabpanelsBo();
tabbox.setTabpanelsBo(tabpanels);
tabpanels.setTabpanelBos(tabpanelsList);
String s = XmlUtil.marshToXmlBinding(PackDocumentBo.class, document);
String templateContent = s.replace("<window>", "<window xmlns=\"http://www.zkoss.org/2005/zul\" xmlns:w=\"http://www.zkoss.org/2005/zk/client\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" height=\"100%\" width=\"100%\" xsi:schemaLocation=\"http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd\">");
if (this.display != null) {
return this.display.saveDisplay(fileName, templateContent, valueMap);
}
return false;
}
@Override
......@@ -259,7 +301,7 @@ public class MdaContext implements IContext {
IModule parent = panel.getParent();
String panelPath = panel.getPath();
// 获取模板内容
String templateContent = snapshotService.getTemplateContent(panelPath,parent);
String templateContent = snapshotService.getTemplateContent(panelPath, parent);
// 获取填充值的key
Set<ValueVo> keySet = snapshotService.getKeySet();
// 获取填充的值
......
......@@ -50,6 +50,11 @@ public class PanelImpl extends AbstractBaseObject implements IPanel {
return this.parent;
}
@Override
public void setTitleI18nKey(String tittle) {
this.titleI18nKey = tittle;
}
public String getTitleI18nKey() {
return this.titleI18nKey;
}
......
......@@ -26,4 +26,7 @@ public class PackDocumentBo {
@XmlElement(name = "borderlayout")
private PackBorderlayoutBo borderlayoutBo;
@XmlElement(name = "tabbox")
private PackTabboxBo tabboxBo;
}
package com.brilliance.mda.runtime.mda.snapshot.bo.pack;
import lombok.Data;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
/**
* @Description
* @Author s_guodong
* @Date 2023/8/22
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "tab")
@Data
public class PackTabBo {
@XmlAttribute(name = "label")
private String label;
@XmlAttribute(name = "sclass")
private String sclass = "savedisplay-tab";
}
package com.brilliance.mda.runtime.mda.snapshot.bo.pack;
import lombok.Data;
import javax.xml.bind.annotation.*;
/**
* @Description
* @Author s_guodong
* @Date 2023/8/22
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "tabbox")
@Data
public class PackTabboxBo {
@XmlAttribute(name = "height")
private String height = "100%";
@XmlAttribute(name = "width")
private String width = "100%";
@XmlElement(name = "tabs")
private PackTabsBo tabsBo;
@XmlElement(name = "tabpanels")
private PackTabpanelsBo tabpanelsBo;
}
package com.brilliance.mda.runtime.mda.snapshot.bo.pack;
import lombok.Data;
import javax.xml.bind.annotation.*;
/**
* @Description
* @Author s_guodong
* @Date 2023/8/22
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "tabpanel")
@Data
public class PackTabpanelBo {
@XmlAttribute(name = "height")
private String height = "100%";
@XmlAttribute(name = "width")
private String width = "100%";
@XmlElement(name = "borderlayout")
private PackBorderlayoutBo borderlayoutBo;
}
package com.brilliance.mda.runtime.mda.snapshot.bo.pack;
import lombok.Data;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
/**
* @Description
* @Author s_guodong
* @Date 2023/8/22
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "tabpanels")
@Data
public class PackTabpanelsBo {
@XmlElement(name = "tabpanel")
private List<PackTabpanelBo> tabpanelBos;
}
package com.brilliance.mda.runtime.mda.snapshot.bo.pack;
import lombok.Data;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
/**
* @Description
* @Author s_guodong
* @Date 2023/8/22
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "tabs")
@Data
public class PackTabsBo {
@XmlElement(name = "tab")
private List<PackTabBo> tabBo;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment