|
|
|
@ -1,7 +1,10 @@
|
|
|
|
|
package com.fr.design.mainframe; |
|
|
|
|
|
|
|
|
|
import com.fr.base.*; |
|
|
|
|
import com.fr.base.io.IOFile; |
|
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
|
import com.fr.base.FRContext; |
|
|
|
|
import com.fr.base.Parameter; |
|
|
|
|
import com.fr.base.ScreenResolution; |
|
|
|
|
import com.fr.base.io.BaseBook; |
|
|
|
|
import com.fr.base.iofileattr.TemplateIdAttrMark; |
|
|
|
|
import com.fr.design.DesignModelAdapter; |
|
|
|
|
import com.fr.design.DesignState; |
|
|
|
@ -44,6 +47,8 @@ import com.fr.form.ui.Widget;
|
|
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
|
import com.fr.general.FRLogger; |
|
|
|
|
import com.fr.general.Inter; |
|
|
|
|
import com.fr.report.cell.Elem; |
|
|
|
|
import com.fr.report.cell.cellattr.CellImage; |
|
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
|
|
import com.fr.stable.OperatingSystem; |
|
|
|
|
import com.fr.stable.ProductConstants; |
|
|
|
@ -51,11 +56,13 @@ import com.fr.stable.StringUtils;
|
|
|
|
|
import com.fr.stable.core.UUID; |
|
|
|
|
import com.fr.stable.project.ProjectConstants; |
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
|
import javax.swing.Icon; |
|
|
|
|
import javax.swing.JComponent; |
|
|
|
|
import javax.swing.JOptionPane; |
|
|
|
|
import javax.swing.tree.DefaultMutableTreeNode; |
|
|
|
|
import javax.swing.undo.UndoManager; |
|
|
|
|
import java.awt.*; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.io.File; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Arrays; |
|
|
|
@ -65,7 +72,7 @@ import java.util.regex.Pattern;
|
|
|
|
|
/** |
|
|
|
|
* 报表设计和表单设计的编辑区域(设计器编辑的IO文件) |
|
|
|
|
*/ |
|
|
|
|
public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> extends TargetComponent<T> implements ToolBarMenuDockPlus, JTemplateProvider { |
|
|
|
|
public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>> extends TargetComponent<T> implements ToolBarMenuDockPlus, JTemplateProvider { |
|
|
|
|
// TODO ALEX_SEP editingFILE这个属性一定要吗?如果非要不可,有没有可能保证不为null
|
|
|
|
|
private static final int PREFIX_NUM = 3000; |
|
|
|
|
private FILE editingFILE = null; |
|
|
|
@ -77,7 +84,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
protected U undoState; |
|
|
|
|
protected U authorityUndoState = null; |
|
|
|
|
protected T template; // 当前模板
|
|
|
|
|
protected TemplateProcessInfo processInfo; // 模板过程的相关信息
|
|
|
|
|
protected TemplateProcessInfo<T> processInfo; // 模板过程的相关信息
|
|
|
|
|
private static short currentIndex = 0;// 此变量用于多次新建模板时,让名字不重复
|
|
|
|
|
private DesignModelAdapter<T, ?> designModel; |
|
|
|
|
private PreviewProvider previewType; |
|
|
|
@ -86,7 +93,8 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
private StringBuilder process = new StringBuilder(""); // 制作模板的过程
|
|
|
|
|
public int resolution = ScreenResolution.getScreenResolution(); |
|
|
|
|
|
|
|
|
|
public JTemplate() {} |
|
|
|
|
public JTemplate() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public JTemplate(T t, String defaultFileName) { |
|
|
|
|
this(t, new MemFILE(newTemplateNameByIndex(defaultFileName)), true); |
|
|
|
@ -123,11 +131,12 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
|
|
|
|
|
// 为收集模版信息作准备
|
|
|
|
|
private void initForCollect() { |
|
|
|
|
template.initTemplateID(); // 为新模板设置 templateID 属性
|
|
|
|
|
generateTemplateId(); |
|
|
|
|
if (openTime == 0) { |
|
|
|
|
openTime = System.currentTimeMillis(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void collectInfo() { // 执行收集操作
|
|
|
|
|
if (openTime == 0) { // 旧模板,不收集数据
|
|
|
|
|
return; |
|
|
|
@ -140,7 +149,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
openTime = saveTime; // 更新 openTime,准备下一次计算
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public abstract TemplateProcessInfo getProcessInfo(); |
|
|
|
|
public abstract TemplateProcessInfo<T> getProcessInfo(); |
|
|
|
|
|
|
|
|
|
// 追加过程记录
|
|
|
|
|
public void appendProcess(String s) { |
|
|
|
@ -178,6 +187,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public int getMenuState() { |
|
|
|
|
return DesignState.WORK_SHEET; |
|
|
|
|
} |
|
|
|
@ -185,6 +195,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
/** |
|
|
|
|
* 取消格式 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public void cancelFormat() { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -380,6 +391,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
/** |
|
|
|
|
* 模板更新 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public void fireTargetModified() { |
|
|
|
|
U newState = createUndoState(); |
|
|
|
|
if (newState == null) { |
|
|
|
@ -410,7 +422,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
fireSuperTargetModified(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected boolean accept(Object o){ |
|
|
|
|
protected boolean accept(Object o) { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -431,11 +443,10 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
/** |
|
|
|
|
* 停止编辑, 判断保存属性 * |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public void stopEditing() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 得到正在编辑的FILE |
|
|
|
@ -454,6 +465,17 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
*/ |
|
|
|
|
public abstract String suffix(); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 添加图片到格子中 |
|
|
|
|
* |
|
|
|
|
* @return 返回图片URI |
|
|
|
|
*/ |
|
|
|
|
public void setPictureElem(Elem elem, CellImage cellImage) { |
|
|
|
|
// 子类实现
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 是否保存 |
|
|
|
|
* |
|
|
|
@ -520,7 +542,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
if (!editingFILE.exists()) { |
|
|
|
|
return saveAsTemplate(isShowLoc); |
|
|
|
|
} |
|
|
|
|
if (!FRContext.getCurrentEnv().hasFileFolderAllow(this.getEditingFILE().getPath()) ) { |
|
|
|
|
if (!FRContext.getCurrentEnv().hasFileFolderAllow(this.getEditingFILE().getPath())) { |
|
|
|
|
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_No-Privilege") + "!", Inter.getLocText("FR-Designer_Message"), JOptionPane.WARNING_MESSAGE); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
@ -528,12 +550,12 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
return this.saveFile(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean isCancelOperation(int operation){ |
|
|
|
|
private boolean isCancelOperation(int operation) { |
|
|
|
|
return operation == FILEChooserPane.CANCEL_OPTION || |
|
|
|
|
operation == FILEChooserPane.JOPTIONPANE_CANCEL_OPTION; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean isOkOperation(int operation){ |
|
|
|
|
private boolean isOkOperation(int operation) { |
|
|
|
|
return operation == FILEChooserPane.JOPTIONPANE_OK_OPTION || |
|
|
|
|
operation == FILEChooserPane.OK_OPTION; |
|
|
|
|
} |
|
|
|
@ -555,7 +577,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (isOkOperation(chooseResult)) { |
|
|
|
|
if (!FRContext.getCurrentEnv().hasFileFolderAllow(fileChooser.getSelectedFILE().getPath()) ) { |
|
|
|
|
if (!FRContext.getCurrentEnv().hasFileFolderAllow(fileChooser.getSelectedFILE().getPath())) { |
|
|
|
|
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_No-Privilege") + "!", Inter.getLocText("FR-Designer_Message"), JOptionPane.WARNING_MESSAGE); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
@ -567,7 +589,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
return saveNewFile(editingFILE, oldName); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected boolean saveNewFile(FILE editingFILE, String oldName){ |
|
|
|
|
protected boolean saveNewFile(FILE editingFILE, String oldName) { |
|
|
|
|
// 在保存之前,初始化 templateID
|
|
|
|
|
initForCollect(); // 如果保存新模板(新建模板直接保存,或者另存为),则添加 templateID
|
|
|
|
|
|
|
|
|
@ -582,7 +604,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void mkNewFile(FILE file){ |
|
|
|
|
protected void mkNewFile(FILE file) { |
|
|
|
|
try { |
|
|
|
|
file.mkfile(); |
|
|
|
|
} catch (Exception e) { |
|
|
|
@ -594,16 +616,16 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
* 将模板另存为可以分享出去的混淆后内置数据集模板 |
|
|
|
|
* |
|
|
|
|
* @return 是否另存成功 |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
public boolean saveShareFile(){ |
|
|
|
|
public boolean saveShareFile() { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
public Widget getSelectElementCase(){ |
|
|
|
|
|
|
|
|
|
public Widget getSelectElementCase() { |
|
|
|
|
return new NoneWidget(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected FILEChooserPane getFILEChooserPane(boolean isShowLoc){ |
|
|
|
|
protected FILEChooserPane getFILEChooserPane(boolean isShowLoc) { |
|
|
|
|
return new FILEChooserPane(true, isShowLoc); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -672,6 +694,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
* |
|
|
|
|
* @return 返回菜单 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public ShortCut[] shortcut4FileMenu() { |
|
|
|
|
if (BaseUtils.isAuthorityEditing()) { |
|
|
|
|
return new ShortCut[]{new SaveTemplateAction(this), new UndoAction(this), new RedoAction(this)}; |
|
|
|
@ -686,6 +709,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
* |
|
|
|
|
* @return 菜单 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public MenuDef[] menus4Target() { |
|
|
|
|
MenuDef tplMenu = new MenuDef(Inter.getLocText("FR-Designer_M-Template"), 'T'); |
|
|
|
|
tplMenu.setAnchor(MenuHandler.TEMPLATE); |
|
|
|
@ -704,6 +728,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
* |
|
|
|
|
* @return 返回菜单 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public abstract ShortCut[] shortcut4TemplateMenu(); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -711,6 +736,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
* |
|
|
|
|
* @return 菜单 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public abstract ShortCut[] shortCuts4Authority(); |
|
|
|
|
|
|
|
|
|
// /////////////////////////////JTemplateActionListener//////////////////////////////////
|
|
|
|
@ -794,7 +820,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private int getVersionCompare(String versionString){ |
|
|
|
|
private int getVersionCompare(String versionString) { |
|
|
|
|
if (StringUtils.isBlank(versionString)) { |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
@ -804,7 +830,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private int getVersionCompareHBB(String versionString){ |
|
|
|
|
private int getVersionCompareHBB(String versionString) { |
|
|
|
|
if (StringUtils.isBlank(versionString)) { |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
@ -826,7 +852,8 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 判断是否是新版设计器 |
|
|
|
|
* @return 是返回true |
|
|
|
|
* |
|
|
|
|
* @return 是返回true |
|
|
|
|
*/ |
|
|
|
|
public boolean isNewDesigner() { |
|
|
|
|
String xmlDesignerVersion = getTarget().getXMLDesignerVersion(); |
|
|
|
@ -888,41 +915,40 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 激活指定的template |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
public void activeJTemplate(int index, JTemplate jt) { |
|
|
|
|
DesignerContext.getDesignerFrame().activateJTemplate(this); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 激活已存在的模板 |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
public void activeOldJTemplate() { |
|
|
|
|
DesignerContext.getDesignerFrame().activateJTemplate(this); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 激活新的模板 |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
public void activeNewJTemplate() { |
|
|
|
|
DesignerContext.getDesignerFrame().addAndActivateJTemplate(this); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 后台关闭template |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
public void closeOverLineTemplate(int index) { |
|
|
|
|
JTemplate overTemplate = HistoryTemplateListPane.getInstance().getHistoryList().get(index); |
|
|
|
|
HistoryTemplateListPane.getInstance().closeVirtualSelectedReport(overTemplate); |
|
|
|
|
HistoryTemplateListPane.getInstance().getHistoryList().set(index, new JVirtualTemplate(overTemplate.getEditingFILE())); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 返回当前支持的超链界面pane |
|
|
|
|
* |
|
|
|
|
* @return 超链连接界面 |
|
|
|
|
*/ |
|
|
|
|
public abstract HyperlinkGroupPane getHyperLinkPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider); |
|
|
|
@ -930,6 +956,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
/** |
|
|
|
|
* 返回当前支持的超链界面pane |
|
|
|
|
* 没有悬浮弹窗,显示为两列 |
|
|
|
|
* |
|
|
|
|
* @return 超链连接界面 |
|
|
|
|
*/ |
|
|
|
|
public abstract HyperlinkGroupPane getHyperLinkPaneNoPop(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider); |
|
|
|
@ -939,7 +966,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
* |
|
|
|
|
* @return 默认不是 |
|
|
|
|
*/ |
|
|
|
|
public boolean isChartBook(){ |
|
|
|
|
public boolean isChartBook() { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -991,11 +1018,9 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
* 创建内置sql提交的pane |
|
|
|
|
* |
|
|
|
|
* @return 内置sql提交的pane |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* @date 2014-10-14-下午7:39:27 |
|
|
|
|
*/ |
|
|
|
|
public DBManipulationPane createDBManipulationPane(){ |
|
|
|
|
public DBManipulationPane createDBManipulationPane() { |
|
|
|
|
return new DBManipulationPane(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1003,24 +1028,25 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
* 创建控件事件里内置sql提交的pane |
|
|
|
|
* |
|
|
|
|
* @return 内置sql提交的pane |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* @date 2014-10-14-下午7:39:27 |
|
|
|
|
*/ |
|
|
|
|
public DBManipulationPane createDBManipulationPaneInWidget(){ |
|
|
|
|
public DBManipulationPane createDBManipulationPaneInWidget() { |
|
|
|
|
return new DBManipulationInWidgetEventPane(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 取小图标,主要用于多TAB标签栏 |
|
|
|
|
* |
|
|
|
|
* @return 图表 |
|
|
|
|
*/ |
|
|
|
|
public abstract Icon getIcon(); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 导出菜单项 |
|
|
|
|
* |
|
|
|
|
* @return 菜单项 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public ShortCut[] shortcut4ExportMenu() { |
|
|
|
|
return new ShortCut[0]; |
|
|
|
|
} |
|
|
|
@ -1028,12 +1054,13 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
/** |
|
|
|
|
* 复制JS代码 |
|
|
|
|
*/ |
|
|
|
|
public void copyJS(){} |
|
|
|
|
public void copyJS() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 系列风格改动 |
|
|
|
|
*/ |
|
|
|
|
public void styleChange(){ |
|
|
|
|
public void styleChange() { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1041,14 +1068,14 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
* 创建分享模板的按钮, 目前只有jworkbook实现了 |
|
|
|
|
* |
|
|
|
|
* @return 分享模板按钮 |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
public UIButton[] createShareButton(){ |
|
|
|
|
public UIButton[] createShareButton() { |
|
|
|
|
return new UIButton[0]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 略 |
|
|
|
|
* |
|
|
|
|
* @param provider 预览模式 |
|
|
|
|
*/ |
|
|
|
|
public void previewMenuActionPerformed(PreviewProvider provider) { |
|
|
|
@ -1057,6 +1084,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 支持的预览模式 |
|
|
|
|
* |
|
|
|
|
* @return 预览模式 |
|
|
|
|
*/ |
|
|
|
|
public PreviewProvider[] supportPreview() { |
|
|
|
@ -1065,6 +1093,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 预览模式转换 |
|
|
|
|
* |
|
|
|
|
* @param typeCode 类型 |
|
|
|
|
* @return 预览模式 |
|
|
|
|
*/ |
|
|
|
@ -1088,6 +1117,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 加载插件中的按钮 |
|
|
|
|
* |
|
|
|
|
* @return 按钮组 |
|
|
|
|
*/ |
|
|
|
|
public UIButton[] createExtraButtons() { |
|
|
|
@ -1102,11 +1132,18 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 由于老版本的模板没有模板ID,当勾选使用参数模板时候,就加一个模板ID attr |
|
|
|
|
* |
|
|
|
|
* @param isUseParamTemplate 是否使用参数模板 |
|
|
|
|
*/ |
|
|
|
|
public void needAddTemplateIdAttr(boolean isUseParamTemplate) { |
|
|
|
|
if (isUseParamTemplate && template.getAttrMark(TemplateIdAttrMark.XML_TAG) == null) { |
|
|
|
|
template.addAttrMark(new TemplateIdAttrMark(UUID.randomUUID().toString())); |
|
|
|
|
generateTemplateId(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void generateTemplateId() { |
|
|
|
|
String templateId = UUID.randomUUID().toString(); |
|
|
|
|
template.addAttrMark(new TemplateIdAttrMark(templateId)); |
|
|
|
|
template.setTemplateID(templateId); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|