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. 25
      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. 125
      designer-base/src/com/fr/design/mainframe/JTemplate.java
  6. 16
      designer-base/src/com/fr/design/mainframe/JVirtualTemplate.java
  7. 29
      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. 8
      designer-base/src/com/fr/design/style/background/BackgroundFactory.java
  12. 27
      designer-base/src/com/fr/design/style/background/BackgroundUIComboBoxPane.java
  13. 52
      designer-base/src/com/fr/design/style/background/image/ImageSelectPane.java
  14. 45
      designer-base/src/com/fr/design/style/background/impl/ImageBackgroundPane.java
  15. 35
      designer-base/src/com/fr/design/style/background/impl/ImageButtonBackgroundPane.java
  16. 24
      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. 99
      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;
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.design.mainframe.JTemplate;
import com.fr.design.mainframe.JTemplateProvider;
@ -19,7 +19,7 @@ import java.util.Map;
* @author zhou
* @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;
protected S jTemplate;

25
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.ToolBarDef;
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;
}
public TargetComponent() {}
public TargetComponent() {
}
// TODO ALEX_SEP JWorkBook不想有copy, paste, cut的操作,怎么办?
public abstract void copy();
@ -40,7 +43,13 @@ public abstract class TargetComponent<T> extends JComponent {
public abstract AuthorityEditPane createAuthorityEditPane();
public abstract ToolBarMenuDockPlus getToolBarMenuDockPlus();
/**
* 提供默认空实现大部分子类不需要这个方法覆写的莫名其妙的
*/
@Nullable
public ToolBarMenuDockPlus getToolBarMenuDockPlus() {
return null;
}
public abstract int getMenuState();
@ -118,10 +127,12 @@ public abstract class TargetComponent<T> extends JComponent {
return false;
}
public int getMenuState(){
@Override
public int getMenuState() {
return DesignState.WORK_SHEET;
}
@Override
public void cancelFormat() {
return;
}
@ -135,10 +146,12 @@ public abstract class TargetComponent<T> extends JComponent {
public void stopEditing() {
}
@Override
public AuthorityEditPane createAuthorityEditPane() {
return null;
}
@Override
public ToolBarMenuDockPlus getToolBarMenuDockPlus() {
return null;
}
@ -158,19 +171,23 @@ public abstract class TargetComponent<T> extends JComponent {
return new ShortCut[0];
}
@Override
public ShortCut[] shortCuts4Authority() {
return new ShortCut[0];
}
@Override
public JComponent[] toolBarButton4Form() {
return new JComponent[0];
}
@Override
public JPanel getEastUpPane() {
return new JPanel();
}
@Override
public JPanel getEastDownPane() {
return new JPanel();
}

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

@ -1,14 +1,14 @@
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.stable.fun.mark.Mutable;
import com.fr.stable.fun.mark.Aftermath;
import com.fr.stable.fun.mark.Mutable;
/**
* 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";

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;
for (int j = 0; j < defaultAppExtentions.length; j++) {
if (defaultAppExtentions[j].equalsIgnoreCase(fileExtention)) {
JTemplate jt = null;
try {
jt = app.openTemplate(tplFile);
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage(), e);
}
// 不要catch
JTemplate jt = app.openTemplate(tplFile);
if (jt == null) {
return;
}

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

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

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.imenu.UIMenuItem;
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.ToolBarDef;
import com.fr.file.FILE;
import com.fr.file.FileFILE;
import com.fr.file.FileNodeFILE;
import com.fr.stable.StableUtils;
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.util.List;
@ -35,6 +34,7 @@ public class JVirtualTemplate extends JTemplate {
setEditingFILE(editingFILE);
}
@Override
public String getFullPathName() {
String editingFileName = getEditingFILE().getPath();
if (editingFileName.startsWith(ProjectConstants.REPORTLETS_NAME)) {
@ -48,6 +48,7 @@ public class JVirtualTemplate extends JTemplate {
*
* @return
*/
@Override
public FILE getEditingFILE() {
return this.editingFILE;
}
@ -71,6 +72,7 @@ public class JVirtualTemplate extends JTemplate {
return null;
}
@Override
public JComponent getCurrentReportComponentPane() {
return null;
}
@ -165,11 +167,6 @@ public class JVirtualTemplate extends JTemplate {
return null;
}
@Override
public ToolBarMenuDockPlus getToolBarMenuDockPlus() {
return null;
}
@Override
public JPanel getEastUpPane() {
return null;
@ -246,6 +243,7 @@ public class JVirtualTemplate extends JTemplate {
return null;
}
@Override
public HyperlinkGroupPane getHyperLinkPaneNoPop(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
return null;
}

29
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.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.border.UIRoundedBorder;
import com.fr.design.event.UIObserverListener;
@ -37,6 +39,8 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
private UIButtonGroup<Byte> imageLayoutPane;
private String suffix = PictureCollection.DEFAULT_SUFFIX;
public ImageBackgroundQuickPane() {
this(true);
}
@ -65,7 +69,7 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
UIButton selectPictureButton = new UIButton(Inter.getLocText("Image-Select_Picture"));
selectPictureButton.addActionListener(selectPictureActionListener);
if(hasImageLayout){
if (hasImageLayout) {
southPane.add(imageLayoutPane, BorderLayout.SOUTH);
}
southPane.add(selectPictureButton, BorderLayout.CENTER);
@ -86,6 +90,7 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
*/
ActionListener selectPictureActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
if (imageFileChooser == null) {
imageFileChooser = new ImageFileChooser();
@ -96,7 +101,9 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
File selectedFile = imageFileChooser.getSelectedFile();
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);
previewPane.setImage(image);
@ -112,9 +119,11 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
}
};
@Override
public void populateBean(Background background) {
ImageBackground imageBackground = (ImageBackground) background;
ImageFileBackground imageBackground = (ImageFileBackground) background;
suffix = imageBackground.getSuffix();
imageLayoutPane.setSelectedItem((byte) imageBackground.getLayout());
Style.DEFAULT_STYLE.deriveImageLayout(imageBackground.getLayout());
@ -123,8 +132,9 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
previewPane.repaint();
}
@Override
public Background updateBean() {
ImageBackground imageBackground = new ImageBackground(previewPane.getImage());
ImageFileBackground imageBackground = new ImageFileBackground(previewPane.getImage(), suffix);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(imageLayoutPane.getSelectedItem());
imageBackground.setLayout(imageStyle.getImageLayout());
return imageBackground;
@ -135,8 +145,10 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
*
* @param listener 观察者监听事件
*/
@Override
public void registerChangeListener(final UIObserverListener listener) {
changeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
@ -154,6 +166,7 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
ChangeListener imageSizeChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent evt) {
if (imageLayoutPane.getSelectedItem() != null) {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(imageLayoutPane.getSelectedItem());
@ -165,17 +178,21 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
/**
* 判断是否是图片背景
*
* @param background 背景
* @return 判断是否是图片背景
*/
@Override
public boolean accept(Background background) {
return background instanceof ImageBackground;
return background instanceof ImageFileBackground;
}
/**
* 标题
*
* @return 标题
*/
@Override
public String title4PopupWindow() {
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;
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.design.DesignerEnvManager;
import com.fr.design.mainframe.DesignerContext;
@ -47,7 +47,7 @@ import java.util.Map;
* 做模板的过程和耗时收集辅助类
* 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;
private static final String FILE_NAME = "tpl.info";
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();
if (inList(t)) { // 已有记录
templateInfo = templateInfoList.get(t.getTemplateID());
templateInfo = templateInfoList.get(templateID);
// 更新 conusmingMap
HashMap<String, Object> consumingMap = (HashMap<String, Object>) templateInfo.get(XML_CONSUMING_MAP);
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;
import com.fr.base.io.IOFile;
import com.fr.base.io.BaseBook;
/**
* Created by plough on 2017/3/17.
*/
public abstract class TemplateProcessInfo<T extends IOFile> {
public abstract class TemplateProcessInfo<T extends BaseBook> {
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.base.background.ColorBackground;
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.TextureBackground;
import com.fr.design.Exception.ValidationException;
@ -30,7 +30,7 @@ public class BackgroundWrapper implements Encoder, Decoder {
return Inter.getLocText("Background-Texture");
} else if (v instanceof PatternBackground) {
return Inter.getLocText("Background-Pattern");
} else if (v instanceof ImageBackground) {
} else if (v instanceof ImageFileBackground) {
return Inter.getLocText("Image");
} else if (v instanceof GradientBackground) {
return Inter.getLocText("Gradient-Color");

8
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) {
map.put(ImageBackground.class, BackgroundUIWrapper.create()
map.put(ImageFileBackground.class, BackgroundUIWrapper.create()
.setType(ImageBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Image")));
}
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")));
}
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()
.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")));
}

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

@ -1,25 +1,24 @@
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.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.ilable.UILabel;
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.image.ImageSelectPane;
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
@ -108,7 +107,7 @@ public class BackgroundUIComboBoxPane extends BasicPane {
if(background instanceof ColorBackground && colorPane != null) {
selectBox.setSelectedItem(color);
colorPane.populate(background);
} else if(background instanceof ImageBackground && imagePane != null) {
} else if(background instanceof ImageFileBackground && imagePane != null) {
selectBox.setSelectedItem(image);
imagePane.populate(background);
} else if(background instanceof GradientBackground && gradientPane != null) {

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

@ -1,28 +1,29 @@
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.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.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
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.Inter;
import com.fr.stable.Constants;
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 String layoutCenter = Inter.getLocText("Default");
private static String layoutTitled = Inter.getLocText("Image-Titled");
private String suffix = PictureCollection.DEFAULT_SUFFIX;
//产品设计说:只需要居中(默认的)和平铺两种方式
private static final String[] layoutTypes = {
layoutCenter,
@ -96,12 +100,16 @@ public class ImageSelectPane extends BackgroundPane4BoxChange {
}
ActionListener selectPictureActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
int returnVal = imageFileChooser.showOpenDialog(ImageSelectPane.this);
if (returnVal != JFileChooser.CANCEL_OPTION) {
File selectedFile = imageFileChooser.getSelectedFile();
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);
selectImage = image;
}
@ -121,16 +129,16 @@ public class ImageSelectPane extends BackgroundPane4BoxChange {
public void populate(Background background) {
if (background instanceof ImageBackground) {
ImageBackground imageBackground = (ImageBackground) background;
if (background instanceof ImageFileBackground) {
ImageFileBackground imageBackground = (ImageFileBackground) background;
selectImage = imageBackground.getImage();
suffix = imageBackground.getUri();
if (imageBackground.getLayout() == Constants.IMAGE_TILED) {
layoutComboBox.setSelectedItem(layoutTitled);
} else {
layoutComboBox.setSelectedItem(layoutCenter);
}
}
chechLabelText();
@ -145,12 +153,12 @@ public class ImageSelectPane extends BackgroundPane4BoxChange {
}
public Background update() {
ImageBackground imageBackground = new ImageBackground(selectImage);
ImageFileBackground imageBackground = new ImageFileBackground(selectImage, suffix);
Object selectLayout = layoutComboBox.getSelectedItem();
if(selectLayout.equals(layoutCenter)) {
if (selectLayout.equals(layoutCenter)) {
imageBackground.setLayout(Constants.IMAGE_CENTER);
} else if(selectLayout.equals(layoutTitled)) {
} else if (selectLayout.equals(layoutTitled)) {
imageBackground.setLayout(Constants.IMAGE_TILED);
}

45
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.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.UIRadioButton;
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.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.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.ActionListener;
import java.io.File;
@ -39,6 +47,8 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
private UIRadioButton extendRadioButton = null;
private UIRadioButton adjustRadioButton = null;
private String suffix = PictureCollection.DEFAULT_SUFFIX;
public ImageBackgroundPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -60,7 +70,7 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
imageFileChooser.setMultiSelectionEnabled(false);
}
public JPanel initSelectFilePane(){
public JPanel initSelectFilePane() {
JPanel selectFilePane = FRGUIPaneFactory.createBorderLayout_L_Pane();
selectFilePane.setBorder(BorderFactory.createEmptyBorder(8, 2, 4, 0));
@ -114,13 +124,16 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
*/
ActionListener selectPictureActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
int returnVal = imageFileChooser.showOpenDialog(ImageBackgroundPane.this);
if (returnVal != JFileChooser.CANCEL_OPTION) {
File selectedFile = imageFileChooser.getSelectedFile();
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);
previewPane.setImage(image);
@ -135,7 +148,7 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
}
};
public void imageStyleRepaint(){
public void imageStyleRepaint() {
setImageStyle();
previewPane.setImageStyle(imageStyle);
}
@ -154,6 +167,7 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
ActionListener layoutActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
setImageStyle();
changeImageStyle();
@ -165,10 +179,12 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
}
};
@Override
public void populate(Background background) {
if (background instanceof ImageBackground) {
ImageBackground imageBackground = (ImageBackground) background;
if (background instanceof ImageFileBackground) {
ImageFileBackground imageBackground = (ImageFileBackground) background;
suffix = imageBackground.getSuffix();
if (imageBackground.getLayout() == Constants.IMAGE_CENTER) {
defaultRadioButton.setSelected(true);
@ -204,13 +220,15 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
fireChagneListener();
}
@Override
public Background update() throws Exception {
ImageBackground imageBackground = new ImageBackground(previewPane.getImage());
ImageFileBackground imageBackground = new ImageFileBackground(previewPane.getImage(), suffix);
setImageStyle();
imageBackground.setLayout(imageStyle.getImageLayout());
return imageBackground;
}
@Override
public void addChangeListener(ChangeListener changeListener) {
this.changeListener = changeListener;
}
@ -224,6 +242,7 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
ChangeListener imageSizeChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent evt) {
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;
}
}

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

@ -1,11 +1,13 @@
package com.fr.design.style.background.impl;
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.general.Background;
import com.fr.general.Inter;
import com.fr.stable.Constants;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
@ -18,13 +20,14 @@ public class ImageButtonBackgroundPane extends ImageBackgroundPane {
private UIButton chooseButton;
private UIButton clearButton;
public ImageButtonBackgroundPane(){
public ImageButtonBackgroundPane() {
super();
Style imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER);
previewPane.setImageStyle(imageStyle);
}
public JPanel initSelectFilePane(){
@Override
public JPanel initSelectFilePane() {
JPanel choosePane = new JPanel(new BorderLayout(0, 10));
choosePane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
@ -33,12 +36,12 @@ public class ImageButtonBackgroundPane extends ImageBackgroundPane {
choosePane.add(chooseButton, BorderLayout.NORTH);
choosePane1.add(clearButton,BorderLayout.NORTH);
choosePane.add(choosePane1,BorderLayout.CENTER);
choosePane1.add(clearButton, BorderLayout.NORTH);
choosePane.add(choosePane1, BorderLayout.CENTER);
imageSizeLabel.setHorizontalAlignment(SwingConstants.CENTER);
choosePane1.add(imageSizeLabel,BorderLayout.CENTER);
this.add(choosePane,BorderLayout.EAST);
choosePane1.add(imageSizeLabel, BorderLayout.CENTER);
this.add(choosePane, BorderLayout.EAST);
return choosePane;
}
@ -48,32 +51,38 @@ public class ImageButtonBackgroundPane extends ImageBackgroundPane {
chooseButton.addActionListener(selectPictureActionListener);
clearButton = new UIButton(Inter.getLocText("FR-Designer_Background_Clear"));
clearButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
previewPane.setImage(null);
previewPane.repaint();
setSuffix(PictureCollection.DEFAULT_SUFFIX);
}
});
}
public void imageStyleRepaint(){
@Override
public void imageStyleRepaint() {
}
@Override
public void populate(Background background) {
if(background != null && background instanceof ImageBackground){
ImageBackground imageBackground = (ImageBackground) background;
if(imageBackground.getImage() != null) {
if (background instanceof ImageFileBackground) {
ImageFileBackground imageBackground = (ImageFileBackground) background;
setSuffix(imageBackground.getSuffix());
if (imageBackground.getImage() != null) {
previewPane.setImage(imageBackground.getImage());
}
}
}
@Override
public Background update() {
if(previewPane.getImage() == null) {
if (previewPane.getImage() == null) {
return null;
}
return new ImageBackground(previewPane.getImage());
return new ImageFileBackground(previewPane.getImage(), getSuffix());
}
}

24
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.TableDataConfig;
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.io.utils.ResourceIOUtils;
import com.fr.json.JSONArray;
@ -53,7 +58,8 @@ import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLableReader;
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.Transformer;
import javax.xml.transform.TransformerConfigurationException;
@ -61,14 +67,12 @@ import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.awt.*;
import java.awt.Component;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@ -84,7 +88,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
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 PWD_KEY = "javax.net.ssl.trustStorePassword";
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 user;
private String password;
@ -552,7 +555,7 @@ public class RemoteEnv extends AbstractEnv {
}
private void stopLogTimer() {
if(logTimer != null) {
if (logTimer != null) {
logTimer.cancel();
logTimer = null;
}
@ -2075,7 +2078,6 @@ public class RemoteEnv extends AbstractEnv {
}
@Override
public String pluginServiceAction(String serviceID, String req) throws Exception {
HashMap<String, String> para = new HashMap<String, String>();
@ -2090,11 +2092,13 @@ public class RemoteEnv extends AbstractEnv {
/**
* 远程不启动使用虚拟服务
*
* @param serviceID
*/
@Override
public void pluginServiceStart(String serviceID){
public void pluginServiceStart(String serviceID) {
}
@Override
public String[] loadREUFile() throws Exception {
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()) {
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 (FRContext.getCurrentEnv().isSupportLocalFileOperate()) { //本地连接
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过滤
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 改成三个字
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));
}
// richer:根据不同的文件类型显示不同的后缀名
// daniel 改成三个字保证兼容
if (ComparatorUtils.equals(suffix, ".frm") || ComparatorUtils.equals(suffix, ".form")) {
if (ComparatorUtils.equals(suffix, ".cpt")) {
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);
// daniel 改成三个字保证兼容
// 现在默认用的是".frm"
postfixComboBox.setSelectedIndex(suffixIndex("frm"));
} else if (ComparatorUtils.equals(suffix, ".xls")) {
@ -600,11 +605,11 @@ public class FILEChooserPane extends BasicPane {
postfixComboBox.setSelectedIndex(suffixIndex("png"));
}
//jerry 26216 只保留.cpt .frm有用的格式,并且不可编辑
if (type == JFileChooser.OPEN_DIALOG) {
postfixComboBox.setEnabled(true);
} else {
postfixComboBox.setEnabled(false);
}
// if (type == JFileChooser.OPEN_DIALOG) {
// postfixComboBox.setEnabled(true);
// } else {
// postfixComboBox.setEnabled(false);
// }
//只有一个类型时不可下拉
if (filterList.size() == 1) {
@ -659,9 +664,14 @@ public class FILEChooserPane extends BasicPane {
private void saveDialog() {
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);
}
}
returnValue = OK_OPTION;
FILE selectedFile = this.getSelectedFILE();
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.Parameter;
import com.fr.page.PageSetProvider;
import com.fr.design.actions.JWorkBookAction;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.iprogressbar.FRProgressBar;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.JWorkBook;
import com.fr.design.parameter.ParameterInputPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.file.FILE;
import com.fr.file.FILEChooserPane;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.general.FRLogger;
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.impl.WorkBook;
import com.fr.page.PageSetProvider;
import com.fr.report.ReportHelper;
import com.fr.report.core.ReportUtils;
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.ActorFactory;
import javax.swing.*;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import java.awt.event.ActionEvent;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.Map;
/**
@ -72,7 +79,7 @@ public abstract class AbstractExportAction extends JWorkBookAction {
}
// Choose a file name....
FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(false, true);
FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(true, true);
fileChooserPane.setFILEFilter(this.getChooseFileFilter());
// 打开文件后输出文件名修改,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 fileGetName = file.getName();
SwingWorker exportWorker = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
Thread.sleep(100); //bug 10516
try {
final FileOutputStream fileOutputStream = new FileOutputStream(filePath);
OutputStream outputStream = file.asOutputStream();
this.setProgress(10);
dealExporter(fileOutputStream, tpl, parameterMap);
dealExporter(outputStream, tpl, parameterMap);
this.setProgress(80);
fileOutputStream.close();
outputStream.flush();
outputStream.close();
this.setProgress(100);
FRContext.getLogger().info("\"" + fileGetName + "\"" + Inter.getLocText("FR-Designer_Finish_Export") + "!");
@ -127,6 +137,7 @@ public abstract class AbstractExportAction extends JWorkBookAction {
return null;
}
@Override
public void done() {
progressbar.close();
}
@ -134,7 +145,7 @@ public abstract class AbstractExportAction extends JWorkBookAction {
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();
if (exporter instanceof AppExporter) {
AppExporter appExporter = (AppExporter) exporter;
@ -142,18 +153,18 @@ public abstract class AbstractExportAction extends JWorkBookAction {
|| exporter instanceof PDFExporterProcessor || exporter instanceof WordExporter) {
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 {
ReportHelper.clearFormulaResult(tpl);// 清空currentReport中的公式计算结果
PageSetProvider pageSet = tpl.execute(parameterMap, ActorFactory.getActor(ActorConstants.TYPE_PAGE)).generateReportPageSet(
ReportUtils.getPaperSettingListFromWorkBook(tpl)).traverse4Export();
appExporter.export(fileOutputStream, pageSet);
appExporter.export(outputStream, pageSet);
pageSet.release();
}
} 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.general.Inter;
import javax.swing.*;
import javax.swing.Icon;
import javax.swing.KeyStroke;
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 {
@ -50,7 +47,7 @@ public class NewWorkBookAction extends UpdateAction {
@Override
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.DynamicUnitList;
import com.fr.base.ScreenResolution;
import com.fr.design.actions.ElementCaseAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.report.SelectImagePane;
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.cellattr.CellImage;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.unit.FU;
import javax.swing.*;
import java.awt.*;
import javax.swing.KeyStroke;
import java.awt.Image;
import java.io.File;
/**
@ -65,6 +64,7 @@ public class ImageFloatAction extends ElementCaseAction {
*
* @return 成功返回true
*/
@Override
public boolean executeActionReturnUndoRecordNeeded() {
final ElementCasePane reportPane = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
if (reportPane == null) {
@ -86,11 +86,11 @@ public class ImageFloatAction extends ElementCaseAction {
File selectedFile = selectImagePane.getSelectedImage();
if (selectedFile != null && selectedFile.isFile()) {
Image image = BaseUtils.readImage(selectedFile.getPath());
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();
int resolution = grid.getResolution();
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;
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.mainframe.ElementCasePane;
import com.fr.design.report.SelectImagePane;
import com.fr.grid.Grid;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.painter.CellImagePainter;
import com.fr.report.elementcase.TemplateElementCase;
import javax.swing.SwingUtilities;
import java.awt.Component;
import java.awt.Image;
/**
* CellEditor used to edit Image object.
*/
@ -59,7 +59,7 @@ public class ImageCellEditor extends AbstractCellEditor implements DialogActionL
if (cellElement != null) {
value = cellElement.getValue();
}
if (value == null || !(value instanceof Image)) {
if (!(value instanceof Image || value instanceof CellImagePainter)) {
value = null;
}

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

@ -3,15 +3,15 @@
*/
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.report.SelectImagePane;
import com.fr.grid.Grid;
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.
@ -54,7 +54,7 @@ public class ImageFloatEditor extends AbstractFloatEditor implements DialogActio
public Component getFloatEditorComponent(Grid grid, FloatElement floatElement, int resolution) {
//populate data to UI
Object value = floatElement.getValue();
if (value == null || !(value instanceof Image)) {
if (!(value instanceof Image || value instanceof CellImagePainter)) {
value = null;
}

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

@ -3,7 +3,13 @@
*/
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.DesignerEnvManager;
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.cell.BorderAction;
import com.fr.design.actions.cell.CleanAuthorityAction;
import com.fr.design.actions.cell.style.*;
import com.fr.design.actions.columnrow.*;
import com.fr.design.actions.cell.style.AlignmentAction;
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.edit.CopyAction;
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.ElementsTransferable;
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.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.designer.EditingState;
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.imenu.UIPopupMenu;
import com.fr.design.mainframe.cell.QuickEditorRegion;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.*;
import com.fr.design.menu.KeySetUtils;
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.Selectedable;
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.FRLogger;
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.selection.CellSelection;
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.group.DSColumn;
import com.fr.report.cell.painter.BiasTextPainter;
import com.fr.report.cell.painter.CellImagePainter;
import com.fr.report.core.SheetUtils;
import com.fr.report.elementcase.ElementCase;
import com.fr.report.elementcase.TemplateElementCase;
@ -65,12 +110,27 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.ColumnRow;
import com.fr.stable.unit.FU;
import javax.swing.*;
import java.awt.*;
import javax.swing.AbstractAction;
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.DataFlavor;
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.util.Set;
@ -327,6 +387,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
grid.setDefaultCellEditor(BiasTextPainter.class, new BiasTextPainterCellEditor(this));
grid.setDefaultCellEditor(Image.class, new ImageCellEditor(this));
grid.setDefaultCellEditor(CellImagePainter.class, new ImageCellEditor(this));
grid.setDefaultCellEditor(SubReport.class, new SubReportCellEditor(this));
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(Image.class, new ImageFloatEditor());
grid.setDefaultFloatEditor(CellImagePainter.class, new ImageFloatEditor());
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager();
grid.setGridLineColor(designerEnvManager.getGridLineColor());
@ -1262,10 +1324,6 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
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
*
*/
@Override
public SheetNameTabPane createSheetNameTabPane(ReportComponentComposite 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.main.TemplateWorkBook;
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.poly.PolyDesigner;
import com.fr.poly.creator.BlockCreator;
import com.fr.privilege.finegrain.WorkSheetPrivilegeControl;
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.poly.PolyWorkSheet;
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_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 double MIN_TIME = 0.4;
@ -94,7 +102,12 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
private int resolution = ScreenResolution.getScreenResolution();
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();
}
@ -166,6 +179,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
return centerPane;
}
@Override
public TemplateProcessInfo getProcessInfo() {
if (processInfo == null) {
processInfo = new JWorkBookProcessInfo(template);
@ -188,6 +202,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*
* @param rolsName 角色
*/
@Override
public void judgeSheetAuthority(String rolsName) {
boolean isCovered = reportComposite.getEditingTemplateReport().getWorkSheetPrivilegeControl().checkInvisible(rolsName);
centerPane.setSheeetCovered(isCovered);
@ -197,6 +212,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/**
* 在编辑的面板是被参考的面板时取消格式刷
*/
@Override
public void doConditionCancelFormat() {
if (ComparatorUtils.equals(reportComposite.centerCardPane.editingComponet.elementCasePane, DesignerContext.getReferencedElementCasePane())) {
cancelFormat();
@ -207,6 +223,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/**
* 无条件取消格式刷
*/
@Override
public void cancelFormat() {
DesignerContext.setFormatState(DesignerContext.FORMAT_STATE_NULL);
reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().setCursor(UIConstants.CELL_DEFAULT_CURSOR);
@ -217,6 +234,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
this.repaint();
}
@Override
public int getEditingReportIndex() {
return reportComposite.getEditingIndex();
}
@ -226,6 +244,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*
* @return 返回权限细粒度面板
*/
@Override
public AuthorityEditPane createAuthorityEditPane() {
if (centerPane.isUpEditMode()) {
return parameterPane.getParaDesigner().getAuthorityEditPane();
@ -241,6 +260,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
}
@Override
public ToolBarMenuDockPlus getToolBarMenuDockPlus() {
if (this.getEditingElementCasePane() == null) {
return JWorkBook.this;
@ -274,6 +294,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
reportComposite.setComponents();
}
@Override
public JPanel getEastUpPane() {
if (BaseUtils.isAuthorityEditing()) {
return allowAuthorityUpPane();
@ -318,6 +339,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
return new JPanel();
}
@Override
public JPanel getEastDownPane() {
if (centerPane.isUpEditMode()) {
return parameterPane.getParaDesigner().getEastDownPane();
@ -340,10 +362,12 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/**
* 移除选择
*/
@Override
public void removeTemplateSelection() {
this.reportComposite.removeSelection();
}
@Override
public void setSheetCovered(boolean isCovered) {
centerPane.setSheeetCovered(isCovered);
}
@ -351,6 +375,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/**
* 刷新容器
*/
@Override
public void refreshContainer() {
centerPane.refreshContainer();
}
@ -358,6 +383,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/**
* 移除参数面板选择
*/
@Override
public void removeParameterPaneSelection() {
parameterPane.getParaDesigner().removeSelection();
}
@ -456,6 +482,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
return this.resolution;
}
@Override
public int getToolBarHeight() {
return TOOLBARPANEDIMHEIGHT;
}
@ -516,6 +543,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/**
* 复制
*/
@Override
public void copy() {
this.delegate4ToolbarMenuAdapter().copy();
}
@ -525,6 +553,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*
* @return 剪切成功返回true
*/
@Override
public boolean cut() {
return this.delegate4ToolbarMenuAdapter().cut();
}
@ -534,6 +563,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*
* @return 黏贴成功返回true
*/
@Override
public boolean paste() {
return this.delegate4ToolbarMenuAdapter().paste();
}
@ -541,6 +571,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/**
* 停止编辑
*/
@Override
public void stopEditing() {
reportComposite.stopEditing();
if (!this.isSaved()) {
@ -550,12 +581,23 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
}
/**
* 后缀
* 保存文件的后缀
*
* @return 后缀的字符串
*/
@Override
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 子菜单
*/
@Override
public ShortCut[] shortcut4FileMenu() {
return (ShortCut[]) ArrayUtils.addAll(
super.shortcut4FileMenu(),
@ -580,12 +623,14 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*
* @return 菜单
*/
@Override
public MenuDef[] menus4Target() {
return (MenuDef[]) ArrayUtils.addAll(
super.menus4Target(), this.delegate4ToolbarMenuAdapter().menus4Target()
);
}
@Override
public int getMenuState() {
return this.delegate4ToolbarMenuAdapter().getMenuState();
}
@ -610,6 +655,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*
* @return 子菜单
*/
@Override
public ShortCut[] shortCuts4Authority() {
return new ShortCut[]{
new NameSeparator(Inter.getLocText("FR-Designer_Permissions_Edition")),
@ -623,6 +669,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*
* @return 子菜单
*/
@Override
public ShortCut[] shortcut4TemplateMenu() {
return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{
new ReportWebAttrAction(this),
@ -638,6 +685,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*
* @return 工具
*/
@Override
public ToolBarDef[] toolbars4Target() {
return this.delegate4ToolbarMenuAdapter().toolbars4Target();
}
@ -699,6 +747,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/**
* 请求焦点
*/
@Override
public void requestFocus() {
super.requestFocus();
ReportComponent reportComponent = reportComposite.getEditingReportComponent();
@ -745,6 +794,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/**
* 恢复
*/
@Override
public void revert() {
ElementCasePane epane = reportComposite.getEditingReportComponent().elementCasePane;
if (epane == null) {
@ -773,6 +823,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*
* @return 表单工具栏
*/
@Override
public JPanel[] toolbarPanes4Form() {
if (centerPane.isUpEditMode() && hasParameterPane()) {
return parameterPane.toolbarPanes4Form();
@ -785,6 +836,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*
* @return 工具按钮
*/
@Override
public JComponent[] toolBarButton4Form() {
centerPane.needToShowCoverAndHidPane();
if (centerPane.isUpEditMode() && hasParameterPane()) {
@ -799,6 +851,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*
* @return 工具面板
*/
@Override
public JComponent toolBar4Authority() {
return new AuthorityToolBarPane();
}
@ -808,6 +861,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*
* @return 预览接口
*/
@Override
public PreviewProvider[] supportPreview() {
Set<PreviewProvider> set = ExtraDesignClassManager.getInstance().getArray(PreviewProvider.MARK_STRING);
return ArrayUtils.addAll(new PreviewProvider[]{
@ -820,6 +874,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*
* @return 预览菜单项
*/
@Override
public UIMenuItem[] createMenuItem4Preview() {
List<UIMenuItem> menuItems = new ArrayList<UIMenuItem>();
PreviewProvider[] previewProviders = supportPreview();
@ -841,6 +896,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*
* @param provider 预览接口
*/
@Override
public void previewMenuActionPerformed(PreviewProvider provider) {
setPreviewType(provider);
WebPreviewUtils.actionPerformed(this, provider.parametersForPreview(), ParameterConstants.REPORTLET);
@ -851,6 +907,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*
* @return 是则返回true
*/
@Override
public boolean isJWorkBook() {
return true;
}
@ -865,6 +922,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
return ReportHyperlinkGroupPaneNoPop.getInstance(hyperlinkGroupPaneActionProvider);
}
@Override
public void setAuthorityMode(boolean isUpMode) {
centerPane.setAuthorityMode(isUpMode);
}
@ -874,6 +932,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*
* @return 是则返回true
*/
@Override
public boolean isUpMode() {
return centerPane.isUpEditMode();
}
@ -881,6 +940,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/**
* 刷新参数和工具区域
*/
@Override
public void refreshToolArea() {
populateReportParameterAttr();
if (centerPane.isUpEditMode()) {
@ -933,6 +993,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*
* @return
*/
@Override
public Parameter[] getParameters() {
Parameter[] ps = this.parameterPane.getParameterArray();
Parameter[] curPs = this.parameterPane.getAllParameters();
@ -949,6 +1010,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/**
* 请求单元格区域的焦点
*/
@Override
public void requestGridFocus() {
reportComposite.centerCardPane.requestGrifFocus();
}
@ -960,6 +1022,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* @return 内置sql提交的pane
* @date 2014-10-14-下午7:39:27
*/
@Override
public DBManipulationPane createDBManipulationPane() {
ElementCasePane<TemplateElementCase> epane = this.getEditingElementCasePane();
return new SmartInsertDBManipulationPane(epane);
@ -971,11 +1034,13 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* @return 内置sql提交的pane
* @date 2014-10-14-下午7:39:27
*/
@Override
public DBManipulationPane createDBManipulationPaneInWidget() {
ElementCasePane<TemplateElementCase> epane = this.getEditingElementCasePane();
return new SmartInsertDBManipulationInWidgetEventPane(epane);
}
@Override
public Icon getIcon() {
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/newcpts.png");
}
@ -996,6 +1061,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*
* @return 是否另存成功
*/
@Override
public boolean saveShareFile() {
FILE newFile = createNewEmptyFile();
//如果文件已经打开, 那么就覆盖关闭掉他
@ -1057,6 +1123,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*
* @return 分享模板按钮
*/
@Override
public UIButton[] createShareButton() {
return new UIButton[0];
//产品想要重新设计下, 1现在的分享多列数据集很麻烦, 2想做成自动上传附件.

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

@ -3,8 +3,6 @@
*/
package com.fr.design.mainframe;
import javax.swing.JScrollBar;
import com.fr.base.BaseUtils;
import com.fr.design.actions.AllowAuthorityEditAction;
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.ReportPageSetupAction;
import com.fr.design.designer.TargetComponent;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.NameSeparator;
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.Selectedable;
import com.fr.general.Inter;
import com.fr.report.report.TemplateReport;
import javax.swing.JScrollBar;
/**
* @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;
import java.awt.BorderLayout;
import javax.swing.*;
import com.fr.base.ScreenResolution;
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.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane;
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.Selection;
import com.fr.report.cell.CellElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.worksheet.WorkSheet;
import com.fr.design.selection.SelectionListener;
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> {
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;
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.FRContext;
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.TargetModifiedListener;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.*;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.mainframe.AuthorityEditPane;
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.NameSeparator;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
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.general.Inter;
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.worksheet.FormElementCase;
import com.fr.report.worksheet.WorkSheet;
import com.fr.design.selection.SelectableElement;
import com.fr.design.selection.Selectedable;
import com.fr.design.selection.SelectionListener;
import javax.swing.JComponent;
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编辑面板
*/
public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extends ElementCasePane, S extends SelectableElement> extends TargetComponent<T> implements Selectedable<S>, FormECDesignerProvider{
protected FormElementCasePaneDelegate elementCasePane;
@Override
public FormElementCasePaneDelegate getEditingElementCasePane() {
return elementCasePane;
}
@ -74,6 +78,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
this.elementCasePane.setTarget((FormElementCase) t);
}
@Override
public int getMenuState() {
return DesignState.WORK_SHEET;
}
@ -83,6 +88,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
*
* @return 子菜单
*/
@Override
public ShortCut[] shortCuts4Authority() {
return new ShortCut[]{
new NameSeparator(Inter.getLocText(new String[]{"DashBoard-Potence", "Edit"})),
@ -96,6 +102,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
*
* @return 返回权限细粒度面板
*/
@Override
public AuthorityEditPane createAuthorityEditPane() {
ElementCasePaneAuthorityEditPane elementCasePaneAuthorityEditPane = new ElementCasePaneAuthorityEditPane(elementCasePane);
elementCasePaneAuthorityEditPane.populateDetials();
@ -107,6 +114,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
*
* @param size 缩略图的大小
*/
@Override
public BufferedImage getElementCaseImage(Dimension size){
BufferedImage image = null;
try{
@ -134,6 +142,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
*
* @return 返回正在编辑的状态.
*/
@Override
public EditingState createEditingState() {
return this.elementCasePane.createEditingState();
}
@ -145,6 +154,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
/**
* 复制
*/
@Override
public void copy() {
this.elementCasePane.copy();
}
@ -153,6 +163,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
* 粘贴
* @return 粘贴成功则返回true
*/
@Override
public boolean paste() {
return this.elementCasePane.paste();
}
@ -161,6 +172,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
* 剪切
* @return 粘贴成功则返回true
*/
@Override
public boolean cut() {
return this.elementCasePane.cut();
}
@ -168,6 +180,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
/**
* 停止编辑
*/
@Override
public void stopEditing() {
this.elementCasePane.stopEditing();
}
@ -177,6 +190,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
*
* @return 工具
*/
@Override
public ToolBarDef[] toolbars4Target() {
return this.elementCasePane.toolbars4Target();
}
@ -186,6 +200,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
*
* @return 工具按钮
*/
@Override
public JComponent[] toolBarButton4Form() {
return this.elementCasePane.toolBarButton4Form();
}
@ -195,6 +210,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
*
* @return 菜单
*/
@Override
public MenuDef[] menus4Target() {
return this.elementCasePane.menus4Target();
}
@ -202,6 +218,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
/**
* 获取焦点
*/
@Override
public void requestFocus() {
super.requestFocus();
elementCasePane.requestFocus();
@ -215,29 +232,35 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
return elementCasePane.getVerticalScrollBar();
}
@Override
public JPanel getEastUpPane() {
return elementCasePane.getEastUpPane();
}
@Override
public JPanel getEastDownPane() {
return elementCasePane.getEastDownPane();
}
@Override
public JPanel getConditionAttrPane() {
ConditionAttributesGroupPane conditionAttributesGroupPane = ConditionAttributesGroupPane.getInstance();
conditionAttributesGroupPane.populate(elementCasePane);
return conditionAttributesGroupPane;
}
@Override
public JPanel getHyperlinkPane(JTemplate jt) {
return jt.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
}
@Override
public S getSelection() {
return (S) elementCasePane.getSelection();
}
@Override
public void setSelection(S selectElement) {
if (selectElement == null) {
selectElement = (S) new CellSelection();
@ -267,6 +290,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
*
* @param selectionListener 选中的listener
*/
@Override
public void addSelectionChangeListener(SelectionListener selectionListener) {
elementCasePane.addSelectionChangeListener(selectionListener);
}
@ -276,19 +300,16 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
*
* @param selectionListener 选中的listener
*/
@Override
public void removeSelectionChangeListener(SelectionListener selectionListener) {
elementCasePane.removeSelectionChangeListener(selectionListener);
}
@Override
public ToolBarMenuDockPlus getToolBarMenuDockPlus() {
return new JWorkBook();
}
/**
* 无条件取消格式刷
*/
@Override
public void cancelFormat() {
return;
}
@ -302,10 +323,12 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
*
* @return 子菜单
*/
@Override
public ShortCut[] shortcut4TemplateMenu() {
return new ShortCut[0];
}
@Override
public FormElementCaseProvider getEditingElementCase(){
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.Style;
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.process.ProcessOperator;
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.utils.ResourceIOUtils;
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.CellDSColumnEditor;
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.group.DSColumn;
import com.fr.report.cell.painter.BiasTextPainter;
import com.fr.report.cell.painter.CellImagePainter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
@ -92,6 +97,7 @@ import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Set;
@ -101,6 +107,7 @@ public class DesignerModule extends DesignModule {
static {
ServletContext.addServletContextListener(new ServletContextAdapter() {
@Override
public void onServletStart() {
ModuleContext.startModule(DesignerModule.class.getName());
}
@ -110,6 +117,7 @@ public class DesignerModule extends DesignModule {
/**
* 启动设计器模块
*/
@Override
public void start() {
super.start();
@ -150,6 +158,7 @@ public class DesignerModule extends DesignModule {
ActionFactory.registerCellEditorClass(Image.class, CellImageQuickEditor.class);
ActionFactory.registerCellEditorClass(BiasTextPainter.class, CellBiasTextPainterEditor.class);
ActionFactory.registerCellEditorClass(BufferedImage.class, CellImageQuickEditor.class);
ActionFactory.registerCellEditor(CellImagePainter.class, new CellImageQuickEditor());
ActionFactory.registerChartCellEditorInEditor(BasicChartQuickEditor.class);
@ -164,6 +173,7 @@ public class DesignerModule extends DesignModule {
}
@Override
public String getInterNationalName() {
return Inter.getLocText("FR-Module_Designer");
}
@ -178,6 +188,7 @@ public class DesignerModule extends DesignModule {
ActionFactory.registerFloatEditorClass(Formula.class, FloatStringQuickEditor.class);
ActionFactory.registerFloatEditorClass(Image.class, FloatImageQuickEditor.class);
ActionFactory.registerFloatEditorClass(BufferedImage.class, FloatImageQuickEditor.class);
ActionFactory.registerFloatEditor(CellImagePainter.class, new FloatImageQuickEditor());
ActionFactory.registerChartFloatEditorInEditor(FloatChartQuickEditor.class);
}
@ -200,6 +211,7 @@ public class DesignerModule extends DesignModule {
*
* @return 返回处理格子值的转换器
*/
@Override
public ValueConverter valueConverter() {
return new CellElementValueConverter();
}
@ -243,6 +255,7 @@ public class DesignerModule extends DesignModule {
return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getParas(book);
}
@Override
protected MultiFieldParameter[] getAllMultiFieldParas(String book) {
return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getAllMultiFieldParas(book);
}
@ -283,7 +296,7 @@ public class DesignerModule extends DesignModule {
* @return 可以打开的模板类型的数组
*/
public App[] apps4TemplateOpener() {
return new App[]{getCptApp(), getXlsApp(), getXlsxApp()};
return new App[]{getCptxApp(), getCptApp(), getXlsApp(), getXlsxApp()};
}
private AbstractWorkBookApp getXlsxApp() {
@ -328,10 +341,12 @@ public class DesignerModule extends DesignModule {
private AbstractWorkBookApp getCptApp() {
return new AbstractWorkBookApp() {
@Override
public String[] defaultExtentions() {
return new String[]{"cpt"};
}
@Override
public WorkBook asIOFile(FILE file) {
if (XMLEncryptUtils.isCptEncoded() &&
!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) {
Iterator it = namestyle.getIterator();
ArrayList<String> al = new ArrayList<String>();
@ -391,6 +437,7 @@ public class DesignerModule extends DesignModule {
// ”是“按钮,点击之后将生成一个全局样式,并写入xml
UIButton confirmButton = new UIButton(Inter.getLocText("FR-Designer_Yes"));
confirmButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
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"));
noButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
jd.dispose();
}
@ -419,6 +467,7 @@ public class DesignerModule extends DesignModule {
jd.setVisible(true);
}
@Override
public Class<?>[] actionsForInsertCellElement() {
return (Class<?>[]) ArrayUtils.addAll(new Class<?>[]{
DSColumnCellAction.class,
@ -432,6 +481,7 @@ public class DesignerModule extends DesignModule {
}, super.actionsForInsertCellElement());
}
@Override
public Class<?>[] actionsForInsertFloatElement() {
return (Class<?>[]) ArrayUtils.addAll(new Class<?>[]{
TextBoxFloatAction.class,

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

@ -1,39 +1,39 @@
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.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.UIRadioButton;
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.report.cell.Elem;
import com.fr.report.cell.cellattr.CellImage;
import com.fr.report.cell.painter.CellImagePainter;
import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper;
import com.fr.design.style.background.image.ImageFileChooser;
import com.fr.design.style.background.image.ImagePreviewPane;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.BorderFactory;
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 ImageFileChooser imageFileChooser = null;
@ -43,8 +43,14 @@ public class SelectImagePane extends BasicPane{
private UIRadioButton adjustRadioButton = null;
private Style imageStyle = null;
private Image previewImage = null;
/**
* 默认格式
*/
private String suffix = PictureCollection.DEFAULT_SUFFIX;
private File imageFile;
public SelectImagePane() {
@ -57,7 +63,7 @@ public class SelectImagePane extends BasicPane{
JPanel previewOwnerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
previewContainerPane.add(previewOwnerPane, BorderLayout.CENTER);
previewOwnerPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Preview"),null));
previewOwnerPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Preview"), null));
previewPane = new ImagePreviewPane();
previewOwnerPane.add(new JScrollPane(previewPane));
@ -73,7 +79,7 @@ public class SelectImagePane extends BasicPane{
selectPictureButton.setMnemonic('S');
selectPictureButton.addActionListener(selectPictureActionListener);
JPanel layoutPane=FRGUIPaneFactory.createMediumHGapHighTopFlowInnerContainer_M_Pane();
JPanel layoutPane = FRGUIPaneFactory.createMediumHGapHighTopFlowInnerContainer_M_Pane();
selectFilePane.add(layoutPane, BorderLayout.CENTER);
//布局
@ -111,6 +117,8 @@ public class SelectImagePane extends BasicPane{
* Select picture.
*/
ActionListener selectPictureActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
int returnVal = imageFileChooser
.showOpenDialog(SelectImagePane.this);
@ -118,7 +126,9 @@ public class SelectImagePane extends BasicPane{
File selectedFile = imageFileChooser.getSelectedFile();
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);
imageFile = selectedFile;
@ -140,20 +150,21 @@ public class SelectImagePane extends BasicPane{
previewPane.repaint();
}
private void setImageStyle(){
if(tiledRadioButton.isSelected()){
private void setImageStyle() {
if (tiledRadioButton.isSelected()) {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_TILED);
}else if(adjustRadioButton.isSelected()){
} else if (adjustRadioButton.isSelected()) {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_ADJUST);
}else if(extendRadioButton.isSelected()){
} else if (extendRadioButton.isSelected()) {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_EXTEND);
}else{
} else {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER);
}
}
ActionListener layoutActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
setImageStyle();
changeImageStyle();
@ -169,22 +180,26 @@ public class SelectImagePane extends BasicPane{
Style style = null;
if (cell != null) {
Object value = cell.getValue();
if (value != null && value instanceof Image) {
Image image = (Image)value;
previewPane.setImage(image);
this.previewImage = image;
if (value instanceof Image) {
setImage((Image) value);
} else if (value instanceof CellImagePainter) {
setImage(((CellImagePainter) value).getImage());
suffix = ((CellImagePainter) value).getSuffix();
}
style = cell.getStyle();
}
if (style == null) {
return;
}
if(style.getImageLayout() == Constants.IMAGE_TILED){
if (style.getImageLayout() == Constants.IMAGE_TILED) {
tiledRadioButton.setSelected(true);
}else if(style.getImageLayout() == Constants.IMAGE_EXTEND){
} else if (style.getImageLayout() == Constants.IMAGE_EXTEND) {
extendRadioButton.setSelected(true);
}else if(style.getImageLayout() == Constants.IMAGE_ADJUST){
} else if (style.getImageLayout() == Constants.IMAGE_ADJUST) {
adjustRadioButton.setSelected(true);
}else{
} else {
style.deriveImageLayout(Constants.IMAGE_CENTER);
defaultRadioButton.setSelected(true);
}
@ -192,14 +207,22 @@ public class SelectImagePane extends BasicPane{
changeImageStyle();
}
public CellImage update(){
public void setImage(Image image) {
previewPane.setImage(image);
this.previewImage = image;
}
public CellImage update() {
CellImage cellImage = new CellImage();
cellImage.setImage(previewPane.getImage());
cellImage.setStyle(this.imageStyle);
if (suffix != null) {
cellImage.setSuffix(suffix);
}
return cellImage;
}
public File getSelectedImage(){
public File getSelectedImage() {
return imageFile;
}
}

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

@ -1,23 +1,13 @@
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.design.gui.ilable.UILabel;
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.base.background.ImageFileBackground;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
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.TableLayoutHelper;
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.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 {
protected AccessibleBackgroundEditor initBackgroundPane;
protected AccessibleBackgroundEditor overBackgroundPane;
@ -124,8 +124,8 @@ public class ButtonSytleDefinedPane extends BasicPane {
public void populate(Background background) {
this.background = background;
if (background instanceof ImageBackground && ((ImageBackground) background).getImage() != null) {
ImagePreviewPane.setIcon(new ImageIcon(((ImageBackground) background).getImage()));
if (background instanceof ImageFileBackground && ((ImageFileBackground) background).getImage() != null) {
ImagePreviewPane.setIcon(new ImageIcon(((ImageFileBackground) background).getImage()));
} else if(background instanceof ColorBackground && ((ColorBackground) background).getColor() != null){
ImagePreviewPane.setIcon(null);
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.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.file.HistoryTemplateListPane;
import com.fr.design.fun.GridUIProcessor;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.grid.event.CellEditorEvent;
@ -32,7 +39,13 @@ import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.StringUtils;
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.geom.Point2D;
import java.util.Hashtable;
@ -148,6 +161,7 @@ public class Grid extends BaseGridComponent {
*
* @date 2014-12-21-下午6:32:43
*/
@Override
public void updateUI() {
GridUIProcessor localGridUIProcessor = ExtraDesignClassManager.getInstance().getSingle(GridUIProcessor.MARK_STRING, new DefaultGridUIProcessor());
ComponentUI localComponentUI = localGridUIProcessor.appearanceForGrid(this.resolution);
@ -964,11 +978,15 @@ public class Grid extends BaseGridComponent {
if (newValue instanceof CellImage) {
CellImage cellImage = (CellImage) newValue;
newValue = cellImage.getImage();
JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
currentEditingTemplate.setPictureElem(selectedFloatElement, cellImage);
if (cellImage.getStyle() != null) {
selectedFloatElement.setStyle(cellImage.getStyle());
}
}
} else {
selectedFloatElement.setValue(newValue);
}
reportPane.fireTargetModified();
//加这句话是为了在编辑完悬浮元素公式的时候,点击确定,右上角面板会立即刷新
reportPane.getCurrentEditor();
@ -1069,7 +1087,8 @@ public class Grid extends BaseGridComponent {
Object oldValue = this.editingCellElement.getValue();
boolean imageChange = false;
if (!ComparatorUtils.equals_exactly(oldValue, newValue)) {
editingCellElement.setValue(newValue);
JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
currentEditingTemplate.setPictureElem(editingCellElement, cellImage);
imageChange = true;
}
if (styleChange || imageChange) {
@ -1283,6 +1302,7 @@ public class Grid extends BaseGridComponent {
* @param event
* @return
*/
@Override
public Point getToolTipLocation(MouseEvent event) {
if (StringUtils.isEmpty(this.getToolTipText())) {
return null;
@ -1363,6 +1383,7 @@ public class Grid extends BaseGridComponent {
/**
* This tells the listeners the editor has stopped editing
*/
@Override
public void editingStopped(CellEditorEvent evt) {
Grid.this.stopCellEditingInner(false);
// if(Grid.this.)
@ -1371,6 +1392,7 @@ public class Grid extends BaseGridComponent {
/**
* This tells the listeners the editor has canceled editing
*/
@Override
public void editingCanceled(CellEditorEvent evt) {
Grid.this.cancelEditing();
}
@ -1381,6 +1403,7 @@ public class Grid extends BaseGridComponent {
/**
* This tells the listeners the editor has stopped editing
*/
@Override
public void editingStopped(FloatEditorEvent evt) {
Grid.this.stopFloatEditingInner(false);
}
@ -1388,6 +1411,7 @@ public class Grid extends BaseGridComponent {
/**
* This tells the listeners the editor has canceled editing
*/
@Override
public void editingCanceled(FloatEditorEvent evt) {
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.Utils;
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.file.HistoryTemplateListPane;
import com.fr.design.mainframe.DesignerContext;
@ -152,7 +152,7 @@ public class GridUI extends ComponentUI {
if (background != null) {
// 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);
}
@ -172,12 +172,12 @@ public class GridUI extends ComponentUI {
private void paintScrollBackground(Graphics2D g2d, Grid grid, Background background, PaperSettingProvider psetting, ReportSettingsProvider reportSettings) {
boolean isCanDrawImage = grid.isEditable() || isAuthority;
if (isCanDrawImage && (background instanceof ImageBackground)) {
if (isCanDrawImage && (background instanceof ImageFileBackground)) {
if (!grid.isShowPaginateLine()) {
calculatePaper(psetting, reportSettings);
}
ImageBackground imageBackground = (ImageBackground) background;
ImageFileBackground imageBackground = (ImageFileBackground) background;
int hideWidth = columnWidthList.getRangeValue(0, horizontalValue)
.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.insert.cell.ImageCellAction;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListPane;
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.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.report.SelectImagePane;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
@ -19,7 +20,6 @@ import javax.swing.JComponent;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
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)) {
cellElement.setValue(cellImage.getImage());
cellElement.setStyle(cellImage.getStyle());
JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
currentEditingTemplate.setPictureElem(cellElement, cellImage);
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.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.report.SelectImagePane;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
@ -59,8 +61,9 @@ public class FloatImageQuickEditor extends FloatQuickEditor {
public void doOk() {
CellImage cellImage = imageEditorPane.update();
if (!ComparatorUtils.equals(cellImage.getImage(), oldValue) || !ComparatorUtils.equals(cellImage.getStyle(), oldStyle)) {
floatElement.setValue(cellImage.getImage());
floatElement.setStyle(cellImage.getStyle());
JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
currentEditingTemplate.setPictureElem(floatElement, cellImage);
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.newReport.NewPolyReportAction;
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.StyleListAction;
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.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.main.impl.WorkBookX;
import com.fr.module.Module;
import com.fr.module.ModuleContext;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLTools;
import com.fr.start.module.StartupArgs;
import javax.swing.*;
import javax.swing.JComponent;
import javax.swing.JPanel;
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.ActionListener;
import java.io.File;
@ -61,21 +68,19 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public class Designer extends BaseDesigner {
private static final int TOOLBARPANEVGAP = -4;
private static final int PREVIEW_DOWN_X_GAP = 92;
private static final int GAP = 7;
private static final String OLD_ENV_FOLDER_71 = ".FineReport71";
private static final String OLD_ENV_FOLDER_70 = ".FineReport70";
private UserInfoPane userInfoPane;
private UIButton saveButton;
private UIButton undo;
private UIButton redo;
private UIPreviewButton run;
/**
* 设计器启动的Main方法
*
@ -100,13 +105,16 @@ public class Designer extends BaseDesigner {
return DesignerModule.class.getName();
}
@Override
/**
* 创建新建文件的快捷方式数组
*
* @return 返回快捷方式的数组
*/
@Override
public ShortCut[] createNewFileShortCuts() {
ArrayList<ShortCut> shortCuts = new ArrayList<ShortCut>();
shortCuts.add(new NewWorkBookXAction());
shortCuts.add(new NewWorkBookAction());
shortCuts.add(new NewPolyReportAction());
try {
@ -146,11 +154,13 @@ public class Designer extends BaseDesigner {
return menuDef;
}
@Override
/**
* 创建设计器上几个比较大的图标新建cpt保存前进后退运行
*
* @return 返回大图标对应的工具栏
*/
@Override
public UILargeToolbar createLargeToolbar() {
UILargeToolbar largeToolbar = super.createLargeToolbar();
largeToolbar.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 4));
@ -348,13 +358,14 @@ public class Designer extends BaseDesigner {
}
@Override
/**
* 生成报表设计和表单设计的编辑区域
*
* @return 返回编辑区域
*/
@Override
public JTemplate<?, ?> createNewTemplate() {
return new JWorkBook();
return new JWorkBook(new WorkBookX(new WorkSheet()));
}
/**

Loading…
Cancel
Save