Browse Source

Merge pull request #34 in DESIGN/design from ~VITO/c-design:feature/10.0 to feature/10.0

* commit '41b508d6c607fab97b4ed6e949947b16c600850a':
  REPORT-5208 设计器部分
master
superman 7 years ago
parent
commit
a89fa6177a
  1. 4
      designer-base/src/com/fr/design/DesignModelAdapter.java
  2. 23
      designer-base/src/com/fr/design/designer/TargetComponent.java
  3. 6
      designer-base/src/com/fr/design/mainframe/App.java
  4. 9
      designer-base/src/com/fr/design/mainframe/DesignerFrame.java
  5. 91
      designer-base/src/com/fr/design/mainframe/JTemplate.java
  6. 16
      designer-base/src/com/fr/design/mainframe/JVirtualTemplate.java
  7. 27
      designer-base/src/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java
  8. 6
      designer-base/src/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java
  9. 4
      designer-base/src/com/fr/design/mainframe/templateinfo/TemplateProcessInfo.java
  10. 4
      designer-base/src/com/fr/design/mainframe/widget/wrappers/BackgroundWrapper.java
  11. 6
      designer-base/src/com/fr/design/style/background/BackgroundFactory.java
  12. 27
      designer-base/src/com/fr/design/style/background/BackgroundUIComboBoxPane.java
  13. 48
      designer-base/src/com/fr/design/style/background/image/ImageSelectPane.java
  14. 41
      designer-base/src/com/fr/design/style/background/impl/ImageBackgroundPane.java
  15. 17
      designer-base/src/com/fr/design/style/background/impl/ImageButtonBackgroundPane.java
  16. 20
      designer-base/src/com/fr/env/RemoteEnv.java
  17. 28
      designer-base/src/com/fr/file/FILEChooserPane.java
  18. 39
      designer-realize/src/com/fr/design/actions/file/export/AbstractExportAction.java
  19. 9
      designer-realize/src/com/fr/design/actions/file/newReport/NewWorkBookAction.java
  20. 67
      designer-realize/src/com/fr/design/actions/file/newReport/NewWorkBookXAction.java
  21. 14
      designer-realize/src/com/fr/design/actions/insert/flot/ImageFloatAction.java
  22. 14
      designer-realize/src/com/fr/design/cell/editor/ImageCellEditor.java
  23. 14
      designer-realize/src/com/fr/design/cell/editor/ImageFloatEditor.java
  24. 86
      designer-realize/src/com/fr/design/mainframe/ElementCasePane.java
  25. 1
      designer-realize/src/com/fr/design/mainframe/JPolyWorkBook.java
  26. 73
      designer-realize/src/com/fr/design/mainframe/JWorkBook.java
  27. 15
      designer-realize/src/com/fr/design/mainframe/ReportComponent.java
  28. 21
      designer-realize/src/com/fr/design/mainframe/WorkSheetDesigner.java
  29. 61
      designer-realize/src/com/fr/design/mainframe/form/FormElementCaseDesigner.java
  30. 52
      designer-realize/src/com/fr/design/module/DesignerModule.java
  31. 71
      designer-realize/src/com/fr/design/report/SelectImagePane.java
  32. 32
      designer-realize/src/com/fr/design/widget/ui/btn/ButtonSytleDefinedPane.java
  33. 32
      designer-realize/src/com/fr/grid/Grid.java
  34. 8
      designer-realize/src/com/fr/grid/GridUI.java
  35. 6
      designer-realize/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java
  36. 5
      designer-realize/src/com/fr/quickeditor/floatquick/FloatImageQuickEditor.java
  37. 29
      designer-realize/src/com/fr/start/Designer.java

4
designer-base/src/com/fr/design/DesignModelAdapter.java

@ -1,7 +1,7 @@
package com.fr.design; package com.fr.design;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.io.IOFile; import com.fr.base.io.BaseBook;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JTemplateProvider; import com.fr.design.mainframe.JTemplateProvider;
@ -19,7 +19,7 @@ import java.util.Map;
* @author zhou * @author zhou
* @since 2012-7-26上午11:24:54 * @since 2012-7-26上午11:24:54
*/ */
public abstract class DesignModelAdapter<T extends IOFile, S extends JTemplateProvider> { public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplateProvider> {
private static DesignModelAdapter<?, ?> currentModelAdapter; private static DesignModelAdapter<?, ?> currentModelAdapter;
protected S jTemplate; protected S jTemplate;

23
designer-base/src/com/fr/design/designer/TargetComponent.java

@ -9,8 +9,10 @@ import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.javax.annotation.Nullable;
import javax.swing.*; import javax.swing.JComponent;
import javax.swing.JPanel;
/** /**
* 模板设计界面 * 模板设计界面
@ -22,7 +24,8 @@ public abstract class TargetComponent<T> extends JComponent {
this.target = t; this.target = t;
} }
public TargetComponent() {} public TargetComponent() {
}
// TODO ALEX_SEP JWorkBook不想有copy, paste, cut的操作,怎么办? // TODO ALEX_SEP JWorkBook不想有copy, paste, cut的操作,怎么办?
public abstract void copy(); public abstract void copy();
@ -40,7 +43,13 @@ public abstract class TargetComponent<T> extends JComponent {
public abstract AuthorityEditPane createAuthorityEditPane(); public abstract AuthorityEditPane createAuthorityEditPane();
public abstract ToolBarMenuDockPlus getToolBarMenuDockPlus(); /**
* 提供默认空实现大部分子类不需要这个方法覆写的莫名其妙的
*/
@Nullable
public ToolBarMenuDockPlus getToolBarMenuDockPlus() {
return null;
}
public abstract int getMenuState(); public abstract int getMenuState();
@ -118,10 +127,12 @@ public abstract class TargetComponent<T> extends JComponent {
return false; return false;
} }
@Override
public int getMenuState() { public int getMenuState() {
return DesignState.WORK_SHEET; return DesignState.WORK_SHEET;
} }
@Override
public void cancelFormat() { public void cancelFormat() {
return; return;
} }
@ -135,10 +146,12 @@ public abstract class TargetComponent<T> extends JComponent {
public void stopEditing() { public void stopEditing() {
} }
@Override
public AuthorityEditPane createAuthorityEditPane() { public AuthorityEditPane createAuthorityEditPane() {
return null; return null;
} }
@Override
public ToolBarMenuDockPlus getToolBarMenuDockPlus() { public ToolBarMenuDockPlus getToolBarMenuDockPlus() {
return null; return null;
} }
@ -158,19 +171,23 @@ public abstract class TargetComponent<T> extends JComponent {
return new ShortCut[0]; return new ShortCut[0];
} }
@Override
public ShortCut[] shortCuts4Authority() { public ShortCut[] shortCuts4Authority() {
return new ShortCut[0]; return new ShortCut[0];
} }
@Override
public JComponent[] toolBarButton4Form() { public JComponent[] toolBarButton4Form() {
return new JComponent[0]; return new JComponent[0];
} }
@Override
public JPanel getEastUpPane() { public JPanel getEastUpPane() {
return new JPanel(); return new JPanel();
} }
@Override
public JPanel getEastDownPane() { public JPanel getEastDownPane() {
return new JPanel(); return new JPanel();
} }

6
designer-base/src/com/fr/design/mainframe/App.java

@ -1,14 +1,14 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.io.IOFile; import com.fr.base.io.BaseBook;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.stable.fun.mark.Mutable;
import com.fr.stable.fun.mark.Aftermath; import com.fr.stable.fun.mark.Aftermath;
import com.fr.stable.fun.mark.Mutable;
/** /**
* Created by Administrator on 2016/3/17/0017. * Created by Administrator on 2016/3/17/0017.
*/ */
public interface App<T extends IOFile> extends Mutable, Aftermath { public interface App<T extends BaseBook> extends Mutable, Aftermath {
String MARK_STRING = "DesignerApp"; String MARK_STRING = "DesignerApp";

9
designer-base/src/com/fr/design/mainframe/DesignerFrame.java

@ -859,12 +859,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
boolean opened = false; boolean opened = false;
for (int j = 0; j < defaultAppExtentions.length; j++) { for (int j = 0; j < defaultAppExtentions.length; j++) {
if (defaultAppExtentions[j].equalsIgnoreCase(fileExtention)) { if (defaultAppExtentions[j].equalsIgnoreCase(fileExtention)) {
JTemplate jt = null; // 不要catch
try { JTemplate jt = app.openTemplate(tplFile);
jt = app.openTemplate(tplFile);
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage(), e);
}
if (jt == null) { if (jt == null) {
return; return;
} }

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

@ -1,7 +1,10 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.*; import com.fr.base.BaseUtils;
import com.fr.base.io.IOFile; 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.base.iofileattr.TemplateIdAttrMark;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState; import com.fr.design.DesignState;
@ -44,6 +47,8 @@ import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; 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.ArrayUtils;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
@ -51,11 +56,13 @@ import com.fr.stable.StringUtils;
import com.fr.stable.core.UUID; import com.fr.stable.core.UUID;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.undo.UndoManager; import javax.swing.undo.UndoManager;
import java.awt.*; import java.awt.BorderLayout;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -65,7 +72,7 @@ import java.util.regex.Pattern;
/** /**
* 报表设计和表单设计的编辑区域(设计器编辑的IO文件) * 报表设计和表单设计的编辑区域(设计器编辑的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 // TODO ALEX_SEP editingFILE这个属性一定要吗?如果非要不可,有没有可能保证不为null
private static final int PREFIX_NUM = 3000; private static final int PREFIX_NUM = 3000;
private FILE editingFILE = null; private FILE editingFILE = null;
@ -77,7 +84,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
protected U undoState; protected U undoState;
protected U authorityUndoState = null; protected U authorityUndoState = null;
protected T template; // 当前模板 protected T template; // 当前模板
protected TemplateProcessInfo processInfo; // 模板过程的相关信息 protected TemplateProcessInfo<T> processInfo; // 模板过程的相关信息
private static short currentIndex = 0;// 此变量用于多次新建模板时,让名字不重复 private static short currentIndex = 0;// 此变量用于多次新建模板时,让名字不重复
private DesignModelAdapter<T, ?> designModel; private DesignModelAdapter<T, ?> designModel;
private PreviewProvider previewType; private PreviewProvider previewType;
@ -86,7 +93,8 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
private StringBuilder process = new StringBuilder(""); // 制作模板的过程 private StringBuilder process = new StringBuilder(""); // 制作模板的过程
public int resolution = ScreenResolution.getScreenResolution(); public int resolution = ScreenResolution.getScreenResolution();
public JTemplate() {} public JTemplate() {
}
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);
@ -123,11 +131,12 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
// 为收集模版信息作准备 // 为收集模版信息作准备
private void initForCollect() { private void initForCollect() {
template.initTemplateID(); // 为新模板设置 templateID 属性 generateTemplateId();
if (openTime == 0) { if (openTime == 0) {
openTime = System.currentTimeMillis(); openTime = System.currentTimeMillis();
} }
} }
private void collectInfo() { // 执行收集操作 private void collectInfo() { // 执行收集操作
if (openTime == 0) { // 旧模板,不收集数据 if (openTime == 0) { // 旧模板,不收集数据
return; return;
@ -140,7 +149,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
openTime = saveTime; // 更新 openTime,准备下一次计算 openTime = saveTime; // 更新 openTime,准备下一次计算
} }
public abstract TemplateProcessInfo getProcessInfo(); public abstract TemplateProcessInfo<T> getProcessInfo();
// 追加过程记录 // 追加过程记录
public void appendProcess(String s) { public void appendProcess(String s) {
@ -178,6 +187,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
return; return;
} }
@Override
public int getMenuState() { public int getMenuState() {
return DesignState.WORK_SHEET; return DesignState.WORK_SHEET;
} }
@ -185,6 +195,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
/** /**
* 取消格式 * 取消格式
*/ */
@Override
public void cancelFormat() { public void cancelFormat() {
return; return;
} }
@ -380,6 +391,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
/** /**
* 模板更新 * 模板更新
*/ */
@Override
public void fireTargetModified() { public void fireTargetModified() {
U newState = createUndoState(); U newState = createUndoState();
if (newState == null) { if (newState == null) {
@ -431,11 +443,10 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
/** /**
* 停止编辑, 判断保存属性 * * 停止编辑, 判断保存属性 *
*/ */
@Override
public void stopEditing() { public void stopEditing() {
} }
;
/** /**
* 得到正在编辑的FILE * 得到正在编辑的FILE
@ -454,6 +465,17 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
*/ */
public abstract String suffix(); public abstract String suffix();
/**
* 添加图片到格子中
*
* @return 返回图片URI
*/
public void setPictureElem(Elem elem, CellImage cellImage) {
// 子类实现
}
;
/** /**
* 是否保存 * 是否保存
* *
@ -594,11 +616,11 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
* 将模板另存为可以分享出去的混淆后内置数据集模板 * 将模板另存为可以分享出去的混淆后内置数据集模板
* *
* @return 是否另存成功 * @return 是否另存成功
*
*/ */
public boolean saveShareFile() { public boolean saveShareFile() {
return true; return true;
} }
public Widget getSelectElementCase() { public Widget getSelectElementCase() {
return new NoneWidget(); return new NoneWidget();
} }
@ -672,6 +694,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
* *
* @return 返回菜单 * @return 返回菜单
*/ */
@Override
public ShortCut[] shortcut4FileMenu() { public ShortCut[] shortcut4FileMenu() {
if (BaseUtils.isAuthorityEditing()) { if (BaseUtils.isAuthorityEditing()) {
return new ShortCut[]{new SaveTemplateAction(this), new UndoAction(this), new RedoAction(this)}; 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 菜单 * @return 菜单
*/ */
@Override
public MenuDef[] menus4Target() { public MenuDef[] menus4Target() {
MenuDef tplMenu = new MenuDef(Inter.getLocText("FR-Designer_M-Template"), 'T'); MenuDef tplMenu = new MenuDef(Inter.getLocText("FR-Designer_M-Template"), 'T');
tplMenu.setAnchor(MenuHandler.TEMPLATE); tplMenu.setAnchor(MenuHandler.TEMPLATE);
@ -704,6 +728,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
* *
* @return 返回菜单 * @return 返回菜单
*/ */
@Override
public abstract ShortCut[] shortcut4TemplateMenu(); public abstract ShortCut[] shortcut4TemplateMenu();
/** /**
@ -711,6 +736,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
* *
* @return 菜单 * @return 菜单
*/ */
@Override
public abstract ShortCut[] shortCuts4Authority(); public abstract ShortCut[] shortCuts4Authority();
// /////////////////////////////JTemplateActionListener////////////////////////////////// // /////////////////////////////JTemplateActionListener//////////////////////////////////
@ -826,6 +852,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
/** /**
* 判断是否是新版设计器 * 判断是否是新版设计器
*
* @return 是返回true * @return 是返回true
*/ */
public boolean isNewDesigner() { public boolean isNewDesigner() {
@ -888,41 +915,40 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
/** /**
* 激活指定的template * 激活指定的template
*
*/ */
public void activeJTemplate(int index, JTemplate jt) { public void activeJTemplate(int index, JTemplate jt) {
DesignerContext.getDesignerFrame().activateJTemplate(this); DesignerContext.getDesignerFrame().activateJTemplate(this);
}; }
/** /**
* 激活已存在的模板 * 激活已存在的模板
*
*/ */
public void activeOldJTemplate() { public void activeOldJTemplate() {
DesignerContext.getDesignerFrame().activateJTemplate(this); DesignerContext.getDesignerFrame().activateJTemplate(this);
}; }
/** /**
* 激活新的模板 * 激活新的模板
*
*/ */
public void activeNewJTemplate() { public void activeNewJTemplate() {
DesignerContext.getDesignerFrame().addAndActivateJTemplate(this); DesignerContext.getDesignerFrame().addAndActivateJTemplate(this);
}; }
/** /**
* 后台关闭template * 后台关闭template
*
*/ */
public void closeOverLineTemplate(int index) { public void closeOverLineTemplate(int index) {
JTemplate overTemplate = HistoryTemplateListPane.getInstance().getHistoryList().get(index); JTemplate overTemplate = HistoryTemplateListPane.getInstance().getHistoryList().get(index);
HistoryTemplateListPane.getInstance().closeVirtualSelectedReport(overTemplate); HistoryTemplateListPane.getInstance().closeVirtualSelectedReport(overTemplate);
HistoryTemplateListPane.getInstance().getHistoryList().set(index, new JVirtualTemplate(overTemplate.getEditingFILE())); HistoryTemplateListPane.getInstance().getHistoryList().set(index, new JVirtualTemplate(overTemplate.getEditingFILE()));
}; }
;
/** /**
* 返回当前支持的超链界面pane * 返回当前支持的超链界面pane
*
* @return 超链连接界面 * @return 超链连接界面
*/ */
public abstract HyperlinkGroupPane getHyperLinkPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider); public abstract HyperlinkGroupPane getHyperLinkPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider);
@ -930,6 +956,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
/** /**
* 返回当前支持的超链界面pane * 返回当前支持的超链界面pane
* 没有悬浮弹窗显示为两列 * 没有悬浮弹窗显示为两列
*
* @return 超链连接界面 * @return 超链连接界面
*/ */
public abstract HyperlinkGroupPane getHyperLinkPaneNoPop(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider); public abstract HyperlinkGroupPane getHyperLinkPaneNoPop(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider);
@ -991,8 +1018,6 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
* 创建内置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() {
@ -1003,8 +1028,6 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
* 创建控件事件里内置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() {
@ -1013,14 +1036,17 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
/** /**
* 取小图标主要用于多TAB标签栏 * 取小图标主要用于多TAB标签栏
*
* @return 图表 * @return 图表
*/ */
public abstract Icon getIcon(); public abstract Icon getIcon();
/** /**
* 导出菜单项 * 导出菜单项
*
* @return 菜单项 * @return 菜单项
*/ */
@Override
public ShortCut[] shortcut4ExportMenu() { public ShortCut[] shortcut4ExportMenu() {
return new ShortCut[0]; return new ShortCut[0];
} }
@ -1028,7 +1054,8 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
/** /**
* 复制JS代码 * 复制JS代码
*/ */
public void copyJS(){} public void copyJS() {
}
/** /**
* 系列风格改动 * 系列风格改动
@ -1041,7 +1068,6 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
* 创建分享模板的按钮, 目前只有jworkbook实现了 * 创建分享模板的按钮, 目前只有jworkbook实现了
* *
* @return 分享模板按钮 * @return 分享模板按钮
*
*/ */
public UIButton[] createShareButton() { public UIButton[] createShareButton() {
return new UIButton[0]; return new UIButton[0];
@ -1049,6 +1075,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
/** /**
* *
*
* @param provider 预览模式 * @param provider 预览模式
*/ */
public void previewMenuActionPerformed(PreviewProvider provider) { public void previewMenuActionPerformed(PreviewProvider provider) {
@ -1057,6 +1084,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
/** /**
* 支持的预览模式 * 支持的预览模式
*
* @return 预览模式 * @return 预览模式
*/ */
public PreviewProvider[] supportPreview() { public PreviewProvider[] supportPreview() {
@ -1065,6 +1093,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
/** /**
* 预览模式转换 * 预览模式转换
*
* @param typeCode 类型 * @param typeCode 类型
* @return 预览模式 * @return 预览模式
*/ */
@ -1088,6 +1117,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
/** /**
* 加载插件中的按钮 * 加载插件中的按钮
*
* @return 按钮组 * @return 按钮组
*/ */
public UIButton[] createExtraButtons() { public UIButton[] createExtraButtons() {
@ -1102,11 +1132,18 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
/** /**
* 由于老版本的模板没有模板ID当勾选使用参数模板时候就加一个模板ID attr * 由于老版本的模板没有模板ID当勾选使用参数模板时候就加一个模板ID attr
*
* @param isUseParamTemplate 是否使用参数模板 * @param isUseParamTemplate 是否使用参数模板
*/ */
public void needAddTemplateIdAttr(boolean isUseParamTemplate) { public void needAddTemplateIdAttr(boolean isUseParamTemplate) {
if (isUseParamTemplate && template.getAttrMark(TemplateIdAttrMark.XML_TAG) == null) { 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);
}
} }

16
designer-base/src/com/fr/design/mainframe/JVirtualTemplate.java

@ -8,16 +8,15 @@ import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; import com.fr.design.mainframe.templateinfo.TemplateProcessInfo;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FileFILE;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import javax.swing.*; import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPanel;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
@ -35,6 +34,7 @@ public class JVirtualTemplate extends JTemplate {
setEditingFILE(editingFILE); setEditingFILE(editingFILE);
} }
@Override
public String getFullPathName() { public String getFullPathName() {
String editingFileName = getEditingFILE().getPath(); String editingFileName = getEditingFILE().getPath();
if (editingFileName.startsWith(ProjectConstants.REPORTLETS_NAME)) { if (editingFileName.startsWith(ProjectConstants.REPORTLETS_NAME)) {
@ -48,6 +48,7 @@ public class JVirtualTemplate extends JTemplate {
* *
* @return * @return
*/ */
@Override
public FILE getEditingFILE() { public FILE getEditingFILE() {
return this.editingFILE; return this.editingFILE;
} }
@ -71,6 +72,7 @@ public class JVirtualTemplate extends JTemplate {
return null; return null;
} }
@Override
public JComponent getCurrentReportComponentPane() { public JComponent getCurrentReportComponentPane() {
return null; return null;
} }
@ -165,11 +167,6 @@ public class JVirtualTemplate extends JTemplate {
return null; return null;
} }
@Override
public ToolBarMenuDockPlus getToolBarMenuDockPlus() {
return null;
}
@Override @Override
public JPanel getEastUpPane() { public JPanel getEastUpPane() {
return null; return null;
@ -246,6 +243,7 @@ public class JVirtualTemplate extends JTemplate {
return null; return null;
} }
@Override
public HyperlinkGroupPane getHyperLinkPaneNoPop(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) { public HyperlinkGroupPane getHyperLinkPaneNoPop(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
return null; return null;
} }

27
designer-base/src/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java

@ -2,7 +2,9 @@ package com.fr.design.mainframe.backgroundpane;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.background.ImageBackground; import com.fr.base.background.ImageFileBackground;
import com.fr.base.frpx.pack.PictureCollection;
import com.fr.base.frpx.util.ImageIOHelper;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
@ -37,6 +39,8 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
private UIButtonGroup<Byte> imageLayoutPane; private UIButtonGroup<Byte> imageLayoutPane;
private String suffix = PictureCollection.DEFAULT_SUFFIX;
public ImageBackgroundQuickPane() { public ImageBackgroundQuickPane() {
this(true); this(true);
} }
@ -86,6 +90,7 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
*/ */
ActionListener selectPictureActionListener = new ActionListener() { ActionListener selectPictureActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
if (imageFileChooser == null) { if (imageFileChooser == null) {
imageFileChooser = new ImageFileChooser(); imageFileChooser = new ImageFileChooser();
@ -96,7 +101,9 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
File selectedFile = imageFileChooser.getSelectedFile(); File selectedFile = imageFileChooser.getSelectedFile();
if (selectedFile != null && selectedFile.isFile()) { if (selectedFile != null && selectedFile.isFile()) {
Image image = BaseUtils.readImage(selectedFile.getPath()); String path = selectedFile.getPath();
suffix = ImageIOHelper.getSuffix(path);
Image image = BaseUtils.readImage(path);
CoreGraphHelper.waitForImage(image); CoreGraphHelper.waitForImage(image);
previewPane.setImage(image); previewPane.setImage(image);
@ -112,9 +119,11 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
} }
}; };
@Override
public void populateBean(Background background) { public void populateBean(Background background) {
ImageBackground imageBackground = (ImageBackground) background; ImageFileBackground imageBackground = (ImageFileBackground) background;
suffix = imageBackground.getSuffix();
imageLayoutPane.setSelectedItem((byte) imageBackground.getLayout()); imageLayoutPane.setSelectedItem((byte) imageBackground.getLayout());
Style.DEFAULT_STYLE.deriveImageLayout(imageBackground.getLayout()); Style.DEFAULT_STYLE.deriveImageLayout(imageBackground.getLayout());
@ -123,8 +132,9 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
previewPane.repaint(); previewPane.repaint();
} }
@Override
public Background updateBean() { public Background updateBean() {
ImageBackground imageBackground = new ImageBackground(previewPane.getImage()); ImageFileBackground imageBackground = new ImageFileBackground(previewPane.getImage(), suffix);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(imageLayoutPane.getSelectedItem()); imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(imageLayoutPane.getSelectedItem());
imageBackground.setLayout(imageStyle.getImageLayout()); imageBackground.setLayout(imageStyle.getImageLayout());
return imageBackground; return imageBackground;
@ -135,8 +145,10 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
* *
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
@Override
public void registerChangeListener(final UIObserverListener listener) { public void registerChangeListener(final UIObserverListener listener) {
changeListener = new ChangeListener() { changeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
listener.doChange(); listener.doChange();
} }
@ -154,6 +166,7 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
ChangeListener imageSizeChangeListener = new ChangeListener() { ChangeListener imageSizeChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent evt) { public void stateChanged(ChangeEvent evt) {
if (imageLayoutPane.getSelectedItem() != null) { if (imageLayoutPane.getSelectedItem() != null) {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(imageLayoutPane.getSelectedItem()); imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(imageLayoutPane.getSelectedItem());
@ -165,17 +178,21 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
/** /**
* 判断是否是图片背景 * 判断是否是图片背景
*
* @param background 背景 * @param background 背景
* @return 判断是否是图片背景 * @return 判断是否是图片背景
*/ */
@Override
public boolean accept(Background background) { public boolean accept(Background background) {
return background instanceof ImageBackground; return background instanceof ImageFileBackground;
} }
/** /**
* 标题 * 标题
*
* @return 标题 * @return 标题
*/ */
@Override
public String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText("FR-Background_Image"); return Inter.getLocText("FR-Background_Image");
} }

6
designer-base/src/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.templateinfo; package com.fr.design.mainframe.templateinfo;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.io.IOFile; import com.fr.base.io.BaseBook;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -47,7 +47,7 @@ import java.util.Map;
* 做模板的过程和耗时收集辅助类 * 做模板的过程和耗时收集辅助类
* Created by plough on 2017/2/21. * Created by plough on 2017/2/21.
*/ */
public class TemplateInfoCollector<T extends IOFile> implements Serializable, XMLReadable, XMLWriter { public class TemplateInfoCollector<T extends BaseBook> implements Serializable, XMLReadable, XMLWriter {
static final long serialVersionUID = 2007L; static final long serialVersionUID = 2007L;
private static final String FILE_NAME = "tpl.info"; private static final String FILE_NAME = "tpl.info";
private static final String OBJECT_FILE_NAME = "tplInfo.ser"; private static final String OBJECT_FILE_NAME = "tplInfo.ser";
@ -241,7 +241,7 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable, XM
String templateID = t.getTemplateID(); String templateID = t.getTemplateID();
if (inList(t)) { // 已有记录 if (inList(t)) { // 已有记录
templateInfo = templateInfoList.get(t.getTemplateID()); templateInfo = templateInfoList.get(templateID);
// 更新 conusmingMap // 更新 conusmingMap
HashMap<String, Object> consumingMap = (HashMap<String, Object>) templateInfo.get(XML_CONSUMING_MAP); HashMap<String, Object> consumingMap = (HashMap<String, Object>) templateInfo.get(XML_CONSUMING_MAP);
timeConsume += (long) consumingMap.get(ATTR_TIME_CONSUME); // 加上之前的累计编辑时间 timeConsume += (long) consumingMap.get(ATTR_TIME_CONSUME); // 加上之前的累计编辑时间

4
designer-base/src/com/fr/design/mainframe/templateinfo/TemplateProcessInfo.java

@ -1,11 +1,11 @@
package com.fr.design.mainframe.templateinfo; package com.fr.design.mainframe.templateinfo;
import com.fr.base.io.IOFile; import com.fr.base.io.BaseBook;
/** /**
* Created by plough on 2017/3/17. * Created by plough on 2017/3/17.
*/ */
public abstract class TemplateProcessInfo<T extends IOFile> { public abstract class TemplateProcessInfo<T extends BaseBook> {
protected T template; protected T template;

4
designer-base/src/com/fr/design/mainframe/widget/wrappers/BackgroundWrapper.java

@ -6,7 +6,7 @@ package com.fr.design.mainframe.widget.wrappers;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.base.background.ColorBackground; import com.fr.base.background.ColorBackground;
import com.fr.base.background.GradientBackground; import com.fr.base.background.GradientBackground;
import com.fr.base.background.ImageBackground; import com.fr.base.background.ImageFileBackground;
import com.fr.base.background.PatternBackground; import com.fr.base.background.PatternBackground;
import com.fr.base.background.TextureBackground; import com.fr.base.background.TextureBackground;
import com.fr.design.Exception.ValidationException; import com.fr.design.Exception.ValidationException;
@ -30,7 +30,7 @@ public class BackgroundWrapper implements Encoder, Decoder {
return Inter.getLocText("Background-Texture"); return Inter.getLocText("Background-Texture");
} else if (v instanceof PatternBackground) { } else if (v instanceof PatternBackground) {
return Inter.getLocText("Background-Pattern"); return Inter.getLocText("Background-Pattern");
} else if (v instanceof ImageBackground) { } else if (v instanceof ImageFileBackground) {
return Inter.getLocText("Image"); return Inter.getLocText("Image");
} else if (v instanceof GradientBackground) { } else if (v instanceof GradientBackground) {
return Inter.getLocText("Gradient-Color"); return Inter.getLocText("Gradient-Color");

6
designer-base/src/com/fr/design/style/background/BackgroundFactory.java

@ -46,19 +46,19 @@ public class BackgroundFactory {
} }
private static void registerImageBackground(Map<Class<? extends Background>, BackgroundUIWrapper> map) { private static void registerImageBackground(Map<Class<? extends Background>, BackgroundUIWrapper> map) {
map.put(ImageBackground.class, BackgroundUIWrapper.create() map.put(ImageFileBackground.class, BackgroundUIWrapper.create()
.setType(ImageBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Image"))); .setType(ImageBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Image")));
} }
private static void registerBrowserImageBackground(Map<Class<? extends Background>, BackgroundUIWrapper> map) { private static void registerBrowserImageBackground(Map<Class<? extends Background>, BackgroundUIWrapper> map) {
map.put(ImageBackground.class, BackgroundUIWrapper.create() map.put(ImageFileBackground.class, BackgroundUIWrapper.create()
.setType(ImageBackgroundPane4Browser.class).setTitle(Inter.getLocText("FR-Designer_Background_Image"))); .setType(ImageBackgroundPane4Browser.class).setTitle(Inter.getLocText("FR-Designer_Background_Image")));
} }
private static void registerButtonBackground(Map<Class<? extends Background>, BackgroundUIWrapper> map) { private static void registerButtonBackground(Map<Class<? extends Background>, BackgroundUIWrapper> map) {
map.put(ColorBackground.class, BackgroundUIWrapper.create() map.put(ColorBackground.class, BackgroundUIWrapper.create()
.setType(ColorBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Color"))); .setType(ColorBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Color")));
map.put(ImageBackground.class, BackgroundUIWrapper.create() map.put(ImageFileBackground.class, BackgroundUIWrapper.create()
.setType(ImageButtonBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Image"))); .setType(ImageButtonBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Image")));
} }

27
designer-base/src/com/fr/design/style/background/BackgroundUIComboBoxPane.java

@ -1,25 +1,24 @@
package com.fr.design.style.background; package com.fr.design.style.background;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import com.fr.base.background.ColorBackground; import com.fr.base.background.ColorBackground;
import com.fr.base.background.GradientBackground; import com.fr.base.background.GradientBackground;
import com.fr.base.background.ImageBackground; import com.fr.base.background.ImageFileBackground;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane;
import com.fr.general.Background;
import com.fr.general.Inter;
import com.fr.design.style.background.gradient.GradientBackgroundSelectPane; import com.fr.design.style.background.gradient.GradientBackgroundSelectPane;
import com.fr.design.style.background.image.ImageSelectPane; import com.fr.design.style.background.image.ImageSelectPane;
import com.fr.design.style.color.ColorUIComboBoxPane; import com.fr.design.style.color.ColorUIComboBoxPane;
import com.fr.general.Background;
import com.fr.general.Inter;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/** /**
* @author kunsnat E-mail:kunsnat@gmail.com * @author kunsnat E-mail:kunsnat@gmail.com
@ -108,7 +107,7 @@ public class BackgroundUIComboBoxPane extends BasicPane {
if(background instanceof ColorBackground && colorPane != null) { if(background instanceof ColorBackground && colorPane != null) {
selectBox.setSelectedItem(color); selectBox.setSelectedItem(color);
colorPane.populate(background); colorPane.populate(background);
} else if(background instanceof ImageBackground && imagePane != null) { } else if(background instanceof ImageFileBackground && imagePane != null) {
selectBox.setSelectedItem(image); selectBox.setSelectedItem(image);
imagePane.populate(background); imagePane.populate(background);
} else if(background instanceof GradientBackground && gradientPane != null) { } else if(background instanceof GradientBackground && gradientPane != null) {

48
designer-base/src/com/fr/design/style/background/image/ImageSelectPane.java

@ -1,28 +1,29 @@
package com.fr.design.style.background.image; package com.fr.design.style.background.image;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.JFileChooser;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.background.ImageBackground; import com.fr.base.background.ImageFileBackground;
import com.fr.base.frpx.pack.PictureCollection;
import com.fr.base.frpx.util.ImageIOHelper;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.AlphaPane;
import com.fr.design.style.background.BackgroundPane4BoxChange;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper; import com.fr.stable.CoreGraphHelper;
import com.fr.design.style.AlphaPane;
import com.fr.design.style.background.BackgroundPane4BoxChange; import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
/** /**
@ -34,6 +35,9 @@ public class ImageSelectPane extends BackgroundPane4BoxChange {
private static final long serialVersionUID = -3938766570998917557L; private static final long serialVersionUID = -3938766570998917557L;
private static String layoutCenter = Inter.getLocText("Default"); private static String layoutCenter = Inter.getLocText("Default");
private static String layoutTitled = Inter.getLocText("Image-Titled"); private static String layoutTitled = Inter.getLocText("Image-Titled");
private String suffix = PictureCollection.DEFAULT_SUFFIX;
//产品设计说:只需要居中(默认的)和平铺两种方式 //产品设计说:只需要居中(默认的)和平铺两种方式
private static final String[] layoutTypes = { private static final String[] layoutTypes = {
layoutCenter, layoutCenter,
@ -96,12 +100,16 @@ public class ImageSelectPane extends BackgroundPane4BoxChange {
} }
ActionListener selectPictureActionListener = new ActionListener() { ActionListener selectPictureActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
int returnVal = imageFileChooser.showOpenDialog(ImageSelectPane.this); int returnVal = imageFileChooser.showOpenDialog(ImageSelectPane.this);
if (returnVal != JFileChooser.CANCEL_OPTION) { if (returnVal != JFileChooser.CANCEL_OPTION) {
File selectedFile = imageFileChooser.getSelectedFile(); File selectedFile = imageFileChooser.getSelectedFile();
if (selectedFile != null && selectedFile.isFile()) { if (selectedFile != null && selectedFile.isFile()) {
Image image = BaseUtils.readImage(selectedFile.getPath()); String path = selectedFile.getPath();
suffix = ImageIOHelper.getSuffix(path);
Image image = BaseUtils.readImage(path);
CoreGraphHelper.waitForImage(image); CoreGraphHelper.waitForImage(image);
selectImage = image; selectImage = image;
} }
@ -121,16 +129,16 @@ public class ImageSelectPane extends BackgroundPane4BoxChange {
public void populate(Background background) { public void populate(Background background) {
if (background instanceof ImageBackground) { if (background instanceof ImageFileBackground) {
ImageBackground imageBackground = (ImageBackground) background; ImageFileBackground imageBackground = (ImageFileBackground) background;
selectImage = imageBackground.getImage(); selectImage = imageBackground.getImage();
suffix = imageBackground.getUri();
if (imageBackground.getLayout() == Constants.IMAGE_TILED) { if (imageBackground.getLayout() == Constants.IMAGE_TILED) {
layoutComboBox.setSelectedItem(layoutTitled); layoutComboBox.setSelectedItem(layoutTitled);
} else { } else {
layoutComboBox.setSelectedItem(layoutCenter); layoutComboBox.setSelectedItem(layoutCenter);
} }
} }
chechLabelText(); chechLabelText();
@ -145,7 +153,7 @@ public class ImageSelectPane extends BackgroundPane4BoxChange {
} }
public Background update() { public Background update() {
ImageBackground imageBackground = new ImageBackground(selectImage); ImageFileBackground imageBackground = new ImageFileBackground(selectImage, suffix);
Object selectLayout = layoutComboBox.getSelectedItem(); Object selectLayout = layoutComboBox.getSelectedItem();
if (selectLayout.equals(layoutCenter)) { if (selectLayout.equals(layoutCenter)) {

41
designer-base/src/com/fr/design/style/background/impl/ImageBackgroundPane.java

@ -2,7 +2,9 @@ package com.fr.design.style.background.impl;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.background.ImageBackground; import com.fr.base.background.ImageFileBackground;
import com.fr.base.frpx.pack.PictureCollection;
import com.fr.base.frpx.util.ImageIOHelper;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -15,10 +17,16 @@ import com.fr.general.Inter;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper; import com.fr.stable.CoreGraphHelper;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.File; import java.io.File;
@ -39,6 +47,8 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
private UIRadioButton extendRadioButton = null; private UIRadioButton extendRadioButton = null;
private UIRadioButton adjustRadioButton = null; private UIRadioButton adjustRadioButton = null;
private String suffix = PictureCollection.DEFAULT_SUFFIX;
public ImageBackgroundPane() { public ImageBackgroundPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -114,13 +124,16 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
*/ */
ActionListener selectPictureActionListener = new ActionListener() { ActionListener selectPictureActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
int returnVal = imageFileChooser.showOpenDialog(ImageBackgroundPane.this); int returnVal = imageFileChooser.showOpenDialog(ImageBackgroundPane.this);
if (returnVal != JFileChooser.CANCEL_OPTION) { if (returnVal != JFileChooser.CANCEL_OPTION) {
File selectedFile = imageFileChooser.getSelectedFile(); File selectedFile = imageFileChooser.getSelectedFile();
if (selectedFile != null && selectedFile.isFile()) { if (selectedFile != null && selectedFile.isFile()) {
Image image = BaseUtils.readImage(selectedFile.getPath()); String path = selectedFile.getPath();
suffix = ImageIOHelper.getSuffix(path);
Image image = BaseUtils.readImage(path);
CoreGraphHelper.waitForImage(image); CoreGraphHelper.waitForImage(image);
previewPane.setImage(image); previewPane.setImage(image);
@ -154,6 +167,7 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
ActionListener layoutActionListener = new ActionListener() { ActionListener layoutActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
setImageStyle(); setImageStyle();
changeImageStyle(); changeImageStyle();
@ -165,10 +179,12 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
} }
}; };
@Override
public void populate(Background background) { public void populate(Background background) {
if (background instanceof ImageBackground) { if (background instanceof ImageFileBackground) {
ImageBackground imageBackground = (ImageBackground) background; ImageFileBackground imageBackground = (ImageFileBackground) background;
suffix = imageBackground.getSuffix();
if (imageBackground.getLayout() == Constants.IMAGE_CENTER) { if (imageBackground.getLayout() == Constants.IMAGE_CENTER) {
defaultRadioButton.setSelected(true); defaultRadioButton.setSelected(true);
@ -204,13 +220,15 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
fireChagneListener(); fireChagneListener();
} }
@Override
public Background update() throws Exception { public Background update() throws Exception {
ImageBackground imageBackground = new ImageBackground(previewPane.getImage()); ImageFileBackground imageBackground = new ImageFileBackground(previewPane.getImage(), suffix);
setImageStyle(); setImageStyle();
imageBackground.setLayout(imageStyle.getImageLayout()); imageBackground.setLayout(imageStyle.getImageLayout());
return imageBackground; return imageBackground;
} }
@Override
public void addChangeListener(ChangeListener changeListener) { public void addChangeListener(ChangeListener changeListener) {
this.changeListener = changeListener; this.changeListener = changeListener;
} }
@ -224,6 +242,7 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
ChangeListener imageSizeChangeListener = new ChangeListener() { ChangeListener imageSizeChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent evt) { public void stateChanged(ChangeEvent evt) {
Image image = ((ImagePreviewPane) evt.getSource()).getImage(); Image image = ((ImagePreviewPane) evt.getSource()).getImage();
@ -234,4 +253,12 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
} }
} }
}; };
public String getSuffix() {
return suffix;
}
public void setSuffix(String suffix) {
this.suffix = suffix;
}
} }

17
designer-base/src/com/fr/design/style/background/impl/ImageButtonBackgroundPane.java

@ -1,11 +1,13 @@
package com.fr.design.style.background.impl; package com.fr.design.style.background.impl;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.background.ImageBackground; import com.fr.base.background.ImageFileBackground;
import com.fr.base.frpx.pack.PictureCollection;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -24,6 +26,7 @@ public class ImageButtonBackgroundPane extends ImageBackgroundPane {
previewPane.setImageStyle(imageStyle); previewPane.setImageStyle(imageStyle);
} }
@Override
public JPanel initSelectFilePane() { public JPanel initSelectFilePane() {
JPanel choosePane = new JPanel(new BorderLayout(0, 10)); JPanel choosePane = new JPanel(new BorderLayout(0, 10));
@ -48,21 +51,26 @@ public class ImageButtonBackgroundPane extends ImageBackgroundPane {
chooseButton.addActionListener(selectPictureActionListener); chooseButton.addActionListener(selectPictureActionListener);
clearButton = new UIButton(Inter.getLocText("FR-Designer_Background_Clear")); clearButton = new UIButton(Inter.getLocText("FR-Designer_Background_Clear"));
clearButton.addActionListener(new ActionListener() { clearButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
previewPane.setImage(null); previewPane.setImage(null);
previewPane.repaint(); previewPane.repaint();
setSuffix(PictureCollection.DEFAULT_SUFFIX);
} }
}); });
} }
@Override
public void imageStyleRepaint() { public void imageStyleRepaint() {
} }
@Override
public void populate(Background background) { public void populate(Background background) {
if(background != null && background instanceof ImageBackground){ if (background instanceof ImageFileBackground) {
ImageBackground imageBackground = (ImageBackground) background; ImageFileBackground imageBackground = (ImageFileBackground) background;
setSuffix(imageBackground.getSuffix());
if (imageBackground.getImage() != null) { if (imageBackground.getImage() != null) {
previewPane.setImage(imageBackground.getImage()); previewPane.setImage(imageBackground.getImage());
} }
@ -70,10 +78,11 @@ public class ImageButtonBackgroundPane extends ImageBackgroundPane {
} }
@Override
public Background update() { public Background update() {
if (previewPane.getImage() == null) { if (previewPane.getImage() == null) {
return null; return null;
} }
return new ImageBackground(previewPane.getImage()); return new ImageFileBackground(previewPane.getImage(), getSuffix());
} }
} }

20
designer-base/src/com/fr/env/RemoteEnv.java vendored

@ -29,7 +29,12 @@ import com.fr.file.CacheManager;
import com.fr.file.ConnectionConfig; import com.fr.file.ConnectionConfig;
import com.fr.file.TableDataConfig; import com.fr.file.TableDataConfig;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.*; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.general.LogRecordTime;
import com.fr.general.LogUtils;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.io.utils.ResourceIOUtils; import com.fr.io.utils.ResourceIOUtils;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
@ -53,7 +58,8 @@ import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import com.fr.web.ResourceConstants; import com.fr.web.ResourceConstants;
import javax.swing.*; import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.xml.transform.Source; import javax.xml.transform.Source;
import javax.xml.transform.Transformer; import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerConfigurationException;
@ -61,14 +67,12 @@ import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource; import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import java.awt.*; import java.awt.Component;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
@ -84,7 +88,6 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import java.util.logging.Level; import java.util.logging.Level;
@ -100,7 +103,7 @@ public class RemoteEnv extends AbstractEnv {
private static final String CERT_KEY = "javax.net.ssl.trustStore"; private static final String CERT_KEY = "javax.net.ssl.trustStore";
private static final String PWD_KEY = "javax.net.ssl.trustStorePassword"; private static final String PWD_KEY = "javax.net.ssl.trustStorePassword";
private static final String HTTPS_PREFIX = "https:"; private static final String HTTPS_PREFIX = "https:";
private final static String[] FILE_TYPE = {"cpt", "frm", "form", "cht", "chart"}; private final static String[] FILE_TYPE = {"cptx", "cpt", "frm", "form", "cht", "chart"};
private String path; private String path;
private String user; private String user;
private String password; private String password;
@ -2075,7 +2078,6 @@ public class RemoteEnv extends AbstractEnv {
} }
@Override @Override
public String pluginServiceAction(String serviceID, String req) throws Exception { public String pluginServiceAction(String serviceID, String req) throws Exception {
HashMap<String, String> para = new HashMap<String, String>(); HashMap<String, String> para = new HashMap<String, String>();
@ -2090,11 +2092,13 @@ public class RemoteEnv extends AbstractEnv {
/** /**
* 远程不启动使用虚拟服务 * 远程不启动使用虚拟服务
*
* @param serviceID * @param serviceID
*/ */
@Override @Override
public void pluginServiceStart(String serviceID) { public void pluginServiceStart(String serviceID) {
} }
@Override @Override
public String[] loadREUFile() throws Exception { public String[] loadREUFile() throws Exception {
ResourceIOUtils.delete(StableUtils.pathJoin( ResourceIOUtils.delete(StableUtils.pathJoin(

28
designer-base/src/com/fr/file/FILEChooserPane.java

@ -520,7 +520,7 @@ public class FILEChooserPane extends BasicPane {
} }
if (editing == null || !editing.isChartBook()) { if (editing == null || !editing.isChartBook()) {
String[] fileSuffix_local = LocalEnv.FILE_TYPE; String[] fileSuffix_local = LocalEnv.FILE_TYPE;
String[] fileSuffix = {"cpt", "frm", "form", "cht", "chart"}; String[] fileSuffix = {"cpt", "cptx", "frm", "form", "cht", "chart"};
if (type == JFileChooser.OPEN_DIALOG) { if (type == JFileChooser.OPEN_DIALOG) {
if (FRContext.getCurrentEnv().isSupportLocalFileOperate()) { //本地连接 if (FRContext.getCurrentEnv().isSupportLocalFileOperate()) { //本地连接
this.addChooseFILEFilter(new ChooseFileFilter(fileSuffix_local, appName + Inter.getLocText(new String[]{"FR-App-Report_Template", "FR-App-All_File"}))); this.addChooseFILEFilter(new ChooseFileFilter(fileSuffix_local, appName + Inter.getLocText(new String[]{"FR-App-Report_Template", "FR-App-All_File"})));
@ -531,6 +531,7 @@ public class FILEChooserPane extends BasicPane {
// ben:filefilter设置初值为cpt过滤 // ben:filefilter设置初值为cpt过滤
this.addChooseFILEFilter(new ChooseFileFilter("cpt", appName + Inter.getLocText(new String[]{"FR-App-Report_Template", "FR-App-All_File"}))); this.addChooseFILEFilter(new ChooseFileFilter("cpt", appName + Inter.getLocText(new String[]{"FR-App-Report_Template", "FR-App-All_File"})));
this.addChooseFILEFilter(new ChooseFileFilter("cptx", appName + Inter.getLocText(new String[]{"FR-App-Report_Template", "FR-App-All_File"})));
// richer:form文件 daniel 改成三个字 // richer:form文件 daniel 改成三个字
this.addChooseFILEFilter(new ChooseFileFilter("frm", appName + Inter.getLocText(new String[]{"FR-App-Template_Form", "FR-App-All_File"}))); this.addChooseFILEFilter(new ChooseFileFilter("frm", appName + Inter.getLocText(new String[]{"FR-App-Template_Form", "FR-App-All_File"})));
@ -577,9 +578,13 @@ public class FILEChooserPane extends BasicPane {
defaultComboBoxModel.setSelectedItem(filterList.get(0)); defaultComboBoxModel.setSelectedItem(filterList.get(0));
} }
// richer:根据不同的文件类型显示不同的后缀名 // richer:根据不同的文件类型显示不同的后缀名
// daniel 改成三个字保证兼容 if (ComparatorUtils.equals(suffix, ".cpt")) {
if (ComparatorUtils.equals(suffix, ".frm") || ComparatorUtils.equals(suffix, ".form")) { postfixComboBox.setSelectedIndex(suffixIndex("cpt"));
} else if (ComparatorUtils.equals(suffix, ".cptx")) {
postfixComboBox.setSelectedIndex(suffixIndex("cptx"));
} else if (ComparatorUtils.equals(suffix, ".frm") || ComparatorUtils.equals(suffix, ".form")) {
// postfixComboBox.setSelectedIndex(2); // postfixComboBox.setSelectedIndex(2);
// daniel 改成三个字保证兼容
// 现在默认用的是".frm" // 现在默认用的是".frm"
postfixComboBox.setSelectedIndex(suffixIndex("frm")); postfixComboBox.setSelectedIndex(suffixIndex("frm"));
} else if (ComparatorUtils.equals(suffix, ".xls")) { } else if (ComparatorUtils.equals(suffix, ".xls")) {
@ -600,11 +605,11 @@ public class FILEChooserPane extends BasicPane {
postfixComboBox.setSelectedIndex(suffixIndex("png")); postfixComboBox.setSelectedIndex(suffixIndex("png"));
} }
//jerry 26216 只保留.cpt .frm有用的格式,并且不可编辑 //jerry 26216 只保留.cpt .frm有用的格式,并且不可编辑
if (type == JFileChooser.OPEN_DIALOG) { // if (type == JFileChooser.OPEN_DIALOG) {
postfixComboBox.setEnabled(true); // postfixComboBox.setEnabled(true);
} else { // } else {
postfixComboBox.setEnabled(false); // postfixComboBox.setEnabled(false);
} // }
//只有一个类型时不可下拉 //只有一个类型时不可下拉
if (filterList.size() == 1) { if (filterList.size() == 1) {
@ -659,9 +664,14 @@ public class FILEChooserPane extends BasicPane {
private void saveDialog() { private void saveDialog() {
String filename = fileNameTextField.getText(); String filename = fileNameTextField.getText();
if (!filename.endsWith(suffix)) { if (!filename.endsWith(suffix) && !filename.contains(CoreConstants.DOT)) {
ChooseFileFilter chooseFileFilter = (ChooseFileFilter) (postfixComboBox.getSelectedItem());
if (chooseFileFilter != null && StringUtils.isNotEmpty(chooseFileFilter.getExtensionString())) {
fileNameTextField.setText(filename + chooseFileFilter.getExtensionString());
} else {
fileNameTextField.setText(filename + this.suffix); fileNameTextField.setText(filename + this.suffix);
} }
}
returnValue = OK_OPTION; returnValue = OK_OPTION;
FILE selectedFile = this.getSelectedFILE(); FILE selectedFile = this.getSelectedFILE();
if (!FRContext.getCurrentEnv().hasFileFolderAllow(selectedFile.getPath())) { if (!FRContext.getCurrentEnv().hasFileFolderAllow(selectedFile.getPath())) {

39
designer-realize/src/com/fr/design/actions/file/export/AbstractExportAction.java

@ -5,22 +5,28 @@ package com.fr.design.actions.file.export;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.page.PageSetProvider;
import com.fr.design.actions.JWorkBookAction; import com.fr.design.actions.JWorkBookAction;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.iprogressbar.FRProgressBar; import com.fr.design.gui.iprogressbar.FRProgressBar;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.JWorkBook; import com.fr.design.mainframe.JWorkBook;
import com.fr.design.parameter.ParameterInputPane; import com.fr.design.parameter.ParameterInputPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FILEChooserPane; import com.fr.file.FILEChooserPane;
import com.fr.file.filter.ChooseFileFilter; import com.fr.file.filter.ChooseFileFilter;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.io.exporter.*; import com.fr.io.exporter.AppExporter;
import com.fr.io.exporter.CSVExporter;
import com.fr.io.exporter.EmbeddedTableDataExporter;
import com.fr.io.exporter.ExcelExporter;
import com.fr.io.exporter.Exporter;
import com.fr.io.exporter.PDFExporterProcessor;
import com.fr.io.exporter.WordExporter;
import com.fr.main.TemplateWorkBook; import com.fr.main.TemplateWorkBook;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.page.PageSetProvider;
import com.fr.report.ReportHelper; import com.fr.report.ReportHelper;
import com.fr.report.core.ReportUtils; import com.fr.report.core.ReportUtils;
import com.fr.report.report.Report; import com.fr.report.report.Report;
@ -28,9 +34,10 @@ import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ActorConstants; import com.fr.stable.ActorConstants;
import com.fr.stable.ActorFactory; import com.fr.stable.ActorFactory;
import javax.swing.*; import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.FileOutputStream; import java.io.OutputStream;
import java.util.Map; import java.util.Map;
/** /**
@ -72,7 +79,7 @@ public abstract class AbstractExportAction extends JWorkBookAction {
} }
// Choose a file name.... // Choose a file name....
FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(false, true); FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(true, true);
fileChooserPane.setFILEFilter(this.getChooseFileFilter()); fileChooserPane.setFILEFilter(this.getChooseFileFilter());
// 打开文件后输出文件名修改,eg:w.cpt.doc / w.svg.doc,去掉中间的后缀名~~ w.doc // 打开文件后输出文件名修改,eg:w.cpt.doc / w.svg.doc,去掉中间的后缀名~~ w.doc
@ -100,20 +107,23 @@ public abstract class AbstractExportAction extends JWorkBookAction {
} }
} }
private SwingWorker createExportWork(FILE file, final TemplateWorkBook tpl, final Map parameterMap) { private SwingWorker createExportWork(final FILE file, final TemplateWorkBook tpl, final Map parameterMap) {
final String filePath = file.getPath(); final String filePath = file.getPath();
final String fileGetName = file.getName(); final String fileGetName = file.getName();
SwingWorker exportWorker = new SwingWorker<Void, Void>() { SwingWorker exportWorker = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception { protected Void doInBackground() throws Exception {
Thread.sleep(100); //bug 10516 Thread.sleep(100); //bug 10516
try { try {
final FileOutputStream fileOutputStream = new FileOutputStream(filePath); OutputStream outputStream = file.asOutputStream();
this.setProgress(10); this.setProgress(10);
dealExporter(fileOutputStream, tpl, parameterMap); dealExporter(outputStream, tpl, parameterMap);
this.setProgress(80); this.setProgress(80);
fileOutputStream.close(); outputStream.flush();
outputStream.close();
this.setProgress(100); this.setProgress(100);
FRContext.getLogger().info("\"" + fileGetName + "\"" + Inter.getLocText("FR-Designer_Finish_Export") + "!"); FRContext.getLogger().info("\"" + fileGetName + "\"" + Inter.getLocText("FR-Designer_Finish_Export") + "!");
@ -127,6 +137,7 @@ public abstract class AbstractExportAction extends JWorkBookAction {
return null; return null;
} }
@Override
public void done() { public void done() {
progressbar.close(); progressbar.close();
} }
@ -134,7 +145,7 @@ public abstract class AbstractExportAction extends JWorkBookAction {
return exportWorker; return exportWorker;
} }
private void dealExporter(FileOutputStream fileOutputStream, final TemplateWorkBook tpl, final Map parameterMap) throws Exception { private void dealExporter(OutputStream outputStream, final TemplateWorkBook tpl, final Map parameterMap) throws Exception {
final Exporter exporter = AbstractExportAction.this.getExporter(); final Exporter exporter = AbstractExportAction.this.getExporter();
if (exporter instanceof AppExporter) { if (exporter instanceof AppExporter) {
AppExporter appExporter = (AppExporter) exporter; AppExporter appExporter = (AppExporter) exporter;
@ -142,18 +153,18 @@ public abstract class AbstractExportAction extends JWorkBookAction {
|| exporter instanceof PDFExporterProcessor || exporter instanceof WordExporter) { || exporter instanceof PDFExporterProcessor || exporter instanceof WordExporter) {
ReportHelper.clearFormulaResult(tpl);// 清空rpt中的公式计算结果 ReportHelper.clearFormulaResult(tpl);// 清空rpt中的公式计算结果
appExporter.export(fileOutputStream, tpl.execute(parameterMap, ActorFactory.getActor(ActorConstants.TYPE_PAGE) appExporter.export(outputStream, tpl.execute(parameterMap, ActorFactory.getActor(ActorConstants.TYPE_PAGE)
)); ));
} else { } else {
ReportHelper.clearFormulaResult(tpl);// 清空currentReport中的公式计算结果 ReportHelper.clearFormulaResult(tpl);// 清空currentReport中的公式计算结果
PageSetProvider pageSet = tpl.execute(parameterMap, ActorFactory.getActor(ActorConstants.TYPE_PAGE)).generateReportPageSet( PageSetProvider pageSet = tpl.execute(parameterMap, ActorFactory.getActor(ActorConstants.TYPE_PAGE)).generateReportPageSet(
ReportUtils.getPaperSettingListFromWorkBook(tpl)).traverse4Export(); ReportUtils.getPaperSettingListFromWorkBook(tpl)).traverse4Export();
appExporter.export(fileOutputStream, pageSet); appExporter.export(outputStream, pageSet);
pageSet.release(); pageSet.release();
} }
} else if (exporter instanceof EmbeddedTableDataExporter) { } else if (exporter instanceof EmbeddedTableDataExporter) {
((EmbeddedTableDataExporter) exporter).export(fileOutputStream, (WorkBook) tpl, parameterMap); ((EmbeddedTableDataExporter) exporter).export(outputStream, (WorkBook) tpl, parameterMap);
} }
} }

9
designer-realize/src/com/fr/design/actions/file/newReport/NewWorkBookAction.java

@ -7,12 +7,9 @@ import com.fr.design.mainframe.JWorkBook;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.Icon;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class NewWorkBookAction extends UpdateAction { public class NewWorkBookAction extends UpdateAction {
@ -50,7 +47,7 @@ public class NewWorkBookAction extends UpdateAction {
@Override @Override
public KeyStroke getKeyStroke() { public KeyStroke getKeyStroke() {
return KeyStroke.getKeyStroke(KeyEvent.VK_N, DEFAULT_MODIFIER); return null;
} }
}; };

67
designer-realize/src/com/fr/design/actions/file/newReport/NewWorkBookXAction.java

@ -0,0 +1,67 @@
package com.fr.design.actions.file.newReport;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JWorkBook;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.main.impl.WorkBookX;
import com.fr.report.worksheet.WorkSheet;
import javax.swing.Icon;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/**
* 新建cptx格式模板
*
* @author vito
* @date 2018/4/23
*/
public class NewWorkBookXAction extends UpdateAction {
private static final String DEFAULT_FILE_PREFIX = "WorkBookX";
public NewWorkBookXAction() {
this.setMenuKeySet(NEW_WORK_BOOK_X);
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(icon());
this.setAccelerator(getMenuKeySet().getKeyStroke());
}
protected Icon icon() {
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/newcpts.png");
}
/**
* 动作
*
* @param e 事件
*/
@Override
public void actionPerformed(ActionEvent e) {
DesignerContext.getDesignerFrame().addAndActivateJTemplate(new JWorkBook(new WorkBookX(new WorkSheet())));
}
public static final MenuKeySet NEW_WORK_BOOK_X = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'N';
}
@Override
public String getMenuName() {
return Inter.getLocText("M-New_WorkBook") + "(cptx)";
}
@Override
public KeyStroke getKeyStroke() {
return KeyStroke.getKeyStroke(KeyEvent.VK_N, DEFAULT_MODIFIER);
}
};
}

14
designer-realize/src/com/fr/design/actions/insert/flot/ImageFloatAction.java

@ -5,13 +5,13 @@ package com.fr.design.actions.insert.flot;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList; import com.fr.base.DynamicUnitList;
import com.fr.base.ScreenResolution;
import com.fr.design.actions.ElementCaseAction; import com.fr.design.actions.ElementCaseAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.report.SelectImagePane; import com.fr.design.report.SelectImagePane;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -21,11 +21,10 @@ import com.fr.report.ReportHelper;
import com.fr.report.cell.FloatElement; import com.fr.report.cell.FloatElement;
import com.fr.report.cell.cellattr.CellImage; import com.fr.report.cell.cellattr.CellImage;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import javax.swing.*; import javax.swing.KeyStroke;
import java.awt.*; import java.awt.Image;
import java.io.File; import java.io.File;
/** /**
@ -65,6 +64,7 @@ public class ImageFloatAction extends ElementCaseAction {
* *
* @return 成功返回true * @return 成功返回true
*/ */
@Override
public boolean executeActionReturnUndoRecordNeeded() { public boolean executeActionReturnUndoRecordNeeded() {
final ElementCasePane reportPane = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane(); final ElementCasePane reportPane = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
if (reportPane == null) { if (reportPane == null) {
@ -86,11 +86,11 @@ public class ImageFloatAction extends ElementCaseAction {
File selectedFile = selectImagePane.getSelectedImage(); File selectedFile = selectImagePane.getSelectedImage();
if (selectedFile != null && selectedFile.isFile()) { if (selectedFile != null && selectedFile.isFile()) {
Image image = BaseUtils.readImage(selectedFile.getPath());
CellImage cellImage = selectImagePane.update(); CellImage cellImage = selectImagePane.update();
CoreGraphHelper.waitForImage(image); Image image = cellImage.getImage();
JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
currentEditingTemplate.setPictureElem(floatElement, cellImage);
floatElement.setValue(image);
Grid grid = reportPane.getGrid(); Grid grid = reportPane.getGrid();
int resolution = grid.getResolution(); int resolution = grid.getResolution();
floatElement.setWidth(FU.valueOfPix(image.getWidth(null), resolution)); floatElement.setWidth(FU.valueOfPix(image.getWidth(null), resolution));

14
designer-realize/src/com/fr/design/cell/editor/ImageCellEditor.java

@ -3,18 +3,18 @@
*/ */
package com.fr.design.cell.editor; package com.fr.design.cell.editor;
import java.awt.Component;
import java.awt.Image;
import javax.swing.SwingUtilities;
import com.fr.design.report.SelectImagePane;
import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.DialogActionListener;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.report.SelectImagePane;
import com.fr.grid.Grid; import com.fr.grid.Grid;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.painter.CellImagePainter;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import javax.swing.SwingUtilities;
import java.awt.Component;
import java.awt.Image;
/** /**
* CellEditor used to edit Image object. * CellEditor used to edit Image object.
*/ */
@ -59,7 +59,7 @@ public class ImageCellEditor extends AbstractCellEditor implements DialogActionL
if (cellElement != null) { if (cellElement != null) {
value = cellElement.getValue(); value = cellElement.getValue();
} }
if (value == null || !(value instanceof Image)) { if (!(value instanceof Image || value instanceof CellImagePainter)) {
value = null; value = null;
} }

14
designer-realize/src/com/fr/design/cell/editor/ImageFloatEditor.java

@ -3,15 +3,15 @@
*/ */
package com.fr.design.cell.editor; package com.fr.design.cell.editor;
import java.awt.Component;
import java.awt.Image;
import javax.swing.SwingUtilities;
import com.fr.design.report.SelectImagePane;
import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.DialogActionListener;
import com.fr.design.report.SelectImagePane;
import com.fr.grid.Grid; import com.fr.grid.Grid;
import com.fr.report.cell.FloatElement; import com.fr.report.cell.FloatElement;
import com.fr.report.cell.painter.CellImagePainter;
import javax.swing.SwingUtilities;
import java.awt.Component;
import java.awt.Image;
/** /**
* FloatEditor used to edit Image object. * FloatEditor used to edit Image object.
@ -54,7 +54,7 @@ public class ImageFloatEditor extends AbstractFloatEditor implements DialogActio
public Component getFloatEditorComponent(Grid grid, FloatElement floatElement, int resolution) { public Component getFloatEditorComponent(Grid grid, FloatElement floatElement, int resolution) {
//populate data to UI //populate data to UI
Object value = floatElement.getValue(); Object value = floatElement.getValue();
if (value == null || !(value instanceof Image)) { if (!(value instanceof Image || value instanceof CellImagePainter)) {
value = null; value = null;
} }

86
designer-realize/src/com/fr/design/mainframe/ElementCasePane.java

@ -3,7 +3,13 @@
*/ */
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.*; import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.base.FRContext;
import com.fr.base.Formula;
import com.fr.base.ScreenResolution;
import com.fr.base.Style;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
@ -12,8 +18,30 @@ import com.fr.design.actions.ExitAuthorityEditAction;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.cell.BorderAction; import com.fr.design.actions.cell.BorderAction;
import com.fr.design.actions.cell.CleanAuthorityAction; import com.fr.design.actions.cell.CleanAuthorityAction;
import com.fr.design.actions.cell.style.*; import com.fr.design.actions.cell.style.AlignmentAction;
import com.fr.design.actions.columnrow.*; import com.fr.design.actions.cell.style.ReportFontBoldAction;
import com.fr.design.actions.cell.style.ReportFontForegroundAction;
import com.fr.design.actions.cell.style.ReportFontItalicAction;
import com.fr.design.actions.cell.style.ReportFontNameAction;
import com.fr.design.actions.cell.style.ReportFontSizeAction;
import com.fr.design.actions.cell.style.ReportFontUnderlineAction;
import com.fr.design.actions.cell.style.StyleBackgroundAction;
import com.fr.design.actions.columnrow.CancelColumnAction;
import com.fr.design.actions.columnrow.CancelRowAction;
import com.fr.design.actions.columnrow.ColumnHideAction;
import com.fr.design.actions.columnrow.ColumnWidthAction;
import com.fr.design.actions.columnrow.DeleteColumnAction;
import com.fr.design.actions.columnrow.DeleteRowAction;
import com.fr.design.actions.columnrow.FootColumnAction;
import com.fr.design.actions.columnrow.FootRowAction;
import com.fr.design.actions.columnrow.HeadColumnAction;
import com.fr.design.actions.columnrow.HeadRowAction;
import com.fr.design.actions.columnrow.InsertColumnAction;
import com.fr.design.actions.columnrow.InsertRowAction;
import com.fr.design.actions.columnrow.ResetColumnHideAction;
import com.fr.design.actions.columnrow.ResetRowHideAction;
import com.fr.design.actions.columnrow.RowHeightAction;
import com.fr.design.actions.columnrow.RowHideAction;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.edit.CopyAction; import com.fr.design.actions.edit.CopyAction;
import com.fr.design.actions.edit.CutAction; import com.fr.design.actions.edit.CutAction;
@ -24,8 +52,17 @@ import com.fr.design.cell.bar.DynamicScrollBar;
import com.fr.design.cell.clipboard.CellElementsClip; import com.fr.design.cell.clipboard.CellElementsClip;
import com.fr.design.cell.clipboard.ElementsTransferable; import com.fr.design.cell.clipboard.ElementsTransferable;
import com.fr.design.cell.clipboard.FloatElementsClip; import com.fr.design.cell.clipboard.FloatElementsClip;
import com.fr.design.cell.editor.*; import com.fr.design.cell.editor.BiasTextPainterCellEditor;
import com.fr.design.cell.editor.CellEditor; import com.fr.design.cell.editor.CellEditor;
import com.fr.design.cell.editor.ChartCellEditor;
import com.fr.design.cell.editor.ChartFloatEditor;
import com.fr.design.cell.editor.DSColumnCellEditor;
import com.fr.design.cell.editor.FormulaCellEditor;
import com.fr.design.cell.editor.FormulaFloatEditor;
import com.fr.design.cell.editor.ImageCellEditor;
import com.fr.design.cell.editor.ImageFloatEditor;
import com.fr.design.cell.editor.RichTextCellEditor;
import com.fr.design.cell.editor.SubReportCellEditor;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.EditingState; import com.fr.design.designer.EditingState;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
@ -34,8 +71,11 @@ import com.fr.design.fun.ElementUIProvider;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.cell.QuickEditorRegion; import com.fr.design.mainframe.cell.QuickEditorRegion;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.*; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.NameSeparator;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.selection.QuickEditor; import com.fr.design.selection.QuickEditor;
import com.fr.design.selection.Selectedable; import com.fr.design.selection.Selectedable;
import com.fr.design.selection.SelectionEvent; import com.fr.design.selection.SelectionEvent;
@ -43,7 +83,11 @@ import com.fr.design.selection.SelectionListener;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.*; import com.fr.grid.Grid;
import com.fr.grid.GridColumn;
import com.fr.grid.GridCorner;
import com.fr.grid.GridRow;
import com.fr.grid.GridUtils;
import com.fr.grid.dnd.ElementCasePaneDropTarget; import com.fr.grid.dnd.ElementCasePaneDropTarget;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
@ -58,6 +102,7 @@ import com.fr.report.cell.cellattr.core.RichText;
import com.fr.report.cell.cellattr.core.SubReport; import com.fr.report.cell.cellattr.core.SubReport;
import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.painter.BiasTextPainter; import com.fr.report.cell.painter.BiasTextPainter;
import com.fr.report.cell.painter.CellImagePainter;
import com.fr.report.core.SheetUtils; import com.fr.report.core.SheetUtils;
import com.fr.report.elementcase.ElementCase; import com.fr.report.elementcase.ElementCase;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
@ -65,12 +110,27 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import javax.swing.*; import javax.swing.AbstractAction;
import java.awt.*; import javax.swing.ActionMap;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollBar;
import javax.swing.KeyStroke;
import java.awt.AWTEvent;
import java.awt.Adjustable;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
import java.awt.event.*; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.util.Set; import java.util.Set;
@ -327,6 +387,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
grid.setDefaultCellEditor(BiasTextPainter.class, new BiasTextPainterCellEditor(this)); grid.setDefaultCellEditor(BiasTextPainter.class, new BiasTextPainterCellEditor(this));
grid.setDefaultCellEditor(Image.class, new ImageCellEditor(this)); grid.setDefaultCellEditor(Image.class, new ImageCellEditor(this));
grid.setDefaultCellEditor(CellImagePainter.class, new ImageCellEditor(this));
grid.setDefaultCellEditor(SubReport.class, new SubReportCellEditor(this)); grid.setDefaultCellEditor(SubReport.class, new SubReportCellEditor(this));
Class chartClass = ActionFactory.getChartCollectionClass(); Class chartClass = ActionFactory.getChartCollectionClass();
@ -339,6 +400,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
grid.setDefaultFloatEditor(Formula.class, new FormulaFloatEditor()); grid.setDefaultFloatEditor(Formula.class, new FormulaFloatEditor());
grid.setDefaultFloatEditor(Image.class, new ImageFloatEditor()); grid.setDefaultFloatEditor(Image.class, new ImageFloatEditor());
grid.setDefaultFloatEditor(CellImagePainter.class, new ImageFloatEditor());
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager();
grid.setGridLineColor(designerEnvManager.getGridLineColor()); grid.setGridLineColor(designerEnvManager.getGridLineColor());
@ -1262,10 +1324,6 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
return new ElementCasePaneAuthorityEditPane(this); return new ElementCasePaneAuthorityEditPane(this);
} }
public ToolBarMenuDockPlus getToolBarMenuDockPlus() {
return new JWorkBook();
}
/** /**
* 创建正在编辑的状态. * 创建正在编辑的状态.
* *

1
designer-realize/src/com/fr/design/mainframe/JPolyWorkBook.java

@ -35,6 +35,7 @@ public class JPolyWorkBook extends JWorkBook {
* @date 2015-2-5-上午11:42:12 * @date 2015-2-5-上午11:42:12
* *
*/ */
@Override
public SheetNameTabPane createSheetNameTabPane(ReportComponentComposite reportCompositeX){ public SheetNameTabPane createSheetNameTabPane(ReportComponentComposite reportCompositeX){
return new PolySheetNameTabPane(reportCompositeX); return new PolySheetNameTabPane(reportCompositeX);
} }

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

@ -57,11 +57,16 @@ import com.fr.grid.GridUtils;
import com.fr.io.exporter.EmbeddedTableDataExporter; import com.fr.io.exporter.EmbeddedTableDataExporter;
import com.fr.main.TemplateWorkBook; import com.fr.main.TemplateWorkBook;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.main.impl.WorkBookAdapter;
import com.fr.main.impl.WorkBookX;
import com.fr.main.parameter.ReportParameterAttr; import com.fr.main.parameter.ReportParameterAttr;
import com.fr.poly.PolyDesigner; import com.fr.poly.PolyDesigner;
import com.fr.poly.creator.BlockCreator; import com.fr.poly.creator.BlockCreator;
import com.fr.privilege.finegrain.WorkSheetPrivilegeControl; import com.fr.privilege.finegrain.WorkSheetPrivilegeControl;
import com.fr.report.ReportHelper; import com.fr.report.ReportHelper;
import com.fr.report.cell.Elem;
import com.fr.report.cell.cellattr.CellImage;
import com.fr.report.cell.painter.CellImagePainter;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.poly.PolyWorkSheet; import com.fr.report.poly.PolyWorkSheet;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
@ -85,6 +90,9 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
private static final String SHARE_SUFFIX = "_share"; private static final String SHARE_SUFFIX = "_share";
private static final String SHARE_FOLDER = "share"; private static final String SHARE_FOLDER = "share";
private static final String DEFAULT_WBX_FILE_PREFIX = "WorkBookX";
private static final String DEFAULT_WB_FILE_PREFIX = "WorkBook";
private static final int TOOLBARPANEDIMHEIGHT = 26; private static final int TOOLBARPANEDIMHEIGHT = 26;
private static final double MIN_TIME = 0.4; private static final double MIN_TIME = 0.4;
@ -94,7 +102,12 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
private int resolution = ScreenResolution.getScreenResolution(); private int resolution = ScreenResolution.getScreenResolution();
public JWorkBook() { public JWorkBook() {
super(new WorkBook(new WorkSheet()), "WorkBook"); super(new WorkBook(new WorkSheet()), DEFAULT_WB_FILE_PREFIX);
populateReportParameterAttr();
}
public JWorkBook(WorkBookX workBookX) {
super(new WorkBookAdapter(workBookX), DEFAULT_WBX_FILE_PREFIX);
populateReportParameterAttr(); populateReportParameterAttr();
} }
@ -166,6 +179,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
return centerPane; return centerPane;
} }
@Override
public TemplateProcessInfo getProcessInfo() { public TemplateProcessInfo getProcessInfo() {
if (processInfo == null) { if (processInfo == null) {
processInfo = new JWorkBookProcessInfo(template); processInfo = new JWorkBookProcessInfo(template);
@ -188,6 +202,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* *
* @param rolsName 角色 * @param rolsName 角色
*/ */
@Override
public void judgeSheetAuthority(String rolsName) { public void judgeSheetAuthority(String rolsName) {
boolean isCovered = reportComposite.getEditingTemplateReport().getWorkSheetPrivilegeControl().checkInvisible(rolsName); boolean isCovered = reportComposite.getEditingTemplateReport().getWorkSheetPrivilegeControl().checkInvisible(rolsName);
centerPane.setSheeetCovered(isCovered); centerPane.setSheeetCovered(isCovered);
@ -197,6 +212,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/** /**
* 在编辑的面板是被参考的面板时取消格式刷 * 在编辑的面板是被参考的面板时取消格式刷
*/ */
@Override
public void doConditionCancelFormat() { public void doConditionCancelFormat() {
if (ComparatorUtils.equals(reportComposite.centerCardPane.editingComponet.elementCasePane, DesignerContext.getReferencedElementCasePane())) { if (ComparatorUtils.equals(reportComposite.centerCardPane.editingComponet.elementCasePane, DesignerContext.getReferencedElementCasePane())) {
cancelFormat(); cancelFormat();
@ -207,6 +223,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/** /**
* 无条件取消格式刷 * 无条件取消格式刷
*/ */
@Override
public void cancelFormat() { public void cancelFormat() {
DesignerContext.setFormatState(DesignerContext.FORMAT_STATE_NULL); DesignerContext.setFormatState(DesignerContext.FORMAT_STATE_NULL);
reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().setCursor(UIConstants.CELL_DEFAULT_CURSOR); reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().setCursor(UIConstants.CELL_DEFAULT_CURSOR);
@ -217,6 +234,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
this.repaint(); this.repaint();
} }
@Override
public int getEditingReportIndex() { public int getEditingReportIndex() {
return reportComposite.getEditingIndex(); return reportComposite.getEditingIndex();
} }
@ -226,6 +244,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* *
* @return 返回权限细粒度面板 * @return 返回权限细粒度面板
*/ */
@Override
public AuthorityEditPane createAuthorityEditPane() { public AuthorityEditPane createAuthorityEditPane() {
if (centerPane.isUpEditMode()) { if (centerPane.isUpEditMode()) {
return parameterPane.getParaDesigner().getAuthorityEditPane(); return parameterPane.getParaDesigner().getAuthorityEditPane();
@ -241,6 +260,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
} }
@Override
public ToolBarMenuDockPlus getToolBarMenuDockPlus() { public ToolBarMenuDockPlus getToolBarMenuDockPlus() {
if (this.getEditingElementCasePane() == null) { if (this.getEditingElementCasePane() == null) {
return JWorkBook.this; return JWorkBook.this;
@ -274,6 +294,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
reportComposite.setComponents(); reportComposite.setComponents();
} }
@Override
public JPanel getEastUpPane() { public JPanel getEastUpPane() {
if (BaseUtils.isAuthorityEditing()) { if (BaseUtils.isAuthorityEditing()) {
return allowAuthorityUpPane(); return allowAuthorityUpPane();
@ -318,6 +339,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
return new JPanel(); return new JPanel();
} }
@Override
public JPanel getEastDownPane() { public JPanel getEastDownPane() {
if (centerPane.isUpEditMode()) { if (centerPane.isUpEditMode()) {
return parameterPane.getParaDesigner().getEastDownPane(); return parameterPane.getParaDesigner().getEastDownPane();
@ -340,10 +362,12 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/** /**
* 移除选择 * 移除选择
*/ */
@Override
public void removeTemplateSelection() { public void removeTemplateSelection() {
this.reportComposite.removeSelection(); this.reportComposite.removeSelection();
} }
@Override
public void setSheetCovered(boolean isCovered) { public void setSheetCovered(boolean isCovered) {
centerPane.setSheeetCovered(isCovered); centerPane.setSheeetCovered(isCovered);
} }
@ -351,6 +375,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/** /**
* 刷新容器 * 刷新容器
*/ */
@Override
public void refreshContainer() { public void refreshContainer() {
centerPane.refreshContainer(); centerPane.refreshContainer();
} }
@ -358,6 +383,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/** /**
* 移除参数面板选择 * 移除参数面板选择
*/ */
@Override
public void removeParameterPaneSelection() { public void removeParameterPaneSelection() {
parameterPane.getParaDesigner().removeSelection(); parameterPane.getParaDesigner().removeSelection();
} }
@ -456,6 +482,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
return this.resolution; return this.resolution;
} }
@Override
public int getToolBarHeight() { public int getToolBarHeight() {
return TOOLBARPANEDIMHEIGHT; return TOOLBARPANEDIMHEIGHT;
} }
@ -516,6 +543,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/** /**
* 复制 * 复制
*/ */
@Override
public void copy() { public void copy() {
this.delegate4ToolbarMenuAdapter().copy(); this.delegate4ToolbarMenuAdapter().copy();
} }
@ -525,6 +553,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* *
* @return 剪切成功返回true * @return 剪切成功返回true
*/ */
@Override
public boolean cut() { public boolean cut() {
return this.delegate4ToolbarMenuAdapter().cut(); return this.delegate4ToolbarMenuAdapter().cut();
} }
@ -534,6 +563,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* *
* @return 黏贴成功返回true * @return 黏贴成功返回true
*/ */
@Override
public boolean paste() { public boolean paste() {
return this.delegate4ToolbarMenuAdapter().paste(); return this.delegate4ToolbarMenuAdapter().paste();
} }
@ -541,6 +571,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/** /**
* 停止编辑 * 停止编辑
*/ */
@Override
public void stopEditing() { public void stopEditing() {
reportComposite.stopEditing(); reportComposite.stopEditing();
if (!this.isSaved()) { if (!this.isSaved()) {
@ -550,12 +581,23 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
} }
/** /**
* 后缀 * 保存文件的后缀
* *
* @return 后缀的字符串 * @return 后缀的字符串
*/ */
@Override
public String suffix() { public String suffix() {
return ".cpt"; return template.suffix();
}
@Override
public void setPictureElem(Elem elem, CellImage cellImage) {
WorkBook workBook = this.getTarget();
if (workBook instanceof WorkBookAdapter) {
elem.setValue(new CellImagePainter(cellImage));
} else {
elem.setValue(cellImage.getImage());
}
} }
@ -568,6 +610,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* *
* @return 子菜单 * @return 子菜单
*/ */
@Override
public ShortCut[] shortcut4FileMenu() { public ShortCut[] shortcut4FileMenu() {
return (ShortCut[]) ArrayUtils.addAll( return (ShortCut[]) ArrayUtils.addAll(
super.shortcut4FileMenu(), super.shortcut4FileMenu(),
@ -580,12 +623,14 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* *
* @return 菜单 * @return 菜单
*/ */
@Override
public MenuDef[] menus4Target() { public MenuDef[] menus4Target() {
return (MenuDef[]) ArrayUtils.addAll( return (MenuDef[]) ArrayUtils.addAll(
super.menus4Target(), this.delegate4ToolbarMenuAdapter().menus4Target() super.menus4Target(), this.delegate4ToolbarMenuAdapter().menus4Target()
); );
} }
@Override
public int getMenuState() { public int getMenuState() {
return this.delegate4ToolbarMenuAdapter().getMenuState(); return this.delegate4ToolbarMenuAdapter().getMenuState();
} }
@ -610,6 +655,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* *
* @return 子菜单 * @return 子菜单
*/ */
@Override
public ShortCut[] shortCuts4Authority() { public ShortCut[] shortCuts4Authority() {
return new ShortCut[]{ return new ShortCut[]{
new NameSeparator(Inter.getLocText("FR-Designer_Permissions_Edition")), new NameSeparator(Inter.getLocText("FR-Designer_Permissions_Edition")),
@ -623,6 +669,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* *
* @return 子菜单 * @return 子菜单
*/ */
@Override
public ShortCut[] shortcut4TemplateMenu() { public ShortCut[] shortcut4TemplateMenu() {
return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{ return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{
new ReportWebAttrAction(this), new ReportWebAttrAction(this),
@ -638,6 +685,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* *
* @return 工具 * @return 工具
*/ */
@Override
public ToolBarDef[] toolbars4Target() { public ToolBarDef[] toolbars4Target() {
return this.delegate4ToolbarMenuAdapter().toolbars4Target(); return this.delegate4ToolbarMenuAdapter().toolbars4Target();
} }
@ -699,6 +747,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/** /**
* 请求焦点 * 请求焦点
*/ */
@Override
public void requestFocus() { public void requestFocus() {
super.requestFocus(); super.requestFocus();
ReportComponent reportComponent = reportComposite.getEditingReportComponent(); ReportComponent reportComponent = reportComposite.getEditingReportComponent();
@ -745,6 +794,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/** /**
* 恢复 * 恢复
*/ */
@Override
public void revert() { public void revert() {
ElementCasePane epane = reportComposite.getEditingReportComponent().elementCasePane; ElementCasePane epane = reportComposite.getEditingReportComponent().elementCasePane;
if (epane == null) { if (epane == null) {
@ -773,6 +823,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* *
* @return 表单工具栏 * @return 表单工具栏
*/ */
@Override
public JPanel[] toolbarPanes4Form() { public JPanel[] toolbarPanes4Form() {
if (centerPane.isUpEditMode() && hasParameterPane()) { if (centerPane.isUpEditMode() && hasParameterPane()) {
return parameterPane.toolbarPanes4Form(); return parameterPane.toolbarPanes4Form();
@ -785,6 +836,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* *
* @return 工具按钮 * @return 工具按钮
*/ */
@Override
public JComponent[] toolBarButton4Form() { public JComponent[] toolBarButton4Form() {
centerPane.needToShowCoverAndHidPane(); centerPane.needToShowCoverAndHidPane();
if (centerPane.isUpEditMode() && hasParameterPane()) { if (centerPane.isUpEditMode() && hasParameterPane()) {
@ -799,6 +851,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* *
* @return 工具面板 * @return 工具面板
*/ */
@Override
public JComponent toolBar4Authority() { public JComponent toolBar4Authority() {
return new AuthorityToolBarPane(); return new AuthorityToolBarPane();
} }
@ -808,6 +861,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* *
* @return 预览接口 * @return 预览接口
*/ */
@Override
public PreviewProvider[] supportPreview() { public PreviewProvider[] supportPreview() {
Set<PreviewProvider> set = ExtraDesignClassManager.getInstance().getArray(PreviewProvider.MARK_STRING); Set<PreviewProvider> set = ExtraDesignClassManager.getInstance().getArray(PreviewProvider.MARK_STRING);
return ArrayUtils.addAll(new PreviewProvider[]{ return ArrayUtils.addAll(new PreviewProvider[]{
@ -820,6 +874,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* *
* @return 预览菜单项 * @return 预览菜单项
*/ */
@Override
public UIMenuItem[] createMenuItem4Preview() { public UIMenuItem[] createMenuItem4Preview() {
List<UIMenuItem> menuItems = new ArrayList<UIMenuItem>(); List<UIMenuItem> menuItems = new ArrayList<UIMenuItem>();
PreviewProvider[] previewProviders = supportPreview(); PreviewProvider[] previewProviders = supportPreview();
@ -841,6 +896,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* *
* @param provider 预览接口 * @param provider 预览接口
*/ */
@Override
public void previewMenuActionPerformed(PreviewProvider provider) { public void previewMenuActionPerformed(PreviewProvider provider) {
setPreviewType(provider); setPreviewType(provider);
WebPreviewUtils.actionPerformed(this, provider.parametersForPreview(), ParameterConstants.REPORTLET); WebPreviewUtils.actionPerformed(this, provider.parametersForPreview(), ParameterConstants.REPORTLET);
@ -851,6 +907,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* *
* @return 是则返回true * @return 是则返回true
*/ */
@Override
public boolean isJWorkBook() { public boolean isJWorkBook() {
return true; return true;
} }
@ -865,6 +922,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
return ReportHyperlinkGroupPaneNoPop.getInstance(hyperlinkGroupPaneActionProvider); return ReportHyperlinkGroupPaneNoPop.getInstance(hyperlinkGroupPaneActionProvider);
} }
@Override
public void setAuthorityMode(boolean isUpMode) { public void setAuthorityMode(boolean isUpMode) {
centerPane.setAuthorityMode(isUpMode); centerPane.setAuthorityMode(isUpMode);
} }
@ -874,6 +932,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* *
* @return 是则返回true * @return 是则返回true
*/ */
@Override
public boolean isUpMode() { public boolean isUpMode() {
return centerPane.isUpEditMode(); return centerPane.isUpEditMode();
} }
@ -881,6 +940,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/** /**
* 刷新参数和工具区域 * 刷新参数和工具区域
*/ */
@Override
public void refreshToolArea() { public void refreshToolArea() {
populateReportParameterAttr(); populateReportParameterAttr();
if (centerPane.isUpEditMode()) { if (centerPane.isUpEditMode()) {
@ -933,6 +993,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* *
* @return * @return
*/ */
@Override
public Parameter[] getParameters() { public Parameter[] getParameters() {
Parameter[] ps = this.parameterPane.getParameterArray(); Parameter[] ps = this.parameterPane.getParameterArray();
Parameter[] curPs = this.parameterPane.getAllParameters(); Parameter[] curPs = this.parameterPane.getAllParameters();
@ -949,6 +1010,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/** /**
* 请求单元格区域的焦点 * 请求单元格区域的焦点
*/ */
@Override
public void requestGridFocus() { public void requestGridFocus() {
reportComposite.centerCardPane.requestGrifFocus(); reportComposite.centerCardPane.requestGrifFocus();
} }
@ -960,6 +1022,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* @return 内置sql提交的pane * @return 内置sql提交的pane
* @date 2014-10-14-下午7:39:27 * @date 2014-10-14-下午7:39:27
*/ */
@Override
public DBManipulationPane createDBManipulationPane() { public DBManipulationPane createDBManipulationPane() {
ElementCasePane<TemplateElementCase> epane = this.getEditingElementCasePane(); ElementCasePane<TemplateElementCase> epane = this.getEditingElementCasePane();
return new SmartInsertDBManipulationPane(epane); return new SmartInsertDBManipulationPane(epane);
@ -971,11 +1034,13 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* @return 内置sql提交的pane * @return 内置sql提交的pane
* @date 2014-10-14-下午7:39:27 * @date 2014-10-14-下午7:39:27
*/ */
@Override
public DBManipulationPane createDBManipulationPaneInWidget() { public DBManipulationPane createDBManipulationPaneInWidget() {
ElementCasePane<TemplateElementCase> epane = this.getEditingElementCasePane(); ElementCasePane<TemplateElementCase> epane = this.getEditingElementCasePane();
return new SmartInsertDBManipulationInWidgetEventPane(epane); return new SmartInsertDBManipulationInWidgetEventPane(epane);
} }
@Override
public Icon getIcon() { public Icon getIcon() {
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/newcpts.png"); return BaseUtils.readIcon("/com/fr/design/images/buttonicon/newcpts.png");
} }
@ -996,6 +1061,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* *
* @return 是否另存成功 * @return 是否另存成功
*/ */
@Override
public boolean saveShareFile() { public boolean saveShareFile() {
FILE newFile = createNewEmptyFile(); FILE newFile = createNewEmptyFile();
//如果文件已经打开, 那么就覆盖关闭掉他 //如果文件已经打开, 那么就覆盖关闭掉他
@ -1057,6 +1123,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* *
* @return 分享模板按钮 * @return 分享模板按钮
*/ */
@Override
public UIButton[] createShareButton() { public UIButton[] createShareButton() {
return new UIButton[0]; return new UIButton[0];
//产品想要重新设计下, 1现在的分享多列数据集很麻烦, 2想做成自动上传附件. //产品想要重新设计下, 1现在的分享多列数据集很麻烦, 2想做成自动上传附件.

15
designer-realize/src/com/fr/design/mainframe/ReportComponent.java

@ -3,8 +3,6 @@
*/ */
package com.fr.design.mainframe; package com.fr.design.mainframe;
import javax.swing.JScrollBar;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.actions.AllowAuthorityEditAction; import com.fr.design.actions.AllowAuthorityEditAction;
import com.fr.design.actions.ExitAuthorityEditAction; import com.fr.design.actions.ExitAuthorityEditAction;
@ -13,13 +11,14 @@ import com.fr.design.actions.report.ReportFooterAction;
import com.fr.design.actions.report.ReportHeaderAction; import com.fr.design.actions.report.ReportHeaderAction;
import com.fr.design.actions.report.ReportPageSetupAction; import com.fr.design.actions.report.ReportPageSetupAction;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.NameSeparator; import com.fr.design.menu.NameSeparator;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.general.Inter;
import com.fr.report.report.TemplateReport;
import com.fr.design.selection.SelectableElement; import com.fr.design.selection.SelectableElement;
import com.fr.design.selection.Selectedable; import com.fr.design.selection.Selectedable;
import com.fr.general.Inter;
import com.fr.report.report.TemplateReport;
import javax.swing.JScrollBar;
/** /**
* @author richer * @author richer
@ -72,10 +71,4 @@ public abstract class ReportComponent<T extends TemplateReport, E extends Elemen
}; };
} }
public ToolBarMenuDockPlus getToolBarMenuDockPlus() {
return new JWorkBook();
}
} }

21
designer-realize/src/com/fr/design/mainframe/WorkSheetDesigner.java

@ -1,26 +1,33 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.BorderLayout;
import javax.swing.*;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.actions.report.*; import com.fr.design.actions.report.ReportColumnsAction;
import com.fr.design.actions.report.ReportEngineAttrAction;
import com.fr.design.actions.report.ReportPageAttrAction;
import com.fr.design.actions.report.ReportWriteAttrAction;
import com.fr.design.designer.EditingState; import com.fr.design.designer.EditingState;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.menu.*; import com.fr.design.menu.DottedSeparator;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.selection.SelectionListener;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
import com.fr.report.cell.CellElement; import com.fr.report.cell.CellElement;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
import com.fr.design.selection.SelectionListener;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollBar;
import java.awt.BorderLayout;
public class WorkSheetDesigner extends ReportComponent<WorkSheet, ElementCasePaneDelegate, Selection> { public class WorkSheetDesigner extends ReportComponent<WorkSheet, ElementCasePaneDelegate, Selection> {
private static final int HUND = 100; private static final int HUND = 100;

61
designer-realize/src/com/fr/design/mainframe/form/FormElementCaseDesigner.java

@ -3,15 +3,6 @@
*/ */
package com.fr.design.mainframe.form; package com.fr.design.mainframe.form;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollBar;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.DesignState; import com.fr.design.DesignState;
@ -22,13 +13,19 @@ import com.fr.design.designer.TargetComponent;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.*; import com.fr.design.mainframe.AuthorityEditPane;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.ElementCasePaneAuthorityEditPane;
import com.fr.design.mainframe.HyperlinkGroupPaneActionImpl;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.NameSeparator; import com.fr.design.menu.NameSeparator;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.present.ConditionAttributesGroupPane; import com.fr.design.present.ConditionAttributesGroupPane;
import com.fr.design.selection.SelectableElement;
import com.fr.design.selection.Selectedable;
import com.fr.design.selection.SelectionListener;
import com.fr.form.FormElementCaseProvider; import com.fr.form.FormElementCaseProvider;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
@ -37,15 +34,22 @@ import com.fr.report.cell.CellElement;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.worksheet.FormElementCase; import com.fr.report.worksheet.FormElementCase;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
import com.fr.design.selection.SelectableElement;
import com.fr.design.selection.Selectedable; import javax.swing.JComponent;
import com.fr.design.selection.SelectionListener; import javax.swing.JPanel;
import javax.swing.JScrollBar;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
/** /**
* 表单中的ElementCase编辑面板 * 表单中的ElementCase编辑面板
*/ */
public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extends ElementCasePane, S extends SelectableElement> extends TargetComponent<T> implements Selectedable<S>, FormECDesignerProvider{ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extends ElementCasePane, S extends SelectableElement> extends TargetComponent<T> implements Selectedable<S>, FormECDesignerProvider{
protected FormElementCasePaneDelegate elementCasePane; protected FormElementCasePaneDelegate elementCasePane;
@Override
public FormElementCasePaneDelegate getEditingElementCasePane() { public FormElementCasePaneDelegate getEditingElementCasePane() {
return elementCasePane; return elementCasePane;
} }
@ -74,6 +78,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
this.elementCasePane.setTarget((FormElementCase) t); this.elementCasePane.setTarget((FormElementCase) t);
} }
@Override
public int getMenuState() { public int getMenuState() {
return DesignState.WORK_SHEET; return DesignState.WORK_SHEET;
} }
@ -83,6 +88,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
* *
* @return 子菜单 * @return 子菜单
*/ */
@Override
public ShortCut[] shortCuts4Authority() { public ShortCut[] shortCuts4Authority() {
return new ShortCut[]{ return new ShortCut[]{
new NameSeparator(Inter.getLocText(new String[]{"DashBoard-Potence", "Edit"})), new NameSeparator(Inter.getLocText(new String[]{"DashBoard-Potence", "Edit"})),
@ -96,6 +102,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
* *
* @return 返回权限细粒度面板 * @return 返回权限细粒度面板
*/ */
@Override
public AuthorityEditPane createAuthorityEditPane() { public AuthorityEditPane createAuthorityEditPane() {
ElementCasePaneAuthorityEditPane elementCasePaneAuthorityEditPane = new ElementCasePaneAuthorityEditPane(elementCasePane); ElementCasePaneAuthorityEditPane elementCasePaneAuthorityEditPane = new ElementCasePaneAuthorityEditPane(elementCasePane);
elementCasePaneAuthorityEditPane.populateDetials(); elementCasePaneAuthorityEditPane.populateDetials();
@ -107,6 +114,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
* *
* @param size 缩略图的大小 * @param size 缩略图的大小
*/ */
@Override
public BufferedImage getElementCaseImage(Dimension size){ public BufferedImage getElementCaseImage(Dimension size){
BufferedImage image = null; BufferedImage image = null;
try{ try{
@ -134,6 +142,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
* *
* @return 返回正在编辑的状态. * @return 返回正在编辑的状态.
*/ */
@Override
public EditingState createEditingState() { public EditingState createEditingState() {
return this.elementCasePane.createEditingState(); return this.elementCasePane.createEditingState();
} }
@ -145,6 +154,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
/** /**
* 复制 * 复制
*/ */
@Override
public void copy() { public void copy() {
this.elementCasePane.copy(); this.elementCasePane.copy();
} }
@ -153,6 +163,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
* 粘贴 * 粘贴
* @return 粘贴成功则返回true * @return 粘贴成功则返回true
*/ */
@Override
public boolean paste() { public boolean paste() {
return this.elementCasePane.paste(); return this.elementCasePane.paste();
} }
@ -161,6 +172,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
* 剪切 * 剪切
* @return 粘贴成功则返回true * @return 粘贴成功则返回true
*/ */
@Override
public boolean cut() { public boolean cut() {
return this.elementCasePane.cut(); return this.elementCasePane.cut();
} }
@ -168,6 +180,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
/** /**
* 停止编辑 * 停止编辑
*/ */
@Override
public void stopEditing() { public void stopEditing() {
this.elementCasePane.stopEditing(); this.elementCasePane.stopEditing();
} }
@ -177,6 +190,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
* *
* @return 工具 * @return 工具
*/ */
@Override
public ToolBarDef[] toolbars4Target() { public ToolBarDef[] toolbars4Target() {
return this.elementCasePane.toolbars4Target(); return this.elementCasePane.toolbars4Target();
} }
@ -186,6 +200,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
* *
* @return 工具按钮 * @return 工具按钮
*/ */
@Override
public JComponent[] toolBarButton4Form() { public JComponent[] toolBarButton4Form() {
return this.elementCasePane.toolBarButton4Form(); return this.elementCasePane.toolBarButton4Form();
} }
@ -195,6 +210,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
* *
* @return 菜单 * @return 菜单
*/ */
@Override
public MenuDef[] menus4Target() { public MenuDef[] menus4Target() {
return this.elementCasePane.menus4Target(); return this.elementCasePane.menus4Target();
} }
@ -202,6 +218,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
/** /**
* 获取焦点 * 获取焦点
*/ */
@Override
public void requestFocus() { public void requestFocus() {
super.requestFocus(); super.requestFocus();
elementCasePane.requestFocus(); elementCasePane.requestFocus();
@ -215,29 +232,35 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
return elementCasePane.getVerticalScrollBar(); return elementCasePane.getVerticalScrollBar();
} }
@Override
public JPanel getEastUpPane() { public JPanel getEastUpPane() {
return elementCasePane.getEastUpPane(); return elementCasePane.getEastUpPane();
} }
@Override
public JPanel getEastDownPane() { public JPanel getEastDownPane() {
return elementCasePane.getEastDownPane(); return elementCasePane.getEastDownPane();
} }
@Override
public JPanel getConditionAttrPane() { public JPanel getConditionAttrPane() {
ConditionAttributesGroupPane conditionAttributesGroupPane = ConditionAttributesGroupPane.getInstance(); ConditionAttributesGroupPane conditionAttributesGroupPane = ConditionAttributesGroupPane.getInstance();
conditionAttributesGroupPane.populate(elementCasePane); conditionAttributesGroupPane.populate(elementCasePane);
return conditionAttributesGroupPane; return conditionAttributesGroupPane;
} }
@Override
public JPanel getHyperlinkPane(JTemplate jt) { public JPanel getHyperlinkPane(JTemplate jt) {
return jt.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance()); return jt.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
} }
@Override
public S getSelection() { public S getSelection() {
return (S) elementCasePane.getSelection(); return (S) elementCasePane.getSelection();
} }
@Override
public void setSelection(S selectElement) { public void setSelection(S selectElement) {
if (selectElement == null) { if (selectElement == null) {
selectElement = (S) new CellSelection(); selectElement = (S) new CellSelection();
@ -267,6 +290,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
* *
* @param selectionListener 选中的listener * @param selectionListener 选中的listener
*/ */
@Override
public void addSelectionChangeListener(SelectionListener selectionListener) { public void addSelectionChangeListener(SelectionListener selectionListener) {
elementCasePane.addSelectionChangeListener(selectionListener); elementCasePane.addSelectionChangeListener(selectionListener);
} }
@ -276,19 +300,16 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
* *
* @param selectionListener 选中的listener * @param selectionListener 选中的listener
*/ */
@Override
public void removeSelectionChangeListener(SelectionListener selectionListener) { public void removeSelectionChangeListener(SelectionListener selectionListener) {
elementCasePane.removeSelectionChangeListener(selectionListener); elementCasePane.removeSelectionChangeListener(selectionListener);
} }
@Override
public ToolBarMenuDockPlus getToolBarMenuDockPlus() {
return new JWorkBook();
}
/** /**
* 无条件取消格式刷 * 无条件取消格式刷
*/ */
@Override
public void cancelFormat() { public void cancelFormat() {
return; return;
} }
@ -302,10 +323,12 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
* *
* @return 子菜单 * @return 子菜单
*/ */
@Override
public ShortCut[] shortcut4TemplateMenu() { public ShortCut[] shortcut4TemplateMenu() {
return new ShortCut[0]; return new ShortCut[0];
} }
@Override
public FormElementCaseProvider getEditingElementCase(){ public FormElementCaseProvider getEditingElementCase(){
return this.getEditingElementCasePane().getTarget(); return this.getEditingElementCasePane().getTarget();
} }

52
designer-realize/src/com/fr/design/module/DesignerModule.java

@ -7,6 +7,8 @@ import com.fr.base.Formula;
import com.fr.base.MultiFieldParameter; import com.fr.base.MultiFieldParameter;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.TempNameStyle; import com.fr.base.TempNameStyle;
import com.fr.base.frpx.exception.FRPackageRunTimeException;
import com.fr.base.frpx.exception.InvalidWorkBookException;
import com.fr.base.io.XMLEncryptUtils; import com.fr.base.io.XMLEncryptUtils;
import com.fr.base.process.ProcessOperator; import com.fr.base.process.ProcessOperator;
import com.fr.base.remote.RemoteDeziConstants; import com.fr.base.remote.RemoteDeziConstants;
@ -54,6 +56,8 @@ import com.fr.io.importer.Excel2007ReportImporter;
import com.fr.io.importer.ExcelReportImporter; import com.fr.io.importer.ExcelReportImporter;
import com.fr.io.utils.ResourceIOUtils; import com.fr.io.utils.ResourceIOUtils;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.main.impl.WorkBookAdapter;
import com.fr.main.impl.WorkBookX;
import com.fr.quickeditor.cellquick.CellBiasTextPainterEditor; import com.fr.quickeditor.cellquick.CellBiasTextPainterEditor;
import com.fr.quickeditor.cellquick.CellDSColumnEditor; import com.fr.quickeditor.cellquick.CellDSColumnEditor;
import com.fr.quickeditor.cellquick.CellFormulaQuickEditor; import com.fr.quickeditor.cellquick.CellFormulaQuickEditor;
@ -70,6 +74,7 @@ import com.fr.report.cell.cellattr.core.RichText;
import com.fr.report.cell.cellattr.core.SubReport; import com.fr.report.cell.cellattr.core.SubReport;
import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.painter.BiasTextPainter; import com.fr.report.cell.painter.BiasTextPainter;
import com.fr.report.cell.painter.CellImagePainter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -92,6 +97,7 @@ import java.awt.Image;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.Set; import java.util.Set;
@ -101,6 +107,7 @@ public class DesignerModule extends DesignModule {
static { static {
ServletContext.addServletContextListener(new ServletContextAdapter() { ServletContext.addServletContextListener(new ServletContextAdapter() {
@Override
public void onServletStart() { public void onServletStart() {
ModuleContext.startModule(DesignerModule.class.getName()); ModuleContext.startModule(DesignerModule.class.getName());
} }
@ -110,6 +117,7 @@ public class DesignerModule extends DesignModule {
/** /**
* 启动设计器模块 * 启动设计器模块
*/ */
@Override
public void start() { public void start() {
super.start(); super.start();
@ -150,6 +158,7 @@ public class DesignerModule extends DesignModule {
ActionFactory.registerCellEditorClass(Image.class, CellImageQuickEditor.class); ActionFactory.registerCellEditorClass(Image.class, CellImageQuickEditor.class);
ActionFactory.registerCellEditorClass(BiasTextPainter.class, CellBiasTextPainterEditor.class); ActionFactory.registerCellEditorClass(BiasTextPainter.class, CellBiasTextPainterEditor.class);
ActionFactory.registerCellEditorClass(BufferedImage.class, CellImageQuickEditor.class); ActionFactory.registerCellEditorClass(BufferedImage.class, CellImageQuickEditor.class);
ActionFactory.registerCellEditor(CellImagePainter.class, new CellImageQuickEditor());
ActionFactory.registerChartCellEditorInEditor(BasicChartQuickEditor.class); ActionFactory.registerChartCellEditorInEditor(BasicChartQuickEditor.class);
@ -164,6 +173,7 @@ public class DesignerModule extends DesignModule {
} }
@Override
public String getInterNationalName() { public String getInterNationalName() {
return Inter.getLocText("FR-Module_Designer"); return Inter.getLocText("FR-Module_Designer");
} }
@ -178,6 +188,7 @@ public class DesignerModule extends DesignModule {
ActionFactory.registerFloatEditorClass(Formula.class, FloatStringQuickEditor.class); ActionFactory.registerFloatEditorClass(Formula.class, FloatStringQuickEditor.class);
ActionFactory.registerFloatEditorClass(Image.class, FloatImageQuickEditor.class); ActionFactory.registerFloatEditorClass(Image.class, FloatImageQuickEditor.class);
ActionFactory.registerFloatEditorClass(BufferedImage.class, FloatImageQuickEditor.class); ActionFactory.registerFloatEditorClass(BufferedImage.class, FloatImageQuickEditor.class);
ActionFactory.registerFloatEditor(CellImagePainter.class, new FloatImageQuickEditor());
ActionFactory.registerChartFloatEditorInEditor(FloatChartQuickEditor.class); ActionFactory.registerChartFloatEditorInEditor(FloatChartQuickEditor.class);
} }
@ -200,6 +211,7 @@ public class DesignerModule extends DesignModule {
* *
* @return 返回处理格子值的转换器 * @return 返回处理格子值的转换器
*/ */
@Override
public ValueConverter valueConverter() { public ValueConverter valueConverter() {
return new CellElementValueConverter(); return new CellElementValueConverter();
} }
@ -243,6 +255,7 @@ public class DesignerModule extends DesignModule {
return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getParas(book); return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getParas(book);
} }
@Override
protected MultiFieldParameter[] getAllMultiFieldParas(String book) { protected MultiFieldParameter[] getAllMultiFieldParas(String book) {
return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getAllMultiFieldParas(book); return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getAllMultiFieldParas(book);
} }
@ -283,7 +296,7 @@ public class DesignerModule extends DesignModule {
* @return 可以打开的模板类型的数组 * @return 可以打开的模板类型的数组
*/ */
public App[] apps4TemplateOpener() { public App[] apps4TemplateOpener() {
return new App[]{getCptApp(), getXlsApp(), getXlsxApp()}; return new App[]{getCptxApp(), getCptApp(), getXlsApp(), getXlsxApp()};
} }
private AbstractWorkBookApp getXlsxApp() { private AbstractWorkBookApp getXlsxApp() {
@ -328,10 +341,12 @@ public class DesignerModule extends DesignModule {
private AbstractWorkBookApp getCptApp() { private AbstractWorkBookApp getCptApp() {
return new AbstractWorkBookApp() { return new AbstractWorkBookApp() {
@Override
public String[] defaultExtentions() { public String[] defaultExtentions() {
return new String[]{"cpt"}; return new String[]{"cpt"};
} }
@Override
public WorkBook asIOFile(FILE file) { public WorkBook asIOFile(FILE file) {
if (XMLEncryptUtils.isCptEncoded() && if (XMLEncryptUtils.isCptEncoded() &&
!XMLEncryptUtils.checkVaild(DesignerEnvManager.getEnvManager().getEncryptionKey())) { !XMLEncryptUtils.checkVaild(DesignerEnvManager.getEnvManager().getEncryptionKey())) {
@ -362,6 +377,37 @@ public class DesignerModule extends DesignModule {
}; };
} }
private AbstractWorkBookApp getCptxApp() {
return new AbstractWorkBookApp() {
@Override
public String[] defaultExtentions() {
return new String[]{"cptx"};
}
@Override
public WorkBook asIOFile(FILE file) {
FRContext.getLogger().info(Inter.getLocText(new String[]{"LOG-Is_Being_Openned", "LOG-Please_Wait"}, new String[]{"\"" + file.getName() + "\"" + ",", "..."}));
WorkBookX tpl;
InputStream inputStream;
try {
inputStream = file.asInputStream();
long time = System.currentTimeMillis();
tpl = new WorkBookX(inputStream);
FRContext.getLogger().error("cost: " + (System.currentTimeMillis() - time) + " ms");
} catch (Exception exp) {
if (exp instanceof FRPackageRunTimeException) {
throw (FRPackageRunTimeException) exp;
}
throw new InvalidWorkBookException(file + ":" + exp.getMessage(), exp);
}
return new WorkBookAdapter(tpl);
}
};
}
private static void checkNameStyle(TempNameStyle namestyle) { private static void checkNameStyle(TempNameStyle namestyle) {
Iterator it = namestyle.getIterator(); Iterator it = namestyle.getIterator();
ArrayList<String> al = new ArrayList<String>(); ArrayList<String> al = new ArrayList<String>();
@ -391,6 +437,7 @@ public class DesignerModule extends DesignModule {
// ”是“按钮,点击之后将生成一个全局样式,并写入xml // ”是“按钮,点击之后将生成一个全局样式,并写入xml
UIButton confirmButton = new UIButton(Inter.getLocText("FR-Designer_Yes")); UIButton confirmButton = new UIButton(Inter.getLocText("FR-Designer_Yes"));
confirmButton.addActionListener(new ActionListener() { confirmButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
try { try {
for (int i = 0; i < namelist.size(); i++) { for (int i = 0; i < namelist.size(); i++) {
@ -406,6 +453,7 @@ public class DesignerModule extends DesignModule {
UIButton noButton = new UIButton(Inter.getLocText("FR-Designer_No")); UIButton noButton = new UIButton(Inter.getLocText("FR-Designer_No"));
noButton.addActionListener(new ActionListener() { noButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
jd.dispose(); jd.dispose();
} }
@ -419,6 +467,7 @@ public class DesignerModule extends DesignModule {
jd.setVisible(true); jd.setVisible(true);
} }
@Override
public Class<?>[] actionsForInsertCellElement() { public Class<?>[] actionsForInsertCellElement() {
return (Class<?>[]) ArrayUtils.addAll(new Class<?>[]{ return (Class<?>[]) ArrayUtils.addAll(new Class<?>[]{
DSColumnCellAction.class, DSColumnCellAction.class,
@ -432,6 +481,7 @@ public class DesignerModule extends DesignModule {
}, super.actionsForInsertCellElement()); }, super.actionsForInsertCellElement());
} }
@Override
public Class<?>[] actionsForInsertFloatElement() { public Class<?>[] actionsForInsertFloatElement() {
return (Class<?>[]) ArrayUtils.addAll(new Class<?>[]{ return (Class<?>[]) ArrayUtils.addAll(new Class<?>[]{
TextBoxFloatAction.class, TextBoxFloatAction.class,

71
designer-realize/src/com/fr/design/report/SelectImagePane.java

@ -1,37 +1,37 @@
package com.fr.design.report; package com.fr.design.report;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.frpx.pack.PictureCollection;
import com.fr.base.frpx.util.ImageIOHelper;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane; import com.fr.design.style.background.image.ImageFileChooser;
import com.fr.design.style.background.image.ImagePreviewPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.cell.Elem; import com.fr.report.cell.Elem;
import com.fr.report.cell.cellattr.CellImage; import com.fr.report.cell.cellattr.CellImage;
import com.fr.report.cell.painter.CellImagePainter;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper; import com.fr.stable.CoreGraphHelper;
import com.fr.design.style.background.image.ImageFileChooser;
import com.fr.design.style.background.image.ImagePreviewPane; import javax.swing.BorderFactory;
import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.ButtonGroup;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
/** /**
*
* 这个类主要用于插入图片时的设置 * 这个类主要用于插入图片时的设置
*
*/ */
public class SelectImagePane extends BasicPane { public class SelectImagePane extends BasicPane {
private ImagePreviewPane previewPane = null; private ImagePreviewPane previewPane = null;
@ -43,8 +43,14 @@ public class SelectImagePane extends BasicPane{
private UIRadioButton adjustRadioButton = null; private UIRadioButton adjustRadioButton = null;
private Style imageStyle = null; private Style imageStyle = null;
private Image previewImage = null; private Image previewImage = null;
/**
* 默认格式
*/
private String suffix = PictureCollection.DEFAULT_SUFFIX;
private File imageFile; private File imageFile;
public SelectImagePane() { public SelectImagePane() {
@ -111,6 +117,8 @@ public class SelectImagePane extends BasicPane{
* Select picture. * Select picture.
*/ */
ActionListener selectPictureActionListener = new ActionListener() { ActionListener selectPictureActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
int returnVal = imageFileChooser int returnVal = imageFileChooser
.showOpenDialog(SelectImagePane.this); .showOpenDialog(SelectImagePane.this);
@ -118,7 +126,9 @@ public class SelectImagePane extends BasicPane{
File selectedFile = imageFileChooser.getSelectedFile(); File selectedFile = imageFileChooser.getSelectedFile();
if (selectedFile != null && selectedFile.isFile()) { if (selectedFile != null && selectedFile.isFile()) {
Image image = BaseUtils.readImage(selectedFile.getPath()); String filePath = selectedFile.getPath();
suffix = ImageIOHelper.getSuffix(filePath);
Image image = BaseUtils.readImage(filePath);
CoreGraphHelper.waitForImage(image); CoreGraphHelper.waitForImage(image);
imageFile = selectedFile; imageFile = selectedFile;
@ -154,6 +164,7 @@ public class SelectImagePane extends BasicPane{
ActionListener layoutActionListener = new ActionListener() { ActionListener layoutActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
setImageStyle(); setImageStyle();
changeImageStyle(); changeImageStyle();
@ -169,14 +180,18 @@ public class SelectImagePane extends BasicPane{
Style style = null; Style style = null;
if (cell != null) { if (cell != null) {
Object value = cell.getValue(); Object value = cell.getValue();
if (value != null && value instanceof Image) { if (value instanceof Image) {
Image image = (Image)value; setImage((Image) value);
previewPane.setImage(image); } else if (value instanceof CellImagePainter) {
this.previewImage = image; setImage(((CellImagePainter) value).getImage());
suffix = ((CellImagePainter) value).getSuffix();
} }
style = cell.getStyle(); style = cell.getStyle();
} }
if (style == null) {
return;
}
if (style.getImageLayout() == Constants.IMAGE_TILED) { if (style.getImageLayout() == Constants.IMAGE_TILED) {
tiledRadioButton.setSelected(true); tiledRadioButton.setSelected(true);
@ -192,10 +207,18 @@ public class SelectImagePane extends BasicPane{
changeImageStyle(); changeImageStyle();
} }
public void setImage(Image image) {
previewPane.setImage(image);
this.previewImage = image;
}
public CellImage update() { public CellImage update() {
CellImage cellImage = new CellImage(); CellImage cellImage = new CellImage();
cellImage.setImage(previewPane.getImage()); cellImage.setImage(previewPane.getImage());
cellImage.setStyle(this.imageStyle); cellImage.setStyle(this.imageStyle);
if (suffix != null) {
cellImage.setSuffix(suffix);
}
return cellImage; return cellImage;
} }

32
designer-realize/src/com/fr/design/widget/ui/btn/ButtonSytleDefinedPane.java

@ -1,23 +1,13 @@
package com.fr.design.widget.ui.btn; package com.fr.design.widget.ui.btn;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import com.fr.base.background.ColorBackground; import com.fr.base.background.ColorBackground;
import com.fr.design.gui.ilable.UILabel; import com.fr.base.background.ImageFileBackground;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import com.fr.base.background.ImageBackground;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleBackgroundEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleBackgroundEditor;
@ -26,6 +16,16 @@ import com.fr.form.ui.FreeButton;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class ButtonSytleDefinedPane extends BasicPane { public class ButtonSytleDefinedPane extends BasicPane {
protected AccessibleBackgroundEditor initBackgroundPane; protected AccessibleBackgroundEditor initBackgroundPane;
protected AccessibleBackgroundEditor overBackgroundPane; protected AccessibleBackgroundEditor overBackgroundPane;
@ -124,8 +124,8 @@ public class ButtonSytleDefinedPane extends BasicPane {
public void populate(Background background) { public void populate(Background background) {
this.background = background; this.background = background;
if (background instanceof ImageBackground && ((ImageBackground) background).getImage() != null) { if (background instanceof ImageFileBackground && ((ImageFileBackground) background).getImage() != null) {
ImagePreviewPane.setIcon(new ImageIcon(((ImageBackground) background).getImage())); ImagePreviewPane.setIcon(new ImageIcon(((ImageFileBackground) background).getImage()));
} else if(background instanceof ColorBackground && ((ColorBackground) background).getColor() != null){ } else if(background instanceof ColorBackground && ((ColorBackground) background).getColor() != null){
ImagePreviewPane.setIcon(null); ImagePreviewPane.setIcon(null);
ImagePreviewPane.setOpaque(true); ImagePreviewPane.setOpaque(true);

32
designer-realize/src/com/fr/grid/Grid.java

@ -5,11 +5,18 @@ package com.fr.grid;
import com.fr.base.DynamicUnitList; import com.fr.base.DynamicUnitList;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.cell.editor.*; import com.fr.design.cell.editor.CellEditor;
import com.fr.design.cell.editor.FloatEditor;
import com.fr.design.cell.editor.FormulaCellEditor;
import com.fr.design.cell.editor.GeneralCellEditor;
import com.fr.design.cell.editor.GeneralFloatEditor;
import com.fr.design.cell.editor.TextCellEditor;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fun.GridUIProcessor; import com.fr.design.fun.GridUIProcessor;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.grid.event.CellEditorEvent; import com.fr.grid.event.CellEditorEvent;
@ -32,7 +39,13 @@ import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import java.awt.*; import java.awt.AWTEvent;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Window;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import java.util.Hashtable; import java.util.Hashtable;
@ -148,6 +161,7 @@ public class Grid extends BaseGridComponent {
* *
* @date 2014-12-21-下午6:32:43 * @date 2014-12-21-下午6:32:43
*/ */
@Override
public void updateUI() { public void updateUI() {
GridUIProcessor localGridUIProcessor = ExtraDesignClassManager.getInstance().getSingle(GridUIProcessor.MARK_STRING, new DefaultGridUIProcessor()); GridUIProcessor localGridUIProcessor = ExtraDesignClassManager.getInstance().getSingle(GridUIProcessor.MARK_STRING, new DefaultGridUIProcessor());
ComponentUI localComponentUI = localGridUIProcessor.appearanceForGrid(this.resolution); ComponentUI localComponentUI = localGridUIProcessor.appearanceForGrid(this.resolution);
@ -964,11 +978,15 @@ public class Grid extends BaseGridComponent {
if (newValue instanceof CellImage) { if (newValue instanceof CellImage) {
CellImage cellImage = (CellImage) newValue; CellImage cellImage = (CellImage) newValue;
newValue = cellImage.getImage(); newValue = cellImage.getImage();
JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
currentEditingTemplate.setPictureElem(selectedFloatElement, cellImage);
if (cellImage.getStyle() != null) { if (cellImage.getStyle() != null) {
selectedFloatElement.setStyle(cellImage.getStyle()); selectedFloatElement.setStyle(cellImage.getStyle());
} }
} } else {
selectedFloatElement.setValue(newValue); selectedFloatElement.setValue(newValue);
}
reportPane.fireTargetModified(); reportPane.fireTargetModified();
//加这句话是为了在编辑完悬浮元素公式的时候,点击确定,右上角面板会立即刷新 //加这句话是为了在编辑完悬浮元素公式的时候,点击确定,右上角面板会立即刷新
reportPane.getCurrentEditor(); reportPane.getCurrentEditor();
@ -1069,7 +1087,8 @@ public class Grid extends BaseGridComponent {
Object oldValue = this.editingCellElement.getValue(); Object oldValue = this.editingCellElement.getValue();
boolean imageChange = false; boolean imageChange = false;
if (!ComparatorUtils.equals_exactly(oldValue, newValue)) { if (!ComparatorUtils.equals_exactly(oldValue, newValue)) {
editingCellElement.setValue(newValue); JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
currentEditingTemplate.setPictureElem(editingCellElement, cellImage);
imageChange = true; imageChange = true;
} }
if (styleChange || imageChange) { if (styleChange || imageChange) {
@ -1283,6 +1302,7 @@ public class Grid extends BaseGridComponent {
* @param event * @param event
* @return * @return
*/ */
@Override
public Point getToolTipLocation(MouseEvent event) { public Point getToolTipLocation(MouseEvent event) {
if (StringUtils.isEmpty(this.getToolTipText())) { if (StringUtils.isEmpty(this.getToolTipText())) {
return null; return null;
@ -1363,6 +1383,7 @@ public class Grid extends BaseGridComponent {
/** /**
* This tells the listeners the editor has stopped editing * This tells the listeners the editor has stopped editing
*/ */
@Override
public void editingStopped(CellEditorEvent evt) { public void editingStopped(CellEditorEvent evt) {
Grid.this.stopCellEditingInner(false); Grid.this.stopCellEditingInner(false);
// if(Grid.this.) // if(Grid.this.)
@ -1371,6 +1392,7 @@ public class Grid extends BaseGridComponent {
/** /**
* This tells the listeners the editor has canceled editing * This tells the listeners the editor has canceled editing
*/ */
@Override
public void editingCanceled(CellEditorEvent evt) { public void editingCanceled(CellEditorEvent evt) {
Grid.this.cancelEditing(); Grid.this.cancelEditing();
} }
@ -1381,6 +1403,7 @@ public class Grid extends BaseGridComponent {
/** /**
* This tells the listeners the editor has stopped editing * This tells the listeners the editor has stopped editing
*/ */
@Override
public void editingStopped(FloatEditorEvent evt) { public void editingStopped(FloatEditorEvent evt) {
Grid.this.stopFloatEditingInner(false); Grid.this.stopFloatEditingInner(false);
} }
@ -1388,6 +1411,7 @@ public class Grid extends BaseGridComponent {
/** /**
* This tells the listeners the editor has canceled editing * This tells the listeners the editor has canceled editing
*/ */
@Override
public void editingCanceled(FloatEditorEvent evt) { public void editingCanceled(FloatEditorEvent evt) {
Grid.this.cancelEditing(); Grid.this.cancelEditing();
} }

8
designer-realize/src/com/fr/grid/GridUI.java

@ -9,7 +9,7 @@ import com.fr.base.Margin;
import com.fr.base.PaperSize; import com.fr.base.PaperSize;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.base.background.ColorBackground; import com.fr.base.background.ColorBackground;
import com.fr.base.background.ImageBackground; import com.fr.base.background.ImageFileBackground;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -152,7 +152,7 @@ public class GridUI extends ComponentUI {
if (background != null) { if (background != null) {
// denny: except the ColorBackground and ImageBackground // denny: except the ColorBackground and ImageBackground
if (grid.isEnabled() && !(background instanceof ImageBackground)) { if (grid.isEnabled() && !(background instanceof ImageFileBackground)) {
background.paint(g2d, this.back_or_selection_rect); background.paint(g2d, this.back_or_selection_rect);
} }
@ -172,12 +172,12 @@ public class GridUI extends ComponentUI {
private void paintScrollBackground(Graphics2D g2d, Grid grid, Background background, PaperSettingProvider psetting, ReportSettingsProvider reportSettings) { private void paintScrollBackground(Graphics2D g2d, Grid grid, Background background, PaperSettingProvider psetting, ReportSettingsProvider reportSettings) {
boolean isCanDrawImage = grid.isEditable() || isAuthority; boolean isCanDrawImage = grid.isEditable() || isAuthority;
if (isCanDrawImage && (background instanceof ImageBackground)) { if (isCanDrawImage && (background instanceof ImageFileBackground)) {
if (!grid.isShowPaginateLine()) { if (!grid.isShowPaginateLine()) {
calculatePaper(psetting, reportSettings); calculatePaper(psetting, reportSettings);
} }
ImageBackground imageBackground = (ImageBackground) background; ImageFileBackground imageBackground = (ImageFileBackground) background;
int hideWidth = columnWidthList.getRangeValue(0, horizontalValue) int hideWidth = columnWidthList.getRangeValue(0, horizontalValue)
.toPixI(resolution); .toPixI(resolution);

6
designer-realize/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java

@ -4,11 +4,12 @@ import com.fr.base.Style;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.ImageCellAction; import com.fr.design.actions.insert.cell.ImageCellAction;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.report.SelectImagePane; import com.fr.design.report.SelectImagePane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -19,7 +20,6 @@ import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -65,6 +65,8 @@ public class CellImageQuickEditor extends CellQuickEditor {
if (!ComparatorUtils.equals(cellImage.getImage(), oldValue) || !ComparatorUtils.equals(cellImage.getStyle(), oldStyle)) { if (!ComparatorUtils.equals(cellImage.getImage(), oldValue) || !ComparatorUtils.equals(cellImage.getStyle(), oldStyle)) {
cellElement.setValue(cellImage.getImage()); cellElement.setValue(cellImage.getImage());
cellElement.setStyle(cellImage.getStyle()); cellElement.setStyle(cellImage.getStyle());
JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
currentEditingTemplate.setPictureElem(cellElement, cellImage);
fireTargetModified(); fireTargetModified();
} }
} }

5
designer-realize/src/com/fr/quickeditor/floatquick/FloatImageQuickEditor.java

@ -2,10 +2,12 @@ package com.fr.quickeditor.floatquick;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.report.SelectImagePane; import com.fr.design.report.SelectImagePane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -59,8 +61,9 @@ public class FloatImageQuickEditor extends FloatQuickEditor {
public void doOk() { public void doOk() {
CellImage cellImage = imageEditorPane.update(); CellImage cellImage = imageEditorPane.update();
if (!ComparatorUtils.equals(cellImage.getImage(), oldValue) || !ComparatorUtils.equals(cellImage.getStyle(), oldStyle)) { if (!ComparatorUtils.equals(cellImage.getImage(), oldValue) || !ComparatorUtils.equals(cellImage.getStyle(), oldStyle)) {
floatElement.setValue(cellImage.getImage());
floatElement.setStyle(cellImage.getStyle()); floatElement.setStyle(cellImage.getStyle());
JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
currentEditingTemplate.setPictureElem(floatElement, cellImage);
fireTargetModified(); fireTargetModified();
} }
} }

29
designer-realize/src/com/fr/start/Designer.java

@ -8,6 +8,7 @@ import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.file.WebPreviewUtils; import com.fr.design.actions.file.WebPreviewUtils;
import com.fr.design.actions.file.newReport.NewPolyReportAction; import com.fr.design.actions.file.newReport.NewPolyReportAction;
import com.fr.design.actions.file.newReport.NewWorkBookAction; import com.fr.design.actions.file.newReport.NewWorkBookAction;
import com.fr.design.actions.file.newReport.NewWorkBookXAction;
import com.fr.design.actions.server.ServerConfigManagerAction; import com.fr.design.actions.server.ServerConfigManagerAction;
import com.fr.design.actions.server.StyleListAction; import com.fr.design.actions.server.StyleListAction;
import com.fr.design.actions.server.WidgetManagerAction; import com.fr.design.actions.server.WidgetManagerAction;
@ -40,17 +41,23 @@ import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.main.impl.WorkBookX;
import com.fr.module.Module; import com.fr.module.Module;
import com.fr.module.ModuleContext; import com.fr.module.ModuleContext;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLTools; import com.fr.stable.xml.XMLTools;
import com.fr.start.module.StartupArgs; import com.fr.start.module.StartupArgs;
import javax.swing.*; import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.border.MatteBorder; import javax.swing.border.MatteBorder;
import java.awt.*; import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.File; import java.io.File;
@ -61,21 +68,19 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class Designer extends BaseDesigner { public class Designer extends BaseDesigner {
private static final int TOOLBARPANEVGAP = -4; private static final int TOOLBARPANEVGAP = -4;
private static final int PREVIEW_DOWN_X_GAP = 92; private static final int PREVIEW_DOWN_X_GAP = 92;
private static final int GAP = 7; private static final int GAP = 7;
private static final String OLD_ENV_FOLDER_71 = ".FineReport71"; private static final String OLD_ENV_FOLDER_71 = ".FineReport71";
private static final String OLD_ENV_FOLDER_70 = ".FineReport70"; private static final String OLD_ENV_FOLDER_70 = ".FineReport70";
private UserInfoPane userInfoPane; private UserInfoPane userInfoPane;
private UIButton saveButton; private UIButton saveButton;
private UIButton undo; private UIButton undo;
private UIButton redo; private UIButton redo;
private UIPreviewButton run; private UIPreviewButton run;
/** /**
* 设计器启动的Main方法 * 设计器启动的Main方法
* *
@ -100,13 +105,16 @@ public class Designer extends BaseDesigner {
return DesignerModule.class.getName(); return DesignerModule.class.getName();
} }
@Override
/** /**
* 创建新建文件的快捷方式数组 * 创建新建文件的快捷方式数组
*
* @return 返回快捷方式的数组 * @return 返回快捷方式的数组
*/ */
@Override
public ShortCut[] createNewFileShortCuts() { public ShortCut[] createNewFileShortCuts() {
ArrayList<ShortCut> shortCuts = new ArrayList<ShortCut>(); ArrayList<ShortCut> shortCuts = new ArrayList<ShortCut>();
shortCuts.add(new NewWorkBookXAction());
shortCuts.add(new NewWorkBookAction()); shortCuts.add(new NewWorkBookAction());
shortCuts.add(new NewPolyReportAction()); shortCuts.add(new NewPolyReportAction());
try { try {
@ -146,11 +154,13 @@ public class Designer extends BaseDesigner {
return menuDef; return menuDef;
} }
@Override
/** /**
* 创建设计器上几个比较大的图标新建cpt保存前进后退运行 * 创建设计器上几个比较大的图标新建cpt保存前进后退运行
*
* @return 返回大图标对应的工具栏 * @return 返回大图标对应的工具栏
*/ */
@Override
public UILargeToolbar createLargeToolbar() { public UILargeToolbar createLargeToolbar() {
UILargeToolbar largeToolbar = super.createLargeToolbar(); UILargeToolbar largeToolbar = super.createLargeToolbar();
largeToolbar.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 4)); largeToolbar.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 4));
@ -348,13 +358,14 @@ public class Designer extends BaseDesigner {
} }
@Override
/** /**
* 生成报表设计和表单设计的编辑区域 * 生成报表设计和表单设计的编辑区域
*
* @return 返回编辑区域 * @return 返回编辑区域
*/ */
@Override
public JTemplate<?, ?> createNewTemplate() { public JTemplate<?, ?> createNewTemplate() {
return new JWorkBook(); return new JWorkBook(new WorkBookX(new WorkSheet()));
} }
/** /**

Loading…
Cancel
Save