From ef832d90a133e02207198dab753c8c9c17bb9462 Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Thu, 21 May 2020 22:43:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?MOBILE-27000=20=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E5=9B=BE=E6=A0=87=E6=94=AF=E6=8C=81=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mobile/ui/MobileStyleDefinePane.java | 16 ++++++++++ .../mobile/ui/MobileStyleFontConfigPane.java | 29 +++++++++++++++++-- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java index c729b5fc0f..83223d1ee0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java @@ -48,6 +48,7 @@ public class MobileStyleDefinePane extends BasicBeanPane { private LineComboBox borderType; private NewColorSelectBox borderColor; private UISpinner borderRadius; + private NewColorSelectBox iconColor; private MobileStyleFontConfigPane fontConfigPane; MobileStyleDefinePane(Widget widget, Class customBeanPaneClass, @@ -69,6 +70,9 @@ public class MobileStyleDefinePane extends BasicBeanPane { borderColor.setSelectObject(ob.getBorderColor()); } borderRadius.setValue(ob.getBorderRadius()); + if (ob.getIconColor() != null) { + iconColor.setSelectObject(ob.getIconColor()); + } if (ob.getFont() != null) { fontConfigPane.populateBean(ob.getFont()); } @@ -83,6 +87,7 @@ public class MobileStyleDefinePane extends BasicBeanPane { mobileStyle.setBorderType(borderType.getSelectedLineStyle()); mobileStyle.setBorderColor(borderColor.getSelectObject()); mobileStyle.setBorderRadius(borderRadius.getValue()); + mobileStyle.setIconColor(iconColor.getSelectObject()); mobileStyle.setFont(fontConfigPane.updateBean()); return mobileStyle; } @@ -123,6 +128,7 @@ public class MobileStyleDefinePane extends BasicBeanPane { createBackgroundPane(); createBorderPane(); + createIconSettingPane(); createFontPane(); } @@ -155,6 +161,16 @@ public class MobileStyleDefinePane extends BasicBeanPane { commomPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_BorderRadius")), borderRadius)); } + private void createIconSettingPane() { + iconColor = new NewColorSelectBox(NORMAL_COMBO_WIDTH); + iconColor.addSelectChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + } + }); + commomPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_Icon_Color")), iconColor)); + } + private void createFontPane() { fontConfigPane = new MobileStyleFontConfigPane(); commomPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_Font")), fontConfigPane)); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleFontConfigPane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleFontConfigPane.java index 7ea91353a8..2b47c82b95 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleFontConfigPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleFontConfigPane.java @@ -4,11 +4,15 @@ import com.fr.base.BaseUtils; import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.i18n.Toolkit; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; import com.fr.stable.Constants; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JLabel; +import javax.swing.JList; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Color; @@ -19,12 +23,14 @@ import java.awt.Font; import java.util.Vector; public class MobileStyleFontConfigPane extends JPanel { + public static final int FONT_NONE = 0; private static final int MAX_FONT_SIZE = 18; private static final int MIN_FONT_SIZE = 12; private static final Dimension BUTTON_SIZE = new Dimension(20, 18); public static Vector getFontSizes() { Vector FONT_SIZES = new Vector(); + FONT_SIZES.add(FONT_NONE); for (int i = MIN_FONT_SIZE; i <= MAX_FONT_SIZE; i++) { FONT_SIZES.add(i); } @@ -42,10 +48,11 @@ public class MobileStyleFontConfigPane extends JPanel { private void initComponent() { - fontSizeComboBox = new UIComboBox(getFontSizes()); - fontSizeComboBox.setSelectedItem(16); + fontSizeComboBox = new UIComboBox(); + fontSizeComboBox.setSelectedItem(0); + fontSizeComboBox.setModel(new DefaultComboBoxModel(getFontSizes())); fontSizeComboBox.setPreferredSize(new Dimension(60, 20)); - fontSizeComboBox.setEditable(true); + fontSizeComboBox.setRenderer(new LineCellRenderer()); underline = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline.png")); italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); @@ -96,4 +103,20 @@ public class MobileStyleFontConfigPane extends JPanel { underline.isSelected() ? Constants.LINE_THIN : Constants.LINE_NONE ); } + + private class LineCellRenderer extends UIComboBoxRenderer { + public LineCellRenderer() { + super(); + } + + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + JLabel renderer =(JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + int currentValue = ((Integer) value).intValue(); + if (currentValue == MobileStyleFontConfigPane.FONT_NONE) { + renderer.setText(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None")); + } + return renderer; + } + } + } From 3be3844d98a062b5a52650814566faf3796dfa72 Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Fri, 22 May 2020 11:32:22 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mobile/ui/MobileStyleDefinePane.java | 15 --------------- .../mobile/ui/MobileStyleFontConfigPane.java | 5 +++-- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java index 83223d1ee0..5f11e46db0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java @@ -134,11 +134,6 @@ public class MobileStyleDefinePane extends BasicBeanPane { private void createBackgroundPane() { colorSelectBox = new ColorSelectBox(NORMAL_COMBO_WIDTH); - colorSelectBox.addSelectChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - } - }); JPanel backgroundPane = createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_Background")), colorSelectBox); commomPane.add(backgroundPane); @@ -149,11 +144,6 @@ public class MobileStyleDefinePane extends BasicBeanPane { borderType.setSelectedLineStyle(Constants.LINE_THIN); borderType.setPreferredSize(new Dimension(NORMAL_COMBO_WIDTH + 15, 20)); borderColor = new NewColorSelectBox(NORMAL_COMBO_WIDTH); - borderColor.addSelectChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - } - }); borderRadius = new UISpinner(0, Integer.MAX_VALUE, 1, 2); borderRadius.setPreferredSize(new Dimension(NORMAL_COMBO_WIDTH + 20, 20)); commomPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_BorderType")), borderType)); @@ -163,11 +153,6 @@ public class MobileStyleDefinePane extends BasicBeanPane { private void createIconSettingPane() { iconColor = new NewColorSelectBox(NORMAL_COMBO_WIDTH); - iconColor.addSelectChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - } - }); commomPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_Icon_Color")), iconColor)); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleFontConfigPane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleFontConfigPane.java index 2b47c82b95..f765e25845 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleFontConfigPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleFontConfigPane.java @@ -9,6 +9,7 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; import com.fr.stable.Constants; +import com.fr.stable.StringUtils; import javax.swing.DefaultComboBoxModel; import javax.swing.JLabel; @@ -49,8 +50,8 @@ public class MobileStyleFontConfigPane extends JPanel { private void initComponent() { fontSizeComboBox = new UIComboBox(); - fontSizeComboBox.setSelectedItem(0); fontSizeComboBox.setModel(new DefaultComboBoxModel(getFontSizes())); + fontSizeComboBox.setSelectedItem(0); fontSizeComboBox.setPreferredSize(new Dimension(60, 20)); fontSizeComboBox.setRenderer(new LineCellRenderer()); underline = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline.png")); @@ -113,7 +114,7 @@ public class MobileStyleFontConfigPane extends JPanel { JLabel renderer =(JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); int currentValue = ((Integer) value).intValue(); if (currentValue == MobileStyleFontConfigPane.FONT_NONE) { - renderer.setText(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None")); + renderer.setText(StringUtils.BLANK + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None")); } return renderer; }