Browse Source

Merge branch 'release/10.0' of http://cloud.finedevelop.com:2015/scm/~mata.li/designrel into release/10.0

master
Mata.Li 7 years ago
parent
commit
bbe92c1fb4
  1. BIN
      designer-base/src/com/fr/design/images/dialog/watermark/watermark_background.png
  2. 2
      designer-base/src/com/fr/design/mainframe/JTemplate.java
  3. 2
      designer-base/src/com/fr/design/report/WatermarkPane.java
  4. 2
      designer-base/src/com/fr/design/report/WatermarkPreviewPane.java
  5. 2
      designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java
  6. 2
      designer-form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  7. 21
      designer-form/src/com/fr/design/mainframe/FormDesignerUI.java
  8. 2
      designer-form/src/com/fr/design/mainframe/ShareWidgetButton.java
  9. 2
      designer-form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java
  10. 2
      designer-form/src/com/fr/design/mainframe/widget/accessibles/AccessibleBodyWatermarkEditor.java
  11. 2
      designer-form/src/com/fr/design/mainframe/widget/wrappers/WatermarkWrapper.java
  12. 2
      designer-form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java
  13. 31
      designer-form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java
  14. 2
      designer-realize/src/com/fr/design/actions/report/ReportMobileAttrAction.java
  15. 2
      designer-realize/src/com/fr/design/actions/report/ReportWatermarkAction.java
  16. 20
      designer-realize/src/com/fr/grid/GridUI.java

BIN
designer-base/src/com/fr/design/images/dialog/watermark/watermark_background.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 121 KiB

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

@ -5,7 +5,7 @@ import com.fr.base.FRContext;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.io.BaseBook; import com.fr.base.io.BaseBook;
import com.fr.base.iofileattr.TemplateIdAttrMark; import com.fr.base.iofile.attr.TemplateIdAttrMark;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;

2
designer-base/src/com/fr/design/report/WatermarkPane.java

@ -1,6 +1,6 @@
package com.fr.design.report; package com.fr.design.report;
import com.fr.base.iofileattr.WatermarkAttr; import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;

2
designer-base/src/com/fr/design/report/WatermarkPreviewPane.java

@ -1,6 +1,6 @@
package com.fr.design.report; package com.fr.design.report;
import com.fr.base.iofileattr.WatermarkAttr; import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.page.WatermarkPainter; import com.fr.page.WatermarkPainter;

2
designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -4,7 +4,7 @@
package com.fr.design.designer.creator; package com.fr.design.designer.creator;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.iofileattr.SharableAttrMark; import com.fr.base.iofile.attr.SharableAttrMark;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;

2
designer-form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java

@ -4,7 +4,7 @@
package com.fr.design.designer.creator.cardlayout; package com.fr.design.designer.creator.cardlayout;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.iofileattr.SharableAttrMark; import com.fr.base.iofile.attr.SharableAttrMark;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;

21
designer-form/src/com/fr/design/mainframe/FormDesignerUI.java

@ -1,14 +1,12 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.AlphaComposite; import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.geom.Area; import java.awt.geom.Area;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.util.ArrayList; import java.util.ArrayList;
import javax.swing.JComponent; import javax.swing.JComponent;
@ -19,6 +17,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;
@ -31,10 +30,11 @@ import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.page.WatermarkPainter;
import com.fr.report.core.ReportUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper;
/** /**
* FormDesigner的UI类是一个有状态的UI类它根据FormDesigner的当前状态画出 * FormDesigner的UI类是一个有状态的UI类它根据FormDesigner的当前状态画出
@ -46,6 +46,7 @@ public class FormDesignerUI extends ComponentUI {
private FormDesigner designer; private FormDesigner designer;
private SelectionModel selectionModel; private SelectionModel selectionModel;
private Rectangle2D.Double back_or_selection_rect = new Rectangle2D.Double(0, 0, 0, 0); private Rectangle2D.Double back_or_selection_rect = new Rectangle2D.Double(0, 0, 0, 0);
private WatermarkPainter watermarkPainter;
private float time; private float time;
public FormDesignerUI() { public FormDesignerUI() {
@ -111,6 +112,18 @@ public class FormDesignerUI extends ComponentUI {
// 当前正在添加的组件 // 当前正在添加的组件
paintAddingBean(g, addingModel); paintAddingBean(g, addingModel);
} }
paintWatermark((Graphics2D) g);
}
// 绘制水印
private void paintWatermark(Graphics2D g) {
WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(designer.getTarget());
// 不要每次都 new 一个 WatermarkPainter
if (watermarkPainter == null || !ComparatorUtils.equals(watermarkPainter.getWatermark(), watermark)) {
watermarkPainter = new WatermarkPainter(watermark);
}
watermarkPainter.paint(g, 0, designer.getParaHeight(), designer.getArea().getBounds());
} }
private int[] getActualLine(int i) { private int[] getActualLine(int i) {

2
designer-form/src/com/fr/design/mainframe/ShareWidgetButton.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.iofileattr.SharableAttrMark; import com.fr.base.iofile.attr.SharableAttrMark;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;

2
designer-form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.actions; package com.fr.design.mainframe.actions;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.iofileattr.MobileOnlyTemplateAttrMark; import com.fr.base.iofile.attr.MobileOnlyTemplateAttrMark;
import com.fr.design.actions.JTemplateAction; import com.fr.design.actions.JTemplateAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;

2
designer-form/src/com/fr/design/mainframe/widget/accessibles/AccessibleBodyWatermarkEditor.java

@ -1,6 +1,6 @@
package com.fr.design.mainframe.widget.accessibles; package com.fr.design.mainframe.widget.accessibles;
import com.fr.base.iofileattr.WatermarkAttr; import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.widget.editors.ITextComponent; import com.fr.design.mainframe.widget.editors.ITextComponent;

2
designer-form/src/com/fr/design/mainframe/widget/wrappers/WatermarkWrapper.java

@ -1,6 +1,6 @@
package com.fr.design.mainframe.widget.wrappers; package com.fr.design.mainframe.widget.wrappers;
import com.fr.base.iofileattr.WatermarkAttr; import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.design.Exception.ValidationException; import com.fr.design.Exception.ValidationException;
import com.fr.design.designer.properties.Decoder; import com.fr.design.designer.properties.Decoder;
import com.fr.design.designer.properties.Encoder; import com.fr.design.designer.properties.Encoder;

2
designer-form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java

@ -1,7 +1,7 @@
package com.fr.design.widget.ui.designer.layout; package com.fr.design.widget.ui.designer.layout;
import com.fr.base.io.IOFile; import com.fr.base.io.IOFile;
import com.fr.base.iofileattr.WatermarkAttr; import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.design.data.DataCreatorUI; import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;

31
designer-form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java

@ -1,5 +1,7 @@
package com.fr.design.widget.ui.designer.layout; package com.fr.design.widget.ui.designer.layout;
import com.fr.base.io.IOFile;
import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.design.data.DataCreatorUI; import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
@ -20,6 +22,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelectionUtils; import com.fr.design.mainframe.FormSelectionUtils;
import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.accessibles.AccessibleBodyWatermarkEditor;
import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor;
import com.fr.design.widget.ui.designer.AbstractDataModify; import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane; import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
@ -30,8 +33,9 @@ import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WBodyLayoutType; import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WFitLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.core.ReportUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel; import javax.swing.DefaultComboBoxModel;
@ -51,6 +55,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
private UISpinner componentIntervel; private UISpinner componentIntervel;
private PaddingBoundPane paddingBound; private PaddingBoundPane paddingBound;
private AccessibleWLayoutBorderStyleEditor stylePane; private AccessibleWLayoutBorderStyleEditor stylePane;
private AccessibleBodyWatermarkEditor watermarkEditor;
public FRFitLayoutDefinePane(XCreator xCreator) { public FRFitLayoutDefinePane(XCreator xCreator) {
super(xCreator); super(xCreator);
@ -72,9 +77,13 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
public JPanel createAdvancePane() { public JPanel createAdvancePane() {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
stylePane = new AccessibleWLayoutBorderStyleEditor(); stylePane = new AccessibleWLayoutBorderStyleEditor();
watermarkEditor = new AccessibleBodyWatermarkEditor();
paddingBound = new PaddingBoundPane(); paddingBound = new PaddingBoundPane();
JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane(
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Style")), stylePane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1); new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Style")), stylePane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), watermarkEditor}
}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1);
jp2.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); jp2.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
jPanel.add(paddingBound, BorderLayout.CENTER); jPanel.add(paddingBound, BorderLayout.CENTER);
jPanel.add(jp2, BorderLayout.NORTH); jPanel.add(jp2, BorderLayout.NORTH);
@ -135,6 +144,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
adaptComboBox.setSelectedIndex(ob.getCompState()); adaptComboBox.setSelectedIndex(ob.getCompState());
componentIntervel.setValue(ob.getCompInterval()); componentIntervel.setValue(ob.getCompInterval());
stylePane.setValue(ob.getBorderStyle()); stylePane.setValue(ob.getBorderStyle());
watermarkEditor.setValue(ReportUtils.getWatermarkFromAttrMarkFile(getCurrentIOFile()));
} }
private XLayoutContainer selectedBodyLayout(FormDesigner formDesigner) { private XLayoutContainer selectedBodyLayout(FormDesigner formDesigner) {
@ -156,6 +166,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
if(borderStyle != null){ if(borderStyle != null){
layout.setBorderStyle(borderStyle); layout.setBorderStyle(borderStyle);
} }
updateWatermark();
Item item = (Item) layoutComboBox.getSelectedItem(); Item item = (Item) layoutComboBox.getSelectedItem();
Object value = item.getValue(); Object value = item.getValue();
int state = 0; int state = 0;
@ -187,7 +198,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{wAbsoluteBodyLayout})); FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{wAbsoluteBodyLayout}));
} }
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }
//todo 验证下 //todo 验证下
@ -203,6 +214,18 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
return layout; return layout;
} }
private void updateWatermark() {
WatermarkAttr watermark = (WatermarkAttr) watermarkEditor.getValue();
if (watermark != null) {
IOFile ioFile = getCurrentIOFile();
ioFile.addAttrMark(watermark);
}
}
private IOFile getCurrentIOFile() {
return WidgetPropertyPane.getInstance().getEditingFormDesigner().getTarget();
}
private void setLayoutGap(int value) { private void setLayoutGap(int value) {
int interval = wFitLayout.getCompInterval(); int interval = wFitLayout.getCompInterval();
if (value != interval) { if (value != interval) {

2
designer-realize/src/com/fr/design/actions/report/ReportMobileAttrAction.java

@ -1,6 +1,6 @@
package com.fr.design.actions.report; package com.fr.design.actions.report;
import com.fr.base.iofileattr.MobileOnlyTemplateAttrMark; import com.fr.base.iofile.attr.MobileOnlyTemplateAttrMark;
import com.fr.design.actions.JWorkBookAction; import com.fr.design.actions.JWorkBookAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;

2
designer-realize/src/com/fr/design/actions/report/ReportWatermarkAction.java

@ -1,7 +1,7 @@
package com.fr.design.actions.report; package com.fr.design.actions.report;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.iofileattr.WatermarkAttr; import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.design.actions.JWorkBookAction; import com.fr.design.actions.JWorkBookAction;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;

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

@ -10,6 +10,7 @@ import com.fr.base.PaperSize;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.base.background.ColorBackground; import com.fr.base.background.ColorBackground;
import com.fr.base.background.ImageFileBackground; import com.fr.base.background.ImageFileBackground;
import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -21,8 +22,10 @@ import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
import com.fr.main.FineBook;
import com.fr.page.PaperSettingProvider; import com.fr.page.PaperSettingProvider;
import com.fr.page.ReportSettingsProvider; import com.fr.page.ReportSettingsProvider;
import com.fr.page.WatermarkPainter;
import com.fr.report.ReportHelper; import com.fr.report.ReportHelper;
import com.fr.report.cell.CellElement; import com.fr.report.cell.CellElement;
import com.fr.report.cell.FloatElement; import com.fr.report.cell.FloatElement;
@ -95,6 +98,7 @@ public class GridUI extends ComponentUI {
protected int resolution; protected int resolution;
private boolean isAuthority = false; private boolean isAuthority = false;
private WatermarkPainter watermarkPainter;
public GridUI(int resolution) { public GridUI(int resolution) {
super(); super();
@ -1089,9 +1093,25 @@ public class GridUI extends ComponentUI {
// 画Drag格子的边框. // 画Drag格子的边框.
this.paintDragCellBorder(g2d, grid); this.paintDragCellBorder(g2d, grid);
// 画水印
if (elementCase instanceof WorkSheet) {
paintWatermark(g2d, ((WorkSheet) elementCase).getBook());
}
grid.ajustEditorComponentBounds(); // refresh size grid.ajustEditorComponentBounds(); // refresh size
} }
// 绘制水印
private void paintWatermark(Graphics2D g2d, FineBook book) {
WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(book);
// 不要每次都 new 一个 WatermarkPainter
if (watermarkPainter == null || !ComparatorUtils.equals(watermarkPainter.getWatermark(), watermark)) {
watermarkPainter = new WatermarkPainter(watermark);
}
watermarkPainter.paint(g2d, gridSize.width, gridSize.height);
}
private void dealWithSizeBeforePaint(Grid grid, TemplateElementCase elementCase) { private void dealWithSizeBeforePaint(Grid grid, TemplateElementCase elementCase) {
// 取出所有的行高和列宽的List // 取出所有的行高和列宽的List

Loading…
Cancel
Save