Browse Source

Pull request #1690: MOBILE-27000 移动端控件图标支持自定义颜色

Merge in DESIGN/design from ~TOMMY/design:release/10.0 to release/10.0

* commit '3be3844d98a062b5a52650814566faf3796dfa72':
  删除多余代码
  MOBILE-27000 移动端控件图标支持自定义颜色
feature/big-screen
Tommy 4 years ago
parent
commit
0181f0109a
  1. 21
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java
  2. 30
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleFontConfigPane.java

21
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java

@ -48,6 +48,7 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
private LineComboBox borderType;
private NewColorSelectBox borderColor;
private UISpinner borderRadius;
private NewColorSelectBox iconColor;
private MobileStyleFontConfigPane fontConfigPane;
MobileStyleDefinePane(Widget widget, Class<? extends MobileStyleCustomDefinePane> customBeanPaneClass,
@ -69,6 +70,9 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
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> {
mobileStyle.setBorderType(borderType.getSelectedLineStyle());
mobileStyle.setBorderColor(borderColor.getSelectObject());
mobileStyle.setBorderRadius(borderRadius.getValue());
mobileStyle.setIconColor(iconColor.getSelectObject());
mobileStyle.setFont(fontConfigPane.updateBean());
return mobileStyle;
}
@ -123,16 +128,12 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
createBackgroundPane();
createBorderPane();
createIconSettingPane();
createFontPane();
}
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);
@ -143,11 +144,6 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
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));
@ -155,6 +151,11 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
commomPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_BorderRadius")), borderRadius));
}
private void createIconSettingPane() {
iconColor = new NewColorSelectBox(NORMAL_COMBO_WIDTH);
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));

30
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleFontConfigPane.java

@ -4,11 +4,16 @@ 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 com.fr.stable.StringUtils;
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 +24,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<Integer> getFontSizes() {
Vector<Integer> FONT_SIZES = new Vector<Integer>();
FONT_SIZES.add(FONT_NONE);
for (int i = MIN_FONT_SIZE; i <= MAX_FONT_SIZE; i++) {
FONT_SIZES.add(i);
}
@ -42,10 +49,11 @@ public class MobileStyleFontConfigPane extends JPanel {
private void initComponent() {
fontSizeComboBox = new UIComboBox(getFontSizes());
fontSizeComboBox.setSelectedItem(16);
fontSizeComboBox = new UIComboBox();
fontSizeComboBox.setModel(new DefaultComboBoxModel(getFontSizes()));
fontSizeComboBox.setSelectedItem(0);
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 +104,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(StringUtils.BLANK + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None"));
}
return renderer;
}
}
}

Loading…
Cancel
Save