|
|
@ -6,6 +6,7 @@ import com.fr.design.formula.TinyFormulaPane; |
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
import com.fr.design.gui.icontainer.UIScrollPane; |
|
|
|
import com.fr.design.gui.icontainer.UIScrollPane; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
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.gui.style.FRFontPane; |
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
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 com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.BorderFactory; |
|
|
|
|
|
|
|
import javax.swing.SwingConstants; |
|
|
|
import javax.swing.JComponent; |
|
|
|
import javax.swing.JComponent; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
import javax.swing.event.DocumentEvent; |
|
|
|
import javax.swing.event.DocumentEvent; |
|
|
|
import javax.swing.event.DocumentListener; |
|
|
|
import javax.swing.event.DocumentListener; |
|
|
|
|
|
|
|
import java.awt.Dimension; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Color; |
|
|
|
|
|
|
|
import java.awt.event.FocusEvent; |
|
|
|
|
|
|
|
import java.awt.event.FocusListener; |
|
|
|
import java.awt.event.ItemEvent; |
|
|
|
import java.awt.event.ItemEvent; |
|
|
|
import java.awt.event.ItemListener; |
|
|
|
import java.awt.event.ItemListener; |
|
|
|
|
|
|
|
|
|
|
@ -37,9 +42,15 @@ public class WatermarkPane extends BasicPane { |
|
|
|
private TinyFormulaPane formulaPane; |
|
|
|
private TinyFormulaPane formulaPane; |
|
|
|
// 字号
|
|
|
|
// 字号
|
|
|
|
private UIComboBox fontSizeComboBox; |
|
|
|
private UIComboBox fontSizeComboBox; |
|
|
|
|
|
|
|
//横向间距
|
|
|
|
|
|
|
|
private UISpinner horizontalGapSpinner; |
|
|
|
|
|
|
|
//横向间距
|
|
|
|
|
|
|
|
private UISpinner verticalGapSpinner; |
|
|
|
// 文字颜色
|
|
|
|
// 文字颜色
|
|
|
|
private NewColorSelectPane colorPane; |
|
|
|
private NewColorSelectPane colorPane; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final Dimension SPINNER_DIMENSION = new Dimension(75, 20); |
|
|
|
|
|
|
|
|
|
|
|
public WatermarkPane() { |
|
|
|
public WatermarkPane() { |
|
|
|
initComponents(); |
|
|
|
initComponents(); |
|
|
|
} |
|
|
|
} |
|
|
@ -73,6 +84,7 @@ public class WatermarkPane extends BasicPane { |
|
|
|
} |
|
|
|
} |
|
|
|
populateFourmula(watermark.getText()); |
|
|
|
populateFourmula(watermark.getText()); |
|
|
|
populateFontSize(watermark.getFontSize()); |
|
|
|
populateFontSize(watermark.getFontSize()); |
|
|
|
|
|
|
|
populateWatermarkGap(watermark); |
|
|
|
populateColor(watermark.getColor()); |
|
|
|
populateColor(watermark.getColor()); |
|
|
|
paintPreviewPane(); |
|
|
|
paintPreviewPane(); |
|
|
|
} |
|
|
|
} |
|
|
@ -81,6 +93,8 @@ public class WatermarkPane extends BasicPane { |
|
|
|
WatermarkAttr watermark = new WatermarkAttr(); |
|
|
|
WatermarkAttr watermark = new WatermarkAttr(); |
|
|
|
watermark.setText(formulaPane.getUITextField().getText()); |
|
|
|
watermark.setText(formulaPane.getUITextField().getText()); |
|
|
|
watermark.setFontSize((int)fontSizeComboBox.getSelectedItem()); |
|
|
|
watermark.setFontSize((int)fontSizeComboBox.getSelectedItem()); |
|
|
|
|
|
|
|
watermark.setHorizontalGap((int) horizontalGapSpinner.getValue()); |
|
|
|
|
|
|
|
watermark.setVerticalGap((int) verticalGapSpinner.getValue()); |
|
|
|
watermark.setColor(colorPane.getColor()); |
|
|
|
watermark.setColor(colorPane.getColor()); |
|
|
|
colorPane.updateUsedColor(); |
|
|
|
colorPane.updateUsedColor(); |
|
|
|
return watermark; |
|
|
|
return watermark; |
|
|
@ -98,20 +112,39 @@ public class WatermarkPane extends BasicPane { |
|
|
|
formulaPane = new TinyFormulaPane(); |
|
|
|
formulaPane = new TinyFormulaPane(); |
|
|
|
fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); |
|
|
|
fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); |
|
|
|
fontSizeComboBox.setEditable(true); |
|
|
|
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)); |
|
|
|
JPanel fontSizeTypePane = new JPanel(new BorderLayout(10,0)); |
|
|
|
fontSizeTypePane.add(fontSizeComboBox, BorderLayout.CENTER); |
|
|
|
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(); |
|
|
|
colorPane = new NewColorSelectPane(); |
|
|
|
JPanel colorLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
JPanel colorLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
colorLabelPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Text_Color")), BorderLayout.NORTH); |
|
|
|
colorLabelPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Text_Color")), BorderLayout.NORTH); |
|
|
|
|
|
|
|
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
double[] rowSize = {p,p,p}; |
|
|
|
double[] rowSize = {p, p, p, p, p}; |
|
|
|
double[] columnSize = { p, MAX_WIDTH}; |
|
|
|
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_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_Basic_Font_Size")), fontSizeTypePane}, |
|
|
|
|
|
|
|
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Watermark_Gap")),watermarkGapPane }, |
|
|
|
|
|
|
|
{null,watermarkGapTipsPane }, |
|
|
|
{colorLabelPane, colorPane}, |
|
|
|
{colorLabelPane, colorPane}, |
|
|
|
}, rowSize, columnSize, 10); |
|
|
|
}, rowSize, columnSize, 10); |
|
|
|
rightContentPane.setBorder(BorderFactory.createEmptyBorder(15, 12, 10, 12)); |
|
|
|
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(){ |
|
|
|
protected void paintPreviewPane(){ |
|
|
|
watermarkPreviewPane.repaint(update()); |
|
|
|
watermarkPreviewPane.repaint(update()); |
|
|
|
} |
|
|
|
} |
|
|
|