Browse Source

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

* commit '54983e915cdf228c4ee8cd7b4d6ff0e4fa769b98':
  REPORT-11612 全局水印=>视觉优化;修复禁用面板后仍然可点击的bug
  REPORT-11612 全局水印=>功能实现
  REPORT-11612 全局水印=>基础面板重构
research/10.0
plough 6 years ago
parent
commit
1b22b578de
  1. 93
      designer-base/src/main/java/com/fr/design/dialog/AbstractTemplateServerSettingPane.java
  2. 5
      designer-base/src/main/java/com/fr/design/report/WatermarkPane.java
  3. 62
      designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java
  4. 4
      designer-base/src/main/java/com/fr/design/style/color/ColorCell.java
  5. 3
      designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java
  6. 14
      designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java
  7. 27
      designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java
  8. 2
      designer-base/src/main/java/com/fr/design/style/color/UsedColorPane.java
  9. 6
      designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java
  10. 5
      designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleBodyWatermarkEditor.java
  11. 3
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java
  12. 2
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java
  13. 6
      designer-realize/src/main/java/com/fr/design/actions/report/ReportWatermarkAction.java
  14. 67
      designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportPrintSettingPane.java
  15. 2
      designer-realize/src/main/java/com/fr/grid/GridUI.java
  16. 2
      designer-realize/src/main/java/com/fr/poly/PolyDesignUI.java

93
designer-base/src/main/java/com/fr/design/dialog/AbstractTemplateServerSettingPane.java

@ -0,0 +1,93 @@
package com.fr.design.dialog;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/**
* 封装了"为该模版单独设置、采用服务器设置"选项功能的设置面板
* Created by plough on 2018/11/7.
*/
public abstract class AbstractTemplateServerSettingPane extends BasicPane {
private static final String[] CHOOSEITEM = new String[] {
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Using_Server_Report_View_Settings")
};
protected static final int SINGLE_SET = 0;
protected static final int SERVER_SET = 1;
protected UIComboBox chooseComboBox;
protected JPanel buttonPane;
private JPanel contentPane;
protected AbstractTemplateServerSettingPane() {
initComponents();
}
private void initComponents() {
chooseComboBox = new UIComboBox(CHOOSEITEM);
chooseComboBox.addItemListener(itemListener);
UILabel belowSetLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Blow_Set"));
belowSetLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20));
buttonPane = GUICoreUtils.createFlowPane(new Component[] {
belowSetLabel, chooseComboBox}, FlowLayout.LEFT, 0, 0);
buttonPane.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 0));
this.setLayout(new BorderLayout());
this.add(buttonPane, BorderLayout.NORTH);
this.contentPane = getContentPane();
this.add(contentPane, BorderLayout.CENTER);
}
/**
* 包含设置项的主面板
*/
protected abstract JPanel getContentPane();
private ItemListener itemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
if (isUsingServerSettings()) {
populateServerSettings();
setSettingPaneEnabled(false);
} else {
setSettingPaneEnabled(true);
}
}
}
};
private void setSettingPaneEnabled(boolean enabled) {
// GUICoreUtils.setEnabled 会遍历所有 Component。所以要先设置外层,如果是生效的,再设置内层
GUICoreUtils.setEnabled(contentPane, enabled);
if (enabled) {
checkContentPaneEnabled();
}
}
protected boolean isUsingServerSettings() {
return chooseComboBox.getSelectedIndex() == SERVER_SET;
}
/**
* 整个配置面板设置为可用后可能还需要检测面板中部分区域的可用性
*/
protected void checkContentPaneEnabled() {
// do nothing
}
/**
* 读取服务器配置并 populate 到主面板中
*/
protected abstract void populateServerSettings();
}

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

@ -13,7 +13,6 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.NewColorSelectPane; import com.fr.design.style.color.NewColorSelectPane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -47,7 +46,7 @@ public class WatermarkPane extends BasicPane {
} }
private void initComponents() { private void initComponents() {
this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); this.setBorder(BorderFactory.createEmptyBorder(4, 4, -5, 4));
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -66,7 +65,7 @@ public class WatermarkPane extends BasicPane {
// 设置 // 设置
JPanel rightPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel rightPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
contentPane.add(rightPane, BorderLayout.EAST); contentPane.add(rightPane, BorderLayout.EAST);
rightPane.add(initRightPane(), BorderLayout.CENTER); rightPane.add(initRightPane(), BorderLayout.NORTH);
} }
public void populate(WatermarkAttr watermark) { public void populate(WatermarkAttr watermark) {

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

@ -0,0 +1,62 @@
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.BorderFactory;
import javax.swing.JPanel;
/**
* Created by plough on 2018/11/7.
*/
public class WatermarkSettingPane extends AbstractTemplateServerSettingPane {
private WatermarkPane watermarkPane;
public WatermarkSettingPane() {
super();
initComponents();
}
private void initComponents() {
buttonPane.setBorder(BorderFactory.createEmptyBorder(10, 8, 0, 0));
}
@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;
}
}

4
designer-base/src/main/java/com/fr/design/style/color/ColorCell.java

@ -89,6 +89,10 @@ public class ColorCell extends JComponent implements ColorSelectable {
* @param 鼠标事件 * @param 鼠标事件
*/ */
public void processMouseEvent(MouseEvent e) { public void processMouseEvent(MouseEvent e) {
if (!isEnabled()) {
return;
}
if (e == null || e.getID() == MouseEvent.MOUSE_RELEASED) { if (e == null || e.getID() == MouseEvent.MOUSE_RELEASED) {
colorSelectable.setColor(this.getColor()); colorSelectable.setColor(this.getColor());
colorSelectable.colorSetted(this); colorSelectable.colorSetted(this);

3
designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java

@ -9,6 +9,7 @@ import java.util.regex.Pattern;
import javax.swing.ButtonGroup; import javax.swing.ButtonGroup;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JColorChooser; import javax.swing.JColorChooser;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SpinnerNumberModel; import javax.swing.SpinnerNumberModel;
@ -706,7 +707,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec
mainPanel.add(hexPanel, BorderLayout.SOUTH); mainPanel.add(hexPanel, BorderLayout.SOUTH);
JPanel rightPane = new JPanel(new BorderLayout()); JPanel rightPane = new JPanel(new BorderLayout());
SpecialUIButton pickColorButton = PickColorButtonFactory.getPickColorButton(this, PickColorButtonFactory.IconType.ICON18, true); JButton pickColorButton = PickColorButtonFactory.getPickColorButton(this, PickColorButtonFactory.IconType.ICON18, true);
JPanel blankArea = new JPanel(); JPanel blankArea = new JPanel();
blankArea.setPreferredSize(new Dimension(100, 175)); blankArea.setPreferredSize(new Dimension(100, 175));
rightPane.add(blankArea, BorderLayout.CENTER); rightPane.add(blankArea, BorderLayout.CENTER);

14
designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java

@ -31,8 +31,6 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
// color setting action. // color setting action.
private ArrayList<ChangeListener> colorChangeListenerList = new ArrayList<ChangeListener>(); private ArrayList<ChangeListener> colorChangeListenerList = new ArrayList<ChangeListener>();
// 颜色选择器
private ColorSelectDetailPane pane;
// 是否支持透明 // 是否支持透明
private boolean isSupportTransparent; private boolean isSupportTransparent;
@ -52,10 +50,10 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
/** /**
* Constructor. * Constructor.
*/ */
public NewColorSelectPane(boolean isSupportTransparent) { NewColorSelectPane(boolean isSupportTransparent) {
this.isSupportTransparent = isSupportTransparent; this.isSupportTransparent = isSupportTransparent;
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5)); this.setBorder(new UIRoundedBorder(UIConstants.TOOLBAR_BORDER_COLOR, 1, 5));
if (isSupportTransparent) { if (isSupportTransparent) {
UIButton transpanrentButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency")); UIButton transpanrentButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency"));
this.add(transpanrentButton, BorderLayout.NORTH); this.add(transpanrentButton, BorderLayout.NORTH);
@ -96,12 +94,13 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
// mod by anchore 16/11/16 // mod by anchore 16/11/16
UIButton customButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_More_Color")); UIButton customButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_More_Color"));
customButton.addMouseListener(new MouseAdapter() { customButton.addActionListener(new ActionListener() {
@Override @Override
public void mousePressed(MouseEvent e) { public void actionPerformed(ActionEvent e) {
customButtonPressed(); customButtonPressed();
} }
}); });
customButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); customButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
JPanel centerPane1 = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel centerPane1 = FRGUIPaneFactory.createBorderLayout_S_Pane();
centerPane1.setBorder(BorderFactory.createEmptyBorder(2, 8, 0, 8)); centerPane1.setBorder(BorderFactory.createEmptyBorder(2, 8, 0, 8));
@ -183,7 +182,8 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
} }
protected void customButtonPressed() { protected void customButtonPressed() {
pane = new ColorSelectDetailPane(Color.WHITE); // 颜色选择器
ColorSelectDetailPane pane = new ColorSelectDetailPane(Color.WHITE);
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, this); ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, this);
} }

27
designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java

@ -2,27 +2,32 @@ package com.fr.design.style.color;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.gui.ibutton.SpecialUIButton; import com.fr.design.gui.ibutton.SpecialUIButton;
import com.fr.design.gui.ibutton.UIBasicButtonUI;
import javax.swing.*; import javax.swing.*;
import javax.swing.plaf.ButtonUI; import javax.swing.plaf.ButtonUI;
import javax.swing.plaf.basic.BasicButtonUI;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
/** /**
* Created by plough on 2016/12/22. * Created by plough on 2016/12/22.
*/ */
public class PickColorButtonFactory { class PickColorButtonFactory {
private static int iconSize; private static int iconSize;
private static final int SIZE_16 = 16; private static final int SIZE_16 = 16;
private static final int SIZE_18 = 18; private static final int SIZE_18 = 18;
private static IconType iconType; private static IconType iconType;
private static Image iconImage; private static Image iconImage;
public static SpecialUIButton getPickColorButton(ColorSelectable colorSelectable, IconType iconType) { /**
return getPickColorButton(colorSelectable, iconType, false); * 生成取色按钮
} * @param colorSelectable 接收取到的颜色值的对象
* @param iconType IconType 枚举可选择 16px 18px 两个尺寸
public static SpecialUIButton getPickColorButton(final ColorSelectable colorSelectable, IconType iconType, final boolean setColorRealTime) { * @param setColorRealTime 是否在取色过程中实时更新颜色值
* @return SpecialUIButton 屏幕取色按钮
*/
static JButton getPickColorButton(final ColorSelectable colorSelectable, IconType iconType, final boolean setColorRealTime) {
SpecialUIButton pickColorButton = new SpecialUIButton(new WhiteButtonUI()); SpecialUIButton pickColorButton = new SpecialUIButton(new WhiteButtonUI());
PickColorButtonFactory.iconType = iconType; PickColorButtonFactory.iconType = iconType;
@ -37,9 +42,9 @@ public class PickColorButtonFactory {
pickColorButton.setPreferredSize(new Dimension(iconSize, iconSize)); pickColorButton.setPreferredSize(new Dimension(iconSize, iconSize));
pickColorButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); pickColorButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
pickColorButton.addMouseListener(new MouseAdapter() { pickColorButton.addActionListener(new ActionListener() {
@Override @Override
public void mousePressed(MouseEvent e) { public void actionPerformed(ActionEvent e) {
new ColorPicker(colorSelectable, setColorRealTime); new ColorPicker(colorSelectable, setColorRealTime);
} }
}); });
@ -47,12 +52,14 @@ public class PickColorButtonFactory {
return pickColorButton; return pickColorButton;
} }
// 取色器按钮使用的图标 /**
* 取色按钮可使用的图标尺寸
*/
public enum IconType { public enum IconType {
ICON16, ICON18 ICON16, ICON18
} }
private static class WhiteButtonUI extends ButtonUI { private static class WhiteButtonUI extends UIBasicButtonUI {
@Override @Override
public void paint(Graphics g, JComponent c) { public void paint(Graphics g, JComponent c) {
super.paint(g, c); super.paint(g, c);

2
designer-base/src/main/java/com/fr/design/style/color/UsedColorPane.java

@ -72,7 +72,7 @@ public class UsedColorPane extends BasicPane {
int i = 0; int i = 0;
if (needPickColorButton) { if (needPickColorButton) {
// 取色按钮 // 取色按钮
SpecialUIButton pickColorButton = PickColorButtonFactory.getPickColorButton(selectable, PickColorButtonFactory.IconType.ICON16, setColorRealTime); JButton pickColorButton = PickColorButtonFactory.getPickColorButton(selectable, PickColorButtonFactory.IconType.ICON16, setColorRealTime);
panel.add(pickColorButton); panel.add(pickColorButton);
i++; i++;
this.reserveCells += 1; this.reserveCells += 1;

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

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

@ -1,77 +1,36 @@
package com.fr.design.webattr.printsettings; package com.fr.design.webattr.printsettings;
import com.fr.base.print.PrintSettingsAttrMark; import com.fr.base.print.PrintSettingsAttrMark;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.AbstractTemplateServerSettingPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.report.core.ReportUtils; import com.fr.report.core.ReportUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/** /**
* 模版->打印设置 * 模版->打印设置
* Created by plough on 2018/3/6. * Created by plough on 2018/3/6.
*/ */
public class ReportPrintSettingPane extends BasicPane { public class ReportPrintSettingPane extends AbstractTemplateServerSettingPane {
private static final String[] CHOOSEITEM = new String[] {
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Using_Server_Report_View_Settings")
};
private static final int SINGLE_SET = 0;
private static final int SERVER_SET = 1;
private UIComboBox chooseComboBox;
private PrintSettingPane printSettingPane; private PrintSettingPane printSettingPane;
public ReportPrintSettingPane() { public ReportPrintSettingPane() {
initComponents();
}
private void initComponents() {
chooseComboBox = new UIComboBox(CHOOSEITEM);
chooseComboBox.addItemListener(itemListener);
UILabel belowSetLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Blow_Set") + ":");
JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[] {
belowSetLabel, chooseComboBox}, FlowLayout.LEFT, 0, 0);
buttonPane.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 0));
printSettingPane = new PrintSettingPane();
this.setLayout(new BorderLayout());
this.add(buttonPane, BorderLayout.NORTH);
this.add(printSettingPane, BorderLayout.CENTER);
} }
private ItemListener itemListener = new ItemListener() { @Override
@Override protected JPanel getContentPane() {
public void itemStateChanged(ItemEvent e) { if (printSettingPane == null) {
if (e.getStateChange() == ItemEvent.SELECTED) { printSettingPane = new PrintSettingPane();
if (chooseComboBox.getSelectedIndex() == 0) {
setSettingPaneEnabled(true);
} else {
populateServerSettings();
setSettingPaneEnabled(false);
}
}
} }
}; return printSettingPane;
}
private void setSettingPaneEnabled(boolean enabled) { @Override
// GUICoreUtils.setEnabled 会遍历所有 Component。所以要先设置外层,如果是生效的,再设置内层 protected void checkContentPaneEnabled() {
GUICoreUtils.setEnabled(printSettingPane, enabled); printSettingPane.checkEnabled();
if (enabled) {
printSettingPane.checkEnabled();
}
} }
private void populateServerSettings() { protected void populateServerSettings() {
PrintSettingsAttrMark printSettings = ReportUtils.getPrintSettingsFromServerConfig(); PrintSettingsAttrMark printSettings = ReportUtils.getPrintSettingsFromServerConfig();
printSettingPane.populate(printSettings); printSettingPane.populate(printSettings);
} }
@ -88,7 +47,7 @@ public class ReportPrintSettingPane extends BasicPane {
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