Browse Source

Merge pull request #40 in DESIGN/design from ~PLOUGH/10-design:feature/10.0 to feature/10.0

* commit '868e95047dd04dc45486f38372b4867a01937779':
  REPORT-8125 水印 设计器配置界面与实时预览=>完善国际化
  REPORT-8125 水印 设计器配置界面与实 时预览=>核心功能完成
  REPORT-8125 水印 设计器配置界面与实时预览=>完成基本框架
master
superman 7 years ago
parent
commit
3d268c04da
  1. 1
      designer-base/src/com/fr/design/constants/UIConstants.java
  2. BIN
      designer-base/src/com/fr/design/images/dialog/watermark/watermark_background.png
  3. BIN
      designer-base/src/com/fr/design/images/m_report/watermark.png
  4. 15
      designer-base/src/com/fr/design/menu/KeySetUtils.java
  5. 170
      designer-base/src/com/fr/design/report/WatermarkPane.java
  6. 84
      designer-base/src/com/fr/design/report/WatermarkPreviewPane.java
  7. 48
      designer-form/src/com/fr/design/mainframe/widget/accessibles/AccessibleBodyWatermarkEditor.java
  8. 14
      designer-form/src/com/fr/design/mainframe/widget/renderer/WatermarkRenderer.java
  9. 26
      designer-form/src/com/fr/design/mainframe/widget/wrappers/WatermarkWrapper.java
  10. 29
      designer-form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java
  11. 16
      designer-form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java
  12. 48
      designer-realize/src/com/fr/design/actions/report/ReportWatermarkAction.java
  13. 2
      designer-realize/src/com/fr/design/mainframe/ReportComponent.java

1
designer-base/src/com/fr/design/constants/UIConstants.java

@ -164,6 +164,7 @@ public interface UIConstants {
public static final BufferedImage POP_BUTTON_UP = BaseUtils.readImage("com/fr/design/images/buttonicon/popuparrow.png");
public static final BufferedImage DRAG_DOWN_SELECTED_SMALL = BaseUtils.readImage("com/fr/design/images/buttonicon/downSelected.png");
public static final BufferedImage DRAG_LEFT_NORMAL_SMALL = BaseUtils.readImage("com/fr/design/images/buttonicon/leftNormal.png");
public static final BufferedImage WATERMARK_BACKGROUND = BaseUtils.readImage("/com/fr/design/images/dialog/watermark/watermark_background.png");
public static final int MODEL_NORMAL = 0;
public static final int MODEL_PRESS = 1;
public static final Icon ARROW_DOWN_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/arrowdown.png");

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 558 B

15
designer-base/src/com/fr/design/menu/KeySetUtils.java

@ -601,6 +601,21 @@ public class KeySetUtils {
}
};
public static final MenuKeySet REPORT_WATERMARK = new MenuKeySet() {
@Override
public char getMnemonic() { return 'M'; }
@Override
public String getMenuName() {
return Inter.getLocText("FR-Designer_WaterMark");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
public static final MenuKeySet REPORT_WRITE = new MenuKeySet() {
@Override

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

@ -0,0 +1,170 @@
package com.fr.design.report;
import com.fr.base.Watermark;
import com.fr.design.dialog.BasicPane;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.style.FRFontPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.NewColorSelectPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/**
* Created by plough on 2018/5/15.
*/
public class WatermarkPane extends BasicPane {
private static final int MAX_WIDTH = 160;
// 水印预览面板
private WatermarkPreviewPane watermarkPreviewPane;
// 文字
private TinyFormulaPane formulaPane;
// 字号
private UIComboBox fontSizeComboBox;
// 文字颜色
private NewColorSelectPane colorPane;
public WatermarkPane() {
initComponents();
}
private void initComponents() {
this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.add(contentPane, BorderLayout.CENTER);
// 预览
JPanel leftPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
contentPane.add(leftPane, BorderLayout.CENTER);
leftPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("FR-Designer-Widget-Style_Preview"), null));
JPanel previewPaneWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane();
leftPane.add(previewPaneWrapper, BorderLayout.CENTER);
previewPaneWrapper.setBorder(BorderFactory.createEmptyBorder(2, 8, 4, 8));
watermarkPreviewPane = new WatermarkPreviewPane();
previewPaneWrapper.add(watermarkPreviewPane, BorderLayout.CENTER);
// 设置
JPanel rightPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
contentPane.add(rightPane, BorderLayout.EAST);
rightPane.add(initRightPane(), BorderLayout.CENTER);
}
public void populate(Watermark watermark) {
populateFourmula(watermark.getText());
populateFontSize(watermark.getFontSize());
populateColor(watermark.getColor());
paintPreviewPane();
}
public Watermark update() {
Watermark watermark = new Watermark();
watermark.setText(formulaPane.getUITextField().getText());
watermark.setFontSize((int)fontSizeComboBox.getSelectedItem());
watermark.setColor(colorPane.getColor());
return watermark;
}
public TinyFormulaPane getFormulaPane() {
return formulaPane;
}
public void setFormulaPane(TinyFormulaPane formulaPane) {
this.formulaPane = formulaPane;
}
protected UIScrollPane initRightPane(){
formulaPane = new TinyFormulaPane();
fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES);
JPanel fontSizeTypePane = new JPanel(new BorderLayout(10,0));
fontSizeTypePane.add(fontSizeComboBox, BorderLayout.CENTER);
colorPane = new NewColorSelectPane();
JPanel colorLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
colorLabelPane.add(new UILabel(Inter.getLocText("FR-Designer_Text_Color")), BorderLayout.NORTH);
double p = TableLayout.PREFERRED;
double[] rowSize = {p,p,p};
double[] columnSize = { p, MAX_WIDTH};
JPanel rightContentPane = TableLayoutHelper.createCommonTableLayoutPane( new JComponent[][]{
{new UILabel(Inter.getLocText("FR-Designer_Watermark_Text")), formulaPane},
{new UILabel(Inter.getLocText("FR-Designer_Font_Size")), fontSizeTypePane},
{colorLabelPane, colorPane},
}, rowSize, columnSize, 10);
rightContentPane.setBorder(BorderFactory.createEmptyBorder(15, 12, 10, 12));
UIScrollPane configPane = new UIScrollPane(rightContentPane);
configPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("FR-Designer_Config"),null));
return configPane;
}
protected void populateFontSize(int fontSize){
this.fontSizeComboBox.setSelectedItem(fontSize);
this.fontSizeComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
paintPreviewPane();
}
});
}
protected void paintPreviewPane(){
watermarkPreviewPane.repaint(update());
}
private void populateFourmula(String formula) {
this.formulaPane.populateBean(formula);
this.formulaPane.getUITextField().getDocument()
.addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
paintPreviewPane();
}
@Override
public void removeUpdate(DocumentEvent e) {
paintPreviewPane();
}
@Override
public void changedUpdate(DocumentEvent e) {
paintPreviewPane();
}
});
}
private void populateColor(Color color) {
colorPane.setColor(color);
colorPane.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
paintPreviewPane();
}
});
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_WaterMark");
}
}

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

@ -0,0 +1,84 @@
package com.fr.design.report;
import com.fr.base.Watermark;
import com.fr.design.constants.UIConstants;
import com.fr.general.FRFont;
import com.fr.stable.StringUtils;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;
/**
* Created by plough on 2018/5/15.
*/
public class WatermarkPreviewPane extends JPanel {
private static final double SCALE_FACTOR = 3; // 水印层的放大比例
private static final int ROTATE_DEGREE = -20; // 旋转角度
// 绘制水印层的坐标,用来控制图层偏移
private static final int MARK_X = 0;
private static final int MARK_Y = -120;
private int horizontalGap = 20; // 水平间隔(一个中文字符宽度)
private int verticalGap = 40; // 垂直间隔(两个中文字符宽度)
private Watermark watermark;
public WatermarkPreviewPane() {
this.watermark = new Watermark();
repaint();
}
/**
* 重新画
*/
public void repaint(Watermark watermark){
this.watermark = watermark;
super.repaint();
}
private void updateGap(FontMetrics fontMetrics) {
horizontalGap = fontMetrics.stringWidth("帆"); // 任意一个中文字符
verticalGap = horizontalGap * 2;
}
private int getLineHeight() {
return horizontalGap;
}
private BufferedImage paintWatermark() {
int width = (int)(this.getWidth() * SCALE_FACTOR);
int height = (int)(this.getHeight() * SCALE_FACTOR);
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics g = image.getGraphics();
g.setColor(watermark.getColor());
g.setFont(FRFont.getInstance().applySize(watermark.getFontSize()));
updateGap(g.getFontMetrics());
for (int y = getLineHeight(); y < height; y += verticalGap) {
for (int x = 0; x < width; x += horizontalGap) {
g.drawString(watermark.getText(), x, y);
x += g.getFontMetrics().stringWidth(watermark.getText());
}
y += getLineHeight();
}
return image;
}
@Override
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2d = (Graphics2D)g;
g2d.drawImage(UIConstants.WATERMARK_BACKGROUND, 0, 0, this.getWidth(), this.getHeight(), null);
BufferedImage markImage = paintWatermark();
g2d.rotate(
Math.toRadians(ROTATE_DEGREE),
(double) markImage.getWidth() / 2,
(double) markImage.getHeight() / 2
);
g.drawImage(markImage, MARK_X, MARK_Y, null);
}
}

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

@ -0,0 +1,48 @@
package com.fr.design.mainframe.widget.accessibles;
import com.fr.base.Watermark;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.widget.editors.ITextComponent;
import com.fr.design.mainframe.widget.renderer.WatermarkRenderer;
import com.fr.design.mainframe.widget.wrappers.WatermarkWrapper;
import com.fr.design.report.WatermarkPane;
import javax.swing.SwingUtilities;
import java.awt.Dimension;
/**
* Created by plough on 2018/5/15.
*/
public class AccessibleBodyWatermarkEditor extends UneditableAccessibleEditor {
private WatermarkPane watermarkPane;
public AccessibleBodyWatermarkEditor() {
super(new WatermarkWrapper());
}
@Override
protected ITextComponent createTextField() {
return new RendererField(new WatermarkRenderer());
}
@Override
protected void showEditorPane() {
if (watermarkPane == null) {
watermarkPane = new WatermarkPane();
watermarkPane.setPreferredSize(new Dimension(600, 400));
}
BasicDialog dlg = watermarkPane.showWindow(SwingUtilities.getWindowAncestor(this));
dlg.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
setValue(watermarkPane.update());
fireStateChanged();
}
});
watermarkPane.populate((Watermark) getValue());
dlg.setVisible(true);
}
}

14
designer-form/src/com/fr/design/mainframe/widget/renderer/WatermarkRenderer.java

@ -0,0 +1,14 @@
package com.fr.design.mainframe.widget.renderer;
import com.fr.design.mainframe.widget.wrappers.WatermarkWrapper;
/**
* Created by plough on 2018/5/15.
*/
public class WatermarkRenderer extends EncoderCellRenderer {
public WatermarkRenderer() {
super(new WatermarkWrapper());
}
}

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

@ -0,0 +1,26 @@
package com.fr.design.mainframe.widget.wrappers;
import com.fr.base.Watermark;
import com.fr.design.Exception.ValidationException;
import com.fr.design.designer.properties.Decoder;
import com.fr.design.designer.properties.Encoder;
/**
* Created by plough on 2018/5/15.
*/
public class WatermarkWrapper implements Encoder, Decoder {
@Override
public Object decode(String txt) {
return new Watermark();
}
@Override
public void validate(String txt) throws ValidationException {
// do nothing
}
@Override
public String encode(Object v) {
return ((Watermark)v).getText();
}
}

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

@ -1,8 +1,11 @@
package com.fr.design.widget.ui.designer.layout;
import com.fr.base.Watermark;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.properties.items.FRLayoutTypeItems;
import com.fr.design.designer.properties.items.Item;
@ -10,12 +13,11 @@ import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.FormDesigner;
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.widget.ui.designer.component.WidgetBoundPane;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WAbsoluteBodyLayout;
import com.fr.form.ui.container.WAbsoluteLayout;
@ -23,8 +25,11 @@ import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.Arrays;
import java.util.Comparator;
@ -32,11 +37,13 @@ import java.util.Comparator;
* Created by ibm on 2017/8/2.
*/
public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
private static final int EACH_ROW_COUNT = 4;
private AccessibleWLayoutBorderStyleEditor borderStyleEditor;
private AccessibleBodyWatermarkEditor watermarkEditor;
private UIComboBox layoutCombox;
private WBodyLayoutType layoutType = WBodyLayoutType.ABSOLUTE;
private static final int EACH_ROW_COUNT = 4;
public FRAbsoluteBodyLayoutDefinePane(XCreator xCreator) {
super(xCreator);
@ -46,8 +53,12 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
public void initComponent() {
super.initComponent();
borderStyleEditor = new AccessibleWLayoutBorderStyleEditor();
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Style")), borderStyleEditor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1);
watermarkEditor = new AccessibleBodyWatermarkEditor();
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Style")), borderStyleEditor},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), watermarkEditor}
}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1);
JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
borderPane.add(jPanel, BorderLayout.CENTER);
@ -88,6 +99,7 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
public void populateSubPane(WAbsoluteLayout ob) {
layoutCombox.setSelectedIndex(1);
borderStyleEditor.setValue(ob.getBorderStyle());
watermarkEditor.setValue(ob.getWatermark());
}
public WAbsoluteBodyLayout updateSubPane() {
@ -105,6 +117,7 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
}
}
layout.setBorderStyle((LayoutBorderStyle) borderStyleEditor.getValue());
layout.setWatermark((Watermark) watermarkEditor.getValue());
return layout;
}

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

@ -1,5 +1,6 @@
package com.fr.design.widget.ui.designer.layout;
import com.fr.base.Watermark;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator;
@ -20,6 +21,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelectionUtils;
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.widget.ui.designer.AbstractDataModify;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
@ -46,6 +48,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
private UISpinner componentIntervel;
private PaddingBoundPane paddingBound;
private AccessibleWLayoutBorderStyleEditor stylePane;
private AccessibleBodyWatermarkEditor watermarkEditor;
public FRFitLayoutDefinePane(XCreator xCreator) {
super(xCreator);
@ -67,9 +70,13 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
public JPanel createAdvancePane() {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
stylePane = new AccessibleWLayoutBorderStyleEditor();
watermarkEditor = new AccessibleBodyWatermarkEditor();
paddingBound = new PaddingBoundPane();
JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Style")), stylePane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1);
JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane(
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));
jPanel.add(paddingBound, BorderLayout.CENTER);
jPanel.add(jp2, BorderLayout.NORTH);
@ -130,6 +137,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
adaptComboBox.setSelectedIndex(ob.getCompState());
componentIntervel.setValue(ob.getCompInterval());
stylePane.setValue(ob.getBorderStyle());
watermarkEditor.setValue(ob.getWatermark());
}
private XLayoutContainer selectedBodyLayout(FormDesigner formDesigner) {
@ -149,6 +157,10 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
if(borderStyle != null){
layout.setBorderStyle(borderStyle);
}
Watermark watermark = (Watermark) watermarkEditor.getValue();
if (watermark != null) {
layout.setWatermark(watermark);
}
Item item = (Item) layoutComboBox.getSelectedItem();
Object value = item.getValue();
int state = 0;

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

@ -0,0 +1,48 @@
package com.fr.design.actions.report;
import com.fr.base.BaseUtils;
import com.fr.design.actions.ReportComponentAction;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ReportComponent;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.WatermarkPane;
import com.fr.report.core.ReportUtils;
import com.fr.report.stable.ReportSettings;
/**
* Created by plough on 2018/5/15.
*/
public class ReportWatermarkAction extends ReportComponentAction<ReportComponent> {
public ReportWatermarkAction(ReportComponent rc) {
super(rc);
this.setMenuKeySet(KeySetUtils.REPORT_WATERMARK);
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/watermark.png"));
}
/**
* 执行动作
* @return 是否执行成功
*/
public boolean executeActionReturnUndoRecordNeeded() {
final ReportComponent reportPane = this.getEditingComponent();
if (reportPane == null) {
return false;
}
final WatermarkPane watermarkPane = new WatermarkPane();
ReportSettings reportSettings = (ReportSettings) ReportUtils.getReportSettings(reportPane.getTemplateReport());
watermarkPane.populate(reportSettings.getWatermark());
watermarkPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
reportSettings.setWatermark(watermarkPane.update());
reportPane.fireTargetModified();
}
}).setVisible(true);
return false;
}
}

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

@ -10,6 +10,7 @@ import com.fr.design.actions.report.ReportBackgroundAction;
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.actions.report.ReportWatermarkAction;
import com.fr.design.designer.TargetComponent;
import com.fr.design.menu.NameSeparator;
import com.fr.design.menu.ShortCut;
@ -56,6 +57,7 @@ public abstract class ReportComponent<T extends TemplateReport, E extends Elemen
new ReportHeaderAction(this),
new ReportFooterAction(this),
new ReportBackgroundAction(this),
new ReportWatermarkAction(this),
};
}

Loading…
Cancel
Save