diff --git a/designer-base/src/main/java/com/fr/design/dialog/AbstractTemplateServerSettingPane.java b/designer-base/src/main/java/com/fr/design/dialog/AbstractTemplateServerSettingPane.java index 46c1036107..b7a425ccab 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/AbstractTemplateServerSettingPane.java +++ b/designer-base/src/main/java/com/fr/design/dialog/AbstractTemplateServerSettingPane.java @@ -26,6 +26,7 @@ public abstract class AbstractTemplateServerSettingPane extends BasicPane { protected static final int SERVER_SET = 1; protected UIComboBox chooseComboBox; + protected JPanel buttonPane; private JPanel contentPane; protected AbstractTemplateServerSettingPane() { @@ -35,8 +36,9 @@ public abstract class AbstractTemplateServerSettingPane extends BasicPane { 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[] { + 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)); 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 27a9822c6c..9b9ff09503 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 @@ -13,7 +13,6 @@ 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; @@ -47,7 +46,7 @@ public class WatermarkPane extends BasicPane { } private void initComponents() { - this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); + this.setBorder(BorderFactory.createEmptyBorder(4, 4, -5, 4)); this.setLayout(FRGUIPaneFactory.createBorderLayout()); JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); @@ -66,7 +65,7 @@ public class WatermarkPane extends BasicPane { // 设置 JPanel rightPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); contentPane.add(rightPane, BorderLayout.EAST); - rightPane.add(initRightPane(), BorderLayout.CENTER); + rightPane.add(initRightPane(), BorderLayout.NORTH); } public void populate(WatermarkAttr watermark) { diff --git a/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java b/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java index e5f54ed678..0cc211c5f1 100644 --- a/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java +++ b/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java @@ -4,6 +4,7 @@ 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; /** @@ -12,6 +13,15 @@ import javax.swing.JPanel; 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) { diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorCell.java b/designer-base/src/main/java/com/fr/design/style/color/ColorCell.java index d43de5120d..06cca51d03 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorCell.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorCell.java @@ -89,6 +89,10 @@ public class ColorCell extends JComponent implements ColorSelectable { * @param 鼠标事件 */ public void processMouseEvent(MouseEvent e) { + if (!isEnabled()) { + return; + } + if (e == null || e.getID() == MouseEvent.MOUSE_RELEASED) { colorSelectable.setColor(this.getColor()); colorSelectable.colorSetted(this); diff --git a/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java b/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java index a6c4195c29..79ecdc9461 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java +++ b/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.Icon; +import javax.swing.JButton; import javax.swing.JColorChooser; import javax.swing.JPanel; import javax.swing.SpinnerNumberModel; @@ -706,7 +707,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec mainPanel.add(hexPanel, BorderLayout.SOUTH); 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(); blankArea.setPreferredSize(new Dimension(100, 175)); rightPane.add(blankArea, BorderLayout.CENTER); diff --git a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java index fec4993221..0f5e629e28 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java +++ b/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. private ArrayList colorChangeListenerList = new ArrayList(); - // 颜色选择器 - private ColorSelectDetailPane pane; // 是否支持透明 private boolean isSupportTransparent; @@ -52,10 +50,10 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { /** * Constructor. */ - public NewColorSelectPane(boolean isSupportTransparent) { + NewColorSelectPane(boolean isSupportTransparent) { this.isSupportTransparent = isSupportTransparent; 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) { UIButton transpanrentButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency")); this.add(transpanrentButton, BorderLayout.NORTH); @@ -96,12 +94,13 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { // mod by anchore 16/11/16 UIButton customButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_More_Color")); - customButton.addMouseListener(new MouseAdapter() { + customButton.addActionListener(new ActionListener() { @Override - public void mousePressed(MouseEvent e) { + public void actionPerformed(ActionEvent e) { customButtonPressed(); } }); + customButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); JPanel centerPane1 = FRGUIPaneFactory.createBorderLayout_S_Pane(); centerPane1.setBorder(BorderFactory.createEmptyBorder(2, 8, 0, 8)); @@ -183,7 +182,8 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { } protected void customButtonPressed() { - pane = new ColorSelectDetailPane(Color.WHITE); + // 颜色选择器 + ColorSelectDetailPane pane = new ColorSelectDetailPane(Color.WHITE); ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, this); } diff --git a/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java b/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java index 47c60e94a8..67d99819d7 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java +++ b/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.design.gui.ibutton.SpecialUIButton; +import com.fr.design.gui.ibutton.UIBasicButtonUI; import javax.swing.*; import javax.swing.plaf.ButtonUI; +import javax.swing.plaf.basic.BasicButtonUI; import java.awt.*; import java.awt.event.*; /** * Created by plough on 2016/12/22. */ -public class PickColorButtonFactory { +class PickColorButtonFactory { private static int iconSize; private static final int SIZE_16 = 16; private static final int SIZE_18 = 18; private static IconType iconType; private static Image iconImage; - public static SpecialUIButton getPickColorButton(ColorSelectable colorSelectable, IconType iconType) { - return getPickColorButton(colorSelectable, iconType, false); - } - - public static SpecialUIButton getPickColorButton(final ColorSelectable colorSelectable, IconType iconType, final boolean setColorRealTime) { + /** + * 生成取色按钮 + * @param colorSelectable 接收取到的颜色值的对象 + * @param iconType IconType 枚举,可选择 16px 和 18px 两个尺寸 + * @param setColorRealTime 是否在取色过程中,实时更新颜色值 + * @return SpecialUIButton 屏幕取色按钮 + */ + static JButton getPickColorButton(final ColorSelectable colorSelectable, IconType iconType, final boolean setColorRealTime) { SpecialUIButton pickColorButton = new SpecialUIButton(new WhiteButtonUI()); PickColorButtonFactory.iconType = iconType; @@ -37,9 +42,9 @@ public class PickColorButtonFactory { pickColorButton.setPreferredSize(new Dimension(iconSize, iconSize)); pickColorButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); - pickColorButton.addMouseListener(new MouseAdapter() { + pickColorButton.addActionListener(new ActionListener() { @Override - public void mousePressed(MouseEvent e) { + public void actionPerformed(ActionEvent e) { new ColorPicker(colorSelectable, setColorRealTime); } }); @@ -47,12 +52,14 @@ public class PickColorButtonFactory { return pickColorButton; } - // 取色器按钮使用的图标 + /** + * 取色按钮可使用的图标尺寸 + */ public enum IconType { ICON16, ICON18 } - private static class WhiteButtonUI extends ButtonUI { + private static class WhiteButtonUI extends UIBasicButtonUI { @Override public void paint(Graphics g, JComponent c) { super.paint(g, c); diff --git a/designer-base/src/main/java/com/fr/design/style/color/UsedColorPane.java b/designer-base/src/main/java/com/fr/design/style/color/UsedColorPane.java index e2186a90ee..a48f33c164 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/UsedColorPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/UsedColorPane.java @@ -72,7 +72,7 @@ public class UsedColorPane extends BasicPane { int i = 0; if (needPickColorButton) { // 取色按钮 - SpecialUIButton pickColorButton = PickColorButtonFactory.getPickColorButton(selectable, PickColorButtonFactory.IconType.ICON16, setColorRealTime); + JButton pickColorButton = PickColorButtonFactory.getPickColorButton(selectable, PickColorButtonFactory.IconType.ICON16, setColorRealTime); panel.add(pickColorButton); i++; this.reserveCells += 1;