diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java index 766f06d511..8fd34d4524 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java +++ b/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.i18n.Toolkit; 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.MobileFormCollapsedStyle; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Dimension; +import javax.swing.*; +import java.awt.*; /** * @author hades @@ -21,34 +20,45 @@ import java.awt.Dimension; */ public class MobileCollapsedStyleExpandPane extends MobileCollapsedStylePane { - private static final Dimension DEFAULT_SPINNER_SIZE = new Dimension(60, 24); - private UISpinner rowSpinner; public MobileCollapsedStyleExpandPane() { } - @Override - protected JPanel createLinePane() { - UITitleSplitLine splitLine = new UITitleSplitLine(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Line_Number"), 520); - splitLine.setPreferredSize(new Dimension(520, 20)); + protected void createConfigPanes(JPanel settingPane) { + JPanel lineNumberConfigPane = this.createLineNumberConfigPane(); + 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) { @Override protected UINumberField initNumberField(){ return new UIIntNumberField(); } }; - rowSpinner.setPreferredSize(DEFAULT_SPINNER_SIZE); - JPanel panel = new JPanel(); - panel.setLayout(FRGUIPaneFactory.createBoxFlowLayout()); - panel.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Start_From"))); - panel.add(rowSpinner); - panel.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Row_To_Fold"))); - JPanel linePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - linePane.add(splitLine, BorderLayout.NORTH); - linePane.add(panel, BorderLayout.CENTER); - return linePane; + this.rowSpinner.setPreferredSize(new Dimension(62, COMPONENT_HEIGHT)); + JPanel defaultCollapsedStatePanel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + defaultCollapsedStatePanel.add(createLabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Start_From") + " ")); + defaultCollapsedStatePanel.add(rowSpinner); + defaultCollapsedStatePanel.add(createLabel(" " + Toolkit.i18nText("Fine-Design_Mobile_Collapse_Row_To_Fold"))); + + double[] rowSize = {COMPONENT_HEIGHT}; + double[] columnSize = {LABEL_WIDTH, COMPONENT_WIDTH}; + double[] verticalGaps = {0}; + 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 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStylePane.java index 74538e77c5..ae86e90ca3 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStylePane.java @@ -1,8 +1,6 @@ package com.fr.design.mainframe.mobile.ui; 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.UIRadioButton; 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.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.mainframe.widget.UITitleSplitLine; import com.fr.design.style.color.NewColorSelectBox; 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 javax.swing.*; -import javax.swing.border.TitledBorder; -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; +import java.awt.*; /** * @author hades @@ -36,6 +26,13 @@ import java.awt.FlowLayout; */ public class MobileCollapsedStylePane extends BasicBeanPane { + 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 NewColorSelectBox buttonColorBox; private UITextField foldedTextFiled; @@ -44,74 +41,94 @@ public class MobileCollapsedStylePane extends BasicBeanPane(); + + 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")); 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")); + 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.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() { - return FRGUIPaneFactory.createBorderLayout_S_Pane(); + double[] rowSize = {COMPONENT_HEIGHT, COMPONENT_HEIGHT, COMPONENT_HEIGHT, COMPONENT_HEIGHT, COMPONENT_HEIGHT}; + 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 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileComboBoxDialogEditor.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileComboBoxDialogEditor.java index 6e9b74a1dd..7a8b823724 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileComboBoxDialogEditor.java +++ b/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.general.ComparatorUtils; -import javax.swing.SwingUtilities; -import java.awt.Dimension; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -33,6 +33,7 @@ public class MobileComboBoxDialogEditor extends BasicPane { private ActionListener listener; public MobileComboBoxDialogEditor(MobileCollapsedStylePane stylePane) { + this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); this.stylePane = stylePane; this.comboBox = new UIComboBox(new Object[] {NONE, CUSTOM}); this.comboBox.setPreferredSize(COMBOX_DIMENSION);