Browse Source

Merge pull request #1044 in DESIGN/design from ~HUGH.C/design:feature/10.0 to feature/10.0

* commit '0d025f1e689829d4687b88de720459407197f585':
  REPORT-19008 水印增加密度设置
  REPORT-19008 水印增加密度设置
research/11.0
Hugh.C 5 years ago
parent
commit
fa112e076c
  1. 69
      designer-base/src/main/java/com/fr/design/report/WatermarkPane.java

69
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;
@ -14,14 +15,18 @@ import com.fr.design.style.color.NewColorSelectPane;
import com.fr.design.utils.gui.GUICoreUtils;
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.Dimension;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
@ -37,9 +42,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 +84,7 @@ public class WatermarkPane extends BasicPane {
}
populateFourmula(watermark.getText());
populateFontSize(watermark.getFontSize());
populateWatermarkGap(watermark);
populateColor(watermark.getColor());
paintPreviewPane();
}
@ -81,6 +93,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 +112,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 +164,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());
}

Loading…
Cancel
Save