Browse Source

REPORT-55243:将JStreamWork中的相关方法合并到该类里面 & 将预编译流程合并到cpt保存流程中 & cptx的另存为cpt文件的流程处理

research/11.0
fly.li 3 years ago
parent
commit
098e494eca
  1. 37
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

37
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -62,10 +62,15 @@ import com.fr.file.MemFILE;
import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.main.impl.WorkBook;
import com.fr.nx.app.designer.toolbar.CompileAction;
import com.fr.nx.app.designer.utils.CptCompileUtil;
import com.fr.nx.cptx.entry.metadata.CptxMetadata;
import com.fr.nx.cptx.utils.CptxFileUtils;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime;
import com.fr.nx.app.designer.toolbar.CompileAction;
import com.fr.nx.app.designer.toolbar.TemplateTransformer;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
@ -331,6 +336,15 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return getEditingFILE().getPath();
}
private String getSuffix() {
CptxMetadata metadata = CptxFileUtils.getMetadata(this.getEditingFILE().getPath());
if (metadata != null && metadata.isForceCpt()) {
//在不支持新引擎时,标题上需要显示分页引擎未生效
return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Paging_Engine_Not_Work");
}
return StringUtils.EMPTY;
}
protected abstract JComponent createCenterPane();
/**
@ -1404,7 +1418,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
* @return 按钮组
*/
public UIButton[] createExtraButtons() {
UIButton[] uiButtons = new UIButton[] {
UIButton[] uiButtons = new UIButton[]{
(UIButton) new CompileAction().createToolBarComponent()
};
Set<DesignerFrameUpButtonProvider> providers = ExtraDesignClassManager.getInstance().getArray(DesignerFrameUpButtonProvider.XML_TAG);
@ -1439,7 +1453,12 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public abstract String route();
public String getTemplateName() {
return getEditingFILE().getName();
boolean isNewEngine = CptCompileUtil.isNewEngine(this.getTarget());
if (isNewEngine) {
return getEditingFILE().getName() + getSuffix();
}else {
return getEditingFILE().getName();
}
}
public String getTemplatePredefinedStyle() {
@ -1468,6 +1487,9 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
@Override
public void run() {
callBackForSave();
//在保存后的回调中执行预编译流程
CptCompileUtil.compile(JTemplate.this);
}
});
@ -1532,7 +1554,12 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
worker.addSuccessCallback(new Runnable() {
@Override
public void run() {
callBackForSave();
//新添加代码,另存为流程中,有可能没有保存,在没有保存的情况下,应该进行预编译判断
if (!JTemplate.this.isSaved() && !DesignModeContext.isVcsMode()){
//这里要先调下面这行代码
callBackForSave();
CptCompileUtil.compile(JTemplate.this);
}
// 当前打开的是正在保存的模板才刷新
if (ComparatorUtils.equals(JTemplate.this.template.getTemplateID(),
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().template.getTemplateID())) {
@ -1592,6 +1619,8 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
result = result || provider.saveToNewFile(this.editingFILE.getPath(), this);
}
if (!result) {
//在这里改变报表引擎属性
CptCompileUtil.changeFrEngineAttr(oldName, this);
result = this.saveRealFile();
// 更换最近打开
DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(oldName, this.getPath());

Loading…
Cancel
Save