Browse Source

REPORT-11612 全局水印=>功能实现

research/10.0
plough 6 years ago
parent
commit
2b56fd924a
  1. 52
      designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java
  2. 6
      designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java
  3. 5
      designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleBodyWatermarkEditor.java
  4. 3
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java
  5. 2
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java
  6. 6
      designer-realize/src/main/java/com/fr/design/actions/report/ReportWatermarkAction.java
  7. 2
      designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportPrintSettingPane.java
  8. 2
      designer-realize/src/main/java/com/fr/grid/GridUI.java
  9. 2
      designer-realize/src/main/java/com/fr/poly/PolyDesignUI.java

52
designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java

@ -0,0 +1,52 @@
package com.fr.design.report;
import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.design.dialog.AbstractTemplateServerSettingPane;
import com.fr.report.core.ReportUtils;
import javax.swing.JPanel;
/**
* Created by plough on 2018/11/7.
*/
public class WatermarkSettingPane extends AbstractTemplateServerSettingPane {
private WatermarkPane watermarkPane;
@Override
protected JPanel getContentPane() {
if (watermarkPane == null) {
watermarkPane = new WatermarkPane();
}
return watermarkPane;
}
@Override
protected void populateServerSettings() {
WatermarkAttr watermarkAttr = ReportUtils.getWatermarkAttrFromServerConfig();
watermarkPane.populate(watermarkAttr);
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark");
}
public void populate(WatermarkAttr watermark) {
if (!watermark.isValid()) {
chooseComboBox.setSelectedIndex(SERVER_SET);
populateServerSettings();
return;
}
chooseComboBox.setSelectedIndex(SINGLE_SET);
watermarkPane.populate(watermark);
}
public WatermarkAttr update() {
WatermarkAttr watermark = watermarkPane.update();
if (isUsingServerSettings()) {
watermark.setValid(false);
}
return watermark;
}
}

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

@ -18,6 +18,7 @@ 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.form.main.parameter.FormParameterUI;
import com.fr.page.WatermarkPainter; import com.fr.page.WatermarkPainter;
import com.fr.report.core.ReportUtils; import com.fr.report.core.ReportUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -113,7 +114,10 @@ public class FormDesignerUI extends ComponentUI {
// 绘制水印 // 绘制水印
private void paintWatermark(Graphics2D g) { private void paintWatermark(Graphics2D g) {
WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(designer.getTarget()); if (designer.getTarget() instanceof FormParameterUI) { // cpt 的参数面板
return;
}
WatermarkAttr watermark = ReportUtils.getWatermarkAttrFromTemplateAndGlobal(designer.getTarget());
WatermarkPainter painter = WatermarkPainter.createPainter(watermark, designer.getResolution()); WatermarkPainter painter = WatermarkPainter.createPainter(watermark, designer.getResolution());
painter.paint(g, 0, 0, designer.getArea().getBounds()); painter.paint(g, 0, 0, designer.getArea().getBounds());
} }

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

@ -7,6 +7,7 @@ import com.fr.design.mainframe.widget.editors.ITextComponent;
import com.fr.design.mainframe.widget.renderer.WatermarkRenderer; import com.fr.design.mainframe.widget.renderer.WatermarkRenderer;
import com.fr.design.mainframe.widget.wrappers.WatermarkWrapper; import com.fr.design.mainframe.widget.wrappers.WatermarkWrapper;
import com.fr.design.report.WatermarkPane; import com.fr.design.report.WatermarkPane;
import com.fr.design.report.WatermarkSettingPane;
import com.fr.intelli.record.Focus; import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original; import com.fr.intelli.record.Original;
import com.fr.record.analyzer.EnableMetrics; import com.fr.record.analyzer.EnableMetrics;
@ -20,7 +21,7 @@ import java.awt.*;
@EnableMetrics @EnableMetrics
public class AccessibleBodyWatermarkEditor extends UneditableAccessibleEditor { public class AccessibleBodyWatermarkEditor extends UneditableAccessibleEditor {
private WatermarkPane watermarkPane; private WatermarkSettingPane watermarkPane;
public AccessibleBodyWatermarkEditor() { public AccessibleBodyWatermarkEditor() {
super(new WatermarkWrapper()); super(new WatermarkWrapper());
@ -34,7 +35,7 @@ public class AccessibleBodyWatermarkEditor extends UneditableAccessibleEditor {
@Override @Override
protected void showEditorPane() { protected void showEditorPane() {
if (watermarkPane == null) { if (watermarkPane == null) {
watermarkPane = new WatermarkPane(); watermarkPane = new WatermarkSettingPane();
watermarkPane.setPreferredSize(new Dimension(600, 400)); watermarkPane.setPreferredSize(new Dimension(600, 400));
} }
BasicDialog dlg = watermarkPane.showWindow(SwingUtilities.getWindowAncestor(this)); BasicDialog dlg = watermarkPane.showWindow(SwingUtilities.getWindowAncestor(this));

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

@ -107,8 +107,7 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
layoutCombox.setSelectedIndex(1); layoutCombox.setSelectedIndex(1);
borderStyleEditor.setValue(ob.getBorderStyle()); borderStyleEditor.setValue(ob.getBorderStyle());
boundPane.populate(); boundPane.populate();
watermarkEditor.setValue(ReportUtils.getWatermarkFromAttrMarkFile(getCurrentIOFile())); watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplate(getCurrentIOFile()));
} }
public WAbsoluteBodyLayout updateSubPane() { public WAbsoluteBodyLayout updateSubPane() {

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

@ -151,7 +151,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())); watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplate(getCurrentIOFile()));
} }
private XLayoutContainer selectedBodyLayout(FormDesigner formDesigner) { private XLayoutContainer selectedBodyLayout(FormDesigner formDesigner) {

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

@ -8,6 +8,7 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JWorkBook; import com.fr.design.mainframe.JWorkBook;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.WatermarkPane; import com.fr.design.report.WatermarkPane;
import com.fr.design.report.WatermarkSettingPane;
import com.fr.intelli.record.Focus; import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original; import com.fr.intelli.record.Original;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
@ -37,9 +38,8 @@ public class ReportWatermarkAction extends JWorkBookAction {
return; return;
} }
final WorkBook wbTpl = jwb.getTarget(); final WorkBook wbTpl = jwb.getTarget();
WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(wbTpl); WatermarkAttr watermark = ReportUtils.getWatermarkAttrFromTemplate(wbTpl);
final WatermarkSettingPane watermarkPane = new WatermarkSettingPane();
final WatermarkPane watermarkPane = new WatermarkPane();
watermarkPane.populate(watermark); watermarkPane.populate(watermark);
watermarkPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { watermarkPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override

2
designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportPrintSettingPane.java

@ -47,7 +47,7 @@ public class ReportPrintSettingPane extends AbstractTemplateServerSettingPane {
public PrintSettingsAttrMark updateBean() { public PrintSettingsAttrMark updateBean() {
PrintSettingsAttrMark printSettings = printSettingPane.updateBean(); PrintSettingsAttrMark printSettings = printSettingPane.updateBean();
if (chooseComboBox.getSelectedIndex() == SERVER_SET) { if (isUsingServerSettings()) {
printSettings.setValid(false); printSettings.setValid(false);
} }
return printSettings; return printSettings;

2
designer-realize/src/main/java/com/fr/grid/GridUI.java

@ -1114,7 +1114,7 @@ public class GridUI extends ComponentUI {
// 绘制水印 // 绘制水印
private void paintWatermark(Graphics2D g2d, FineBook book) { private void paintWatermark(Graphics2D g2d, FineBook book) {
WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(book); WatermarkAttr watermark = ReportUtils.getWatermarkAttrFromTemplateAndGlobal(book);
WatermarkPainter painter = WatermarkPainter.createPainter(watermark, resolution); WatermarkPainter painter = WatermarkPainter.createPainter(watermark, resolution);
painter.paint(g2d, gridSize.width, gridSize.height); painter.paint(g2d, gridSize.width, gridSize.height);
} }

2
designer-realize/src/main/java/com/fr/poly/PolyDesignUI.java

@ -109,7 +109,7 @@ public class PolyDesignUI extends ComponentUI {
// 绘制水印 // 绘制水印
private void paintWatermark(Graphics2D g2d, FineBook book, int width, int height) { private void paintWatermark(Graphics2D g2d, FineBook book, int width, int height) {
WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(book); WatermarkAttr watermark = ReportUtils.getWatermarkAttrFromTemplateAndGlobal(book);
WatermarkPainter painter = WatermarkPainter.createPainter(watermark, resolution); WatermarkPainter painter = WatermarkPainter.createPainter(watermark, resolution);
painter.paint(g2d, width, height); painter.paint(g2d, width, height);
} }

Loading…
Cancel
Save