Browse Source

REPORT-46916 新引擎内置,调整代码结构,适配代码调用方式

persist/11.0
loy 4 years ago
parent
commit
2556a97285
  1. 2
      designer-base/src/main/java/com/fr/design/actions/file/BatchCompileAction.java
  2. 2
      designer-base/src/main/java/com/fr/design/actions/server/LocalAnalyzerAction.java
  3. 12
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java
  4. 22
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  5. 4
      designer-base/src/main/java/com/fr/design/preview/PagePlusPreview.java
  6. 1
      designer-base/src/main/java/com/fr/file/FILEChooserPane.java
  7. 0
      designer-base/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanel.java
  8. 0
      designer-base/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanelProvider.java
  9. 0
      designer-base/src/main/java/com/fr/plugin/designer/cptx/io/DesignReadWritableProvider.java
  10. 0
      designer-base/src/main/java/com/fr/plugin/designer/monitor/DesignerMetricRecorder.java
  11. 0
      designer-base/src/main/java/com/fr/plugin/designer/toolbar/CompileAction.java
  12. 0
      designer-base/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformer.java
  13. 0
      designer-base/src/main/java/com/fr/plugin/designer/toolbar/TransformResult.java
  14. 0
      designer-base/src/main/java/com/fr/plugin/designer/toolbar/TransformResultInfo.java
  15. 0
      designer-base/src/main/java/com/fr/plugin/designer/transform/BatchTransformProgress.java
  16. 0
      designer-base/src/main/java/com/fr/plugin/designer/transform/BatchTransformUtil.java
  17. 0
      designer-base/src/main/java/com/fr/plugin/designer/transform/BatchTransformer.java
  18. 0
      designer-base/src/main/java/com/fr/plugin/designer/transform/UpdateCallBack.java
  19. 0
      designer-base/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformDialog.java
  20. 0
      designer-base/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformPane.java
  21. 0
      designer-base/src/main/java/com/fr/plugin/designer/transform/ui/PrepareTransformFileList.java
  22. 0
      designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformFileTree.java
  23. 0
      designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformPreparePane.java
  24. 0
      designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultList.java
  25. 0
      designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultPane.java
  26. 0
      designer-base/src/main/java/com/fr/plugin/designer/transform/ui/UIListControlCellRenderer.java
  27. 0
      designer-base/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressDialog.java
  28. 0
      designer-base/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressPane.java
  29. 0
      designer-base/src/main/java/com/fr/plugin/designer/utils/CompileTransformUtil.java
  30. 0
      designer-base/src/main/java/com/fr/plugin/designer/utils/DesignerCptxFileUtils.java
  31. 0
      designer-base/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerDebugTest.java
  32. 0
      designer-base/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerTest.java
  33. 0
      designer-base/src/test/java/com/fr/plugin/designer/toolbar/TransformResultInfoTest.java
  34. 0
      designer-base/src/test/java/com/fr/plugin/designer/transform/BatchTransformProgressTest.java
  35. 0
      designer-base/src/test/java/com/fr/plugin/designer/transform/BatchTransformUtilTest.java
  36. 0
      designer-base/src/test/java/com/fr/plugin/designer/transform/BatchTransformerTest.java
  37. 0
      designer-base/src/test/java/com/fr/plugin/designer/utils/CompileTransformUtilTest.java
  38. 4
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  39. 3
      designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java
  40. 6
      designer-realize/src/main/java/com/fr/plugin/designer/CptxApp.java
  41. 51
      designer-realize/src/main/java/com/fr/plugin/designer/EnginexSupportedFileUIImpl.java
  42. 8
      designer-realize/src/main/java/com/fr/plugin/designer/JStreamBook.java
  43. 20
      designer-realize/src/main/java/com/fr/plugin/designer/StartupAssist.java
  44. 29
      designer-realize/src/main/java/com/fr/plugin/designer/WritableCptx.java
  45. 36
      designer-realize/src/main/java/com/fr/plugin/designer/menu/BatchCompileMenu.java
  46. 69
      designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrMenu.java
  47. 37
      designer-realize/src/main/java/com/fr/plugin/designer/menu/LocalAnalyzerMenu.java
  48. 20
      designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformerUIButton.java
  49. 2
      designer-realize/src/main/java/com/fr/start/MainDesigner.java
  50. 26
      designer-realize/src/test/java/com/fr/plugin/designer/EnginexSupportedFileUIImplTest.java
  51. 42
      designer-realize/src/test/java/com/fr/plugin/designer/clean/CompileCleanManagerTest.java
  52. 16
      designer-realize/src/test/java/com/fr/plugin/designer/menu/BatchCompileMenuTest.java

2
designer-realize/src/main/java/com/fr/plugin/designer/menu/BatchCompileAction.java → designer-base/src/main/java/com/fr/design/actions/file/BatchCompileAction.java

@ -1,4 +1,4 @@
package com.fr.plugin.designer.menu;
package com.fr.design.actions.file;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;

2
designer-realize/src/main/java/com/fr/plugin/designer/menu/LocalAnalyzerAction.java → designer-base/src/main/java/com/fr/design/actions/server/LocalAnalyzerAction.java

@ -1,4 +1,4 @@
package com.fr.plugin.designer.menu;
package com.fr.design.actions.server;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;

12
designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java

@ -48,6 +48,9 @@ public class FileTreeIcon {
public static final Icon MODERN_CHT_FILE_IMAGE_ICON =
BaseUtils.readIcon("/com/fr/design/images/gui/modern_style_cht_file_icon_16x16.png");
public static final Icon CPTX_ICON = BaseUtils.readIcon("/com/fr/plugin/designer/cptx_file_icon.png");
public static final Icon CPTX_LOCKED_ICON = BaseUtils.readIcon("/com/fr/plugin/designer/cptx_file_icon_locked.png");
public static final LockIcon FOLDER_LOCK_ICON =
new LockIcon(BaseUtils.readImage("/com/fr/design/images/gui/fold.png"));
public static final LockIcon FILE_LOCK_ICON =
@ -108,6 +111,7 @@ public class FileTreeIcon {
public final static int CPT_FILE = 11; //.cpt
public final static int FRM_FILE = 12; //.form .frm
public final static int CHT_FILE = 13; //.chart .cht
public final static int CPTX_FILE = 14; //.cptx
public static Icon getIcon(File file) {
return FileTreeIcon.getIcon(file, false);
@ -252,6 +256,12 @@ public class FileTreeIcon {
} else {
return FileTreeIcon.MODERN_CPT_FILE_IMAGE_ICON;
}
} else if (fileType == CPTX_FILE) {
if (isLocked) {
return FileTreeIcon.CPTX_LOCKED_ICON;
} else {
return FileTreeIcon.CPTX_ICON;
}
} else if (fileType == FRM_FILE) { //form frm
if (isLocked) {
return FileTreeIcon.FRM_FILE_LOCK_ICON;
@ -314,6 +324,8 @@ public class FileTreeIcon {
return BMP_FILE;
} else if (fileName.endsWith(".cpt")) {
return CPT_FILE;
} else if (fileName.endsWith(".cptx")) {
return CPTX_FILE;
} else if (fileName.endsWith(".frm") || fileName.endsWith(".form")) {
return FRM_FILE;
} else if (fileName.endsWith(".cht") || fileName.endsWith(".chart")) {

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

@ -3,6 +3,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.Parameter;
import com.fr.base.extension.FileExtension;
import com.fr.base.io.BaseBook;
import com.fr.base.iofile.attr.DesignBanCopyAttrMark;
import com.fr.base.iofile.attr.TemplateIdAttrMark;
@ -14,6 +15,7 @@ import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.TableDataSourceAction;
import com.fr.design.actions.edit.RedoAction;
import com.fr.design.actions.edit.UndoAction;
import com.fr.design.actions.file.BatchCompileAction;
import com.fr.design.actions.file.SaveAsTemplateAction;
import com.fr.design.actions.file.SaveTemplateAction;
import com.fr.design.actions.file.WebPreviewUtils;
@ -60,6 +62,8 @@ import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime;
import com.fr.plugin.designer.toolbar.CompileAction;
import com.fr.plugin.designer.toolbar.TemplateTransformer;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
@ -781,10 +785,12 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
protected boolean saveToNewFile(String oldName) {
boolean result = false;
String path = this.editingFILE.getPath();
Set<ReportSupportedFileUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ReportSupportedFileUIProvider.XML_TAG);
for (ReportSupportedFileUIProvider provider : providers) {
result = result || provider.saveToNewFile(this.editingFILE.getPath(), this);
result = result || provider.saveToNewFile(path, this);
}
result = result || saveToNewFile4Cptx(path);
if (!result) {
result = result || this.saveFile();
//更换最近打开
@ -794,6 +800,14 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return result;
}
private boolean saveToNewFile4Cptx(String targetPath) {
if (FileExtension.CPTX.matchExtension(targetPath)) {
TemplateTransformer.TO_CPTX.transform(this);
return true;
}
return false;
}
protected void mkNewFile(FILE file) {
try {
file.mkfile();
@ -887,7 +901,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} else if (DesignerMode.isAuthorityEditing()) {
return new ShortCut[]{new SaveTemplateAction(this), new UndoAction(this), new RedoAction(this)};
} else {
return new ShortCut[]{new SaveTemplateAction(this), new SaveAsTemplateAction(this), new UndoAction(this), new RedoAction(this)};
return new ShortCut[]{new SaveTemplateAction(this), new SaveAsTemplateAction(this), new BatchCompileAction(), new UndoAction(this), new RedoAction(this)};
}
}
@ -1323,8 +1337,10 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
* @return 按钮组
*/
public UIButton[] createExtraButtons() {
UIButton[] uiButtons = new UIButton[] {
(UIButton) new CompileAction().createToolBarComponent()
};
Set<DesignerFrameUpButtonProvider> providers = ExtraDesignClassManager.getInstance().getArray(DesignerFrameUpButtonProvider.XML_TAG);
UIButton[] uiButtons = new UIButton[0];
for (DesignerFrameUpButtonProvider provider : providers) {
uiButtons = ArrayUtils.addAll(uiButtons, provider.getUpButtons(getMenuState()));
}

4
designer-realize/src/main/java/com/fr/plugin/designer/preview/PagePlusPreview.java → designer-base/src/main/java/com/fr/design/preview/PagePlusPreview.java

@ -1,4 +1,4 @@
package com.fr.plugin.designer.preview;
package com.fr.design.preview;
import com.fr.design.fun.impl.AbstractPreviewProvider;
import com.fr.general.web.ParameterConstants;
@ -7,7 +7,7 @@ import com.fr.locale.InterProviderFactory;
import java.util.HashMap;
import java.util.Map;
import static com.fr.plugin.v9.web.PagePlusActor.TYPE;
import static com.fr.plugin.web.v9.PagePlusActor.TYPE;
public class PagePlusPreview extends AbstractPreviewProvider {
private static final int CODE = 100;

1
designer-base/src/main/java/com/fr/file/FILEChooserPane.java

@ -770,6 +770,7 @@ public class FILEChooserPane extends BasicPane {
// ben:filefilter设置初值为cpt过滤
this.addChooseFILEFilter(new ChooseFileFilter(FileExtension.CPT, appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
this.addChooseFILEFilter(new ChooseFileFilter(FileExtension.CPTX, appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
// richer:form文件 daniel 改成三个字
this.addChooseFILEFilter(new ChooseFileFilter(FileExtension.FRM, appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));

0
designer-realize/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanel.java → designer-base/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanel.java

0
designer-realize/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanelProvider.java → designer-base/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanelProvider.java

0
designer-realize/src/main/java/com/fr/plugin/designer/cptx/io/DesignReadWritableProvider.java → designer-base/src/main/java/com/fr/plugin/designer/cptx/io/DesignReadWritableProvider.java

0
designer-realize/src/main/java/com/fr/plugin/designer/monitor/DesignerMetricRecorder.java → designer-base/src/main/java/com/fr/plugin/designer/monitor/DesignerMetricRecorder.java

0
designer-realize/src/main/java/com/fr/plugin/designer/toolbar/CompileAction.java → designer-base/src/main/java/com/fr/plugin/designer/toolbar/CompileAction.java

0
designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformer.java → designer-base/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformer.java

0
designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TransformResult.java → designer-base/src/main/java/com/fr/plugin/designer/toolbar/TransformResult.java

0
designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TransformResultInfo.java → designer-base/src/main/java/com/fr/plugin/designer/toolbar/TransformResultInfo.java

0
designer-realize/src/main/java/com/fr/plugin/designer/transform/BatchTransformProgress.java → designer-base/src/main/java/com/fr/plugin/designer/transform/BatchTransformProgress.java

0
designer-realize/src/main/java/com/fr/plugin/designer/transform/BatchTransformUtil.java → designer-base/src/main/java/com/fr/plugin/designer/transform/BatchTransformUtil.java

0
designer-realize/src/main/java/com/fr/plugin/designer/transform/BatchTransformer.java → designer-base/src/main/java/com/fr/plugin/designer/transform/BatchTransformer.java

0
designer-realize/src/main/java/com/fr/plugin/designer/transform/UpdateCallBack.java → designer-base/src/main/java/com/fr/plugin/designer/transform/UpdateCallBack.java

0
designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformDialog.java → designer-base/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformDialog.java

0
designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformPane.java → designer-base/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformPane.java

0
designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/PrepareTransformFileList.java → designer-base/src/main/java/com/fr/plugin/designer/transform/ui/PrepareTransformFileList.java

0
designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformFileTree.java → designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformFileTree.java

0
designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformPreparePane.java → designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformPreparePane.java

0
designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultList.java → designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultList.java

0
designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultPane.java → designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultPane.java

0
designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/UIListControlCellRenderer.java → designer-base/src/main/java/com/fr/plugin/designer/transform/ui/UIListControlCellRenderer.java

0
designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressDialog.java → designer-base/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressDialog.java

0
designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressPane.java → designer-base/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressPane.java

0
designer-realize/src/main/java/com/fr/plugin/designer/utils/CompileTransformUtil.java → designer-base/src/main/java/com/fr/plugin/designer/utils/CompileTransformUtil.java

0
designer-realize/src/main/java/com/fr/plugin/designer/utils/DesignerCptxFileUtils.java → designer-base/src/main/java/com/fr/plugin/designer/utils/DesignerCptxFileUtils.java

0
designer-realize/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerDebugTest.java → designer-base/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerDebugTest.java

0
designer-realize/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerTest.java → designer-base/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerTest.java

0
designer-realize/src/test/java/com/fr/plugin/designer/toolbar/TransformResultInfoTest.java → designer-base/src/test/java/com/fr/plugin/designer/toolbar/TransformResultInfoTest.java

0
designer-realize/src/test/java/com/fr/plugin/designer/transform/BatchTransformProgressTest.java → designer-base/src/test/java/com/fr/plugin/designer/transform/BatchTransformProgressTest.java

0
designer-realize/src/test/java/com/fr/plugin/designer/transform/BatchTransformUtilTest.java → designer-base/src/test/java/com/fr/plugin/designer/transform/BatchTransformUtilTest.java

0
designer-realize/src/test/java/com/fr/plugin/designer/transform/BatchTransformerTest.java → designer-base/src/test/java/com/fr/plugin/designer/transform/BatchTransformerTest.java

0
designer-realize/src/test/java/com/fr/plugin/designer/utils/CompileTransformUtilTest.java → designer-base/src/test/java/com/fr/plugin/designer/utils/CompileTransformUtilTest.java

4
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -55,6 +55,7 @@ import com.fr.design.module.DesignModuleFactory;
import com.fr.design.parameter.ParameterDefinitePane;
import com.fr.design.parameter.ParameterInputPane;
import com.fr.design.preview.MobilePreview;
import com.fr.design.preview.PagePlusPreview;
import com.fr.design.preview.PagePreview;
import com.fr.design.preview.ViewPreview;
import com.fr.design.preview.WriteEnhancePreview;
@ -918,7 +919,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
public PreviewProvider[] supportPreview() {
PreviewProvider[] templatePreviews = super.supportPreview();
return ArrayUtils.addAll(new PreviewProvider[]{
new PagePreview(), new WritePreview(), new ViewPreview(), new WriteEnhancePreview(), new MobilePreview()
new PagePreview(), new WritePreview(), new ViewPreview(), new WriteEnhancePreview(), new MobilePreview(), new PagePlusPreview()
}, templatePreviews);
}
@ -1194,6 +1195,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
protected void addChooseFILEFilter(FILEChooserPane fileChooser) {
String appName = ProductConstants.APP_NAME;
fileChooser.addChooseFILEFilter(new ChooseFileFilter(FileExtension.CPT, appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
fileChooser.addChooseFILEFilter(new ChooseFileFilter(FileExtension.CPTX, appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
addExtraChooseFILEFilter(fileChooser);
}

3
designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java

@ -4,6 +4,7 @@ import com.fr.design.mainframe.App;
import com.fr.design.mainframe.JTemplateFactory;
import com.fr.module.Activator;
import com.fr.module.extension.Prepare;
import com.fr.plugin.designer.CptxApp;
import java.util.List;
@ -33,7 +34,7 @@ public class DesignerAppActivator extends Activator implements Prepare {
@Override
public void prepare() {
addMutable(App.KEY, new CptApp(), new FormApp(), new XlsApp(), new XlsxApp());
addMutable(App.KEY, new CptApp(), new CptxApp(), new FormApp(), new XlsApp(), new XlsxApp());
}
}

6
designer-realize/src/main/java/com/fr/plugin/designer/CptxApp.java

@ -12,12 +12,6 @@ import com.fr.plugin.designer.utils.DesignerCptxFileUtils;
*/
public class CptxApp extends AbstractAppProvider<WorkBook> {
static {
// 保证设计器默认 cptx 启动正常
StartupAssist.init();
}
public CptxApp() {
StartupAssist.initDesignModule();
}

51
designer-realize/src/main/java/com/fr/plugin/designer/EnginexSupportedFileUIImpl.java

@ -1,51 +0,0 @@
package com.fr.plugin.designer;
import com.fr.base.BaseUtils;
import com.fr.base.extension.FileExtension;
import com.fr.design.i18n.Toolkit;
import com.fr.design.fun.impl.AbstractReportSupportedFileUIProvider;
import com.fr.design.mainframe.JTemplate;
import com.fr.file.FILEChooserPane;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.plugin.designer.toolbar.TemplateTransformer;
import com.fr.stable.ProductConstants;
import javax.swing.Icon;
/**
* Created by kerry on 2019-10-14
*/
public class EnginexSupportedFileUIImpl extends AbstractReportSupportedFileUIProvider {
public static final Icon CPTX_ICON = BaseUtils.readIcon("/com/fr/plugin/designer/cptx_file_icon.png");
public static final Icon CPTX_LOCKED_ICON = BaseUtils.readIcon("/com/fr/plugin/designer/cptx_file_icon_locked.png");
@Override
public void addChooseFileFilter(FILEChooserPane fileChooser, String suffix) {
String filterDescription = ProductConstants.APP_NAME + Toolkit.i18nText("Fine-Design_Report_Template_File");
ChooseFileFilter cptxChooserFilter = new ChooseFileFilter(FileExtension.CPTX, filterDescription);
fileChooser.addChooseFILEFilter(cptxChooserFilter);
}
@Override
public Icon getFileIcon(String path, boolean isShowLock) {
if (!FileExtension.CPTX.matchExtension(path)) {
return null;
}
if (isShowLock) {
return CPTX_LOCKED_ICON;
}
return CPTX_ICON;
}
@Override
public boolean saveToNewFile(String targetPath, JTemplate jTemplate) {
if (FileExtension.CPTX.matchExtension(targetPath)) {
TemplateTransformer.TO_CPTX.transform(jTemplate);
return true;
}
return false;
}
}

8
designer-realize/src/main/java/com/fr/plugin/designer/JStreamBook.java

@ -8,18 +8,21 @@ import com.fr.design.actions.file.export.TextExportAction;
import com.fr.design.actions.file.export.WordExportAction;
import com.fr.design.mainframe.JWorkBook;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut;
import com.fr.file.FILE;
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.cptx.entry.metadata.CptxMetadata;
import com.fr.plugin.designer.menu.CalculateAttrAction;
import com.fr.plugin.designer.toolbar.TemplateTransformer;
import com.fr.plugin.designer.toolbar.TransformResult;
import com.fr.plugin.designer.toolbar.TransformResultInfo;
import com.fr.plugin.designer.utils.DesignerCptxFileUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.third.jodd.util.ArraysUtil;
import java.io.File;
import java.io.FileOutputStream;
@ -106,4 +109,9 @@ public class JStreamBook extends JWorkBook {
}
return StringUtils.EMPTY;
}
@Override
public ShortCut[] shortcut4TemplateMenu() {
return ArraysUtil.insert(super.shortcut4TemplateMenu(), new CalculateAttrAction(this), 5);
}
}

20
designer-realize/src/main/java/com/fr/plugin/designer/StartupAssist.java

@ -10,15 +10,10 @@ import com.fr.design.mainframe.JTemplateFactory;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.parameter.AbstractParameterReader;
import com.fr.design.ui.util.UIUtil;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.log.FineLoggerFactory;
import com.fr.main.impl.WorkBook;
import com.fr.nx.cptx.CptxIOManager;
import com.fr.nx.cptx.io.handle.CptxTemplateHandle;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.observer.PluginEventType;
/**
* 保证设计器默认 cptx 启动正常
@ -28,11 +23,6 @@ import com.fr.plugin.observer.PluginEventType;
*/
public class StartupAssist {
public static void init() {
listenInitDesignModule();
}
public static void initDesignModule() {
DesignModuleFactory.registerParameterReader(new AbstractParameterReader() {
@Override
@ -82,14 +72,4 @@ public class StartupAssist {
(path = jTemplate.getPath()) != null
&& path.endsWith(FileExtension.CPTX.getExtension());
}
private static void listenInitDesignModule() {
EventDispatcher.listen(PluginEventType.AfterRun, new Listener<PluginContext>() {
@SuppressWarnings("rawtypes")
@Override
public void on(Event event, PluginContext param) {
initDesignModule();
}
});
}
}

29
designer-realize/src/main/java/com/fr/plugin/designer/WritableCptx.java

@ -1,29 +0,0 @@
package com.fr.plugin.designer;
import com.fr.file.FILE;
import com.fr.nx.cptx.io.handle.impl.AbstractCptxIOProvider;
import java.io.InputStream;
import java.io.OutputStream;
/**
* 读写型模板, 用于设计器端增删改模板
*/
public class WritableCptx extends AbstractCptxIOProvider {
private FILE file;
public WritableCptx(FILE file) {
this.file = file;
}
@Override
public InputStream open() throws Exception {
return file.asInputStream();
}
@Override
public OutputStream createTemp() throws Exception {
return file.asOutputStream();
}
}

36
designer-realize/src/main/java/com/fr/plugin/designer/menu/BatchCompileMenu.java

@ -1,36 +0,0 @@
package com.fr.plugin.designer.menu;
import com.fr.design.fun.impl.AbstractMenuHandler;
import com.fr.design.menu.ShortCut;
/**
* Created by kerry on 2019-12-10
*/
public class BatchCompileMenu extends AbstractMenuHandler {
private static final int DEFAULT_INSERT_POSITION = 9;
@Override
public int insertPosition(int total) {
return DEFAULT_INSERT_POSITION;
}
@Override
public boolean insertSeparatorBefore() {
return false;
}
@Override
public boolean insertSeparatorAfter() {
return false;
}
@Override
public String category() {
return FILE;
}
@Override
public ShortCut shortcut() {
return new BatchCompileAction();
}
}

69
designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrMenu.java

@ -1,69 +0,0 @@
package com.fr.plugin.designer.menu;
import com.fr.design.fun.impl.AbstractMenuHandler;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.ShortCut;
import com.fr.plugin.designer.JStreamBook;
public class CalculateAttrMenu extends AbstractMenuHandler {
private static final int DEFAULT_INSERT_POSITION = 7;
/**
* 插入位置
* @param total 插入点
*
* @return 插入位置
*
*/
public int insertPosition(int total) {
return DEFAULT_INSERT_POSITION;
}
/**
* 在分隔符前插入
*
* @return 是否在分隔符前插入
*
*/
public boolean insertSeparatorBefore() {
return false;
}
/**
* 在分隔符后插入
*
* @return 是否在分隔符后插入
*
*/
public boolean insertSeparatorAfter() {
return false;
}
/**
* 分类
*
* @return 菜单分类
*
*/
public String category() {
return TEMPLATE;
}
/**
* 获取当前菜单的Action
*
* @param plus 当前操作对象
*
* @return 菜单Action
*
*/
public ShortCut shortcut(ToolBarMenuDockPlus plus) {
//往ToolBarMenuDockPlus里塞感觉也很糟.
if (!(plus instanceof JStreamBook)){
return null;
}
return new CalculateAttrAction((JStreamBook) plus);
}
}

37
designer-realize/src/main/java/com/fr/plugin/designer/menu/LocalAnalyzerMenu.java

@ -1,37 +0,0 @@
package com.fr.plugin.designer.menu;
import com.fr.design.fun.impl.AbstractMenuHandler;
import com.fr.design.menu.ShortCut;
/**
* @author Maksim
* Created in 2020/11/5 11:44 上午
*/
public class LocalAnalyzerMenu extends AbstractMenuHandler {
private static final int DEFAULT_INSERT_POSITION = 13;
@Override
public int insertPosition(int i) {
return DEFAULT_INSERT_POSITION;
}
@Override
public boolean insertSeparatorBefore() {
return false;
}
@Override
public boolean insertSeparatorAfter() {
return false;
}
@Override
public String category() {
return SERVER;
}
@Override
public ShortCut shortcut() {
return new LocalAnalyzerAction();
}
}

20
designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformerUIButton.java

@ -1,20 +0,0 @@
package com.fr.plugin.designer.toolbar;
import com.fr.design.fun.impl.AbstractDsinFrameUpButtonProvider;
import com.fr.design.gui.ibutton.UIButton;
public class TemplateTransformerUIButton extends AbstractDsinFrameUpButtonProvider {
@Override
public UIButton[] getUpButtons(int menuState) {
CompileAction compileAction = new CompileAction();
UIButton transBtn = (UIButton) compileAction.createToolBarComponent();
return new UIButton[]{transBtn};
}
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
}

2
designer-realize/src/main/java/com/fr/start/MainDesigner.java

@ -6,6 +6,7 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.file.WebPreviewUtils;
import com.fr.design.actions.file.newReport.NewPolyReportAction;
import com.fr.design.actions.file.newReport.NewWorkBookAction;
import com.fr.design.actions.server.LocalAnalyzerAction;
import com.fr.design.actions.server.ServerConfigManagerAction;
import com.fr.design.actions.server.StyleListAction;
import com.fr.design.actions.server.WidgetManagerAction;
@ -165,6 +166,7 @@ public class MainDesigner extends BaseDesigner {
if (WorkContext.getCurrent().isRoot()) {
menuDef.addShortCut(new ServerConfigManagerAction(), new StyleListAction(), new WidgetManagerAction());
menuDef.addShortCut(new ChartPreStyleAction(), new ChartEmptyDataStyleAction(),new ChartMapEditorAction());
menuDef.addShortCut(new LocalAnalyzerAction());
}
insertMenu(menuDef, MenuHandler.SERVER);

26
designer-realize/src/test/java/com/fr/plugin/designer/EnginexSupportedFileUIImplTest.java

@ -1,26 +0,0 @@
package com.fr.plugin.designer;
import org.junit.Assert;
import org.junit.Test;
import javax.swing.Icon;
/**
* Created by kerry on 2019-10-15
*/
public class EnginexSupportedFileUIImplTest {
@Test
public void testGetFileIcon() {
EnginexSupportedFileUIImpl newFileType = new EnginexSupportedFileUIImpl();
Icon icon1 = newFileType.getFileIcon("WorkBook.cpt", false);
Assert.assertNull(icon1);
Icon icon2 = newFileType.getFileIcon("WorkBook.cptx", false);
Assert.assertEquals(EnginexSupportedFileUIImpl.CPTX_ICON, icon2);
Icon icon3 = newFileType.getFileIcon("WorkBook.cpt", true);
Assert.assertNull(icon3);
Icon icon4 = newFileType.getFileIcon("WorkBook.cptx", true);
Assert.assertEquals(EnginexSupportedFileUIImpl.CPTX_LOCKED_ICON, icon4);
}
}

42
designer-realize/src/test/java/com/fr/plugin/designer/clean/CompileCleanManagerTest.java

@ -1,42 +0,0 @@
package com.fr.plugin.designer.clean;
import com.fr.config.dao.DaoContext;
import com.fr.config.dao.impl.LocalClassHelperDao;
import com.fr.config.dao.impl.LocalEntityDao;
import com.fr.config.dao.impl.LocalXmlEntityDao;
import com.fr.nx.cptx.clean.CompileCleanManager;
import com.fr.transaction.Configurations;
import com.fr.transaction.LocalConfigurationHelper;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
/**
* @author: Maksim
* @Date: Created in 2020/4/23
* @Description:
*/
public class CompileCleanManagerTest {
@Before
public void before() {
DaoContext.setEntityDao(new LocalEntityDao());
DaoContext.setClassHelperDao(new LocalClassHelperDao());
DaoContext.setXmlEntityDao(new LocalXmlEntityDao());
Configurations.setHelper(new LocalConfigurationHelper());
}
@Test
public void clearTest() {
CompileCleanManager manager = CompileCleanManager.getInstance();
manager.addRecord("com.cptx");
manager.addRecord("abc/com.cptx");
manager.addRecord("merge.cptx", "2020-01-01");
manager.addRecord("merge.cptx", "2020-02-01");
Assert.assertEquals(3, manager.getRecords().size());
manager.clear();
Assert.assertEquals(2, manager.getRecords().size());
}
}

16
designer-realize/src/test/java/com/fr/plugin/designer/menu/BatchCompileMenuTest.java

@ -1,16 +0,0 @@
package com.fr.plugin.designer.menu;
import org.junit.Assert;
import org.junit.Test;
/**
* Created by kerry on 2020-01-15
*/
public class BatchCompileMenuTest {
@Test
public void testBatchCompileMenuIndex(){
BatchCompileMenu menu = new BatchCompileMenu();
Assert.assertEquals(9, menu.insertPosition(20));
}
}
Loading…
Cancel
Save