Browse Source

REPORT-5208 设计器部分

master
vito 7 years ago
parent
commit
41b508d6c6
  1. 4
      designer-base/src/com/fr/design/DesignModelAdapter.java
  2. 251
      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. 127
      designer-base/src/com/fr/design/mainframe/JTemplate.java
  6. 16
      designer-base/src/com/fr/design/mainframe/JVirtualTemplate.java
  7. 273
      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. 299
      designer-base/src/com/fr/design/style/background/BackgroundUIComboBoxPane.java
  13. 154
      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. 54
      designer-base/src/com/fr/env/RemoteEnv.java
  17. 30
      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. 38
      designer-realize/src/com/fr/design/cell/editor/ImageCellEditor.java
  23. 34
      designer-realize/src/com/fr/design/cell/editor/ImageFloatEditor.java
  24. 86
      designer-realize/src/com/fr/design/mainframe/ElementCasePane.java
  25. 49
      designer-realize/src/com/fr/design/mainframe/JPolyWorkBook.java
  26. 73
      designer-realize/src/com/fr/design/mainframe/JWorkBook.java
  27. 107
      designer-realize/src/com/fr/design/mainframe/ReportComponent.java
  28. 23
      designer-realize/src/com/fr/design/mainframe/WorkSheetDesigner.java
  29. 161
      designer-realize/src/com/fr/design/mainframe/form/FormElementCaseDesigner.java
  30. 52
      designer-realize/src/com/fr/design/module/DesignerModule.java
  31. 177
      designer-realize/src/com/fr/design/report/SelectImagePane.java
  32. 256
      designer-realize/src/com/fr/design/widget/ui/btn/ButtonSytleDefinedPane.java
  33. 32
      designer-realize/src/com/fr/grid/Grid.java
  34. 22
      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. 31
      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;

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

@ -9,171 +9,188 @@ 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;
/**
* 模板设计界面
*/
public abstract class TargetComponent<T> extends JComponent {
private T target;
private T target;
public TargetComponent(T t) {
this.target = t;
}
public TargetComponent(T t) {
this.target = t;
}
public TargetComponent() {}
public TargetComponent() {
}
// TODO ALEX_SEP JWorkBook不想有copy, paste, cut的操作,怎么办?
public abstract void copy();
// TODO ALEX_SEP JWorkBook不想有copy, paste, cut的操作,怎么办?
public abstract void copy();
public abstract boolean paste();
public abstract boolean paste();
public abstract boolean cut();
public abstract boolean cut();
public abstract void stopEditing();
public abstract void stopEditing();
public T getTarget() {
return target;
}
public T getTarget() {
return target;
}
public abstract AuthorityEditPane createAuthorityEditPane();
public abstract AuthorityEditPane createAuthorityEditPane();
public abstract ToolBarMenuDockPlus getToolBarMenuDockPlus();
/**
* 提供默认空实现大部分子类不需要这个方法覆写的莫名其妙的
*/
@Nullable
public ToolBarMenuDockPlus getToolBarMenuDockPlus() {
return null;
}
public abstract int getMenuState();
public abstract JPanel getEastUpPane();
public abstract JPanel getEastUpPane();
public abstract JPanel getEastDownPane();
public abstract JPanel getEastDownPane();
public abstract void cancelFormat();
public abstract void cancelFormat();
public void setTarget(T t) {
if (t != null) {
this.target = t;
}
}
///////////////////////////////////////Event Listener//////////////
/**
* Adds a <code>TargetModifiedListener</code> to the listener list.
*/
public void addTargetModifiedListener(TargetModifiedListener targetModifiedListener) {
this.listenerList.add(TargetModifiedListener.class, targetModifiedListener);
}
/**
* Removes a <code>TargetModifiedListener</code> from the listener list.
*/
public void removeTargetModifiedListener(TargetModifiedListener targetModifiedListener) {
this.listenerList.remove(TargetModifiedListener.class, targetModifiedListener);
}
/**
* Fire template modified listeners.
*/
public void fireTargetModified() {
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == TargetModifiedListener.class) {
((TargetModifiedListener) listeners[i + 1]).targetModified(new TargetModifiedEvent(this));
}
}
public void setTarget(T t) {
if (t != null) {
this.target = t;
}
}
///////////////////////////////////////Event Listener//////////////
/**
* Adds a <code>TargetModifiedListener</code> to the listener list.
*/
public void addTargetModifiedListener(TargetModifiedListener targetModifiedListener) {
this.listenerList.add(TargetModifiedListener.class, targetModifiedListener);
}
/**
* Removes a <code>TargetModifiedListener</code> from the listener list.
*/
public void removeTargetModifiedListener(TargetModifiedListener targetModifiedListener) {
this.listenerList.remove(TargetModifiedListener.class, targetModifiedListener);
}
/**
* Fire template modified listeners.
*/
public void fireTargetModified() {
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == TargetModifiedListener.class) {
((TargetModifiedListener) listeners[i + 1]).targetModified(new TargetModifiedEvent(this));
}
}
this.repaint(30);
}
this.repaint(30);
}
///////////////////////////////////////ToolBarMenuDock//////////////
public abstract ToolBarDef[] toolbars4Target();
///////////////////////////////////////ToolBarMenuDock//////////////
public abstract ToolBarDef[] toolbars4Target();
public abstract MenuDef[] menus4Target();
public abstract MenuDef[] menus4Target();
public abstract ShortCut[] shortcut4TemplateMenu();
public abstract ShortCut[] shortcut4TemplateMenu();
public abstract ShortCut[] shortCuts4Authority();
public abstract ShortCut[] shortCuts4Authority();
public abstract JComponent[] toolBarButton4Form();
public abstract JComponent[] toolBarButton4Form();
///////////////////////////////////////EditingState//////////////
///////////////////////////////////////EditingState//////////////
public EditingState createEditingState() {
return EditingState.NULL;
}
public EditingState createEditingState() {
return EditingState.NULL;
}
public static final TargetComponent<String> NULLAVOID = new TargetComponent<String>(StringUtils.EMPTY) {
public static final TargetComponent<String> NULLAVOID = new TargetComponent<String>(StringUtils.EMPTY) {
@Override
public void copy() {
}
@Override
public void copy() {
}
@Override
public boolean paste() {
return false;
}
@Override
public boolean paste() {
return false;
}
public int getMenuState(){
@Override
public int getMenuState() {
return DesignState.WORK_SHEET;
}
public void cancelFormat() {
return;
}
@Override
public void cancelFormat() {
return;
}
@Override
public boolean cut() {
return false;
}
@Override
public boolean cut() {
return false;
}
@Override
public void stopEditing() {
}
@Override
public void stopEditing() {
}
public AuthorityEditPane createAuthorityEditPane() {
return null;
}
@Override
public AuthorityEditPane createAuthorityEditPane() {
return null;
}
public ToolBarMenuDockPlus getToolBarMenuDockPlus() {
return null;
}
@Override
public ToolBarMenuDockPlus getToolBarMenuDockPlus() {
return null;
}
@Override
public ToolBarDef[] toolbars4Target() {
return new ToolBarDef[0];
}
@Override
public ToolBarDef[] toolbars4Target() {
return new ToolBarDef[0];
}
@Override
public MenuDef[] menus4Target() {
return new MenuDef[0];
}
@Override
public MenuDef[] menus4Target() {
return new MenuDef[0];
}
@Override
public ShortCut[] shortcut4TemplateMenu() {
return new ShortCut[0];
}
@Override
public ShortCut[] shortcut4TemplateMenu() {
return new ShortCut[0];
}
public ShortCut[] shortCuts4Authority() {
return new ShortCut[0];
@Override
public ShortCut[] shortCuts4Authority() {
return new ShortCut[0];
}
}
public JComponent[] toolBarButton4Form() {
return new JComponent[0];
}
@Override
public JComponent[] toolBarButton4Form() {
return new JComponent[0];
}
public JPanel getEastUpPane() {
return new JPanel();
}
@Override
public JPanel getEastUpPane() {
return new JPanel();
}
public JPanel getEastDownPane() {
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;
}

127
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,7 +852,8 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
/**
* 判断是否是新版设计器
* @return 是返回true
*
* @return 是返回true
*/
public boolean isNewDesigner() {
String xmlDesignerVersion = getTarget().getXMLDesignerVersion();
@ -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;
}

273
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;
@ -30,159 +32,174 @@ import java.io.File;
*/
public class ImageBackgroundQuickPane extends BackgroundQuickPane {
private ImagePreviewPane previewPane;
private Style imageStyle = null;
private ChangeListener changeListener = null;
private ImageFileChooser imageFileChooser;
private ImagePreviewPane previewPane;
private Style imageStyle = null;
private ChangeListener changeListener = null;
private ImageFileChooser imageFileChooser;
private UIButtonGroup<Byte> imageLayoutPane;
private UIButtonGroup<Byte> imageLayoutPane;
private String suffix = PictureCollection.DEFAULT_SUFFIX;
public ImageBackgroundQuickPane() {
this(true);
}
public ImageBackgroundQuickPane(boolean hasImageLayout) {
this.setLayout(new BorderLayout(0, 4));
String[] nameArray = {Inter.getLocText("FR-Background_Image_Default"), Inter.getLocText("FR-Background_Image_Titled"), Inter.getLocText("FR-Background_Image_Adjust"), Inter.getLocText("FR-Background_Image_Extend")};
Byte[] valueArray = {Constants.IMAGE_CENTER, Constants.IMAGE_TILED, Constants.IMAGE_EXTEND, Constants.IMAGE_ADJUST};
imageLayoutPane = new UIButtonGroup<Byte>(nameArray, valueArray);
imageLayoutPane.setSelectedIndex(0);
public ImageBackgroundQuickPane(boolean hasImageLayout) {
this.setLayout(new BorderLayout(0, 4));
String[] nameArray = {Inter.getLocText("FR-Background_Image_Default"), Inter.getLocText("FR-Background_Image_Titled"), Inter.getLocText("FR-Background_Image_Adjust"), Inter.getLocText("FR-Background_Image_Extend")};
Byte[] valueArray = {Constants.IMAGE_CENTER, Constants.IMAGE_TILED, Constants.IMAGE_EXTEND, Constants.IMAGE_ADJUST};
imageLayoutPane = new UIButtonGroup<Byte>(nameArray, valueArray);
imageLayoutPane.setSelectedIndex(0);
previewPane = new ImagePreviewPane();
JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
borderPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5));
borderPane.setPreferredSize(new Dimension(0, 145));
borderPane.add(previewPane, BorderLayout.CENTER);
this.add(borderPane, BorderLayout.NORTH);
previewPane.addChangeListener(imageSizeChangeListener);
previewPane = new ImagePreviewPane();
JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
borderPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5));
borderPane.setPreferredSize(new Dimension(0, 145));
borderPane.add(previewPane, BorderLayout.CENTER);
this.add(borderPane, BorderLayout.NORTH);
previewPane.addChangeListener(imageSizeChangeListener);
JPanel southPane = new JPanel(new BorderLayout(0, 4));
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
contentPane.add(southPane, BorderLayout.NORTH);
this.add(contentPane, BorderLayout.CENTER);
JPanel southPane = new JPanel(new BorderLayout(0, 4));
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
contentPane.add(southPane, BorderLayout.NORTH);
this.add(contentPane, BorderLayout.CENTER);
UIButton selectPictureButton = new UIButton(Inter.getLocText("Image-Select_Picture"));
selectPictureButton.addActionListener(selectPictureActionListener);
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);
imageLayoutPane.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(imageLayoutPane.getSelectedItem());
previewPane.setImageStyle(imageStyle);
previewPane.repaint();
}
});
}
/**
* Select picture.
*/
ActionListener selectPictureActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (imageFileChooser == null) {
imageFileChooser = new ImageFileChooser();
imageFileChooser.setMultiSelectionEnabled(false);
}
int returnVal = imageFileChooser.showOpenDialog(DesignerContext.getDesignerFrame());
if (returnVal != JFileChooser.CANCEL_OPTION) {
File selectedFile = imageFileChooser.getSelectedFile();
if (selectedFile != null && selectedFile.isFile()) {
Image image = BaseUtils.readImage(selectedFile.getPath());
CoreGraphHelper.waitForImage(image);
previewPane.setImage(image);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(imageLayoutPane.getSelectedItem());
previewPane.setImageStyle(imageStyle);
previewPane.repaint();
} else {
previewPane.setImage(null);
}
fireChagneListener();
}
}
};
public void populateBean(Background background) {
ImageBackground imageBackground = (ImageBackground) background;
imageLayoutPane.setSelectedItem((byte) imageBackground.getLayout());
Style.DEFAULT_STYLE.deriveImageLayout(imageBackground.getLayout());
previewPane.setImageStyle(ImageBackgroundQuickPane.this.imageStyle);
previewPane.setImage(imageBackground.getImage());
previewPane.repaint();
}
public Background updateBean() {
ImageBackground imageBackground = new ImageBackground(previewPane.getImage());
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(imageLayoutPane.getSelectedItem());
imageBackground.setLayout(imageStyle.getImageLayout());
return imageBackground;
}
/**
* 给组件登记一个观察者监听事件
*
* @param listener 观察者监听事件
*/
public void registerChangeListener(final UIObserverListener listener) {
changeListener = new ChangeListener() {
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
};
imageLayoutPane.addChangeListener(changeListener);
}
private void fireChagneListener() {
if (this.changeListener != null) {
ChangeEvent evt = new ChangeEvent(this);
this.changeListener.stateChanged(evt);
}
}
ChangeListener imageSizeChangeListener = new ChangeListener() {
public void stateChanged(ChangeEvent evt) {
southPane.add(selectPictureButton, BorderLayout.CENTER);
imageLayoutPane.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(imageLayoutPane.getSelectedItem());
previewPane.setImageStyle(imageStyle);
previewPane.repaint();
}
});
}
/**
* Select picture.
*/
ActionListener selectPictureActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
if (imageFileChooser == null) {
imageFileChooser = new ImageFileChooser();
imageFileChooser.setMultiSelectionEnabled(false);
}
int returnVal = imageFileChooser.showOpenDialog(DesignerContext.getDesignerFrame());
if (returnVal != JFileChooser.CANCEL_OPTION) {
File selectedFile = imageFileChooser.getSelectedFile();
if (selectedFile != null && selectedFile.isFile()) {
String path = selectedFile.getPath();
suffix = ImageIOHelper.getSuffix(path);
Image image = BaseUtils.readImage(path);
CoreGraphHelper.waitForImage(image);
previewPane.setImage(image);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(imageLayoutPane.getSelectedItem());
previewPane.setImageStyle(imageStyle);
previewPane.repaint();
} else {
previewPane.setImage(null);
}
fireChagneListener();
}
}
};
@Override
public void populateBean(Background background) {
ImageFileBackground imageBackground = (ImageFileBackground) background;
suffix = imageBackground.getSuffix();
imageLayoutPane.setSelectedItem((byte) imageBackground.getLayout());
Style.DEFAULT_STYLE.deriveImageLayout(imageBackground.getLayout());
previewPane.setImageStyle(ImageBackgroundQuickPane.this.imageStyle);
previewPane.setImage(imageBackground.getImage());
previewPane.repaint();
}
@Override
public Background updateBean() {
ImageFileBackground imageBackground = new ImageFileBackground(previewPane.getImage(), suffix);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(imageLayoutPane.getSelectedItem());
imageBackground.setLayout(imageStyle.getImageLayout());
return imageBackground;
}
/**
* 给组件登记一个观察者监听事件
*
* @param listener 观察者监听事件
*/
@Override
public void registerChangeListener(final UIObserverListener listener) {
changeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
};
imageLayoutPane.addChangeListener(changeListener);
}
private void fireChagneListener() {
if (this.changeListener != null) {
ChangeEvent evt = new ChangeEvent(this);
this.changeListener.stateChanged(evt);
}
}
ChangeListener imageSizeChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent evt) {
if (imageLayoutPane.getSelectedItem() != null) {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(imageLayoutPane.getSelectedItem());
previewPane.setImageStyle(imageStyle);
previewPane.repaint();
}
}
};
}
};
/**
* 判断是否是图片背景
* @param background 背景
*
* @param background 背景
* @return 判断是否是图片背景
*/
public boolean accept(Background background) {
return background instanceof ImageBackground;
}
@Override
public boolean accept(Background background) {
return background instanceof ImageFileBackground;
}
/**
* 标题
*
* @return 标题
*/
public String title4PopupWindow() {
return Inter.getLocText("FR-Background_Image");
}
@Override
public void reset() {
imageLayoutPane.setSelectedIndex(0);
previewPane.setImage(null);
}
@Override
public String title4PopupWindow() {
return Inter.getLocText("FR-Background_Image");
}
@Override
public void reset() {
imageLayoutPane.setSelectedIndex(0);
previewPane.setImage(null);
}
}

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")));
}

299
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
@ -27,141 +26,141 @@ import com.fr.design.style.color.ColorUIComboBoxPane;
* 类说明: 通过选择box切换界面的背景选择pane. bug原型图@5471
*/
public class BackgroundUIComboBoxPane extends BasicPane {
private static final long serialVersionUID = -3751191424737067321L;
protected static final String none = Inter.getLocText("DataFunction-None");
protected static final String color = Inter.getLocText("Colors");
protected static final String image = Inter.getLocText("Image");
protected static final String gradient = Inter.getLocText("Gradient-Color");
protected CardLayout cardLayout;
protected JPanel layoutPane;
protected ColorUIComboBoxPane colorPane;
protected GradientBackgroundSelectPane gradientPane;
private UIComboBox selectBox;
private ImageSelectPane imagePane;
public BackgroundUIComboBoxPane() {
initPane();
}
protected void initPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel pane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
this.add(pane);
selectBox = new UIComboBox(getSelectType());
selectBox.setPreferredSize(new Dimension(70, 20));
JPanel labelPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
pane.add(labelPane);
labelPane.setPreferredSize(new Dimension(150, 40));
JPanel northPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
labelPane.add(northPane, BorderLayout.NORTH);
northPane.add(new UILabel(Inter.getLocText(new String[]{"Background_Settings"}) + ":"));
northPane.add(selectBox);
cardLayout = new CardLayout();
layoutPane = new JPanel();
pane.add(layoutPane);
layoutPane.setLayout(cardLayout);
initSelectPane();
selectBox.addItemListener(itemListener);
}
protected String[] getSelectType() {
return new String[]{none, color, image, gradient};
}
protected void initSelectPane() {
layoutPane.add(new JPanel(), "none");
layoutPane.add(colorPane = new ColorUIComboBoxPane(), "color");
layoutPane.add(imagePane = new ImageSelectPane(), "image");
layoutPane.add(gradientPane = new GradientBackgroundSelectPane(), "gradient");
cardLayout.show(layoutPane, "none");
}
ItemListener itemListener = new ItemListener() {
public void itemStateChanged(ItemEvent e) {
UIComboBox source = (UIComboBox)e.getSource();
Object select = source.getSelectedItem();
if(none.equals(select)) {
cardLayout.show(layoutPane, "none");
} else if(color.equals(select)) {
cardLayout.show(layoutPane, "color");
} else if(image.equals(select)) {
cardLayout.show(layoutPane, "image");
} else if(gradient.equals(select)) {
cardLayout.show(layoutPane, "gradient");
}
}
};
public void populate(Background background) {
if(background instanceof ColorBackground && colorPane != null) {
selectBox.setSelectedItem(color);
colorPane.populate(background);
} else if(background instanceof ImageBackground && imagePane != null) {
selectBox.setSelectedItem(image);
imagePane.populate(background);
} else if(background instanceof GradientBackground && gradientPane != null) {
selectBox.setSelectedItem(gradient);
gradientPane.populate(background);
}
}
public Background update() {
Background background = null;
Object select = selectBox.getSelectedItem();
if(none.equals(select)) {
} else if(color.equals(select) && colorPane != null) {
background = colorPane.update();
} else if(image.equals(select) && imagePane != null) {
background = imagePane.update();
} else if(gradient.equals(select) && gradientPane != null) {
background = gradientPane.update();
}
return background;
}
public void populateAlpha(int alpha) {
if(colorPane != null) {
colorPane.populateAlpha(alpha);
}
if(imagePane != null) {
imagePane.populateAlpha(alpha);
}
if(gradientPane != null) {
gradientPane.populateAlpha(alpha);
}
}
public float updateAlpha() {
float alpha = 1;
Object select = selectBox.getSelectedItem();
if(none.equals(select)) {
} else if(color.equals(select) && colorPane != null) {
alpha = colorPane.updateAlpha();
} else if(image.equals(select) && imagePane != null) {
alpha = imagePane.updateAlpha();
} else if(gradient.equals(select) && gradientPane != null) {
alpha = gradientPane.updateAlpha();
}
return alpha;
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText(new String[]{"Background", "Set"});
}
private static final long serialVersionUID = -3751191424737067321L;
protected static final String none = Inter.getLocText("DataFunction-None");
protected static final String color = Inter.getLocText("Colors");
protected static final String image = Inter.getLocText("Image");
protected static final String gradient = Inter.getLocText("Gradient-Color");
protected CardLayout cardLayout;
protected JPanel layoutPane;
protected ColorUIComboBoxPane colorPane;
protected GradientBackgroundSelectPane gradientPane;
private UIComboBox selectBox;
private ImageSelectPane imagePane;
public BackgroundUIComboBoxPane() {
initPane();
}
protected void initPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel pane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
this.add(pane);
selectBox = new UIComboBox(getSelectType());
selectBox.setPreferredSize(new Dimension(70, 20));
JPanel labelPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
pane.add(labelPane);
labelPane.setPreferredSize(new Dimension(150, 40));
JPanel northPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
labelPane.add(northPane, BorderLayout.NORTH);
northPane.add(new UILabel(Inter.getLocText(new String[]{"Background_Settings"}) + ":"));
northPane.add(selectBox);
cardLayout = new CardLayout();
layoutPane = new JPanel();
pane.add(layoutPane);
layoutPane.setLayout(cardLayout);
initSelectPane();
selectBox.addItemListener(itemListener);
}
protected String[] getSelectType() {
return new String[]{none, color, image, gradient};
}
protected void initSelectPane() {
layoutPane.add(new JPanel(), "none");
layoutPane.add(colorPane = new ColorUIComboBoxPane(), "color");
layoutPane.add(imagePane = new ImageSelectPane(), "image");
layoutPane.add(gradientPane = new GradientBackgroundSelectPane(), "gradient");
cardLayout.show(layoutPane, "none");
}
ItemListener itemListener = new ItemListener() {
public void itemStateChanged(ItemEvent e) {
UIComboBox source = (UIComboBox)e.getSource();
Object select = source.getSelectedItem();
if(none.equals(select)) {
cardLayout.show(layoutPane, "none");
} else if(color.equals(select)) {
cardLayout.show(layoutPane, "color");
} else if(image.equals(select)) {
cardLayout.show(layoutPane, "image");
} else if(gradient.equals(select)) {
cardLayout.show(layoutPane, "gradient");
}
}
};
public void populate(Background background) {
if(background instanceof ColorBackground && colorPane != null) {
selectBox.setSelectedItem(color);
colorPane.populate(background);
} else if(background instanceof ImageFileBackground && imagePane != null) {
selectBox.setSelectedItem(image);
imagePane.populate(background);
} else if(background instanceof GradientBackground && gradientPane != null) {
selectBox.setSelectedItem(gradient);
gradientPane.populate(background);
}
}
public Background update() {
Background background = null;
Object select = selectBox.getSelectedItem();
if(none.equals(select)) {
} else if(color.equals(select) && colorPane != null) {
background = colorPane.update();
} else if(image.equals(select) && imagePane != null) {
background = imagePane.update();
} else if(gradient.equals(select) && gradientPane != null) {
background = gradientPane.update();
}
return background;
}
public void populateAlpha(int alpha) {
if(colorPane != null) {
colorPane.populateAlpha(alpha);
}
if(imagePane != null) {
imagePane.populateAlpha(alpha);
}
if(gradientPane != null) {
gradientPane.populateAlpha(alpha);
}
}
public float updateAlpha() {
float alpha = 1;
Object select = selectBox.getSelectedItem();
if(none.equals(select)) {
} else if(color.equals(select) && colorPane != null) {
alpha = colorPane.updateAlpha();
} else if(image.equals(select) && imagePane != null) {
alpha = imagePane.updateAlpha();
} else if(gradient.equals(select) && gradientPane != null) {
alpha = gradientPane.updateAlpha();
}
return alpha;
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText(new String[]{"Background", "Set"});
}
}

154
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;
/**
@ -31,134 +32,141 @@ import com.fr.design.style.background.BackgroundPane4BoxChange;
* 类说明 : 背景图片的新选择界面 , UIComboBox切换的分支pane. bug原型图@5471
*/
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 static final String[] layoutTypes = {
layoutCenter,
layoutTitled,
};
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,
layoutTitled,
};
private UIComboBox layoutComboBox;
private ImageFileChooser imageFileChooser = null;
private UILabel imageSizeLabel = new UILabel();
private AlphaPane alphaPane;
private transient Image selectImage;
public ImageSelectPane() {
this.setLayout(new BorderLayout());
JPanel pane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
this.add(pane, BorderLayout.CENTER);
JPanel testPane1 = new JPanel();
testPane1.setLayout(new BorderLayout());
JPanel selectFilePane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
testPane1.add(selectFilePane, BorderLayout.CENTER);
pane.add(testPane1);
// 选择图片按钮
UIButton selectPictureButton = new UIButton(Inter.getLocText("Image-Select_Picture"));
selectFilePane.add(selectPictureButton);
selectPictureButton.setPreferredSize(new Dimension(110, 20));
imageFileChooser = new ImageFileChooser();
imageFileChooser.setMultiSelectionEnabled(false);
selectPictureButton.setMnemonic('S');
selectPictureButton.addActionListener(selectPictureActionListener);
//布局
selectFilePane.add(new UILabel(Inter.getLocText("Form-Layout") + ":"));
layoutComboBox = new UIComboBox(layoutTypes);
selectFilePane.add(layoutComboBox);
layoutComboBox.setPreferredSize(new Dimension(60, 20));
selectFilePane.add(alphaPane = new AlphaPane());
// image size label.
JPanel testPane = new JPanel();
testPane.setLayout(new BorderLayout());
JPanel southImagePane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
testPane.add(southImagePane, BorderLayout.CENTER);
pane.add(testPane);
imageSizeLabel.setHorizontalAlignment(SwingConstants.CENTER);
southImagePane.add(imageSizeLabel);
imageSizeLabel.setPreferredSize(new Dimension(100, 20));
}
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;
}
}
chechLabelText();
}
}
};
private void chechLabelText() {
if (selectImage == null) {
imageSizeLabel.setText("");
} else {
imageSizeLabel.setText(selectImage.getWidth(null) + "x"
+ selectImage.getHeight(null) + Inter.getLocText("px"));
}
if (selectImage == null) {
imageSizeLabel.setText("");
} else {
imageSizeLabel.setText(selectImage.getWidth(null) + "x"
+ selectImage.getHeight(null) + Inter.getLocText("px"));
}
}
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);
layoutComboBox.setSelectedItem(layoutTitled);
} else {
layoutComboBox.setSelectedItem(layoutCenter);
layoutComboBox.setSelectedItem(layoutCenter);
}
}
chechLabelText();
}
public void populateAlpha(int alpha) {
alphaPane.populate(alpha);
alphaPane.populate(alpha);
}
public float updateAlpha() {
return alphaPane.update();
return alphaPane.update();
}
public Background update() {
ImageBackground imageBackground = new ImageBackground(selectImage);
Object selectLayout = layoutComboBox.getSelectedItem();
if(selectLayout.equals(layoutCenter)) {
imageBackground.setLayout(Constants.IMAGE_CENTER);
} else if(selectLayout.equals(layoutTitled)) {
imageBackground.setLayout(Constants.IMAGE_TILED);
}
return imageBackground;
ImageFileBackground imageBackground = new ImageFileBackground(selectImage, suffix);
Object selectLayout = layoutComboBox.getSelectedItem();
if (selectLayout.equals(layoutCenter)) {
imageBackground.setLayout(Constants.IMAGE_CENTER);
} else if (selectLayout.equals(layoutTitled)) {
imageBackground.setLayout(Constants.IMAGE_TILED);
}
return imageBackground;
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Image-Select_Picture");
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Image-Select_Picture");
}
}

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());
}
}

54
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;
@ -230,14 +233,14 @@ public class RemoteEnv extends AbstractEnv {
}
/*
* Read the response body.
* 拿出InputStream中所有的Byte,转换成ByteArrayInputStream的形式返回
*
* 这样做的目的是确保method.releaseConnection
*
* TODO 但如果不做method.releaseConnection,有多大危害呢?不确定...
*/
/*
* Read the response body.
* 拿出InputStream中所有的Byte,转换成ByteArrayInputStream的形式返回
*
* 这样做的目的是确保method.releaseConnection
*
* TODO 但如果不做method.releaseConnection,有多大危害呢?不确定...
*/
/**
* execute method之后,取返回的inputstream
@ -552,7 +555,7 @@ public class RemoteEnv extends AbstractEnv {
}
private void stopLogTimer() {
if(logTimer != null) {
if (logTimer != null) {
logTimer.cancel();
logTimer = null;
}
@ -2073,8 +2076,7 @@ public class RemoteEnv extends AbstractEnv {
info.parseJSON(jo);
return info;
}
@Override
public String pluginServiceAction(String serviceID, String req) throws Exception {
@ -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(
@ -2211,29 +2215,29 @@ public class RemoteEnv extends AbstractEnv {
public void doWhenServerShutDown() {
}
@Override
public boolean isLocalEnv() {
return false;
}
@Override
public boolean hasPluginServiceStarted(String key) {
return true;
}
@Override
public JSONArray getPluginStatus() {
try {
HashMap<String, String> para = new HashMap<String, String>();
para.put("op", "plugin");
para.put("cmd", "get_status");
para.put("current_uid", this.createUserID());
para.put("currentUsername", this.getUser());
HttpClient client = createHttpMethod(para);
InputStream input = execute4InputStream(client);
return new JSONArray(stream2String(input));

30
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,8 +664,13 @@ public class FILEChooserPane extends BasicPane {
private void saveDialog() {
String filename = fileNameTextField.getText();
if (!filename.endsWith(suffix)) {
fileNameTextField.setText(filename + this.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();

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));

38
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.
*/
@ -26,7 +26,7 @@ public class ImageCellEditor extends AbstractCellEditor implements DialogActionL
* Constructor.
*/
public ImageCellEditor(ElementCasePane<? extends TemplateElementCase> ePane) {
super(ePane);
super(ePane);
}
/**
@ -59,25 +59,25 @@ 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;
}
this.imageEditorPane = new SelectImagePane();
this.imageEditorPane.populate(cellElement);
return this.imageEditorPane.showWindow(SwingUtilities.getWindowAncestor(grid), this);
}
@Override
public void doOk() {
stopCellEditing();
}
@Override
public void doOk() {
stopCellEditing();
@Override
public void doCancel() {
cancelCellEditing();
}
}
@Override
public void doCancel() {
cancelCellEditing();
}
}

34
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,25 +54,25 @@ 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;
}
this.imageEditorPane = new SelectImagePane();
this.imageEditorPane.populate(floatElement);
return this.imageEditorPane.showWindow(SwingUtilities.getWindowAncestor(grid), this);
}
@Override
public void doOk() {
stopFloatEditing();
}
public void doOk() {
stopFloatEditing();
}
@Override
public void doCancel() {
cancelFloatEditing();
@Override
public void doCancel() {
cancelFloatEditing();
}
}
}

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();
}
/**
* 创建正在编辑的状态.
*

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

@ -1,5 +1,5 @@
/**
*
*
*/
package com.fr.design.mainframe;
@ -8,39 +8,40 @@ import com.fr.report.poly.PolyWorkSheet;
/**
* 聚合报表Book, 跟WorkBook区别在于不能放入WorkSheet.
*
*
* @author neil
*
* @date: 2015-2-5-上午8:58:39
*/
public class JPolyWorkBook extends JWorkBook {
private static final String DEFAULT_NAME = "Poly";
/**
* 构造函数
*/
public JPolyWorkBook() {
private static final String DEFAULT_NAME = "Poly";
/**
* 构造函数
*/
public JPolyWorkBook() {
super(new WorkBook(new PolyWorkSheet()), DEFAULT_NAME);
populateReportParameterAttr();
}
}
/**
* 创建sheet名称tab面板
*
* @param reportCompositeX 当前组件对象
*
* @return sheet名称tab面板
*
* @date 2015-2-5-上午11:42:12
*
*/
* 创建sheet名称tab面板
*
* @param reportCompositeX 当前组件对象
*
* @return sheet名称tab面板
*
* @date 2015-2-5-上午11:42:12
*
*/
@Override
public SheetNameTabPane createSheetNameTabPane(ReportComponentComposite reportCompositeX){
return new PolySheetNameTabPane(reportCompositeX);
return new PolySheetNameTabPane(reportCompositeX);
}
@Override
public void refreshEastPropertiesPane() {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY);
}
@Override
public void refreshEastPropertiesPane() {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY);
}
}

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想做成自动上传附件.

107
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,69 +11,64 @@ 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
* @since 6.5.4 创建于2011-4-19 报表编辑面板
*/
public abstract class ReportComponent<T extends TemplateReport, E extends ElementCasePane, S extends SelectableElement> extends TargetComponent<T> implements Selectedable<S> {
protected E elementCasePane;
public E getEditingElementCasePane() {
return elementCasePane;
}
public ReportComponent(T t) {
super(t);
}
// TODO ALEX_SEP 这个方法有没有可能删掉
public T getTemplateReport() {
return this.getTarget();
}
public abstract JScrollBar getHorizontalScrollBar();
public abstract JScrollBar getVerticalScrollBar();
public abstract S getDefaultSelectElement();
/**
* 更新JSliderPane
*/
public abstract void updateJSliderValue();
@Override
public ShortCut[] shortcut4TemplateMenu() {
return new ShortCut[]{
new ReportPageSetupAction(this),
new ReportHeaderAction(this),
new ReportFooterAction(this),
new ReportBackgroundAction(this),
};
}
public void cancelFormat() {
return;
}
public ShortCut[] shortCuts4Authority() {
return new ShortCut[]{
new NameSeparator(Inter.getLocText(new String[]{"DashBoard-Potence", "Edit"})),
BaseUtils.isAuthorityEditing() ? new ExitAuthorityEditAction(this) : new AllowAuthorityEditAction(this),
};
}
public ToolBarMenuDockPlus getToolBarMenuDockPlus() {
return new JWorkBook();
}
protected E elementCasePane;
public E getEditingElementCasePane() {
return elementCasePane;
}
public ReportComponent(T t) {
super(t);
}
// TODO ALEX_SEP 这个方法有没有可能删掉
public T getTemplateReport() {
return this.getTarget();
}
public abstract JScrollBar getHorizontalScrollBar();
public abstract JScrollBar getVerticalScrollBar();
public abstract S getDefaultSelectElement();
/**
* 更新JSliderPane
*/
public abstract void updateJSliderValue();
@Override
public ShortCut[] shortcut4TemplateMenu() {
return new ShortCut[]{
new ReportPageSetupAction(this),
new ReportHeaderAction(this),
new ReportFooterAction(this),
new ReportBackgroundAction(this),
};
}
public void cancelFormat() {
return;
}
public ShortCut[] shortCuts4Authority() {
return new ShortCut[]{
new NameSeparator(Inter.getLocText(new String[]{"DashBoard-Potence", "Edit"})),
BaseUtils.isAuthorityEditing() ? new ExitAuthorityEditAction(this) : new AllowAuthorityEditAction(this),
};
}
}

23
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;
@ -68,7 +75,7 @@ public class WorkSheetDesigner extends ReportComponent<WorkSheet, ElementCasePan
}
//////////////////////////////////////////////////////////////////////
//////////////////for toolbarMenuAdapter//////////////////////////////
//////////////////for toolbarMenuAdapter//////////////////////////////
//////////////////////////////////////////////////////////////////////
@Override

161
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,19 +34,26 @@ 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;
public FormElementCasePaneDelegate getEditingElementCasePane() {
return elementCasePane;
}
protected FormElementCasePaneDelegate elementCasePane;
@Override
public FormElementCasePaneDelegate getEditingElementCasePane() {
return elementCasePane;
}
public FormElementCaseDesigner(T sheet) {
super(sheet);
@ -61,7 +65,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
@Override
public void targetModified(TargetModifiedEvent e) {
FormElementCaseDesigner.this.fireTargetModified();
FormElementCaseDesigner.this.fireTargetModified();
}
});
@ -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,50 +88,53 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
*
* @return 子菜单
*/
public ShortCut[] shortCuts4Authority() {
return new ShortCut[]{
new NameSeparator(Inter.getLocText(new String[]{"DashBoard-Potence", "Edit"})),
BaseUtils.isAuthorityEditing() ? new ExitAuthorityEditAction(this) : new AllowAuthorityEditAction(this),
};
@Override
public ShortCut[] shortCuts4Authority() {
return new ShortCut[]{
new NameSeparator(Inter.getLocText(new String[]{"DashBoard-Potence", "Edit"})),
BaseUtils.isAuthorityEditing() ? new ExitAuthorityEditAction(this) : new AllowAuthorityEditAction(this),
};
}
}
/**
* 创建权限细粒度面板
*
* @return 返回权限细粒度面板
*/
@Override
public AuthorityEditPane createAuthorityEditPane() {
ElementCasePaneAuthorityEditPane elementCasePaneAuthorityEditPane = new ElementCasePaneAuthorityEditPane(elementCasePane);
elementCasePaneAuthorityEditPane.populateDetials();
return elementCasePaneAuthorityEditPane;
}
/**
* 获取当前ElementCase的缩略图
*
* @param size 缩略图的大小
*/
* 获取当前ElementCase的缩略图
*
* @param size 缩略图的大小
*/
@Override
public BufferedImage getElementCaseImage(Dimension size){
BufferedImage image = null;
try{
image = new java.awt.image.BufferedImage(size.width, size.height,
java.awt.image.BufferedImage.TYPE_INT_RGB);
Graphics g = image.getGraphics();
//填充白色背景, 不然有黑框
Color oldColor = g.getColor();
g.setColor(Color.WHITE);
g.fillRect(0, 0, size.width, size.height);
g.setColor(oldColor);
this.elementCasePane.paintComponents(g);
}catch (Exception e) {
FRContext.getLogger().error(e.getMessage());
}
return image;
BufferedImage image = null;
try{
image = new java.awt.image.BufferedImage(size.width, size.height,
java.awt.image.BufferedImage.TYPE_INT_RGB);
Graphics g = image.getGraphics();
//填充白色背景, 不然有黑框
Color oldColor = g.getColor();
g.setColor(Color.WHITE);
g.fillRect(0, 0, size.width, size.height);
g.setColor(oldColor);
this.elementCasePane.paintComponents(g);
}catch (Exception e) {
FRContext.getLogger().error(e.getMessage());
}
return image;
}
/**
@ -134,17 +142,19 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
*
* @return 返回正在编辑的状态.
*/
@Override
public EditingState createEditingState() {
return this.elementCasePane.createEditingState();
}
//////////////////////////////////////////////////////////////////////
//////////////////for toolbarMenuAdapter//////////////////////////////
//////////////////for toolbarMenuAdapter//////////////////////////////
//////////////////////////////////////////////////////////////////////
/**
* 复制
*/
@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,37 +300,36 @@ 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();
}
/**
* 无条件取消格式刷
*/
public void cancelFormat() {
return;
}
public FormElementCase getElementCase(){
return (FormElementCase) this.getTarget();
}
@Override
public void cancelFormat() {
return;
}
public FormElementCase getElementCase(){
return (FormElementCase) this.getTarget();
}
/**
* 模板的子菜单
*
* @return 子菜单
*/
public ShortCut[] shortcut4TemplateMenu() {
return new ShortCut[0];
}
@Override
public ShortCut[] shortcut4TemplateMenu() {
return new ShortCut[0];
}
public FormElementCaseProvider getEditingElementCase(){
return this.getEditingElementCasePane().getTarget();
}
@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,

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

@ -1,41 +1,41 @@
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;
private UIRadioButton defaultRadioButton = null;
private UIRadioButton tiledRadioButton = 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));
@ -72,10 +78,10 @@ public class SelectImagePane extends BasicPane{
selectFilePane.add(selectPictureButton, BorderLayout.NORTH);
selectPictureButton.setMnemonic('S');
selectPictureButton.addActionListener(selectPictureActionListener);
JPanel layoutPane=FRGUIPaneFactory.createMediumHGapHighTopFlowInnerContainer_M_Pane();
JPanel layoutPane = FRGUIPaneFactory.createMediumHGapHighTopFlowInnerContainer_M_Pane();
selectFilePane.add(layoutPane, BorderLayout.CENTER);
//布局
defaultRadioButton = new UIRadioButton(Inter.getLocText("Default"));
tiledRadioButton = new UIRadioButton(Inter.getLocText("Image-Titled"));
@ -86,7 +92,7 @@ public class SelectImagePane extends BasicPane{
tiledRadioButton.addActionListener(layoutActionListener);
extendRadioButton.addActionListener(layoutActionListener);
adjustRadioButton.addActionListener(layoutActionListener);
JPanel jp = new JPanel(new GridLayout(4, 1, 15, 15));
jp.add(defaultRadioButton);
jp.add(tiledRadioButton);
@ -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,9 +126,11 @@ 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;
setImageStyle();
previewPane.setImage(image);
@ -133,73 +143,86 @@ public class SelectImagePane extends BasicPane{
}
}
};
// 调整图片样式,只有水平和垂直对齐以及拉伸。相对于背景,平铺不予考虑。
private void changeImageStyle() {
previewPane.setImageStyle(this.imageStyle);
previewPane.repaint();
previewPane.setImageStyle(this.imageStyle);
previewPane.repaint();
}
private void setImageStyle(){
if(tiledRadioButton.isSelected()){
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_TILED);
}else if(adjustRadioButton.isSelected()){
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_ADJUST);
}else if(extendRadioButton.isSelected()){
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_EXTEND);
}else{
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER);
private void setImageStyle() {
if (tiledRadioButton.isSelected()) {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_TILED);
} else if (adjustRadioButton.isSelected()) {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_ADJUST);
} else if (extendRadioButton.isSelected()) {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_EXTEND);
} else {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER);
}
}
ActionListener layoutActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
setImageStyle();
setImageStyle();
changeImageStyle();
}
};
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Image");
return Inter.getLocText("Image");
}
public void populate(Elem cell) {
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;
}
style = cell.getStyle();
}
if(style.getImageLayout() == Constants.IMAGE_TILED){
tiledRadioButton.setSelected(true);
}else if(style.getImageLayout() == Constants.IMAGE_EXTEND){
extendRadioButton.setSelected(true);
}else if(style.getImageLayout() == Constants.IMAGE_ADJUST){
adjustRadioButton.setSelected(true);
}else{
style.deriveImageLayout(Constants.IMAGE_CENTER);
defaultRadioButton.setSelected(true);
}
this.imageStyle = style;
changeImageStyle();
Style style = null;
if (cell != null) {
Object value = cell.getValue();
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) {
tiledRadioButton.setSelected(true);
} else if (style.getImageLayout() == Constants.IMAGE_EXTEND) {
extendRadioButton.setSelected(true);
} else if (style.getImageLayout() == Constants.IMAGE_ADJUST) {
adjustRadioButton.setSelected(true);
} else {
style.deriveImageLayout(Constants.IMAGE_CENTER);
defaultRadioButton.setSelected(true);
}
this.imageStyle = style;
changeImageStyle();
}
public CellImage update(){
CellImage cellImage = new CellImage();
cellImage.setImage(previewPane.getImage());
cellImage.setStyle(this.imageStyle);
return cellImage;
public void setImage(Image image) {
previewPane.setImage(image);
this.previewImage = image;
}
public File getSelectedImage(){
return imageFile;
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() {
return imageFile;
}
}

256
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,119 +16,129 @@ 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;
protected AccessibleBackgroundEditor clickBackgroundPane;
public ButtonSytleDefinedPane() {
this.initComponents();
}
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
initBackgroundPane = new AccessibleBackgroundEditor();
overBackgroundPane = new AccessibleBackgroundEditor();
clickBackgroundPane = new AccessibleBackgroundEditor();
double f = TableLayout.FILL;
final double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1},{1, 1}};
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Initial")), initBackgroundPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Over")), overBackgroundPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Click")), clickBackgroundPane},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 7, 7);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
this.add(panel, BorderLayout.CENTER);
}
public void populate(FreeButton button) {
if (button == null) {
return;
}
initBackgroundPane.setValue(button.getInitialBackground());
overBackgroundPane.setValue(button.getOverBackground());
clickBackgroundPane.setValue(button.getClickBackground());
}
public FreeButton update(FreeButton button) {
button.setCustomStyle(true);
button.setInitialBackground((Background) initBackgroundPane.getValue());
button.setOverBackground((Background) overBackgroundPane.getValue());
button.setClickBackground((Background) clickBackgroundPane.getValue());
return button;
}
@Override
protected String title4PopupWindow() {
return null;
}
class BackgroundPane extends JPanel {
private UIButton editButton;
private BackgroundButtonPane choosePane;
private Background background;
private UILabel ImagePreviewPane;
BackgroundPane(String text, String ToolTips) {
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 150));
UILabel label = new UILabel(text);
label.setToolTipText(ToolTips);
label.setPreferredSize(new Dimension(100, 20));
this.add(label);
ImagePreviewPane = new UILabel();
ImagePreviewPane.setPreferredSize(new Dimension(100, 20));
this.add(ImagePreviewPane);
editButton = new UIButton(Inter.getLocText("FR-Designer_Edit"));
editButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
choosePane = new BackgroundButtonPane();
BasicDialog dlg = choosePane.showWindow(SwingUtilities
.getWindowAncestor(ButtonSytleDefinedPane.this));
dlg.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
populate(choosePane.update());
}
});
if(BackgroundPane.this.background == null){
BackgroundPane.this.background = new ColorBackground();
}
choosePane.populate((Background) BackgroundPane.this.background);
dlg.setVisible(true);
}
});
this.add(editButton);
}
public void populate(Background background) {
this.background = background;
if (background instanceof ImageBackground && ((ImageBackground) background).getImage() != null) {
ImagePreviewPane.setIcon(new ImageIcon(((ImageBackground) background).getImage()));
} else if(background instanceof ColorBackground && ((ColorBackground) background).getColor() != null){
ImagePreviewPane.setIcon(null);
ImagePreviewPane.setOpaque(true);
ImagePreviewPane.setBackground(((ColorBackground) background).getColor());
}else{
ImagePreviewPane.setIcon(null);
ImagePreviewPane.setOpaque(false);
ImagePreviewPane.setBackground(null);
}
}
public Background update() {
return background;
}
}
protected AccessibleBackgroundEditor initBackgroundPane;
protected AccessibleBackgroundEditor overBackgroundPane;
protected AccessibleBackgroundEditor clickBackgroundPane;
public ButtonSytleDefinedPane() {
this.initComponents();
}
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
initBackgroundPane = new AccessibleBackgroundEditor();
overBackgroundPane = new AccessibleBackgroundEditor();
clickBackgroundPane = new AccessibleBackgroundEditor();
double f = TableLayout.FILL;
final double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1},{1, 1}};
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Initial")), initBackgroundPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Over")), overBackgroundPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Click")), clickBackgroundPane},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 7, 7);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
this.add(panel, BorderLayout.CENTER);
}
public void populate(FreeButton button) {
if (button == null) {
return;
}
initBackgroundPane.setValue(button.getInitialBackground());
overBackgroundPane.setValue(button.getOverBackground());
clickBackgroundPane.setValue(button.getClickBackground());
}
public FreeButton update(FreeButton button) {
button.setCustomStyle(true);
button.setInitialBackground((Background) initBackgroundPane.getValue());
button.setOverBackground((Background) overBackgroundPane.getValue());
button.setClickBackground((Background) clickBackgroundPane.getValue());
return button;
}
@Override
protected String title4PopupWindow() {
return null;
}
class BackgroundPane extends JPanel {
private UIButton editButton;
private BackgroundButtonPane choosePane;
private Background background;
private UILabel ImagePreviewPane;
BackgroundPane(String text, String ToolTips) {
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 150));
UILabel label = new UILabel(text);
label.setToolTipText(ToolTips);
label.setPreferredSize(new Dimension(100, 20));
this.add(label);
ImagePreviewPane = new UILabel();
ImagePreviewPane.setPreferredSize(new Dimension(100, 20));
this.add(ImagePreviewPane);
editButton = new UIButton(Inter.getLocText("FR-Designer_Edit"));
editButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
choosePane = new BackgroundButtonPane();
BasicDialog dlg = choosePane.showWindow(SwingUtilities
.getWindowAncestor(ButtonSytleDefinedPane.this));
dlg.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
populate(choosePane.update());
}
});
if(BackgroundPane.this.background == null){
BackgroundPane.this.background = new ColorBackground();
}
choosePane.populate((Background) BackgroundPane.this.background);
dlg.setVisible(true);
}
});
this.add(editButton);
}
public void populate(Background background) {
this.background = background;
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);
ImagePreviewPane.setBackground(((ColorBackground) background).getColor());
}else{
ImagePreviewPane.setIcon(null);
ImagePreviewPane.setOpaque(false);
ImagePreviewPane.setBackground(null);
}
}
public Background update() {
return background;
}
}
}

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);
}
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();
}

22
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;
@ -105,7 +105,7 @@ public class GridUI extends ComponentUI {
if (elementCase instanceof Report) {
return ReportUtils.getReportSettings((Report) elementCase);
} else if(elementCase instanceof FormElementCase){
return ((FormElementCase) elementCase).getReportSettings();
return ((FormElementCase) elementCase).getReportSettings();
} else {
return new ReportSettings();
}
@ -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);
@ -448,8 +448,8 @@ public class GridUI extends ComponentUI {
// peter:保留clip.
oldClip = g2d.getClip(); /*
* alex:此处的tmpRectangle_1被GridUtils.validate判断必定为true,
* 因为这些tmpCellElement是intersect的结果 所以,不必判断了
*/
* 因为这些tmpCellElement是intersect的结果 所以,不必判断了
*/
g2d.clip(this.tmpRectangle);
// 这边为什么要加1? 因为单元格的左边和上面有线,宽度为一,属于此单元格,画单元格的内容不应该把那条线给遮住了
@ -485,7 +485,7 @@ public class GridUI extends ComponentUI {
String selectedRole = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName();
boolean isWidgetAuthority = false;
if (tmpCellElement.getWidget() != null) {
isWidgetAuthority = tmpCellElement.getWidget().isDirtyWidget(selectedRole);
isWidgetAuthority = tmpCellElement.getWidget().isDirtyWidget(selectedRole);
}
boolean isCellDoneAuthority = tmpCellElement.isDoneAuthority(selectedRole) || tmpCellElement.isDoneNewValueAuthority(selectedRole);
boolean isDoneAuthority = isWidgetAuthority || isCellDoneAuthority;
@ -508,10 +508,10 @@ public class GridUI extends ComponentUI {
// cellGUIAttr = CellGUIAttr.DEFAULT_CELLGUIATTR;
// }
/*
/*
* 记录当前选中的单元格的左父与上父的位置于leftColumnRowRectangle2D &
* topColumnRowRectangle2D
*/
* topColumnRowRectangle2D
*/
if (selectedCellElement == tmpCellElement) {
CellExpandAttr cellExpandAttr = tmpCellElement.getCellExpandAttr();
if (cellExpandAttr != null) {

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();
}
}

31
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,28 +68,26 @@ 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方法
*
* @param args 参数
*/
public static void main(String[] args) {
Module designerRoot = ModuleContext.parseRoot("designer-startup.xml");
//传递启动参数
designerRoot.setSingleton(StartupArgs.class, new StartupArgs(args));
@ -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