|
|
@ -85,7 +85,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex |
|
|
|
|
|
|
|
|
|
|
|
public JTemplate(T t, String defaultFileName) { |
|
|
|
public JTemplate(T t, String defaultFileName) { |
|
|
|
this(t, new MemFILE(newTemplateNameByIndex(defaultFileName)), true); |
|
|
|
this(t, new MemFILE(newTemplateNameByIndex(defaultFileName)), true); |
|
|
|
initForCollect(); |
|
|
|
openTime = System.currentTimeMillis(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public JTemplate(T t, FILE file) { |
|
|
|
public JTemplate(T t, FILE file) { |
|
|
@ -111,14 +111,15 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex |
|
|
|
|
|
|
|
|
|
|
|
// 为收集模版信息作准备
|
|
|
|
// 为收集模版信息作准备
|
|
|
|
private void initForCollect() { |
|
|
|
private void initForCollect() { |
|
|
|
if (template.getTemplateID() == null) { |
|
|
|
template.initTemplateID(); // 为新模板设置 templateID 属性
|
|
|
|
template.initTemplateID(); // 为新模板设置 templateID 属性
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (openTime == 0) { |
|
|
|
if (openTime == 0) { |
|
|
|
openTime = System.currentTimeMillis(); |
|
|
|
openTime = System.currentTimeMillis(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
private void collectInfo() { // 执行收集操作
|
|
|
|
private void collectInfo() { // 执行收集操作
|
|
|
|
|
|
|
|
if (openTime == 0) { // 旧模板,不收集数据
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
long saveTime = System.currentTimeMillis(); // 保存模板的时间点
|
|
|
|
long saveTime = System.currentTimeMillis(); // 保存模板的时间点
|
|
|
|
tic.collectInfo(template, this, openTime, saveTime); |
|
|
|
tic.collectInfo(template, this, openTime, saveTime); |
|
|
|
openTime = saveTime; // 更新 openTime,准备下一次计算
|
|
|
|
openTime = saveTime; // 更新 openTime,准备下一次计算
|
|
|
@ -371,7 +372,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected boolean accept(Object o){ |
|
|
|
protected boolean accept(Object o){ |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void fireSuperTargetModified() { |
|
|
|
private void fireSuperTargetModified() { |
|
|
@ -487,15 +488,15 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex |
|
|
|
collectInfo(); |
|
|
|
collectInfo(); |
|
|
|
return this.saveFile(); |
|
|
|
return this.saveFile(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean isCancelOperation(int operation){ |
|
|
|
private boolean isCancelOperation(int operation){ |
|
|
|
return operation == FILEChooserPane.CANCEL_OPTION || |
|
|
|
return operation == FILEChooserPane.CANCEL_OPTION || |
|
|
|
operation == FILEChooserPane.JOPTIONPANE_CANCEL_OPTION; |
|
|
|
operation == FILEChooserPane.JOPTIONPANE_CANCEL_OPTION; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean isOkOperation(int operation){ |
|
|
|
private boolean isOkOperation(int operation){ |
|
|
|
return operation == FILEChooserPane.JOPTIONPANE_OK_OPTION || |
|
|
|
return operation == FILEChooserPane.JOPTIONPANE_OK_OPTION || |
|
|
|
operation == FILEChooserPane.OK_OPTION; |
|
|
|
operation == FILEChooserPane.OK_OPTION; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean saveAsTemplate(boolean isShowLoc) { |
|
|
|
private boolean saveAsTemplate(boolean isShowLoc) { |
|
|
@ -512,8 +513,8 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex |
|
|
|
if (isCancelOperation(chooseResult)) { |
|
|
|
if (isCancelOperation(chooseResult)) { |
|
|
|
fileChooser = null; |
|
|
|
fileChooser = null; |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (isOkOperation(chooseResult)) { |
|
|
|
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); |
|
|
|
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_No-Privilege") + "!", Inter.getLocText("FR-Designer_Message"), JOptionPane.WARNING_MESSAGE); |
|
|
@ -523,40 +524,40 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex |
|
|
|
mkNewFile(editingFILE); |
|
|
|
mkNewFile(editingFILE); |
|
|
|
fileChooser = null; |
|
|
|
fileChooser = null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return saveNewFile(editingFILE, oldName); |
|
|
|
return saveNewFile(editingFILE, oldName); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected boolean saveNewFile(FILE editingFILE, String oldName){ |
|
|
|
protected boolean saveNewFile(FILE editingFILE, String oldName){ |
|
|
|
this.editingFILE = editingFILE; |
|
|
|
this.editingFILE = editingFILE; |
|
|
|
|
|
|
|
|
|
|
|
boolean result = this.saveFile(); |
|
|
|
boolean result = this.saveFile(); |
|
|
|
if (result) { |
|
|
|
if (result) { |
|
|
|
DesignerFrameFileDealerPane.getInstance().refresh(); |
|
|
|
DesignerFrameFileDealerPane.getInstance().refresh(); |
|
|
|
initForCollect(); // 如果是旧模板另存为新模板,则添加 templateID
|
|
|
|
initForCollect(); // 如果保存新模板(新建模板直接保存,或者另存为),则添加 templateID
|
|
|
|
collectInfo(); |
|
|
|
collectInfo(); |
|
|
|
} |
|
|
|
} |
|
|
|
//更换最近打开
|
|
|
|
//更换最近打开
|
|
|
|
DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(oldName, this.getFullPathName()); |
|
|
|
DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(oldName, this.getFullPathName()); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void mkNewFile(FILE file){ |
|
|
|
protected void mkNewFile(FILE file){ |
|
|
|
try { |
|
|
|
try { |
|
|
|
file.mkfile(); |
|
|
|
file.mkfile(); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
FRContext.getLogger().error(e.getMessage(), e); |
|
|
|
FRContext.getLogger().error(e.getMessage(), e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 将模板另存为可以分享出去的混淆后内置数据集模板 |
|
|
|
* 将模板另存为可以分享出去的混淆后内置数据集模板 |
|
|
|
* |
|
|
|
* |
|
|
|
* @return 是否另存成功 |
|
|
|
* @return 是否另存成功 |
|
|
|
* |
|
|
|
* |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean saveShareFile(){ |
|
|
|
public boolean saveShareFile(){ |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
public Widget getSelectElementCase(){ |
|
|
|
public Widget getSelectElementCase(){ |
|
|
|
return new NoneWidget(); |
|
|
|
return new NoneWidget(); |
|
|
@ -761,7 +762,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex |
|
|
|
public void revert() { |
|
|
|
public void revert() { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private int getVersionCompare(String versionString){ |
|
|
|
private int getVersionCompare(String versionString){ |
|
|
|
if (StringUtils.isBlank(versionString)) { |
|
|
|
if (StringUtils.isBlank(versionString)) { |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
@ -771,7 +772,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex |
|
|
|
return ComparatorUtils.compare(versionString.substring(0, len), ProductConstants.DESIGNER_VERSION.substring(0, len)); |
|
|
|
return ComparatorUtils.compare(versionString.substring(0, len), ProductConstants.DESIGNER_VERSION.substring(0, len)); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private int getVersionCompareHBB(String versionString){ |
|
|
|
private int getVersionCompareHBB(String versionString){ |
|
|
|
if (StringUtils.isBlank(versionString)) { |
|
|
|
if (StringUtils.isBlank(versionString)) { |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
@ -779,17 +780,17 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex |
|
|
|
return ComparatorUtils.compare(versionString, "HBB"); |
|
|
|
return ComparatorUtils.compare(versionString, "HBB"); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean isHigherThanCurrent(String versionString) { |
|
|
|
private boolean isHigherThanCurrent(String versionString) { |
|
|
|
return getVersionCompare(versionString) > 0; |
|
|
|
return getVersionCompare(versionString) > 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean isLowerThanCurrent(String versionString) { |
|
|
|
private boolean isLowerThanCurrent(String versionString) { |
|
|
|
return getVersionCompare(versionString) < 0; |
|
|
|
return getVersionCompare(versionString) < 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean isLowerThanHBB(String versionString) { |
|
|
|
private boolean isLowerThanHBB(String versionString) { |
|
|
|
return getVersionCompareHBB(versionString) < 0; |
|
|
|
return getVersionCompareHBB(versionString) < 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -799,7 +800,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex |
|
|
|
public boolean isNewDesigner() { |
|
|
|
public boolean isNewDesigner() { |
|
|
|
String xmlDesignerVersion = getTarget().getXMLDesignerVersion(); |
|
|
|
String xmlDesignerVersion = getTarget().getXMLDesignerVersion(); |
|
|
|
if (isLowerThanHBB(xmlDesignerVersion)) { |
|
|
|
if (isLowerThanHBB(xmlDesignerVersion)) { |
|
|
|
String info = Inter.getLocText("FR-Designer_open-new-form-tip"); |
|
|
|
String info = Inter.getLocText("FR-Designer_open-new-form-tip"); |
|
|
|
String moreInfo = Inter.getLocText("FR-Designer_Server-version-tip-moreInfo"); |
|
|
|
String moreInfo = Inter.getLocText("FR-Designer_Server-version-tip-moreInfo"); |
|
|
|
new InformationWarnPane(info, moreInfo, Inter.getLocText("FR-Designer_Tooltips")).show(); |
|
|
|
new InformationWarnPane(info, moreInfo, Inter.getLocText("FR-Designer_Tooltips")).show(); |
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -853,13 +854,13 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex |
|
|
|
* @return 是则返回true |
|
|
|
* @return 是则返回true |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public abstract boolean isJWorkBook(); |
|
|
|
public abstract boolean isJWorkBook(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 返回当前支持的超链界面pane |
|
|
|
* 返回当前支持的超链界面pane |
|
|
|
* @return 超链连接界面 |
|
|
|
* @return 超链连接界面 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public HyperlinkGroupPane getHyperLinkPane() { |
|
|
|
public HyperlinkGroupPane getHyperLinkPane() { |
|
|
|
return new HyperlinkGroupPane(); |
|
|
|
return new HyperlinkGroupPane(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -914,29 +915,29 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex |
|
|
|
public void requestGridFocus() { |
|
|
|
public void requestGridFocus() { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 创建内置sql提交的pane |
|
|
|
* 创建内置sql提交的pane |
|
|
|
* |
|
|
|
* |
|
|
|
* @return 内置sql提交的pane |
|
|
|
* @return 内置sql提交的pane |
|
|
|
* |
|
|
|
* |
|
|
|
* |
|
|
|
* |
|
|
|
* @date 2014-10-14-下午7:39:27 |
|
|
|
* @date 2014-10-14-下午7:39:27 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public DBManipulationPane createDBManipulationPane(){ |
|
|
|
public DBManipulationPane createDBManipulationPane(){ |
|
|
|
return new DBManipulationPane(); |
|
|
|
return new DBManipulationPane(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 创建控件事件里内置sql提交的pane |
|
|
|
* 创建控件事件里内置sql提交的pane |
|
|
|
* |
|
|
|
* |
|
|
|
* @return 内置sql提交的pane |
|
|
|
* @return 内置sql提交的pane |
|
|
|
* |
|
|
|
* |
|
|
|
* |
|
|
|
* |
|
|
|
* @date 2014-10-14-下午7:39:27 |
|
|
|
* @date 2014-10-14-下午7:39:27 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public DBManipulationPane createDBManipulationPaneInWidget(){ |
|
|
|
public DBManipulationPane createDBManipulationPaneInWidget(){ |
|
|
|
return new DBManipulationInWidgetEventPane(); |
|
|
|
return new DBManipulationInWidgetEventPane(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -964,15 +965,15 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex |
|
|
|
public void styleChange(){ |
|
|
|
public void styleChange(){ |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 创建分享模板的按钮, 目前只有jworkbook实现了 |
|
|
|
* 创建分享模板的按钮, 目前只有jworkbook实现了 |
|
|
|
* |
|
|
|
* |
|
|
|
* @return 分享模板按钮 |
|
|
|
* @return 分享模板按钮 |
|
|
|
* |
|
|
|
* |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public UIButton[] createShareButton(){ |
|
|
|
public UIButton[] createShareButton(){ |
|
|
|
return new UIButton[0]; |
|
|
|
return new UIButton[0]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|