Browse Source

Merge pull request #1634 in DESIGN/design from ~STARRYI/design:release/10.0 to release/10.0

* commit '649cd4590e03a19f2482dcd2ab40c187d01242f7':
  MOBILE-25666 移动端折叠展开配置面板样式不符合设计
feature/big-screen
starryi 5 years ago
parent
commit
b4263517a9
  1. 50
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java
  2. 153
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStylePane.java
  3. 5
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileComboBoxDialogEditor.java

50
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java

@ -6,13 +6,12 @@ import com.fr.design.gui.itextfield.UIIntNumberField;
import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.widget.UITitleSplitLine; import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.mobile.MobileCollapsedStyle; import com.fr.form.ui.mobile.MobileCollapsedStyle;
import com.fr.form.ui.mobile.MobileFormCollapsedStyle; import com.fr.form.ui.mobile.MobileFormCollapsedStyle;
import javax.swing.JPanel; import javax.swing.*;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.Dimension;
/** /**
* @author hades * @author hades
@ -21,34 +20,45 @@ import java.awt.Dimension;
*/ */
public class MobileCollapsedStyleExpandPane extends MobileCollapsedStylePane { public class MobileCollapsedStyleExpandPane extends MobileCollapsedStylePane {
private static final Dimension DEFAULT_SPINNER_SIZE = new Dimension(60, 24);
private UISpinner rowSpinner; private UISpinner rowSpinner;
public MobileCollapsedStyleExpandPane() { public MobileCollapsedStyleExpandPane() {
} }
@Override @Override
protected JPanel createLinePane() { protected void createConfigPanes(JPanel settingPane) {
UITitleSplitLine splitLine = new UITitleSplitLine(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Line_Number"), 520); JPanel lineNumberConfigPane = this.createLineNumberConfigPane();
splitLine.setPreferredSize(new Dimension(520, 20)); settingPane.add(lineNumberConfigPane);
super.createConfigPanes(settingPane);
}
protected JPanel createLineNumberConfigPane() {
JPanel configPane = super.createTitleConfigPane(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Line_Number"));
UILabel collapseLocationLabel = createLabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Show_Button"));
this.rowSpinner = new UISpinner(1, Integer.MAX_VALUE, 1, 1) { this.rowSpinner = new UISpinner(1, Integer.MAX_VALUE, 1, 1) {
@Override @Override
protected UINumberField initNumberField(){ protected UINumberField initNumberField(){
return new UIIntNumberField(); return new UIIntNumberField();
} }
}; };
rowSpinner.setPreferredSize(DEFAULT_SPINNER_SIZE); this.rowSpinner.setPreferredSize(new Dimension(62, COMPONENT_HEIGHT));
JPanel panel = new JPanel(); JPanel defaultCollapsedStatePanel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
panel.setLayout(FRGUIPaneFactory.createBoxFlowLayout()); defaultCollapsedStatePanel.add(createLabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Start_From") + " "));
panel.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Start_From"))); defaultCollapsedStatePanel.add(rowSpinner);
panel.add(rowSpinner); defaultCollapsedStatePanel.add(createLabel(" " + Toolkit.i18nText("Fine-Design_Mobile_Collapse_Row_To_Fold")));
panel.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Row_To_Fold")));
JPanel linePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); double[] rowSize = {COMPONENT_HEIGHT};
linePane.add(splitLine, BorderLayout.NORTH); double[] columnSize = {LABEL_WIDTH, COMPONENT_WIDTH};
linePane.add(panel, BorderLayout.CENTER); double[] verticalGaps = {0};
return linePane; JPanel navButtonSettingsPanel = TableLayoutHelper.createDiffVGapTableLayoutPane(new JComponent[][]{
{collapseLocationLabel, defaultCollapsedStatePanel},
}, rowSize, columnSize, 5, verticalGaps);
navButtonSettingsPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 15, 0));
configPane.add(navButtonSettingsPanel);
return configPane;
} }
@Override @Override

153
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStylePane.java

@ -1,8 +1,6 @@
package com.fr.design.mainframe.mobile.ui; package com.fr.design.mainframe.mobile.ui;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.ibutton.ModeButtonGroup; import com.fr.design.gui.ibutton.ModeButtonGroup;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
@ -10,9 +8,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.mainframe.widget.UITitleSplitLine; import com.fr.design.mainframe.widget.UITitleSplitLine;
import com.fr.design.style.color.NewColorSelectBox; import com.fr.design.style.color.NewColorSelectBox;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
@ -21,13 +17,7 @@ import com.fr.form.ui.mobile.MobileChartCollapsedStyle;
import com.fr.form.ui.mobile.MobileCollapsedStyle; import com.fr.form.ui.mobile.MobileCollapsedStyle;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.TitledBorder; import java.awt.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
/** /**
* @author hades * @author hades
@ -36,6 +26,13 @@ import java.awt.FlowLayout;
*/ */
public class MobileCollapsedStylePane extends BasicBeanPane<MobileCollapsedStyle> { public class MobileCollapsedStylePane extends BasicBeanPane<MobileCollapsedStyle> {
public final static Color THEME_COLOR = Color.decode("#2F8EF1");
public final static Font TEXT_FONT = new Font("Default", Font.PLAIN, 12);
public final static Color TEXT_FONT_COLOR = Color.decode("#333334");
public final static int LABEL_WIDTH = 96;
public final static int COMPONENT_HEIGHT = 20;
public final static int COMPONENT_WIDTH = 160;
private UICheckBox showButtonCheck; private UICheckBox showButtonCheck;
private NewColorSelectBox buttonColorBox; private NewColorSelectBox buttonColorBox;
private UITextField foldedTextFiled; private UITextField foldedTextFiled;
@ -44,74 +41,94 @@ public class MobileCollapsedStylePane extends BasicBeanPane<MobileCollapsedStyle
public MobileCollapsedStylePane() { public MobileCollapsedStylePane() {
TitledBorder titledBorder = GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set"), null); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
VerticalFlowLayout layout = new VerticalFlowLayout(FlowLayout.LEADING, 0, 10); this.setBorder(BorderFactory.createEmptyBorder( 10, 5, 0, 5));
layout.setAlignLeft(true);
this.setBorder(titledBorder); JPanel settingPane = this.createSettingPane();
this.setLayout(layout); this.createConfigPanes(settingPane);
this.add(createLinePane());
this.add(createSettingPane()); this.add(settingPane);
} }
private JPanel createSettingPane() { private JPanel createSettingPane() {
JPanel settingPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 0); JPanel settingPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
UITitleSplitLine splitLine = new UITitleSplitLine(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Button"), 520); settingPane.setBorder(GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Report_Set"), THEME_COLOR));
splitLine.setPreferredSize(new Dimension(520, 20)); return settingPane;
UILabel showButtonLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Show_Button")); }
showButtonCheck = new UICheckBox(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Show_Button_On_Right"));
showButtonCheck.setPreferredSize(new Dimension(140, 24)); protected UILabel createLabel(String text) {
UILabel buttonColorLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Button_Color")); UILabel label = new UILabel(text, SwingConstants.RIGHT);
buttonColorBox = new NewColorSelectBox(137); label.setForeground(TEXT_FONT_COLOR);
UILabel foldedLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Folded_Hint")); label.setFont(TEXT_FONT);
return label;
}
protected void createConfigPanes(JPanel settingPane) {
JPanel collapsedButtonConfigPane = this.createCollapsedButtonConfigPane();
settingPane.add(collapsedButtonConfigPane);
}
protected JPanel createTitleConfigPane(String title) {
JPanel configPane = new JPanel();
configPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
configPane.setLayout(new BoxLayout(configPane, BoxLayout.Y_AXIS));
Dimension titleLineDim = new Dimension(610, 20);
UITitleSplitLine splitLine = new UITitleSplitLine(title, titleLineDim.width);
splitLine.setPreferredSize(titleLineDim);
configPane.add(splitLine);
return configPane;
}
private JPanel createCollapsedButtonConfigPane() {
JPanel configPane = this.createTitleConfigPane(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Button"));
UILabel showButtonLabel = this.createLabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Show_Button"));
showButtonCheck = new UICheckBox(Toolkit.i18nText(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Show_Button_On_Right")));
showButtonCheck.setForeground(TEXT_FONT_COLOR);
showButtonCheck.setFont(TEXT_FONT);
UILabel buttonColorLabel = this.createLabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Button_Color"));
buttonColorBox = new NewColorSelectBox(COMPONENT_WIDTH);
UILabel foldedLabel = this.createLabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Folded_Hint"));
foldedTextFiled = new UITextField(); foldedTextFiled = new UITextField();
UILabel unfoldedLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_UnFolded_Hint"));
UILabel unfoldedLabel = this.createLabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_UnFolded_Hint"));
unfoldedTextFiled = new UITextField(); unfoldedTextFiled = new UITextField();
UILabel defaultStateLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Default_State"));
buttonGroup = new ModeButtonGroup<>(); UILabel defaultCollapsedStateLabel = this.createLabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Default_State"));
JPanel defaultCollapsedStatePanel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
UIRadioButton foldedButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Fold")); UIRadioButton foldedButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Fold"));
foldedButton.setSelected(true); foldedButton.setSelected(true);
foldedButton.setPreferredSize(new Dimension(COMPONENT_WIDTH / 2, COMPONENT_HEIGHT));
foldedButton.setForeground(TEXT_FONT_COLOR);
foldedButton.setFont(TEXT_FONT);
UIRadioButton unfoldedButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Unfold")); UIRadioButton unfoldedButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Unfold"));
unfoldedButton.setPreferredSize(new Dimension(COMPONENT_WIDTH / 2, COMPONENT_HEIGHT));
unfoldedButton.setForeground(TEXT_FONT_COLOR);
unfoldedButton.setFont(TEXT_FONT);
defaultCollapsedStatePanel.add(foldedButton);
defaultCollapsedStatePanel.add(unfoldedButton);
buttonGroup = new ModeButtonGroup<>();
buttonGroup.put(CollapseState.FOLDED, foldedButton); buttonGroup.put(CollapseState.FOLDED, foldedButton);
buttonGroup.put(CollapseState.UNFOLDED, unfoldedButton); buttonGroup.put(CollapseState.UNFOLDED, unfoldedButton);
JPanel flowLeftPane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
flowLeftPane.add(foldedButton);
flowLeftPane.add(unfoldedButton);
Component[][] northComponents = new Component[][] {
new Component[] {showButtonLabel, showButtonCheck}
};
Component[][] southComponents = new Component[][] {
new Component[] {defaultStateLabel, flowLeftPane}
};
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p};
double[] colSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}};
Component[][] centerComponents = new Component[][] {
new Component[] {buttonColorLabel, buttonColorBox},
new Component[] {foldedLabel, foldedTextFiled},
new Component[] {unfoldedLabel, unfoldedTextFiled},
};
JPanel northPane = TableLayoutHelper.createGapTableLayoutPane(northComponents, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1);
JPanel southPane = TableLayoutHelper.createGapTableLayoutPane(southComponents, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
final JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(centerComponents, rowSize, colSize, rowCount, LayoutConstants.HGAP_LARGE, LayoutConstants.VGAP_SMALL);
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.add(northPane, BorderLayout.NORTH);
panel.add(centerPane, BorderLayout.CENTER);
panel.add(southPane, BorderLayout.SOUTH);
settingPane.add(splitLine);
settingPane.add(panel);
showButtonCheck.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
centerPane.setVisible(showButtonCheck.isSelected());
}
});
return settingPane;
}
protected JPanel createLinePane() { double[] rowSize = {COMPONENT_HEIGHT, COMPONENT_HEIGHT, COMPONENT_HEIGHT, COMPONENT_HEIGHT, COMPONENT_HEIGHT};
return FRGUIPaneFactory.createBorderLayout_S_Pane(); double[] columnSize = {LABEL_WIDTH, COMPONENT_WIDTH};
double[] verticalGaps = {10, 10, 10, 10, 10};
JPanel contentPane = TableLayoutHelper.createDiffVGapTableLayoutPane(new JComponent[][]{
{showButtonLabel, showButtonCheck},
{buttonColorLabel, buttonColorBox},
{foldedLabel, foldedTextFiled},
{unfoldedLabel, unfoldedTextFiled},
{defaultCollapsedStateLabel, defaultCollapsedStatePanel}
}, rowSize, columnSize, 5, verticalGaps);
contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 15, 0));
configPane.add(contentPane);
return configPane;
} }
@Override @Override

5
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileComboBoxDialogEditor.java

@ -9,8 +9,8 @@ import com.fr.design.i18n.Toolkit;
import com.fr.form.ui.mobile.MobileCollapsedStyle; import com.fr.form.ui.mobile.MobileCollapsedStyle;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import javax.swing.SwingUtilities; import javax.swing.*;
import java.awt.Dimension; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -33,6 +33,7 @@ public class MobileComboBoxDialogEditor extends BasicPane {
private ActionListener listener; private ActionListener listener;
public MobileComboBoxDialogEditor(MobileCollapsedStylePane stylePane) { public MobileComboBoxDialogEditor(MobileCollapsedStylePane stylePane) {
this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
this.stylePane = stylePane; this.stylePane = stylePane;
this.comboBox = new UIComboBox(new Object[] {NONE, CUSTOM}); this.comboBox = new UIComboBox(new Object[] {NONE, CUSTOM});
this.comboBox.setPreferredSize(COMBOX_DIMENSION); this.comboBox.setPreferredSize(COMBOX_DIMENSION);

Loading…
Cancel
Save