From e913f94dab117988babf24f2fab97cfae1d967ff Mon Sep 17 00:00:00 2001 From: "Crawford.Zhou" Date: Thu, 25 Jan 2024 10:12:32 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-111299=20=E6=8E=A7=E4=BB=B6=E6=89=A9?= =?UTF-8?q?=E5=B1=95=E6=A0=B7=E5=BC=8F-=E5=A4=8D=E9=80=89=E6=A1=86?= =?UTF-8?q?=E7=BB=84=E6=89=A9=E5=B1=95=E6=A0=B7=E5=BC=8F=20feat=EF=BC=9A?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=8D=95=E9=80=89?= =?UTF-8?q?=E6=A1=86=E7=BB=84=E6=A0=B7=E5=BC=8F=EF=BC=9B=E6=89=A9=E5=B1=95?= =?UTF-8?q?=E5=A4=8D=E9=80=89=E6=A1=86=E7=BB=84=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CapsuleCheckboxGroupStyleProvider.java | 6 + .../ImageCheckboxGroupStyleProvider.java | 7 +- .../UnitedCheckboxGroupStyleProvider.java | 7 +- .../radiogroup/CapsuleCustomDefinePane.java | 104 +++++++++------ .../mobile/ui/radiogroup/IconConfigPane.java | 63 +++++++--- .../ui/radiogroup/ImageCustomDefinePane.java | 118 +++++++++++------- .../mainframe/mobile/utils/DesignerUtils.java | 7 +- 7 files changed, 215 insertions(+), 97 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/CapsuleCheckboxGroupStyleProvider.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/CapsuleCheckboxGroupStyleProvider.java index fa2d9d9055..3f84336c33 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/CapsuleCheckboxGroupStyleProvider.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/CapsuleCheckboxGroupStyleProvider.java @@ -7,6 +7,12 @@ import com.fr.design.mainframe.mobile.ui.radiogroup.CapsuleCustomDefinePane; import com.fr.form.ui.mobile.MobileStyle; import com.fr.form.ui.mobile.radiogroup.CapsuleMobileStyle; +/** + * 移动端复选框provider + * @author crawford.zhou + * @since 11.0 + * Created on 2024/1/25 + */ public class CapsuleCheckboxGroupStyleProvider extends AbstractMobileWidgetStyleProvider { @Override public Class classForMobileStyle() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/ImageCheckboxGroupStyleProvider.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/ImageCheckboxGroupStyleProvider.java index fb7224aa19..bafb50a43b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/ImageCheckboxGroupStyleProvider.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/ImageCheckboxGroupStyleProvider.java @@ -6,7 +6,12 @@ import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane; import com.fr.design.mainframe.mobile.ui.radiogroup.ImageCustomDefinePane; import com.fr.form.ui.mobile.MobileStyle; import com.fr.form.ui.mobile.radiogroup.ImageMobileStyle; - +/** + * 移动端复选框provider + * @author crawford.zhou + * @since 11.0 + * Created on 2024/1/25 + */ public class ImageCheckboxGroupStyleProvider extends AbstractMobileWidgetStyleProvider { @Override public Class classForMobileStyle() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/UnitedCheckboxGroupStyleProvider.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/UnitedCheckboxGroupStyleProvider.java index e22aa9223d..81249fee8c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/UnitedCheckboxGroupStyleProvider.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/UnitedCheckboxGroupStyleProvider.java @@ -6,7 +6,12 @@ import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane; import com.fr.design.mainframe.mobile.ui.radiogroup.UnitedCustomDefinePane; import com.fr.form.ui.mobile.MobileStyle; import com.fr.form.ui.mobile.radiogroup.UnitedMobileStyle; - +/** + * 移动端复选框provider + * @author crawford.zhou + * @since 11.0 + * Created on 2024/1/25 + */ public class UnitedCheckboxGroupStyleProvider extends AbstractMobileWidgetStyleProvider { @Override public Class classForMobileStyle() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/CapsuleCustomDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/CapsuleCustomDefinePane.java index ab5b64a996..1d6987526e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/CapsuleCustomDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/CapsuleCustomDefinePane.java @@ -133,27 +133,10 @@ public class CapsuleCustomDefinePane extends MobileStyleCustomDefinePane { return FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); } - private void addPaddingPane() { - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p}; - double[] columnSize = {p, p}; - centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout"))); - UILabel paddingHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Button_Padding")); - UILabel emptyHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("")); - UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Left")); - leftSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding); - - UILabel rightLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Right")); - rightSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding); - - UILabel topLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Top")); - topSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); - - UILabel bottomLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Bottom")); - bottomSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); - - // 布局方式下拉框 - UILabel layoutTypeLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Type")); + /** + * 初始化布局方式下拉框 + */ + private void initLayoutCombo() { layoutTypeCombo = new UIComboBox(new String[]{ Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Single_Line"), Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Auto"), @@ -163,22 +146,26 @@ public class CapsuleCustomDefinePane extends MobileStyleCustomDefinePane { layoutTypeCombo.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { - if (layoutTypeCombo.getSelectedIndex() == 0) { + if (layoutTypeCombo.getSelectedIndex() == DesignerUtils.K_LAYOUT_SINGLE) { buttonAlignPane.setVisible(true); columnSizePane.setVisible(false); } - if (layoutTypeCombo.getSelectedIndex() == 1) { + if (layoutTypeCombo.getSelectedIndex() == DesignerUtils.K_LAYOUT_AUTO) { buttonAlignPane.setVisible(false); columnSizePane.setVisible(false); } - if (layoutTypeCombo.getSelectedIndex() == 2) { + if (layoutTypeCombo.getSelectedIndex() == DesignerUtils.K_LAYOUT_FIXED) { buttonAlignPane.setVisible(false); columnSizePane.setVisible(true); } } }); + } - // 按钮排布下拉框 + /** + * 初始化按钮排布面板 + */ + private void initButtonAlignPane() { UILabel buttonAlignLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment")); buttonAlignCombo = new UIComboBox(new String[]{ Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Nature"), @@ -190,24 +177,70 @@ public class CapsuleCustomDefinePane extends MobileStyleCustomDefinePane { TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL ); + } - // 固定列数——数字输入框 + /** + * 初始化固定列数面板 + */ + private void initColumnSizePane() { UILabel columnSizeLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Fixed_Number")); - columnSizeSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 1); + columnSizeSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.INITIAL_COLUMN_SIZE); columnSizeSpinner.setPreferredSize(new Dimension(DesignerUtils.LARGE_COMBO_WIDTH, 20)); columnSizePane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{columnSizeLabel, columnSizeSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); columnSizePane.setVisible(false); + } - leftAlignRadioButton = new JRadioButton(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Left"), true); - centerAlignRadioButton = new JRadioButton(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Center"), false); + private JPanel initVPaddingConfig() { - JPanel leftSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftLabel, leftSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); - JPanel rightSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{rightLabel, rightSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); + UILabel topLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Top")); + topSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); + + UILabel bottomLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Bottom")); + bottomSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); JPanel topSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topLabel, topSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); JPanel bottomSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{bottomLabel, bottomSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); - JPanel vPaddingSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topSpinnerPanel, bottomSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); - JPanel hPaddingSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftSpinnerPanel, rightSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); + return TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topSpinnerPanel, bottomSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); + + } + private JPanel initHPaddingConfig() { + UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Left")); + leftSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding); + + UILabel rightLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Right")); + rightSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding); + JPanel leftSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftLabel, leftSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); + JPanel rightSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{rightLabel, rightSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); + + return TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftSpinnerPanel, rightSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); + } + + private void addPaddingPane() { + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p, p}; + double[] columnSize = {p, p}; + centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout"))); + UILabel paddingHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Button_Padding")); + UILabel emptyHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("")); + UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Left")); + leftSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding); + + UILabel rightLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Right")); + rightSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding); + + UILabel topLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Top")); + topSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); + + UILabel bottomLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Bottom")); + bottomSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); + + UILabel layoutTypeLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Type")); + initLayoutCombo(); + initButtonAlignPane(); + initColumnSizePane(); + leftAlignRadioButton = new JRadioButton(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Left"), true); + centerAlignRadioButton = new JRadioButton(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Center"), false); + JPanel layoutTypePanel = TableLayoutHelper.createGapTableLayoutPane( new Component[][]{new Component[]{layoutTypeCombo}}, @@ -219,10 +252,9 @@ public class CapsuleCustomDefinePane extends MobileStyleCustomDefinePane { ButtonGroup layoutRadioButtonGroup = new ButtonGroup(); layoutRadioButtonGroup.add(leftAlignRadioButton); layoutRadioButtonGroup.add(centerAlignRadioButton); - JPanel paddingPanel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{ - {paddingHintLabel, vPaddingSpinnerPanel}, - {emptyHintLabel, hPaddingSpinnerPanel}, + {paddingHintLabel, initVPaddingConfig()}, + {emptyHintLabel, initHPaddingConfig()}, {layoutTypeLabel, layoutTypePanel}, }, rowSize, columnSize, 10); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/IconConfigPane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/IconConfigPane.java index 61cf282883..17d995d3cf 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/IconConfigPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/IconConfigPane.java @@ -28,6 +28,7 @@ import java.util.ArrayList; public class IconConfigPane extends JPanel { private final int northPaneWidth = 330; + private final int listenerStep = 2; private final Icon addIcon = BaseUtils.readIcon("/com/fr/design/images/buttonicon/icon_add.png"); private final Icon deleteIcon = BaseUtils.readIcon("/com/fr/design/images/buttonicon/icon_delete.png"); @@ -45,9 +46,17 @@ public class IconConfigPane extends JPanel { private EventListenerList deleteCountListener = new EventListenerList(); private JPanel northPane; + + public IconConfigPane(int count) { + initComp(count, false); + } public IconConfigPane(int count, boolean canChangeCount) { initComp(count, canChangeCount); } + + /** + * 删除一个图标 + */ public void deleteCount() { if (!iconButtons.isEmpty()) { northPane.remove(iconButtons.get(iconButtons.size() - 1)); @@ -59,7 +68,9 @@ public class IconConfigPane extends JPanel { } deleteCountButton.setEnabled(!iconButtons.isEmpty()); } - + /** + * 添加一个图标 + */ public void addCount() { deleteCountButton.setEnabled(true); IconButton iconButton = new IconButton(""); @@ -103,6 +114,12 @@ public class IconConfigPane extends JPanel { northPane.add(addCountButton); northPane.add(deleteCountButton); } + + /** + * 根据图标名称刷新字体配置面板 + * @param names 字体名称 + * @param canChangeCount 是否支持改变数目 + */ public void refreshByIconNames(String[] names, Boolean canChangeCount) { northPane.removeAll(); northPane.setPreferredSize(new Dimension(northPaneWidth, getNorthPanelHeight(names.length))); @@ -119,17 +136,14 @@ public class IconConfigPane extends JPanel { IconConfigPane.this.revalidate(); IconConfigPane.this.repaint(); } - /* - 重载形式,默认没有增加/删减按钮 + + /** + * 初始化编辑按钮 */ - public void initComp(int count, boolean canChangeCount) { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel panel = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); - panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); + private void initEditIconButton() { editIconButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Edit")); editIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A"))); editIconButton.setPreferredSize(new Dimension(62, 20)); - panel.add(editIconButton); editIconButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final CustomIconPane cip = new CustomIconPane(){ @@ -150,11 +164,14 @@ public class IconConfigPane extends JPanel { } }); editIconButton.setEnabled(false); - + } + /** + * 初始化删除按钮 + */ + private void initDeleteIconButton() { deleteIconButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Delete")); deleteIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A"))); deleteIconButton.setPreferredSize(new Dimension(62, 20)); - panel.add(deleteIconButton); deleteIconButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -163,6 +180,20 @@ public class IconConfigPane extends JPanel { } }); deleteIconButton.setEnabled(false); + } + /** + * 重载形式 + * @param count 图标数目 + * @param canChangeCount 是否可以动态增减 + */ + public void initComp(int count, boolean canChangeCount) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel panel = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); + panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); + initEditIconButton(); + initDeleteIconButton(); + panel.add(editIconButton); + panel.add(deleteIconButton); northPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); northPane.setPreferredSize(new Dimension(northPaneWidth, getNorthPanelHeight(count))); this.add(panel, BorderLayout.CENTER); @@ -181,14 +212,16 @@ public class IconConfigPane extends JPanel { selectIconButton.setIconName(curIconName); } /** - * 添加监听 - * + * 添加事件的监听 * @param changeListener 监听列表 */ public void addAddCountListener(ChangeListener changeListener) { addCountListener.add(ChangeListener.class, changeListener); } - + /** + * 删除事件的监听 + * @param changeListener 监听列表 + */ public void addDeleteCountListener(ChangeListener changeListener) { deleteCountListener.add(ChangeListener.class, changeListener); } @@ -199,7 +232,7 @@ public class IconConfigPane extends JPanel { Object[] listeners = addCountListener.getListenerList(); ChangeEvent e = null; - for (int i = listeners.length - 2; i >= 0; i -= 2) { + for (int i = listeners.length - listenerStep; i >= 0; i -= listenerStep) { if (listeners[i] == ChangeListener.class) { if (e == null) { e = new ChangeEvent(this); @@ -215,7 +248,7 @@ public class IconConfigPane extends JPanel { Object[] listeners = deleteCountListener.getListenerList(); ChangeEvent e = null; - for (int i = listeners.length - 2; i >= 0; i -= 2) { + for (int i = listeners.length - listenerStep; i >= 0; i -= listenerStep) { if (listeners[i] == ChangeListener.class) { if (e == null) { e = new ChangeEvent(this); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/ImageCustomDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/ImageCustomDefinePane.java index 776ec65844..0284f28c57 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/ImageCustomDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/ImageCustomDefinePane.java @@ -125,34 +125,7 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane { return FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); } - private void addPaddingPane() { - centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout"))); - - UILabel paddingHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Button_Padding")); - UILabel emptyHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("")); - - UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Left")); - leftSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding); - - UILabel rightLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Right")); - rightSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding); - - UILabel topLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Top")); - topSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); - - UILabel bottomLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Bottom")); - bottomSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); - - JPanel leftSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftLabel, leftSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); - JPanel rightSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{rightLabel, rightSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); - JPanel topSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topLabel, topSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); - JPanel bottomSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{bottomLabel, bottomSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); - - JPanel vPaddingSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topSpinnerPanel, bottomSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); - JPanel hPaddingSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftSpinnerPanel, rightSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); - - // 布局方式下拉框 - UILabel layoutTypeLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Type")); + private void initLayoutCombo() { layoutTypeCombo = new UIComboBox(new String[]{ Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Single_Line"), Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Auto"), @@ -162,22 +135,26 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane { layoutTypeCombo.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { - if (layoutTypeCombo.getSelectedIndex() == 0) { + if (layoutTypeCombo.getSelectedIndex() == DesignerUtils.K_LAYOUT_SINGLE) { buttonAlignPane.setVisible(true); columnSizePane.setVisible(false); } - if (layoutTypeCombo.getSelectedIndex() == 1) { + if (layoutTypeCombo.getSelectedIndex() == DesignerUtils.K_LAYOUT_AUTO) { buttonAlignPane.setVisible(false); columnSizePane.setVisible(false); } - if (layoutTypeCombo.getSelectedIndex() == 2) { + if (layoutTypeCombo.getSelectedIndex() == DesignerUtils.K_LAYOUT_FIXED) { buttonAlignPane.setVisible(false); columnSizePane.setVisible(true); } } }); + } - // 按钮排布下拉框 + /** + * 初始化按钮排布面板 + */ + private void initButtonAlignPane() { UILabel buttonAlignLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment")); buttonAlignCombo = new UIComboBox(new String[]{ Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Nature"), @@ -185,19 +162,61 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane { }); buttonAlignCombo.setPreferredSize(new Dimension(DesignerUtils.LARGE_COMBO_WIDTH, 20)); buttonAlignPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{buttonAlignLabel, buttonAlignCombo}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); + } - // 固定列数——数字输入框 + /** + * 初始化固定列数面板 + */ + private void initColumnSizePane() { UILabel columnSizeLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Fixed_Number")); - columnSizeSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); + columnSizeSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.INITIAL_COLUMN_SIZE); columnSizeSpinner.setPreferredSize(new Dimension(DesignerUtils.LARGE_COMBO_WIDTH, 20)); columnSizePane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{columnSizeLabel, columnSizeSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); columnSizePane.setVisible(false); + } + + private JPanel initVPaddingConfig() { + + UILabel topLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Top")); + topSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); + + UILabel bottomLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Bottom")); + bottomSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); + JPanel topSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topLabel, topSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); + JPanel bottomSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{bottomLabel, bottomSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); + + return TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topSpinnerPanel, bottomSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); + + } + private JPanel initHPaddingConfig() { + UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Left")); + leftSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding); + + UILabel rightLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Right")); + rightSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding); + JPanel leftSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftLabel, leftSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); + JPanel rightSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{rightLabel, rightSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); + + return TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftSpinnerPanel, rightSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); + } + + private void addPaddingPane() { + centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout"))); + + UILabel paddingHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Button_Padding")); + UILabel emptyHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("")); + + UILabel layoutTypeLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Type")); + initLayoutCombo(); + initButtonAlignPane(); + initColumnSizePane(); + double p = TableLayout.PREFERRED; double[] rowSize = {p, p, p}; double[] columnSize = {p, p}; JPanel paddingPanel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{ - {paddingHintLabel, vPaddingSpinnerPanel}, - {emptyHintLabel, hPaddingSpinnerPanel}, + {paddingHintLabel, initVPaddingConfig()}, + {emptyHintLabel, initHPaddingConfig()}, {layoutTypeLabel, layoutTypeCombo}, }, rowSize, columnSize, 10); @@ -206,13 +225,11 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane { centerPane.add(columnSizePane); } - private void addIconPane() { - centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon"))); - - UILabel initialLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon_Init")); - UILabel selectedLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon_Select")); + /** + * 初始化默认字体配置面版 + */ + private void initInitialIconConfigPane() { initialIconConfigPane = new IconConfigPane(8, true); - selectedIconConfigPane = new IconConfigPane(8, true); initialIconConfigPane.addAddCountListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { @@ -227,6 +244,13 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane { selectedIconConfigPane.deleteCount(); } }); + } + + /** + * 初始化选择字体配置面板 + */ + private void initSelectedIconConfigPane() { + selectedIconConfigPane = new IconConfigPane(8, true); selectedIconConfigPane.addAddCountListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { @@ -241,6 +265,14 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane { selectedIconConfigPane.deleteCount(); } }); + } + private void addIconPane() { + centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon"))); + + UILabel initialLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon_Init")); + UILabel selectedLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon_Select")); + initInitialIconConfigPane(); + initSelectedIconConfigPane(); JPanel container = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 5); JPanel initialPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); @@ -261,7 +293,7 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane { UILabel initialFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_init")); initialFontConfPane = new FontConfigPane(); - initialFontConfPane.setFontColor(new Color(204, 204, 204)); + initialFontConfPane.setFontColor(new Color(102, 102, 102)); JPanel fontPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initialFontLabel, initialFontConfPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); centerPane.add(fontPanel); UILabel selectedFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_Select")); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/utils/DesignerUtils.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/utils/DesignerUtils.java index 89fa5e5209..a2e8d0656f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/utils/DesignerUtils.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/utils/DesignerUtils.java @@ -23,7 +23,12 @@ public class DesignerUtils { public static final int kAlignLeft = 0; public static final int kAlignCenter = 1; - public static final int kAlignSplit = 1; + public static final int K_LAYOUT_SINGLE = 0; + public static final int K_LAYOUT_AUTO = 1; + public static final int K_LAYOUT_FIXED = 2; + + public static final int INITIAL_COLUMN_SIZE = 1; + public static final int[] BORDER_LINE_STYLE_ARRAY = new int[]{ Constants.LINE_NONE, Constants.LINE_THIN,