From ac92a719bd60aa21b64b5d67ddde76ca20629ffc Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Mon, 26 Aug 2019 10:47:54 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-19008=20=E6=B0=B4=E5=8D=B0=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=AF=86=E5=BA=A6=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/report/WatermarkPane.java | 74 +++++++++++++++++-- 1 file changed, 66 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java b/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java index 0caa7e8b6..ef396c4cb 100644 --- a/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java +++ b/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java @@ -6,6 +6,7 @@ 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.ispinner.UISpinner; import com.fr.design.gui.style.FRFontPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; @@ -13,15 +14,14 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.style.color.NewColorSelectPane; import com.fr.design.utils.gui.GUICoreUtils; -import javax.swing.BorderFactory; -import javax.swing.JComponent; -import javax.swing.JPanel; +import javax.swing.*; 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.*; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; @@ -37,9 +37,15 @@ public class WatermarkPane extends BasicPane { private TinyFormulaPane formulaPane; // 字号 private UIComboBox fontSizeComboBox; + //横向间距 + private UISpinner horizontalGapSpinner; + //横向间距 + private UISpinner verticalGapSpinner; // 文字颜色 private NewColorSelectPane colorPane; + private static final Dimension SPINNER_DIMENSION = new Dimension(75, 20); + public WatermarkPane() { initComponents(); } @@ -73,6 +79,7 @@ public class WatermarkPane extends BasicPane { } populateFourmula(watermark.getText()); populateFontSize(watermark.getFontSize()); + populateWatermarkGap(watermark); populateColor(watermark.getColor()); paintPreviewPane(); } @@ -81,6 +88,8 @@ public class WatermarkPane extends BasicPane { WatermarkAttr watermark = new WatermarkAttr(); watermark.setText(formulaPane.getUITextField().getText()); watermark.setFontSize((int)fontSizeComboBox.getSelectedItem()); + watermark.setHorizontalGap((int) horizontalGapSpinner.getValue()); + watermark.setVerticalGap((int) verticalGapSpinner.getValue()); watermark.setColor(colorPane.getColor()); colorPane.updateUsedColor(); return watermark; @@ -98,20 +107,39 @@ public class WatermarkPane extends BasicPane { formulaPane = new TinyFormulaPane(); fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); fontSizeComboBox.setEditable(true); + horizontalGapSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 200); + verticalGapSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 100); + horizontalGapSpinner.setPreferredSize(SPINNER_DIMENSION); + verticalGapSpinner.setPreferredSize(SPINNER_DIMENSION); JPanel fontSizeTypePane = new JPanel(new BorderLayout(10,0)); fontSizeTypePane.add(fontSizeComboBox, BorderLayout.CENTER); + //水印间距面板 + JPanel watermarkGapPane = new JPanel(new BorderLayout(10, 0)); + JPanel jp = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 10, 0); + jp.add(horizontalGapSpinner); + jp.add(verticalGapSpinner); + watermarkGapPane.add(jp, BorderLayout.CENTER); + + JPanel watermarkGapTipsPane = new JPanel(new BorderLayout()); + JPanel tipsJp = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 10, 0); + tipsJp.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), SwingConstants.CENTER)); + tipsJp.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical"), SwingConstants.CENTER)); + watermarkGapTipsPane.add(tipsJp, BorderLayout.CENTER); + colorPane = new NewColorSelectPane(); JPanel colorLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); colorLabelPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Text_Color")), BorderLayout.NORTH); double p = TableLayout.PREFERRED; - double[] rowSize = {p,p,p}; - double[] columnSize = { p, MAX_WIDTH}; + double[] rowSize = {p, p, p, p, p}; + double[] columnSize = {p, MAX_WIDTH}; - JPanel rightContentPane = TableLayoutHelper.createCommonTableLayoutPane( new JComponent[][]{ + JPanel rightContentPane = TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{ {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Watermark_Text")), formulaPane}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Font_Size")), fontSizeTypePane}, + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Watermark_Gap")),watermarkGapPane }, + {null,watermarkGapTipsPane }, {colorLabelPane, colorPane}, }, rowSize, columnSize, 10); rightContentPane.setBorder(BorderFactory.createEmptyBorder(15, 12, 10, 12)); @@ -131,6 +159,36 @@ public class WatermarkPane extends BasicPane { }); } + protected void populateWatermarkGap(WatermarkAttr watermark){ + this.horizontalGapSpinner.setValue(watermark.getHorizontalGap()); + this.horizontalGapSpinner.addUISpinnerFocusListenner(new FocusListener() { + + @Override + public void focusGained(FocusEvent e) { + paintPreviewPane(); + } + + @Override + public void focusLost(FocusEvent e) { + paintPreviewPane(); + } + }); + + this.verticalGapSpinner.setValue(watermark.getVerticalGap()); + this.verticalGapSpinner.addUISpinnerFocusListenner(new FocusListener() { + + @Override + public void focusGained(FocusEvent e) { + paintPreviewPane(); + } + + @Override + public void focusLost(FocusEvent e) { + paintPreviewPane(); + } + }); + } + protected void paintPreviewPane(){ watermarkPreviewPane.repaint(update()); } From 0d025f1e689829d4687b88de720459407197f585 Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Mon, 26 Aug 2019 10:55:19 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-19008=20=E6=B0=B4=E5=8D=B0=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=AF=86=E5=BA=A6=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/report/WatermarkPane.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java b/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java index ef396c4cb..e190d4038 100644 --- a/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java +++ b/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java @@ -14,12 +14,17 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.style.color.NewColorSelectPane; import com.fr.design.utils.gui.GUICoreUtils; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.SwingConstants; +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.*; +import java.awt.Dimension; +import java.awt.BorderLayout; +import java.awt.Color; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.ItemEvent;