Browse Source

Pull request #13542: REPORT-111299 控件扩展样式-复选框组扩展样式

Merge in DESIGN/design from ~CRAWFORD.ZHOU/design:feature/x to feature/x

* commit 'e913f94dab117988babf24f2fab97cfae1d967ff':
  REPORT-111299 控件扩展样式-复选框组扩展样式 feat:调整移动端单选框组样式;扩展复选框组样式
  REPORT-111299 控件扩展样式-复选框组扩展样式 feat:调整移动端单选框组样式;扩展复选框组样式
  REPORT-111299 控件扩展样式-复选框组扩展样式 feat:调整移动端单选框组样式;扩展复选框组样式
feature/x
Crawford.Zhou-周旭 10 months ago
parent
commit
159233fc01
  1. 41
      designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/CapsuleCheckboxGroupStyleProvider.java
  2. 40
      designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/ImageCheckboxGroupStyleProvider.java
  3. 40
      designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/UnitedCheckboxGroupStyleProvider.java
  4. 141
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/CapsuleCustomDefinePane.java
  5. 193
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/IconConfigPane.java
  6. 166
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/ImageCustomDefinePane.java
  7. 15
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/UnitedCustomDefinePane.java
  8. 9
      designer-base/src/main/java/com/fr/design/mainframe/mobile/utils/DesignerUtils.java
  9. 6
      designer-base/src/main/java/com/fr/design/mainframe/mobile/utils/MobileStyleProviderManager.java
  10. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_add.png
  11. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_delete.png

41
designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/CapsuleCheckboxGroupStyleProvider.java

@ -0,0 +1,41 @@
package com.fr.design.mainframe.mobile.provider.checkboxgroup;
import com.fr.design.fun.impl.AbstractMobileWidgetStyleProvider;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane;
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<? extends MobileStyle> classForMobileStyle() {
return CapsuleMobileStyle.class;
}
@Override
public Class<? extends MobileStyleCustomDefinePane> classForWidgetAppearance() {
return CapsuleCustomDefinePane.class;
}
@Override
public String xTypeForWidget() {
return "checkboxgroup";
}
@Override
public String displayName() {
return Toolkit.i18nText("Fine-Plugin-RadioGroup_Capsule_Button");
}
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
}

40
designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/ImageCheckboxGroupStyleProvider.java

@ -0,0 +1,40 @@
package com.fr.design.mainframe.mobile.provider.checkboxgroup;
import com.fr.design.fun.impl.AbstractMobileWidgetStyleProvider;
import com.fr.design.i18n.Toolkit;
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<? extends MobileStyle> classForMobileStyle() {
return ImageMobileStyle.class;
}
@Override
public Class<? extends MobileStyleCustomDefinePane> classForWidgetAppearance() {
return ImageCustomDefinePane.class;
}
@Override
public String xTypeForWidget() {
return "checkboxgroup";
}
@Override
public String displayName() {
return Toolkit.i18nText("Fine-Plugin-RadioGroup_Graphic_Button");
}
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
}

40
designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/UnitedCheckboxGroupStyleProvider.java

@ -0,0 +1,40 @@
package com.fr.design.mainframe.mobile.provider.checkboxgroup;
import com.fr.design.fun.impl.AbstractMobileWidgetStyleProvider;
import com.fr.design.i18n.Toolkit;
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<? extends MobileStyle> classForMobileStyle() {
return UnitedMobileStyle.class;
}
@Override
public Class<? extends MobileStyleCustomDefinePane> classForWidgetAppearance() {
return UnitedCustomDefinePane.class;
}
@Override
public String xTypeForWidget() {
return "checkboxgroup";
}
@Override
public String displayName() {
return Toolkit.i18nText("Fine-Plugin-RadioGroup_Linkage_Button");
}
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
}

141
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/CapsuleCustomDefinePane.java

@ -36,11 +36,23 @@ public class CapsuleCustomDefinePane extends MobileStyleCustomDefinePane {
private UIComboBox custom; private UIComboBox custom;
private JPanel centerPane; private JPanel centerPane;
// 按钮排布+按钮排布下拉框panel;
private JPanel buttonAlignPane;
// 固定列数 数字panel
private JPanel columnSizePane;
private UISpinner leftSpinner; private UISpinner leftSpinner;
private UISpinner rightSpinner; private UISpinner rightSpinner;
private UISpinner topSpinner; private UISpinner topSpinner;
private UISpinner bottomSpinner; private UISpinner bottomSpinner;
private UIComboBox layoutTypeCombo;
private UIComboBox buttonAlignCombo;
private UISpinner columnSizeSpinner;
private JRadioButton leftAlignRadioButton; private JRadioButton leftAlignRadioButton;
private JRadioButton centerAlignRadioButton; private JRadioButton centerAlignRadioButton;
@ -121,13 +133,95 @@ public class CapsuleCustomDefinePane extends MobileStyleCustomDefinePane {
return FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); return FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10);
} }
/**
* 初始化布局方式下拉框
*/
private void initLayoutCombo() {
layoutTypeCombo = new UIComboBox(new String[]{
Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Single_Line"),
Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Auto"),
Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Fixed")
});
layoutTypeCombo.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20));
layoutTypeCombo.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (layoutTypeCombo.getSelectedIndex() == DesignerUtils.K_LAYOUT_SINGLE) {
buttonAlignPane.setVisible(true);
columnSizePane.setVisible(false);
}
if (layoutTypeCombo.getSelectedIndex() == DesignerUtils.K_LAYOUT_AUTO) {
buttonAlignPane.setVisible(false);
columnSizePane.setVisible(false);
}
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"),
Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Center"),
});
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.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() { 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"))); centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout")));
UILabel paddingHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Button_Padding")); UILabel paddingHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Button_Padding"));
UILabel emptyHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("")); UILabel emptyHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText(""));
UILabel buttonAlignHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment"));
UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Left")); UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Left"));
leftSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding); leftSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding);
@ -140,33 +234,33 @@ public class CapsuleCustomDefinePane extends MobileStyleCustomDefinePane {
UILabel bottomLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Bottom")); UILabel bottomLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Bottom"));
bottomSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); 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); leftAlignRadioButton = new JRadioButton(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Left"), true);
centerAlignRadioButton = new JRadioButton(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Center"), false); centerAlignRadioButton = new JRadioButton(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Center"), false);
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); JPanel layoutTypePanel = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{layoutTypeCombo}},
JPanel layoutPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftAlignRadioButton, centerAlignRadioButton}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); TableLayoutHelper.FILL_LASTCOLUMN,
IntervalConstants.INTERVAL_W1,
LayoutConstants.VGAP_SMALL
);
ButtonGroup layoutRadioButtonGroup = new ButtonGroup(); ButtonGroup layoutRadioButtonGroup = new ButtonGroup();
layoutRadioButtonGroup.add(leftAlignRadioButton); layoutRadioButtonGroup.add(leftAlignRadioButton);
layoutRadioButtonGroup.add(centerAlignRadioButton); layoutRadioButtonGroup.add(centerAlignRadioButton);
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p};
double[] columnSize = {p, p};
JPanel paddingPanel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{ JPanel paddingPanel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{
{paddingHintLabel, vPaddingSpinnerPanel}, {paddingHintLabel, initVPaddingConfig()},
{emptyHintLabel, hPaddingSpinnerPanel}, {emptyHintLabel, initHPaddingConfig()},
{buttonAlignHintLabel, layoutPanel}, {layoutTypeLabel, layoutTypePanel},
}, rowSize, columnSize, 10); }, rowSize, columnSize, 10);
centerPane.add(paddingPanel); centerPane.add(paddingPanel);
centerPane.add(buttonAlignPane);
centerPane.add(columnSizePane);
} }
private void addBackgroundPane() { private void addBackgroundPane() {
@ -240,7 +334,7 @@ public class CapsuleCustomDefinePane extends MobileStyleCustomDefinePane {
UILabel initialFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_init")); UILabel initialFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_init"));
initialFontConfPane = new FontConfigPane(); 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); JPanel fontPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initialFontLabel, initialFontConfPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
centerPane.add(fontPanel); centerPane.add(fontPanel);
UILabel selectedFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_Select")); UILabel selectedFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_Select"));
@ -260,6 +354,9 @@ public class CapsuleCustomDefinePane extends MobileStyleCustomDefinePane {
rightSpinner.setValue(mobileStyle.getRightPadding()); rightSpinner.setValue(mobileStyle.getRightPadding());
topSpinner.setValue(mobileStyle.getTopPadding()); topSpinner.setValue(mobileStyle.getTopPadding());
bottomSpinner.setValue(mobileStyle.getBottomPadding()); bottomSpinner.setValue(mobileStyle.getBottomPadding());
layoutTypeCombo.setSelectedIndex(mobileStyle.getButtonLayoutType());
buttonAlignCombo.setSelectedIndex(mobileStyle.getButtonAlign());
columnSizeSpinner.setValue(mobileStyle.getButtonColumnSize());
leftAlignRadioButton.setSelected(mobileStyle.getButtonAlign() == DesignerUtils.kAlignLeft); leftAlignRadioButton.setSelected(mobileStyle.getButtonAlign() == DesignerUtils.kAlignLeft);
centerAlignRadioButton.setSelected(mobileStyle.getButtonAlign() == DesignerUtils.kAlignCenter); centerAlignRadioButton.setSelected(mobileStyle.getButtonAlign() == DesignerUtils.kAlignCenter);
initialColorSelectBox.setSelectObject(mobileStyle.getInitialBackgroundColor()); initialColorSelectBox.setSelectObject(mobileStyle.getInitialBackgroundColor());
@ -285,7 +382,9 @@ public class CapsuleCustomDefinePane extends MobileStyleCustomDefinePane {
mobileStyle.setRightPadding(rightSpinner.getValue()); mobileStyle.setRightPadding(rightSpinner.getValue());
mobileStyle.setTopPadding(topSpinner.getValue()); mobileStyle.setTopPadding(topSpinner.getValue());
mobileStyle.setBottomPadding(bottomSpinner.getValue()); mobileStyle.setBottomPadding(bottomSpinner.getValue());
mobileStyle.setButtonAlign(leftAlignRadioButton.isSelected() ? DesignerUtils.kAlignLeft : DesignerUtils.kAlignCenter); mobileStyle.setButtonAlign(buttonAlignCombo.getSelectedIndex());
mobileStyle.setButtonLayoutType(layoutTypeCombo.getSelectedIndex());
mobileStyle.setButtonColumnSize((int)columnSizeSpinner.getValue());
mobileStyle.setInitialBackgroundColor(initialColorSelectBox.getSelectObject()); mobileStyle.setInitialBackgroundColor(initialColorSelectBox.getSelectObject());
mobileStyle.setSelectedBackgroundColor(selectedColorSelectBox.getSelectObject()); mobileStyle.setSelectedBackgroundColor(selectedColorSelectBox.getSelectObject());
mobileStyle.setBorderType(borderLineCombo.getSelectedLineStyle()); mobileStyle.setBorderType(borderLineCombo.getSelectedLineStyle());

193
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/IconConfigPane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.mobile.ui.radiogroup; package com.fr.design.mainframe.mobile.ui.radiogroup;
import com.fr.base.BaseUtils;
import com.fr.base.IconManager; import com.fr.base.IconManager;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -12,11 +13,13 @@ import com.fr.design.web.CustomIconPane;
import com.fr.form.ui.WidgetInfoConfig; import com.fr.form.ui.WidgetInfoConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
import javax.swing.plaf.basic.BasicButtonUI; import javax.swing.plaf.basic.BasicButtonUI;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -24,24 +27,123 @@ import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
public class IconConfigPane extends JPanel { 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");
private UIButton editIconButton; private UIButton editIconButton;
private UIButton deleteIconButton; private UIButton deleteIconButton;
private String curIconName; private String curIconName;
private IconButton selectIconButton; private IconButton selectIconButton;
private ArrayList<IconButton> iconButtons = new ArrayList<IconButton>(); private ArrayList<IconButton> iconButtons = new ArrayList<IconButton>();
private UIButton addCountButton;
private UIButton deleteCountButton;
private EventListenerList addCountListener = new EventListenerList();
private EventListenerList deleteCountListener = new EventListenerList();
private JPanel northPane;
public IconConfigPane(int count) { public IconConfigPane(int count) {
initComp(count); initComp(count, false);
}
public IconConfigPane(int count, boolean canChangeCount) {
initComp(count, canChangeCount);
} }
public void initComp(int count) { /**
this.setLayout(FRGUIPaneFactory.createBorderLayout()); * 删除一个图标
JPanel panel = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); */
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); public void deleteCount() {
if (!iconButtons.isEmpty()) {
northPane.remove(iconButtons.get(iconButtons.size() - 1));
iconButtons.remove(iconButtons.size() - 1);
adjustNorthPaneHeight();
IconConfigPane.this.revalidate(); // 重新验证并更新布局
IconConfigPane.this.repaint(); // 可选:刷新JPanel以更新界面显示
deleteCountButton.setEnabled(!iconButtons.isEmpty());
}
deleteCountButton.setEnabled(!iconButtons.isEmpty());
}
/**
* 添加一个图标
*/
public void addCount() {
deleteCountButton.setEnabled(true);
IconButton iconButton = new IconButton("");
iconButtons.add(iconButton);
int indexToInsert = northPane.getComponentCount() - 2;
deleteCountButton.setEnabled(!iconButtons.isEmpty());
// 创建新的按钮并插入到倒数第三个组件后面
northPane.add(iconButton, indexToInsert);
adjustNorthPaneHeight();
IconConfigPane.this.revalidate(); // 重新验证并更新布局
IconConfigPane.this.repaint(); // 可选:刷新JPanel以更新界面显示
}
private void adjustNorthPaneHeight() {
northPane.setPreferredSize(new Dimension(northPaneWidth, getNorthPanelHeight(iconButtons.size())));
}
private int getNorthPanelHeight(int iconNum) {
return (int) Math.ceil((iconNum + 2) / 13.0) * 30;
}
private void initAddAndDeleteCountButton(Boolean deleteCountButtonEnabled) {
addCountButton = new UIButton(addIcon);
addCountButton.setPreferredSize(new Dimension(20, 20));
addCountButton.setName("add");
deleteCountButton = new UIButton(deleteIcon);
deleteCountButton.setPreferredSize(new Dimension(20, 20));
deleteCountButton.setName("delete");
deleteCountButton.setEnabled(deleteCountButtonEnabled);
addCountButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
fireAddCountListener();
}
});
deleteCountButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
fireDeleteCountListener();
}
});
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)));
ArrayList<IconButton> newIconButtons = new ArrayList<>();
for (String name : names) {
IconButton iconButton = new IconButton(name);
northPane.add(iconButton);
newIconButtons.add(iconButton);
}
iconButtons = newIconButtons;
if (canChangeCount) {
initAddAndDeleteCountButton(!ArrayUtils.isEmpty(names));
}
IconConfigPane.this.revalidate();
IconConfigPane.this.repaint();
}
/**
* 初始化编辑按钮
*/
private void initEditIconButton() {
editIconButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Edit")); editIconButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Edit"));
editIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A"))); editIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A")));
editIconButton.setPreferredSize(new Dimension(62, 20)); editIconButton.setPreferredSize(new Dimension(62, 20));
panel.add(editIconButton);
editIconButton.addActionListener(new ActionListener() { editIconButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
final CustomIconPane cip = new CustomIconPane(){ final CustomIconPane cip = new CustomIconPane(){
@ -62,11 +164,14 @@ public class IconConfigPane extends JPanel {
} }
}); });
editIconButton.setEnabled(false); editIconButton.setEnabled(false);
}
/**
* 初始化删除按钮
*/
private void initDeleteIconButton() {
deleteIconButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Delete")); deleteIconButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Delete"));
deleteIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A"))); deleteIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A")));
deleteIconButton.setPreferredSize(new Dimension(62, 20)); deleteIconButton.setPreferredSize(new Dimension(62, 20));
panel.add(deleteIconButton);
deleteIconButton.addActionListener(new ActionListener() { deleteIconButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -75,30 +180,89 @@ public class IconConfigPane extends JPanel {
} }
}); });
deleteIconButton.setEnabled(false); 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); this.add(panel, BorderLayout.CENTER);
JPanel northPane = new JPanel();
northPane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0));
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
IconButton iconButton = new IconButton(""); IconButton iconButton = new IconButton("");
northPane.add(iconButton); northPane.add(iconButton);
iconButtons.add(iconButton); iconButtons.add(iconButton);
} }
if (canChangeCount) {
initAddAndDeleteCountButton(count != 0);
}
this.add(northPane, BorderLayout.NORTH); this.add(northPane, BorderLayout.NORTH);
} }
public void setShowIconImage() { public void setShowIconImage() {
selectIconButton.setIconName(curIconName); 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);
}
/**
* 点击增加按钮
*/
public void fireAddCountListener() {
Object[] listeners = addCountListener.getListenerList();
ChangeEvent e = null;
for (int i = listeners.length - listenerStep; i >= 0; i -= listenerStep) {
if (listeners[i] == ChangeListener.class) {
if (e == null) {
e = new ChangeEvent(this);
}
((ChangeListener) listeners[i + 1]).stateChanged(e);
}
}
}
/**
* 点击删除按钮
*/
public void fireDeleteCountListener() {
Object[] listeners = deleteCountListener.getListenerList();
ChangeEvent e = null;
for (int i = listeners.length - listenerStep; i >= 0; i -= listenerStep) {
if (listeners[i] == ChangeListener.class) {
if (e == null) {
e = new ChangeEvent(this);
}
((ChangeListener) listeners[i + 1]).stateChanged(e);
}
}
}
public void populate(ArrayList<String> iconArr) { public void populate(ArrayList<String> iconArr) {
for (int i = 0; i < iconButtons.size(); i++) { for (int i = 0; i < iconButtons.size(); i++) {
iconButtons.get(i).setIconName(iconArr.get(i)); iconButtons.get(i).setIconName(iconArr.get(i));
} }
} }
public ArrayList<String> update() { public ArrayList<String> update() {
ArrayList<String> iconNames = new ArrayList<String>(); ArrayList<String> iconNames = new ArrayList<String>();
for (int i = 0; i < iconButtons.size(); i++) { for (int i = 0; i < iconButtons.size(); i++) {
@ -107,7 +271,6 @@ public class IconConfigPane extends JPanel {
return iconNames; return iconNames;
} }
private class IconButton extends JToggleButton implements ActionListener { private class IconButton extends JToggleButton implements ActionListener {
private String iconName; private String iconName;
private Image iconImage = null; private Image iconImage = null;

166
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/ImageCustomDefinePane.java

@ -23,11 +23,12 @@ import com.fr.form.ui.mobile.radiogroup.ImageMobileStyle;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.*;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
public class ImageCustomDefinePane extends MobileStyleCustomDefinePane { public class ImageCustomDefinePane extends MobileStyleCustomDefinePane {
@ -36,12 +37,21 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane {
private JPanel scrollPanel; private JPanel scrollPanel;
private UIComboBox custom; private UIComboBox custom;
private JPanel centerPane; private JPanel centerPane;
// 按钮排布+按钮排布下拉框panel;
private JPanel buttonAlignPane;
// 固定列数 数字panel
private JPanel columnSizePane;
private UISpinner leftSpinner; private UISpinner leftSpinner;
private UISpinner rightSpinner; private UISpinner rightSpinner;
private UISpinner topSpinner; private UISpinner topSpinner;
private UISpinner bottomSpinner; private UISpinner bottomSpinner;
private UIComboBox layoutTypeCombo;
private UIComboBox buttonAlignCombo;
private UISpinner columnSizeSpinner;
private IconConfigPane initialIconConfigPane; private IconConfigPane initialIconConfigPane;
private IconConfigPane selectedIconConfigPane; private IconConfigPane selectedIconConfigPane;
@ -115,53 +125,154 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane {
return FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); return FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10);
} }
private void addPaddingPane() { private void initLayoutCombo() {
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout"))); layoutTypeCombo = new UIComboBox(new String[]{
Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Single_Line"),
Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Auto"),
Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Fixed")
});
layoutTypeCombo.setPreferredSize(new Dimension(DesignerUtils.LARGE_COMBO_WIDTH, 20));
layoutTypeCombo.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (layoutTypeCombo.getSelectedIndex() == DesignerUtils.K_LAYOUT_SINGLE) {
buttonAlignPane.setVisible(true);
columnSizePane.setVisible(false);
}
if (layoutTypeCombo.getSelectedIndex() == DesignerUtils.K_LAYOUT_AUTO) {
buttonAlignPane.setVisible(false);
columnSizePane.setVisible(false);
}
if (layoutTypeCombo.getSelectedIndex() == DesignerUtils.K_LAYOUT_FIXED) {
buttonAlignPane.setVisible(false);
columnSizePane.setVisible(true);
}
}
});
}
UILabel paddingHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Button_Padding")); /**
UILabel emptyHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("")); * 初始化按钮排布面板
*/
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"),
Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Split"),
});
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);
}
UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Left")); /**
leftSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding); * 初始化固定列数面板
*/
private void initColumnSizePane() {
UILabel columnSizeLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Fixed_Number"));
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);
}
UILabel rightLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Right")); private JPanel initVPaddingConfig() {
rightSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding);
UILabel topLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Top")); UILabel topLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Top"));
topSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); topSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding);
UILabel bottomLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Bottom")); UILabel bottomLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Bottom"));
bottomSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); 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 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 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); return TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftSpinnerPanel, rightSpinnerPanel}}, 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); }
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 p = TableLayout.PREFERRED;
double[] rowSize = {p, p}; double[] rowSize = {p, p, p};
double[] columnSize = {p, p}; double[] columnSize = {p, p};
JPanel paddingPanel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{ JPanel paddingPanel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{
{paddingHintLabel, vPaddingSpinnerPanel}, {paddingHintLabel, initVPaddingConfig()},
{emptyHintLabel, hPaddingSpinnerPanel}, {emptyHintLabel, initHPaddingConfig()},
{layoutTypeLabel, layoutTypeCombo},
}, rowSize, columnSize, 10); }, rowSize, columnSize, 10);
centerPane.add(paddingPanel); centerPane.add(paddingPanel);
centerPane.add(buttonAlignPane);
centerPane.add(columnSizePane);
} }
private void addIconPane() { /**
* 初始化默认字体配置面版
*/
private void initInitialIconConfigPane() {
initialIconConfigPane = new IconConfigPane(8, true);
initialIconConfigPane.addAddCountListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
initialIconConfigPane.addCount();
selectedIconConfigPane.addCount();
}
});
initialIconConfigPane.addDeleteCountListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
initialIconConfigPane.deleteCount();
selectedIconConfigPane.deleteCount();
}
});
}
/**
* 初始化选择字体配置面板
*/
private void initSelectedIconConfigPane() {
selectedIconConfigPane = new IconConfigPane(8, true);
selectedIconConfigPane.addAddCountListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
initialIconConfigPane.addCount();
selectedIconConfigPane.addCount();
}
});
selectedIconConfigPane.addDeleteCountListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
initialIconConfigPane.deleteCount();
selectedIconConfigPane.deleteCount();
}
});
}
private void addIconPane() {
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon"))); centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon")));
UILabel initialLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon_Init")); UILabel initialLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon_Init"));
UILabel selectedLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon_Select")); UILabel selectedLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon_Select"));
initInitialIconConfigPane();
initialIconConfigPane = new IconConfigPane(8); initSelectedIconConfigPane();
selectedIconConfigPane = new IconConfigPane(8);
JPanel container = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 5); JPanel container = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 5);
JPanel initialPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel initialPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
@ -175,7 +286,6 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane {
container.add(selectedPane); container.add(selectedPane);
centerPane.add(container); centerPane.add(container);
} }
private void addFontPane() { private void addFontPane() {
@ -183,7 +293,7 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane {
UILabel initialFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_init")); UILabel initialFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_init"));
initialFontConfPane = new FontConfigPane(); 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); JPanel fontPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initialFontLabel, initialFontConfPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
centerPane.add(fontPanel); centerPane.add(fontPanel);
UILabel selectedFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_Select")); UILabel selectedFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_Select"));
@ -205,8 +315,11 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane {
rightSpinner.setValue(mobileStyle.getRightPadding()); rightSpinner.setValue(mobileStyle.getRightPadding());
topSpinner.setValue(mobileStyle.getTopPadding()); topSpinner.setValue(mobileStyle.getTopPadding());
bottomSpinner.setValue(mobileStyle.getBottomPadding()); bottomSpinner.setValue(mobileStyle.getBottomPadding());
initialIconConfigPane.populate(new ArrayList<>(Arrays.asList(mobileStyle.getInitialIconNames()))); layoutTypeCombo.setSelectedIndex(mobileStyle.getButtonLayoutType());
selectedIconConfigPane.populate(new ArrayList<>(Arrays.asList(mobileStyle.getSelectedIconNames()))); buttonAlignCombo.setSelectedIndex(mobileStyle.getButtonAlign());
columnSizeSpinner.setValue(mobileStyle.getButtonColumnSize());
initialIconConfigPane.refreshByIconNames(mobileStyle.getInitialIconNames(), true);
selectedIconConfigPane.refreshByIconNames(mobileStyle.getSelectedIconNames(), true);
if(mobileStyle.getInitialFont() != null) { if(mobileStyle.getInitialFont() != null) {
initialFontConfPane.populate(mobileStyle.getInitialFont()); initialFontConfPane.populate(mobileStyle.getInitialFont());
} }
@ -224,6 +337,9 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane {
mobileStyle.setRightPadding(rightSpinner.getValue()); mobileStyle.setRightPadding(rightSpinner.getValue());
mobileStyle.setTopPadding(topSpinner.getValue()); mobileStyle.setTopPadding(topSpinner.getValue());
mobileStyle.setBottomPadding(bottomSpinner.getValue()); mobileStyle.setBottomPadding(bottomSpinner.getValue());
mobileStyle.setButtonLayoutType(layoutTypeCombo.getSelectedIndex());
mobileStyle.setButtonAlign(buttonAlignCombo.getSelectedIndex());
mobileStyle.setButtonColumnSize((int)columnSizeSpinner.getValue());
ArrayList<String> initialIconNamesList = initialIconConfigPane.update(); ArrayList<String> initialIconNamesList = initialIconConfigPane.update();
ArrayList<String> selectedIconNamesList = selectedIconConfigPane.update(); ArrayList<String> selectedIconNamesList = selectedIconConfigPane.update();
mobileStyle.setInitialIconNames(initialIconNamesList.toArray(new String[initialIconNamesList.size()])); mobileStyle.setInitialIconNames(initialIconNamesList.toArray(new String[initialIconNamesList.size()]));

15
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/UnitedCustomDefinePane.java

@ -41,6 +41,7 @@ public class UnitedCustomDefinePane extends MobileStyleCustomDefinePane {
private UISpinner topSpinner; private UISpinner topSpinner;
private UISpinner bottomSpinner; private UISpinner bottomSpinner;
private UIComboBox buttonAlignCombo;
private NewColorSelectBox initialColorSelectBox; private NewColorSelectBox initialColorSelectBox;
private NewColorSelectBox selectedColorSelectBox; private NewColorSelectBox selectedColorSelectBox;
@ -117,7 +118,7 @@ public class UnitedCustomDefinePane extends MobileStyleCustomDefinePane {
private void addPaddingPane() { private void addPaddingPane() {
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout"))); centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout")));
UILabel buttonAlignLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment"));
UILabel paddingHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Button_Padding")); UILabel paddingHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Button_Padding"));
UILabel emptyHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("")); UILabel emptyHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText(""));
@ -140,13 +141,19 @@ public class UnitedCustomDefinePane extends MobileStyleCustomDefinePane {
JPanel vPaddingSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topSpinnerPanel, bottomSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, 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); JPanel hPaddingSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftSpinnerPanel, rightSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL);
// 按钮排布下拉框
buttonAlignCombo = new UIComboBox(new String[]{
Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Nature"),
Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Split"),
});
buttonAlignCombo.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20));
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p}; double[] rowSize = {p, p, p};
double[] columnSize = {p, p}; double[] columnSize = {p, p};
JPanel paddingPanel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{ JPanel paddingPanel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{
{paddingHintLabel, vPaddingSpinnerPanel}, {paddingHintLabel, vPaddingSpinnerPanel},
{emptyHintLabel, hPaddingSpinnerPanel}, {emptyHintLabel, hPaddingSpinnerPanel},
{buttonAlignLabel, buttonAlignCombo}
}, rowSize, columnSize, 10); }, rowSize, columnSize, 10);
centerPane.add(paddingPanel); centerPane.add(paddingPanel);
@ -234,6 +241,7 @@ public class UnitedCustomDefinePane extends MobileStyleCustomDefinePane {
rightSpinner.setValue(mobileStyle.getRightPadding()); rightSpinner.setValue(mobileStyle.getRightPadding());
topSpinner.setValue(mobileStyle.getTopPadding()); topSpinner.setValue(mobileStyle.getTopPadding());
bottomSpinner.setValue(mobileStyle.getBottomPadding()); bottomSpinner.setValue(mobileStyle.getBottomPadding());
buttonAlignCombo.setSelectedIndex(mobileStyle.getButtonAlign());
initialColorSelectBox.setSelectObject(mobileStyle.getInitialBackgroundColor()); initialColorSelectBox.setSelectObject(mobileStyle.getInitialBackgroundColor());
selectedColorSelectBox.setSelectObject(mobileStyle.getSelectedBackgroundColor()); selectedColorSelectBox.setSelectObject(mobileStyle.getSelectedBackgroundColor());
borderLineCombo.setSelectedLineStyle(mobileStyle.getBorderType()); borderLineCombo.setSelectedLineStyle(mobileStyle.getBorderType());
@ -256,6 +264,7 @@ public class UnitedCustomDefinePane extends MobileStyleCustomDefinePane {
mobileStyle.setRightPadding(rightSpinner.getValue()); mobileStyle.setRightPadding(rightSpinner.getValue());
mobileStyle.setTopPadding(topSpinner.getValue()); mobileStyle.setTopPadding(topSpinner.getValue());
mobileStyle.setBottomPadding(bottomSpinner.getValue()); mobileStyle.setBottomPadding(bottomSpinner.getValue());
mobileStyle.setButtonAlign(buttonAlignCombo.getSelectedIndex());
mobileStyle.setInitialBackgroundColor(initialColorSelectBox.getSelectObject()); mobileStyle.setInitialBackgroundColor(initialColorSelectBox.getSelectObject());
mobileStyle.setSelectedBackgroundColor(selectedColorSelectBox.getSelectObject()); mobileStyle.setSelectedBackgroundColor(selectedColorSelectBox.getSelectObject());
mobileStyle.setBorderType(borderLineCombo.getSelectedLineStyle()); mobileStyle.setBorderType(borderLineCombo.getSelectedLineStyle());

9
designer-base/src/main/java/com/fr/design/mainframe/mobile/utils/DesignerUtils.java

@ -16,10 +16,19 @@ import java.awt.*;
public class DesignerUtils { public class DesignerUtils {
public static final int NORMAL_COMBO_WIDTH = 152; public static final int NORMAL_COMBO_WIDTH = 152;
public static final int LARGE_COMBO_WIDTH = 174;
public static final int kDefaultHorizontalPadding = 0; public static final int kDefaultHorizontalPadding = 0;
public static final int kDefaultVerticalPadding = 15; public static final int kDefaultVerticalPadding = 15;
public static final int kAlignLeft = 0; public static final int kAlignLeft = 0;
public static final int kAlignCenter = 1; public static final int kAlignCenter = 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[]{ public static final int[] BORDER_LINE_STYLE_ARRAY = new int[]{
Constants.LINE_NONE, Constants.LINE_NONE,
Constants.LINE_THIN, Constants.LINE_THIN,

6
designer-base/src/main/java/com/fr/design/mainframe/mobile/utils/MobileStyleProviderManager.java

@ -1,5 +1,8 @@
package com.fr.design.mainframe.mobile.utils; package com.fr.design.mainframe.mobile.utils;
import com.fr.design.mainframe.mobile.provider.checkboxgroup.CapsuleCheckboxGroupStyleProvider;
import com.fr.design.mainframe.mobile.provider.checkboxgroup.ImageCheckboxGroupStyleProvider;
import com.fr.design.mainframe.mobile.provider.checkboxgroup.UnitedCheckboxGroupStyleProvider;
import com.fr.design.mainframe.mobile.provider.combo.SimpleComboCheckBoxStyleProvider; import com.fr.design.mainframe.mobile.provider.combo.SimpleComboCheckBoxStyleProvider;
import com.fr.design.mainframe.mobile.provider.combo.SimpleComboStyleProvider; import com.fr.design.mainframe.mobile.provider.combo.SimpleComboStyleProvider;
import com.fr.design.mainframe.mobile.provider.date.NavigationStyleProvider; import com.fr.design.mainframe.mobile.provider.date.NavigationStyleProvider;
@ -26,6 +29,9 @@ public class MobileStyleProviderManager {
add(new CapsuleRadioGroupStyleProvider()); add(new CapsuleRadioGroupStyleProvider());
add(new UnitedRadioGroupStyleProvider()); add(new UnitedRadioGroupStyleProvider());
add(new ImageRadioGroupStyleProvider()); add(new ImageRadioGroupStyleProvider());
add(new CapsuleCheckboxGroupStyleProvider());
add(new UnitedCheckboxGroupStyleProvider());
add(new ImageCheckboxGroupStyleProvider());
}}; }};
private static Set<Mutable> mobileParamUIProviderSet = new HashSet<Mutable>() {{ private static Set<Mutable> mobileParamUIProviderSet = new HashSet<Mutable>() {{
add(new MobileTopParamStyleProvider()); add(new MobileTopParamStyleProvider());

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_add.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_delete.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

Loading…
Cancel
Save