From 3c20c124644230da54a2dfd3bfa78c09fb7488dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Fri, 12 Jan 2024 18:52:42 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-111995=20=E3=80=90UI=E7=BF=BB=E6=96=B0?= =?UTF-8?q?=E3=80=91=E6=8E=A7=E4=BB=B6=E9=9D=A2=E6=9D=BF=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E6=95=B4=E4=BD=93=E7=BF=BB=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fine/theme/utils/FineUIStyle.java | 1 + .../fr/design/border/FineBorderFactory.java | 19 ++ .../fr/design/constants/LayoutConstants.java | 10 + .../com/fr/design/dialog/BasicScrollPane.java | 16 +- .../design/gui/columnrow/ColumnRowPane.java | 19 +- .../fr/design/gui/frpane/RegFieldPane.java | 38 ++-- .../com/fr/design/gui/frpane/RegPane.java | 195 +++++++++--------- .../itree/refreshabletree/TreeRootPane.java | 41 ++-- .../btn/ButtonWithHotkeysDetailPane.java | 57 ++--- .../widget/component/DateValuePane.java | 51 +++-- .../component/NumberEditorValidatePane.java | 52 +++-- .../widget/component/ReturnTypePane.java | 46 +++-- .../widget/mobile/WidgetMobilePane.java | 4 +- .../light/ui/laf/FineLightLaf.properties | 5 +- .../ui/btn/AbstractExtraButtonPane.java | 20 +- .../MobileTextFieldInputSettingPane.java | 57 +++-- .../fr/design/widget/CellWidgetCardPane.java | 50 +++-- .../com/fr/design/widget/WidgetEventPane.java | 4 +- .../java/com/fr/design/widget/WidgetPane.java | 60 +++--- .../ui/BasicWidgetPropertySettingPane.java | 44 ++-- .../design/widget/ui/ButtonGroupDictPane.java | 71 ++++--- .../design/widget/ui/CheckBoxDefinePane.java | 40 ++-- .../widget/ui/CheckBoxGroupDefinePane.java | 42 ++-- .../design/widget/ui/ComboBoxDefinePane.java | 21 +- .../widget/ui/ComboCheckBoxDefinePane.java | 41 ++-- .../ui/CustomWritableRepeatEditorPane.java | 20 +- .../widget/ui/DateEditorDefinePane.java | 171 +++++++-------- .../ui/DirectWriteEditorDefinePane.java | 36 ++-- .../widget/ui/FieldEditorDefinePane.java | 77 ++++--- .../widget/ui/IframeEditorDefinePane.java | 57 +++-- .../widget/ui/ListEditorDefinePane.java | 14 +- .../design/widget/ui/MultiFileEditorPane.java | 42 ++-- .../widget/ui/NumberEditorDefinePane.java | 41 ++-- .../widget/ui/RadioGroupDefinePane.java | 29 +-- .../widget/ui/TextFieldEditorDefinePane.java | 40 ++-- .../ui/TreeComboBoxEditorDefinePane.java | 41 ++-- .../widget/ui/TreeEditorDefinePane.java | 60 +++--- .../design/widget/ui/WaterMarkDictPane.java | 30 ++- .../widget/ui/WritableRepeatEditorPane.java | 12 +- .../ui/WriteUnableRepeatEditorPane.java | 44 ++-- .../ui/btn/AppendRowButtonDefinePane.java | 13 -- .../widget/ui/btn/ButtonSytleDefinedPane.java | 52 +++-- .../ui/btn/DefineAppendColumnRowPane.java | 45 ++-- .../ui/btn/DefineDeleteColumnRowPane.java | 41 ++-- .../btn/TreeNodeToogleButtonDefinePane.java | 27 ++- .../ui/mobile/MultiFileEditorMobilePane.java | 30 +-- .../ui/mobile/TextEditorMobilePane.java | 10 +- 47 files changed, 934 insertions(+), 1002 deletions(-) diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java b/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java index 0af3013ff2..873c0e4edd 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java @@ -28,6 +28,7 @@ public interface FineUIStyle { String BRAND_COLOR_LABEL = "brandColorLabel"; String BUTTON_TAB_ACTION = "tabAction"; String LABEL_BOLD = "boldLabel"; + String LABEL_TIP = "tipLabel"; String MENU_TOOL_BAR = "menuToolBar"; String MENU_ITEM_TOOL_BAR = "menuItemToolBar"; diff --git a/designer-base/src/main/java/com/fr/design/border/FineBorderFactory.java b/designer-base/src/main/java/com/fr/design/border/FineBorderFactory.java index 02cf2541af..7867055844 100644 --- a/designer-base/src/main/java/com/fr/design/border/FineBorderFactory.java +++ b/designer-base/src/main/java/com/fr/design/border/FineBorderFactory.java @@ -34,4 +34,23 @@ public class FineBorderFactory { return createUnderlineBorder(FineUIUtils.getUIColor("Label.borderColor", "defaultBorderColor")); } + /** + * 创建一个上边缘线边框 + * + * @param color 上边缘线颜色 + * @return 边框 + */ + public static Border createToplineBorder(Color color) { + return BorderFactory.createMatteBorder(1, 0, 0, 0, color); + } + + /** + * 创建默认的上划线边框 + * + * @return 边框 + */ + public static Border createDefaultTopBorder() { + return createToplineBorder(FineUIUtils.getUIColor("Label.borderColor", "defaultBorderColor")); + } + } diff --git a/designer-base/src/main/java/com/fr/design/constants/LayoutConstants.java b/designer-base/src/main/java/com/fr/design/constants/LayoutConstants.java index a4150dbfa1..13bf91003c 100644 --- a/designer-base/src/main/java/com/fr/design/constants/LayoutConstants.java +++ b/designer-base/src/main/java/com/fr/design/constants/LayoutConstants.java @@ -52,4 +52,14 @@ public class LayoutConstants { * 主题化布局:垂直间隙 */ public static final int VERTICAL_GAP = 10; + + /** + * 主题化布局:常规布局左侧比例 + */ + public static final double LEFT_WEIGHT = 1.2; + + /** + * 主题化布局:常规布局右侧比例 + */ + public static final double RIGHT_WEIGHT = 3; } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java b/designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java index 0255748979..fbb602db38 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java +++ b/designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java @@ -1,10 +1,17 @@ package com.fr.design.dialog; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.iscrollbar.UIScrollBar; -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import javax.swing.JScrollBar; +import java.awt.AWTEvent; +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.LayoutManager; import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; import java.awt.event.MouseWheelEvent; @@ -104,7 +111,6 @@ public abstract class BasicScrollPane extends BasicBeanPane{ protected void layoutContentPane() { leftcontentPane = createContentPane(); - leftcontentPane.setBorder(BorderFactory.createMatteBorder(0, 10, 0, 5, original)); this.add(leftcontentPane); } @@ -176,7 +182,7 @@ public abstract class BasicScrollPane extends BasicBeanPane{ scrollBar.setBounds(width - scrollBar.getWidth() - 1, 0, scrollBar.getWidth(), height); } else { int hideBarWidth = hideBarWidth() ? scrollBar.getWidth() : 0; - leftcontentPane.setBounds(0, 0, width - DET_WIDTH + hideBarWidth, height); + leftcontentPane.setBounds(0, 0, width + hideBarWidth, height); } } @@ -205,7 +211,7 @@ public abstract class BasicScrollPane extends BasicBeanPane{ this.setLayout(new BarLayout()); this.add(scrollBar); leftcontentPane = pane; - leftcontentPane.setBorder(BorderFactory.createMatteBorder(0, 10, 0, 5, original)); + leftcontentPane.setBorder(new ScaledEmptyBorder(0, 6, 0, 6)); this.add(leftcontentPane); } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/columnrow/ColumnRowPane.java b/designer-base/src/main/java/com/fr/design/gui/columnrow/ColumnRowPane.java index 10ea21a9ae..4f76c2e69f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/columnrow/ColumnRowPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/columnrow/ColumnRowPane.java @@ -1,6 +1,5 @@ package com.fr.design.gui.columnrow; -import com.fr.design.designer.IntervalConstants; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ispinner.ColumnRowSpinner; @@ -15,8 +14,8 @@ import com.fr.stable.StringUtils; import javax.swing.JFormattedTextField; import javax.swing.JPanel; -import javax.swing.JSpinner.DefaultEditor; import javax.swing.SpinnerListModel; +import javax.swing.JSpinner.DefaultEditor; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; @@ -27,7 +26,10 @@ import javax.swing.text.BadLocationException; import javax.swing.text.DocumentFilter; import java.awt.BorderLayout; import java.awt.Dimension; -import java.awt.GridLayout; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.fix; +import static com.fine.swing.ui.layout.Layouts.row; /** * the component to edit ColumnRow @@ -96,11 +98,16 @@ public class ColumnRowPane extends JPanel implements UIObserver { * 初始化元素 */ public void initComponents() { - this.setLayout(new GridLayout(0, 2, IntervalConstants.INTERVAL_L6, 0)); + this.setLayout(new BorderLayout()); initColSpinner(); - this.add(columnSpinner, BorderLayout.WEST); initRowSpinner(); - this.add(rowSpinner); + this.add( + row( + cell(columnSpinner).weight(1), + fix(2), + cell(rowSpinner).weight(1) + ).getComponent() + ); this.addDocumentListener(d); } diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/RegFieldPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/RegFieldPane.java index 38e33514bc..9020e1688c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/RegFieldPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/RegFieldPane.java @@ -3,23 +3,19 @@ package com.fr.design.gui.frpane; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.ErrorMsgTextFieldAdapter; import com.fr.design.beans.UITextFieldAdapter; -import com.fr.design.constants.LayoutConstants; -import com.fr.design.designer.IntervalConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.fun.TextFieldAdapterProvider; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.TextEditor; import com.fr.form.ui.reg.NoneReg; import com.fr.form.ui.reg.RegExp; import com.fr.log.FineLoggerFactory; -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; /** * Created by kerry on 2017/9/4. @@ -37,22 +33,17 @@ public class RegFieldPane extends RegPane { } public void initComponents() { - this.setBorder(BorderFactory.createEmptyBorder(0, 0, IntervalConstants.INTERVAL_L1, 0)); regErrorMsgPane = new RegErrorMsgPane(); - final RegChangeListener regChangeListener = new RegChangeListener() { - - @Override - public void regChangeAction() { - RegExp regExp = (RegExp) getRegComboBox().getSelectedItem(); - if (regExp instanceof NoneReg) { - regErrorMsgPane.setVisible(false); - return; - } - regErrorMsgPane.setVisible(true); + final RegChangeListener regChangeListener = () -> { + RegExp regExp = (RegExp) getRegComboBox().getSelectedItem(); + if (regExp instanceof NoneReg) { + regErrorMsgPane.setVisible(false); + return; } + regErrorMsgPane.setVisible(true); }; + corePane.add(regErrorMsgPane); this.addRegChangeListener(regChangeListener); - this.add(regErrorMsgPane, BorderLayout.CENTER); } @Override @@ -80,11 +71,10 @@ public class RegFieldPane extends RegPane { private void setStyle() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0)); UILabel tipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip")); - tipLabel.setPreferredSize(new Dimension(60, 20)); - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{tipLabel, errorMsgTextFieldAdapter.getErrorMsgTextField()}}, TableLayoutHelper.FILL_LASTCOLUMN, 10, LayoutConstants.VGAP_MEDIUM); - this.add(panel); + this.add(row( + cell(tipLabel).weight(LEFT_WEIGHT), cell(errorMsgTextFieldAdapter.getErrorMsgTextField()).weight(RIGHT_WEIGHT) + ).getComponent()); } private void initRegErrorMsgField() { diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/RegPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/RegPane.java index ea92ee73ce..e378100567 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/RegPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/RegPane.java @@ -1,16 +1,14 @@ package com.fr.design.gui.frpane; import com.fr.design.constants.LayoutConstants; -import com.fr.design.designer.IntervalConstants; import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.core.ReactiveCardPane; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.reg.*; import com.fr.general.ComparatorUtils; @@ -18,13 +16,14 @@ import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; import java.util.EventListener; import java.util.EventObject; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.column; + public class RegPane extends BasicPane { public static final RegExp[] ALL_REG_TYPE = { new NoneReg(), @@ -54,7 +53,7 @@ public class RegPane extends BasicPane { private RegPhonePane regPhonePane; private DefaultRegPane defaultRegPane; private CustomRegRexPane customRegRexPane; - + protected JPanel corePane; public UIComboBox getRegComboBox(){ return regComboBox; @@ -71,49 +70,51 @@ public class RegPane extends BasicPane { private void initComponents(){ this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + corePane = column(LayoutConstants.VERTICAL_GAP).getComponent(); + this.add(corePane); + regComboBox = new UIComboBox(regType); regComboBox.setRenderer(listCellRender); - JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Input_Rule")), regComboBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - - jPanel.add(contentPane, BorderLayout.NORTH); - JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - final JPanel cardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); - detailedCardLayout = new CardLayout(); - cardPane.setLayout(detailedCardLayout); - cardPane.add((defaultRegPane = new DefaultRegPane()), "Default"); - cardPane.add((regLengthPane = new RegLengthPane()), "Length"); - cardPane.add((regPhonePane = new RegPhonePane()), "Phone"); - cardPane.add((customRegRexPane = new CustomRegRexPane()), "Custom"); - centerPane.add(cardPane, BorderLayout.NORTH); - jPanel.add(centerPane, BorderLayout.CENTER); - this.add(jPanel, BorderLayout.NORTH); - regComboBox.addActionListener(new ActionListener(){ - public void actionPerformed(ActionEvent e) { - RegExp regExp = (RegExp)regComboBox.getSelectedItem(); - if(regExp instanceof PhoneReg) { - cardPane.setPreferredSize(new Dimension(220, 30)); - Object selectItem = regPhonePane.dataTypeComboBox.getSelectedItem(); - String regString = selectItem == null ? StringUtils.EMPTY : selectItem.toString(); - firePhoneRegAction(regString); - detailedCardLayout.show(cardPane, "Phone"); + JPanel comboPane = row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Input_Rule"))).weight(1.2), + cell(regComboBox).weight(3) + ).getComponent(); + + defaultRegPane = new DefaultRegPane(); + regLengthPane = new RegLengthPane(); + regPhonePane = new RegPhonePane(); + customRegRexPane = new CustomRegRexPane(); + + final ReactiveCardPane cardPane = ReactiveCardPane.create() + .addSupplier("Length", () -> regLengthPane) + .addSupplier("Phone", () -> regPhonePane) + .addSupplier("Custom", () -> customRegRexPane); + cardPane.setVisible(false); + + corePane.add(comboPane); + corePane.add(cardPane); + initComboListener(cardPane); + } + + private void initComboListener(ReactiveCardPane cardPane) { + regComboBox.addActionListener(e -> { + RegExp regExp = (RegExp)regComboBox.getSelectedItem(); + if(regExp instanceof PhoneReg) { + Object selectItem = regPhonePane.dataTypeComboBox.getSelectedItem(); + String regString = selectItem == null ? StringUtils.EMPTY : selectItem.toString(); + firePhoneRegAction(regString); + cardPane.select("Phone").populate(); + } else { + if (regExp instanceof LengthReg){ + cardPane.select("Length").populate(); + } else if (regExp instanceof CustomReg){ + cardPane.select("Custom").populate(); } else { - if (regExp instanceof LengthReg){ - cardPane.setPreferredSize(new Dimension(220, 60)); - detailedCardLayout.show(cardPane, "Length"); - } else if (regExp instanceof CustomReg){ - cardPane.setPreferredSize(new Dimension(220, 30)); - detailedCardLayout.show(cardPane, "Custom"); - } else { - cardPane.setPreferredSize(new Dimension(0,0 )); - detailedCardLayout.show(cardPane, "Default"); - } + cardPane.setVisible(false); } - fireRegChangeAction(); } + fireRegChangeAction(); }); } @@ -174,16 +175,24 @@ public class RegPane extends BasicPane { public abstract void populate(RegExp regRex); public abstract RegExp update(); + + public DisplayPane() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.add(createContentPane(), BorderLayout.CENTER); + } + + protected JPanel createContentPane() { + return new JPanel(); + } } private static class DefaultRegPane extends DisplayPane { public RegExp regRex; public DefaultRegPane(){ - + this.setVisible(false); } - @Override protected String title4PopupWindow() { return "Default"; @@ -328,38 +337,40 @@ public class RegPane extends BasicPane { private static final String EMB_REG3 = "025 85679591"; private static final int LIMIT_LENGTH = 20; private static final String REG_PATTERN = "0123456789-*# "; + private static final int CUSTOM_OPTION_INDEX = 3; private UIComboBox dataTypeComboBox; - private final String[] dataType = {EMB_REG1, EMB_REG2, EMB_REG3, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom")}; - DefaultComboBoxModel DefaultComboBoxModel= new DefaultComboBoxModel(dataType); - public RegPhonePane() { - this.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0)); - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - dataTypeComboBox = new UIComboBox(DefaultComboBoxModel); + private DefaultComboBoxModel defaultComboBoxModel; + + @Override + protected JPanel createContentPane() { + String[] dataType = {EMB_REG1, EMB_REG2, EMB_REG3, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom")}; + defaultComboBoxModel = new DefaultComboBoxModel(dataType); + dataTypeComboBox = new UIComboBox(defaultComboBoxModel); JTextField editFiled = (JTextField)(dataTypeComboBox.getEditor().getEditorComponent()); - UILabel dataTypeLable = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Data_Type")); - dataTypeLable.setPreferredSize(new Dimension(60, 20)); - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{dataTypeLable, dataTypeComboBox}}, TableLayoutHelper.FILL_LASTCOLUMN, 10, 0); - this.add(panel); + UILabel dataTypeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Data_Type")); + editFiled.setDocument(new LimitedDocument(LIMIT_LENGTH, REG_PATTERN)); - dataTypeComboBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if(e.getStateChange() == ItemEvent.SELECTED) { - if(ComparatorUtils.equals(e.getItem(), dataType[3])) { - dataTypeComboBox.setSelectedItem(null); - dataTypeComboBox.setEditable(true); - firePhoneRegAction(EMB_REG1); - } else { - dataTypeComboBox.setEditable(false); - firePhoneRegAction(dataTypeComboBox.getSelectedItem().toString()); - } + dataTypeComboBox.addItemListener(e -> { + if(e.getStateChange() == ItemEvent.SELECTED) { + if(ComparatorUtils.equals(e.getItem(), dataType[CUSTOM_OPTION_INDEX])) { + dataTypeComboBox.setSelectedItem(null); + dataTypeComboBox.setEditable(true); + firePhoneRegAction(EMB_REG1); + } else { + dataTypeComboBox.setEditable(false); + firePhoneRegAction(dataTypeComboBox.getSelectedItem().toString()); } } }); dataTypeComboBox.setSelectedIndex(0); firePhoneRegAction(dataTypeComboBox.getSelectedItem().toString()); + + return row( + cell(dataTypeLabel).weight(1.2), cell(dataTypeComboBox).weight(3) + ).getComponent(); } + @Override protected String title4PopupWindow() { return "PHONE"; @@ -372,7 +383,7 @@ public class RegPane extends BasicPane { } String regstr = ((PhoneReg)regRex).getRegString(); if (checkEmbedded(regstr)){ - DefaultComboBoxModel.addElement(regstr); + defaultComboBoxModel.addElement(regstr); } dataTypeComboBox.setSelectedItem(((PhoneReg)regRex).getRegString()); } @@ -394,34 +405,21 @@ public class RegPane extends BasicPane { private static class RegLengthPane extends DisplayPane { private UISpinner minLenSpinner; private UISpinner maxLenSpinner; - private final int DEFAULT_WIDTH = 60; - public RegLengthPane(){ - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0)); - this.setPreferredSize(new Dimension(210, 56)); + @Override + protected JPanel createContentPane() { minLenSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); maxLenSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); UILabel minLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Reg_Min_Length")); UILabel maxLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Reg_Max_Length")); - int minLabelWidth = Math.max(minLabel.getPreferredSize().width, DEFAULT_WIDTH); - int maxLabelWidth = Math.max(maxLabel.getPreferredSize().width, DEFAULT_WIDTH); - - minLabel.setPreferredSize(new Dimension(minLabelWidth, 20)); - maxLabel.setPreferredSize(new Dimension(maxLabelWidth, 20)); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - Component[][] components = new Component[][]{ - new Component[]{minLabel, minLenSpinner }, - new Component[]{maxLabel, maxLenSpinner}, - }; - double[] rowSize = {p, p}; - double[] columnSize = {p,f}; - int[][] rowCount = {{1, 1},{1, 1}}; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, LayoutConstants.VGAP_MEDIUM); - this.add(panel); - - + return column(LayoutConstants.VERTICAL_GAP, + row( + cell(minLabel).weight(1.2), cell(minLenSpinner).weight(3) + ), + row( + cell(maxLabel).weight(1.2), cell(maxLenSpinner).weight(3) + ) + ).getComponent(); } @Override @@ -453,15 +451,16 @@ public class RegPane extends BasicPane { } } - private static class CustomRegRexPane extends DisplayPane{ + private static class CustomRegRexPane extends DisplayPane { private UITextField regTextField; - public CustomRegRexPane(){ - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0)); + @Override + protected JPanel createContentPane() { regTextField = new UITextField(); - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Reg_Expressions")), regTextField}}, TableLayoutHelper.FILL_LASTCOLUMN, 10, LayoutConstants.VGAP_MEDIUM); - this.add(panel); + return row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Reg_Expressions"))).weight(1.2), + cell(regTextField).weight(3) + ).getComponent(); } @Override diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/TreeRootPane.java b/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/TreeRootPane.java index 691749fac6..9b1edf986f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/TreeRootPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/TreeRootPane.java @@ -1,6 +1,7 @@ package com.fr.design.gui.itree.refreshabletree; import com.fr.data.impl.TreeAttr; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.layout.FRGUIPaneFactory; @@ -8,11 +9,15 @@ import com.fr.design.layout.FRGUIPaneFactory; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JPanel; +import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; + public class TreeRootPane extends BasicPane { @@ -30,38 +35,20 @@ public class TreeRootPane extends BasicPane { private final UICheckBox returnFullPathCheckBox; public TreeRootPane() { - this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - - JPanel checkTypePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0(); - checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + this.setLayout(new BorderLayout()); checkTypeCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Mutiple_Selection_Or_Not")); - checkTypeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - - checkTypePane.add(checkTypeCheckBox); - this.add(checkTypePane); - - JPanel loadTypePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0(); - checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); loadTypeCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Load_By_Async")); - loadTypeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - - loadTypePane.add(loadTypeCheckBox); - this.add(loadTypePane); - - JPanel leafSelectPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0(); - checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - leafSelectPane.add(layerTypeCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Select_Leaf_Only"))); - layerTypeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - - this.add(leafSelectPane); + layerTypeCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Select_Leaf_Only")); + returnFullPathCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Return_Full_Path")); - JPanel returnFullPathPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0(); - checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - returnFullPathPane.add(returnFullPathCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Return_Full_Path"))); - returnFullPathCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); addCheckBoxListener(); - this.add(returnFullPathPane); + this.add(column(LayoutConstants.VERTICAL_GAP, + cell(checkTypeCheckBox), + cell(loadTypeCheckBox), + cell(layerTypeCheckBox), + cell(returnFullPathCheckBox) + ).getComponent()); } diff --git a/designer-base/src/main/java/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java b/designer-base/src/main/java/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java index d146c73099..66994ef844 100644 --- a/designer-base/src/main/java/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java +++ b/designer-base/src/main/java/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java @@ -4,19 +4,22 @@ import java.awt.*; import javax.swing.*; -import com.fr.design.designer.IntervalConstants; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.icombobox.DictionaryComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.widget.accessibles.AccessibleIconEditor; import com.fr.form.ui.Button; import com.fr.stable.StableUtils; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; + /** * Created by IntelliJ IDEA. * Author : Richer @@ -34,32 +37,38 @@ public abstract class ButtonWithHotkeysDetailPane extends Butt } private void initComponents() { - this.setLayout(new BorderLayout(7, 7)); - JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double rowSize[] = {p, p, p, p}; - double columnSize[] = {p, f}; - JPanel labelPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + this.setLayout(new BorderLayout()); + JPanel advancePane = column(VERTICAL_GAP).getComponent(); + iconPane = new AccessibleIconEditor(); - labelPane.add(iconPane); - Component comp = createCenterPane(); - Component[][] n_components = { - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Button_Type")), createCustomButtonTypeComboBox()}, - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")), buttonNameTextField = new UITextField()}, - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Icon")), iconPane}, - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")), hotkeysTextField = new UITextField()}, - }; + buttonNameTextField = new UITextField(); + hotkeysTextField = new UITextField(); hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ",")); - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - advancePane.add(panel, BorderLayout.NORTH); + + Component comp = createCenterPane(); + advancePane.add(column(VERTICAL_GAP, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Button_Type"))).weight(LEFT_WEIGHT), + cell(createCustomButtonTypeComboBox()).weight(RIGHT_WEIGHT) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name"))).weight(LEFT_WEIGHT), + cell(buttonNameTextField).weight(RIGHT_WEIGHT) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Icon"))).weight(LEFT_WEIGHT), + cell(iconPane).weight(RIGHT_WEIGHT) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys"))).weight(LEFT_WEIGHT), + cell(hotkeysTextField).weight(RIGHT_WEIGHT) + ) + ).getComponent()); if(comp != null ) { - advancePane.add(comp,BorderLayout.CENTER); + advancePane.add(comp); } UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Advanced"), 280, 20, advancePane); this.add(uiExpandablePane); - } protected abstract Component createCenterPane(); diff --git a/designer-base/src/main/java/com/fr/design/widget/component/DateValuePane.java b/designer-base/src/main/java/com/fr/design/widget/component/DateValuePane.java index 656b42283c..846bf6b3f0 100644 --- a/designer-base/src/main/java/com/fr/design/widget/component/DateValuePane.java +++ b/designer-base/src/main/java/com/fr/design/widget/component/DateValuePane.java @@ -1,5 +1,6 @@ package com.fr.design.widget.component; +import com.fine.swing.ui.layout.Column; import com.fr.base.BaseFormula; import com.fr.design.constants.LayoutConstants; import com.fr.design.editor.editor.DateEditor; @@ -7,55 +8,65 @@ import com.fr.design.editor.editor.Editor; import com.fr.design.editor.editor.FormulaEditor; import com.fr.design.editor.editor.NoneEditor; import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; import com.fr.general.ComparatorUtils; +import com.fr.stable.StringUtils; import javax.swing.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import java.awt.*; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.flex; + /** - * Created by ibm on 2017/8/8. + * 日期设置面板 + * + * @author ibm + * @since 10.0 + * Created on 2017/08/08 */ -public class DateValuePane extends JPanel { +public class DateValuePane extends Column { private UIButtonGroup widgetValueHead; private Editor[] editor; private static final String NONE_EDITOR_NAME = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None"); private static final String DATE_EDITOR_NAME = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Date"); private static final String FORMULA_EDITOR_NAME = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Parameter_Formula"); - public DateValuePane() { + this(StringUtils.EMPTY); + } + + public DateValuePane(String title) { + setSpacing(LayoutConstants.VERTICAL_GAP); + UILabel titleLabel = new UILabel(title); editor = new Editor[]{ new NoneEditor(null, NONE_EDITOR_NAME), new DateEditor(true, DATE_EDITOR_NAME), new FormulaEditor(FORMULA_EDITOR_NAME) }; - this.setLayout(new BorderLayout(0, LayoutConstants.VGAP_SMALL)); final CardLayout cardLayout = new CardLayout(); final JPanel customPane = new JPanel(cardLayout); + final JPanel customRow = row(flex(1.2), cell(customPane).weight(3)).getComponent(); final String[] tabTitles = new String[editor.length]; for (int i = 0; i < editor.length; i++) { customPane.add(editor[i], editor[i].getName()); tabTitles[i] = editor[i].getName(); } widgetValueHead = new UIButtonGroup(tabTitles); - widgetValueHead.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - int index = widgetValueHead.getSelectedIndex(); - if (ComparatorUtils.equals(tabTitles[index], com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None"))) { - customPane.setVisible(false); - } else { - customPane.setVisible(true); - } - cardLayout.show(customPane, tabTitles[index]); - } + widgetValueHead.addChangeListener(e -> { + int index = widgetValueHead.getSelectedIndex(); + customRow.setVisible(!ComparatorUtils.equals(tabTitles[index], + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None"))); + cardLayout.show(customPane, tabTitles[index]); }); - this.add(widgetValueHead, BorderLayout.NORTH); - this.add(customPane, BorderLayout.CENTER); - + this.add( + row( + cell(titleLabel).weight(1.2), cell(widgetValueHead).weight(3) + ), + cell(customRow) + ); } diff --git a/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java b/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java index 7fd88dd957..7d5c817e16 100644 --- a/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java +++ b/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java @@ -3,30 +3,31 @@ package com.fr.design.widget.component; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.ErrorMsgTextFieldAdapter; import com.fr.design.beans.UITextFieldAdapter; +import com.fr.design.constants.LayoutConstants; import com.fr.design.designer.IntervalConstants; import com.fr.design.fun.TextFieldAdapterProvider; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; -import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.NumberEditor; import com.fr.log.FineLoggerFactory; import com.fr.stable.AssistUtils; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; import javax.swing.JPanel; 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.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.column; + /** * Created by kerry on 2017/9/10. */ @@ -63,45 +64,40 @@ public class NumberEditorValidatePane extends JPanel { private void initComponent() { initListeners(); this.allowDecimalsCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Allow_Decimals")); - allowDecimalsCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); this.allowDecimalsCheckBox.addActionListener(allowDecimalsListener); this.decimalLength = new UISpinner(0, Integer.MAX_VALUE, 1, 16); this.allowNegativeCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Allow_Negative")); this.allowNegativeCheckBox.addActionListener(allowNegativeListener); - allowNegativeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); this.setMaxValueCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Need_Max_Value"), false); - setMaxValueCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); this.maxValueSpinner = new UISpinner(-Double.MAX_VALUE, Double.MAX_VALUE, 1D, 0D); this.setMaxValueCheckBox.addActionListener(setMaxListener); this.maxValueSpinner.addChangeListener(maxValueChangeListener); this.setMinValueCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Need_Min_Value"), false); this.minValueSpinner = new UISpinner(-Double.MAX_VALUE, Double.MAX_VALUE, 1D, 0D); - minValueSpinner.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); this.setMinValueCheckBox.addActionListener(setMinListener); this.minValueSpinner.addChangeListener(minValueChangeListener); - setMinValueCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); initErrorMsgPane(); JPanel errorMsgBorderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - errorMsgBorderPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L5, IntervalConstants.INTERVAL_L1, 0)); errorMsgBorderPane.add(errorMsgTextFieldPane, BorderLayout.CENTER); UILabel numberLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Decimal_Digits")); - limitNumberPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{numberLabel, decimalLength}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7); - limitNumberPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L5, 0, 0)); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - Component[][] components = new Component[][]{ - new Component[]{allowDecimalsCheckBox, null}, - new Component[]{limitNumberPane, null}, - new Component[]{allowNegativeCheckBox, null}, - new Component[]{setMaxValueCheckBox, maxValueSpinner}, - new Component[]{setMinValueCheckBox, minValueSpinner}, - new Component[]{errorMsgBorderPane, null}, - }; - double[] rowSize = {p, p, p, p, p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); - this.add(panel); + + limitNumberPane = row( + cell(numberLabel).weight(1.2), + cell(decimalLength).weight(3) + ).getComponent(); + + this.add(column(LayoutConstants.VERTICAL_GAP, + cell(allowDecimalsCheckBox), + cell(limitNumberPane), + cell(allowNegativeCheckBox), + row( + cell(setMaxValueCheckBox).weight(1), cell(maxValueSpinner).weight(1.5) + ), + row( + cell(setMinValueCheckBox).weight(1), cell(minValueSpinner).weight(1.5) + ), + cell(errorMsgBorderPane) + ).getComponent()); } private void initErrorMsgPane() { @@ -128,10 +124,8 @@ public class NumberEditorValidatePane extends JPanel { public void actionPerformed(ActionEvent e) { if (allowDecimalsCheckBox.isSelected()) { limitNumberPane.setVisible(true); - limitNumberPane.setPreferredSize(new Dimension(215, 20)); } else { limitNumberPane.setVisible(false); - limitNumberPane.setPreferredSize(new Dimension(0, 0)); } } }; diff --git a/designer-base/src/main/java/com/fr/design/widget/component/ReturnTypePane.java b/designer-base/src/main/java/com/fr/design/widget/component/ReturnTypePane.java index 4f3b93a539..0812c94783 100644 --- a/designer-base/src/main/java/com/fr/design/widget/component/ReturnTypePane.java +++ b/designer-base/src/main/java/com/fr/design/widget/component/ReturnTypePane.java @@ -1,18 +1,18 @@ package com.fr.design.widget.component; -import com.fr.design.designer.IntervalConstants; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icombobox.DictionaryComboBox; import com.fr.design.gui.icombobox.DictionaryConstants; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.ReturnTypeProvider; -import javax.swing.BorderFactory; import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Component; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; public class ReturnTypePane extends JPanel { @@ -31,22 +31,32 @@ public class ReturnTypePane extends JPanel { startComboBox.setEditable(true); endComboBox = new DictionaryComboBox(DictionaryConstants.symbols, DictionaryConstants.symbolDisplays); endComboBox.setEditable(true); - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Delimiter")), delimiterComboBox}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Combo_CheckBox_Start_Symbol")), startComboBox}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Combo_CheckBox_End_Symbol")), endComboBox} - }; - returnStringPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1); + + returnStringPane = column(LayoutConstants.VERTICAL_GAP, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Delimiter"))).weight(1.2), + cell(delimiterComboBox).weight(3) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Combo_CheckBox_Start_Symbol"))).weight(1.2), + cell(startComboBox).weight(3) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Combo_CheckBox_End_Symbol"))).weight(1.2), + cell(endComboBox).weight(3) + ) + ).getComponent(); returnTypeComboBox = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Array"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_String")}); returnTypeComboBox.addActionListener(e -> checkVisible(returnTypeComboBox.getSelectedIndex())); - JPanel headPane = TableLayoutHelper.createGapTableLayoutPane( - new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Date_Selector_Return_Type")), returnTypeComboBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - jPanel.add(headPane, BorderLayout.NORTH); - jPanel.add(returnStringPane, BorderLayout.CENTER); - returnStringPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L5, 0, 0)); - this.add(jPanel); + + this.add(column(LayoutConstants.VERTICAL_GAP, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Date_Selector_Return_Type"))).weight(1.2), + cell(returnTypeComboBox).weight(3) + ), + cell(returnStringPane) + ).getComponent()); } public void setReturnType(ReturnType returnType) { diff --git a/designer-base/src/main/java/com/fr/design/widget/mobile/WidgetMobilePane.java b/designer-base/src/main/java/com/fr/design/widget/mobile/WidgetMobilePane.java index 20b82467bb..b2ebf896af 100644 --- a/designer-base/src/main/java/com/fr/design/widget/mobile/WidgetMobilePane.java +++ b/designer-base/src/main/java/com/fr/design/widget/mobile/WidgetMobilePane.java @@ -4,8 +4,6 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.form.ui.Widget; - -import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingConstants; @@ -17,7 +15,7 @@ public class WidgetMobilePane extends JPanel { public static WidgetMobilePane DEFAULT_PANE = new WidgetMobilePane(); public WidgetMobilePane() { - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + this.setBorder(null); init(); } diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties index a6d558281f..a03c97da7f 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties @@ -1299,4 +1299,7 @@ CellOtherSetPane.height=$Component.defaultHeight toolbar.pressedBackground: null [style]Label.boldLabel = \ - font: bold $defaultFont \ No newline at end of file + font: bold $defaultFont + +[style]Label.tipLabel = \ + foreground: $Label.tipColor \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/btn/AbstractExtraButtonPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/btn/AbstractExtraButtonPane.java index 79a71d56e0..bea7a1bfc4 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/btn/AbstractExtraButtonPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/btn/AbstractExtraButtonPane.java @@ -1,7 +1,9 @@ package com.fr.design.widget.ui.btn; +import com.fine.swing.ui.layout.Column; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.fun.WidgetAdvancedPaneProvider; import com.fr.design.gui.icombobox.DictionaryComboBox; @@ -21,6 +23,8 @@ import javax.swing.JPanel; import java.awt.Component; import java.util.Set; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP; /** @@ -116,14 +120,14 @@ public abstract class AbstractExtraButtonPane extends ButtonWi */ protected Component createExtraPane(@Nullable BasicPane pane) { initExtraPane(); - Component[][] components = new Component[][]{ - new Component[]{pane, null}, - new Component[]{extraPane, null} - }; - double[] rowSize = {P, P}; - double[] columnSize = {P, F}; - int[][] rowCount = {{1, 1},{1, 1}}; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); + Column column = column(VERTICAL_GAP).getComponent(); + if (pane != null) { + column.add(pane); + } + if (extraPane != null) { + column.add(extraPane); + } + return column; } } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java index b7661f9f04..28a7db4aae 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java @@ -8,15 +8,15 @@ import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; 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 javax.swing.ButtonGroup; import javax.swing.JPanel; import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; + +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.flex; /** * @author hades @@ -47,23 +47,23 @@ public class MobileTextFieldInputSettingPane extends BasicBeanPane it.setBorder(new ScaledEmptyBorder(0, 10, 0, 10))) + ).getComponent()); // 属性 attriTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); @@ -73,16 +94,19 @@ public class CellWidgetCardPane extends BasicPane { } }; widgetPropertyPane = new BasicWidgetPropertySettingPane(); - UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic"), 280, 24, widgetPropertyPane); - attriTabPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); - attriTabPane.add(uiExpandablePane, BorderLayout.NORTH); + UIExpandablePane basicPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic"), 280, 24, widgetPropertyPane); attriCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); - attriTabPane.add(attriCardPane, BorderLayout.CENTER); attriCardLayout = (CardLayout) attriCardPane.getLayout(); + attriTabPane.add(column( + cell(basicPane), + fix(1).with(it -> it.setBorder(FineBorderFactory.createDefaultUnderlineBorder())), + cell(attriCardPane) + ).getComponent() + ); + // 事件 eventTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - eventTabPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); eventPane = initWidgetEventPane(pane); eventTabPane.add(eventPane, BorderLayout.CENTER); @@ -97,16 +121,6 @@ public class CellWidgetCardPane extends BasicPane { center.add(mobileTabPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Mobile_Terminal")); initPaneList(); - - final String[] tabTitles = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Attribute"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Mobile_Terminal")}; - tabsHeaderIconPane = new UIHeadGroup(tabTitles) { - @Override - public void tabChanged(int index) { - tabbedPane.show(center, tabTitles[index]); - } - }; - tabsHeaderIconPane.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, UIConstants.SHADOW_GREY)); - this.add(tabsHeaderIconPane, BorderLayout.NORTH); } private void initPaneList() { diff --git a/designer-realize/src/main/java/com/fr/design/widget/WidgetEventPane.java b/designer-realize/src/main/java/com/fr/design/widget/WidgetEventPane.java index b2b4f2fde7..41e5a99011 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/WidgetEventPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/WidgetEventPane.java @@ -1,6 +1,7 @@ package com.fr.design.widget; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.UIListGroupControlPane; @@ -23,7 +24,6 @@ import com.fr.stable.AssistUtils; import com.fr.stable.Nameable; import com.fr.write.JavaScriptResourceInfo; -import javax.swing.BorderFactory; import java.lang.reflect.Constructor; public class WidgetEventPane extends UIListGroupControlPane { @@ -40,7 +40,7 @@ public class WidgetEventPane extends UIListGroupControlPane { if (pane != null) { selection = pane.getSelection(); } - setBorder(BorderFactory.createEmptyBorder(10, 0, 15, 0)); + setBorder(new ScaledEmptyBorder(10, 0, 10, 0)); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java b/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java index 3a50c38705..9cbcc66b8d 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java @@ -1,5 +1,6 @@ package com.fr.design.widget; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.ExtraDesignClassManager; import com.fr.design.fun.WidgetDesignHandler; import com.fr.design.gui.core.WidgetOption; @@ -9,27 +10,36 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.ilable.UILabel; 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.mainframe.CellWidgetPropertyPane; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.widget.btn.ButtonConstants; import com.fr.form.ui.Button; -import com.fr.form.ui.*; +import com.fr.form.ui.NameWidget; +import com.fr.form.ui.Widget; +import com.fr.form.ui.WidgetConfig; +import com.fr.form.ui.WidgetInfoConfig; import com.fr.general.ComparatorUtils; - import com.fr.stable.ArrayUtils; import com.fr.stable.AssistUtils; -import javax.swing.*; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JComponent; +import javax.swing.JList; +import javax.swing.JPanel; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; -import java.awt.*; +import java.awt.Component; +import java.awt.Dimension; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.Vector; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; + /** * CellEditorDef Pane. */ @@ -38,7 +48,7 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener private EditorTypeComboBox editorTypeComboBox; private CellWidgetCardPane cellEditorCardPane; private boolean shouldFireSelectedEvent = true; - private JPanel northPane; + private JComponent northPane; public WidgetPane() { this(null); @@ -58,36 +68,32 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener protected void initComponents(ElementCasePane pane) { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); editorTypeComboBox = new EditorTypeComboBox(pane != null); - editorTypeComboBox.setPreferredSize(new Dimension(155, 30)); editorTypeComboBox.setMaximumRowCount(16); northPane = initNorthPane(); - northPane.setBorder(BorderFactory.createEmptyBorder(12, 10, 10, 15)); - this.add(northPane, BorderLayout.NORTH); + northPane.setBorder(new ScaledEmptyBorder(10, 10, 0, 10)); editorTypeComboBox.addItemListener(this); - cellEditorCardPane = initWidgetCardPane(pane); - this.add(cellEditorCardPane, BorderLayout.CENTER); this.addAttributeChangeListener(listener); + + this.add(column( + 10, + cell(northPane), + cell(cellEditorCardPane) + ).getComponent() + ); } public JPanel initNorthPane() { - UILabel emptyLabel = new UILabel(); - emptyLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, p, f}; - double[] rowSize = {p}; - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Select_Widget")), emptyLabel, editorTypeComboBox}, - }; - JPanel jPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - return jPanel; + + return column( + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Select_Widget"))).weight(LEFT_WEIGHT), + cell(editorTypeComboBox).weight(RIGHT_WEIGHT) + ) + ).getComponent(); } protected CellWidgetCardPane initWidgetCardPane(ElementCasePane pane) { diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java index 5bd91d038d..c7ff5fdddb 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java @@ -1,21 +1,22 @@ package com.fr.design.widget.ui; -import com.fr.design.designer.IntervalConstants; +import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.dialog.BasicPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.dialog.BasicPane; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.ui.NoneWidget; import com.fr.form.ui.Widget; -import com.fr.design.utils.gui.GUICoreUtils; - -import javax.swing.BorderFactory; -import javax.swing.JPanel; import java.awt.BorderLayout; -import java.awt.Component; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; public class BasicWidgetPropertySettingPane extends BasicPane { @@ -26,27 +27,20 @@ public class BasicWidgetPropertySettingPane extends BasicPane { public BasicWidgetPropertySettingPane() { this.setLayout(new BorderLayout()); + this.setBorder(new ScaledEmptyBorder(0, 0, 10, 0)); enableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Enabled"), true); - enableCheckBox.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); visibleCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Form_Widget_Visible"), true); - visibleCheckBox.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); widgetNameComboBox = new ParameterTreeComboBox(); widgetNameComboBox.refreshTree(); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - Component[][] components = new Component[][]{ - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Widget_Name")), widgetNameComboBox}, - new Component[]{enableCheckBox, null}, - new Component[]{visibleCheckBox, null}, - }; - double[] rowSize = {p, p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1}}; - JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1); - pane.setBorder(BorderFactory.createEmptyBorder(10,0,10,0)); - - this.add(pane, BorderLayout.CENTER); + this.add(column(LayoutConstants.VERTICAL_GAP, + row( + cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Widget_Name"))).weight(LEFT_WEIGHT), + cell(widgetNameComboBox).weight(RIGHT_WEIGHT) + ), + cell(enableCheckBox), + cell(visibleCheckBox) + ).getComponent()); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/ButtonGroupDictPane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/ButtonGroupDictPane.java index 049168da14..752b6e44c8 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/ButtonGroupDictPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/ButtonGroupDictPane.java @@ -1,26 +1,27 @@ package com.fr.design.widget.ui; -import java.awt.*; -import java.awt.event.ActionEvent; - import com.fr.data.Dictionary; -import com.fr.design.designer.IntervalConstants; -import com.fr.design.gui.ispinner.UIBasicSpinner; -import java.awt.event.ActionListener; - -import com.fr.design.gui.ilable.UILabel; - -import javax.swing.*; - +import com.fr.design.gui.core.ReactiveCardPane; import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor; import com.fr.design.widget.FRWidgetFactory; import com.fr.form.ui.ButtonGroup; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.SpinnerNumberModel; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; public class ButtonGroupDictPane extends JPanel { @@ -28,6 +29,7 @@ public class ButtonGroupDictPane extends JPanel { private UICheckBox adaptiveCheckbox; private UILabel columnLabel; private AccessibleDictionaryEditor dictPane; + private ReactiveCardPane reactiveCardPane; public ButtonGroupDictPane() { @@ -45,36 +47,45 @@ public class ButtonGroupDictPane extends JPanel { adaptiveCheckbox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); - columnLabel.setVisible(!adaptiveCheckbox.isSelected()); + boolean selected = adaptiveCheckbox.isSelected(); + if (selected) { + reactiveCardPane.select("adaptive").populate(); + } else { + reactiveCardPane.select("inadaptive").populate(); + } } }); UILabel dictLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_DS_Dictionary")); this.columnLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Group_Display_Columns") + ":", dictLabel.getPreferredSize().width); columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1)); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; - Component[][] components = { - new Component[] {dictLabel, dictPane}, - new Component[] {adaptiveCheckbox, null}, - new Component[] {columnLabel, columnSpinner} - }; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - this.add(panel); + reactiveCardPane = ReactiveCardPane.create() + .addSupplier("adaptive", () -> column( + 10, + row(cell(dictLabel).weight(LEFT_WEIGHT), cell(dictPane).weight(RIGHT_WEIGHT)), + row(cell(adaptiveCheckbox)), + row(cell(columnLabel).weight(LEFT_WEIGHT), cell(columnSpinner).weight(RIGHT_WEIGHT)) + ).getComponent() + ).addSupplier("inadaptive", () -> column( + 10, + row(cell(dictLabel).weight(LEFT_WEIGHT), cell(dictPane).weight(RIGHT_WEIGHT)), + row(cell(adaptiveCheckbox)) + ).getComponent()); + reactiveCardPane.select("inadaptive").populate(); + this.add(reactiveCardPane); } public void populate(ButtonGroup buttonGroup) { dictPane.setValue(buttonGroup.getDictionary()); adaptiveCheckbox.setSelected(buttonGroup.isAdaptive()); - columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); - columnLabel.setVisible(!adaptiveCheckbox.isSelected()); + boolean selected = adaptiveCheckbox.isSelected(); + if (selected) { + reactiveCardPane.select("adaptive").populate(); + } else { + reactiveCardPane.select("inadaptive").populate(); + } columnSpinner.setValue(buttonGroup.getColumnsInRow()); } diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/CheckBoxDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/CheckBoxDefinePane.java index 324596bbe1..85e5272eb5 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/CheckBoxDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/CheckBoxDefinePane.java @@ -2,26 +2,28 @@ package com.fr.design.widget.ui; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.designer.IntervalConstants; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.fun.WidgetAdvancedPaneProvider; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widgettheme.processor.WidgetThemeCreatorPaneAdder; import com.fr.form.ui.CheckBox; import com.fr.general.GeneralContext; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.collections.CollectionUtils; -import javax.swing.BorderFactory; import javax.swing.JPanel; -import java.awt.Component; +import java.awt.BorderLayout; import java.util.ArrayList; import java.util.List; import java.util.Set; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; /** * 复选框pane @@ -46,18 +48,28 @@ public class CheckBoxDefinePane extends AbstractDataModify { this.setLayout(FRGUIPaneFactory.createBorderLayout()); text = new UITextField(); initExtraPane(); - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text")), text}, - new Component[]{extraPane, null}, - }; - double[] rowSize = {P,P}; - double[] columnSize = {P, F}; - int[][] rowCount = {{1, 1}, {1, 1}}; - JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1); - UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 24, pane); - pane.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 0)); + JPanel content = new JPanel(new BorderLayout()); + if (extraPane == null) { + content.add( + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text"))).weight(LEFT_WEIGHT), + cell(text).weight(RIGHT_WEIGHT) + ).getComponent() + ); + } else { + content.add( + column( + 10, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text"))).weight(LEFT_WEIGHT), + cell(text)).weight(RIGHT_WEIGHT), + row(cell(extraPane)) + ).getComponent() + ); + } + UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 24, content); this.add(uiExpandablePane); } diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java index ea7a774a49..083f92bd8b 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java @@ -1,25 +1,16 @@ package com.fr.design.widget.ui; -import java.awt.*; -import java.util.Set; - -import javax.swing.BorderFactory; import javax.swing.JPanel; -import javax.swing.SwingConstants; -import com.fr.design.ExtraDesignClassManager; -import com.fr.design.beans.BasicBeanPane; +import com.fr.design.constants.LayoutConstants; import com.fr.design.data.DataCreatorUI; -import com.fr.design.designer.IntervalConstants; -import com.fr.design.fun.WidgetAdvancedPaneProvider; import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widget.component.ReturnTypePane; import com.fr.form.ui.CheckBoxGroup; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; + public class CheckBoxGroupDefinePane extends FieldEditorDefinePane { private ReturnTypePane returnTypePane; @@ -44,27 +35,18 @@ public class CheckBoxGroupDefinePane extends FieldEditorDefinePane { protected AccessibleDictionaryEditor dictPane; @@ -32,10 +27,10 @@ public class ComboBoxDefinePane extends CustomWritableRepeatEditorPane protected JPanel setForthContentPane () { dictPane = new AccessibleDictionaryEditor(); - JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane( - new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_DS_Dictionary")), dictPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - return jPanel; + return row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_DS_Dictionary"))).weight(LEFT_WEIGHT), + cell(dictPane).weight(RIGHT_WEIGHT) + ).getComponent(); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/ComboCheckBoxDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/ComboCheckBoxDefinePane.java index 270377d427..d982809ff6 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/ComboCheckBoxDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/ComboCheckBoxDefinePane.java @@ -1,24 +1,22 @@ package com.fr.design.widget.ui; import com.fr.data.Dictionary; -import com.fr.design.ExtraDesignClassManager; -import com.fr.design.beans.BasicBeanPane; +import com.fr.design.constants.LayoutConstants; import com.fr.design.data.DataCreatorUI; -import com.fr.design.designer.IntervalConstants; -import com.fr.design.fun.WidgetAdvancedPaneProvider; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor; import com.fr.design.widget.component.ReturnTypePane; import com.fr.form.ui.ComboCheckBox; import javax.swing.*; -import java.awt.*; -import java.util.Set; + +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; public class ComboCheckBoxDefinePane extends CustomWritableRepeatEditorPane { private ReturnTypePane returnTypePane; @@ -34,23 +32,14 @@ public class ComboCheckBoxDefinePane extends CustomWritableRepeatEditorPane extends WritableRepeatEditorPane { private UICheckBox customDataCheckBox; - private static final int CUSTOM_DATA_CHECK_BOX_WIDTH = GraphHelper.getWidth(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Custom_Data")) + 30; - private static final int CUSTOM_DATA_CHECK_BOX_HEIGHT = 30; public CustomWritableRepeatEditorPane() { this.initComponents(); @@ -27,21 +20,14 @@ public abstract class CustomWritableRepeatEditorPane { - private UIButtonGroup returnTypeComboBox; + private UIButtonGroup returnTypeButtonGroup; private DateValuePane startDv; private DateValuePane endDv; private UIComboBox currentFormatComboBox; - private UILabel currentSamplelabel; - private UIButtonGroup fomatHeadGroup; - private static final int SAMPLE_LABEL_PADDING = 4; - + private UILabel currentSampleLabel; + private UIButtonGroup formatButtonGroup; public DateEditorDefinePane() { } @@ -55,33 +54,22 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane(new String[] {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Date") , com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_String")}); + returnTypeButtonGroup = new UIButtonGroup<>(new String[] {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Date") , + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_String")}); JPanel formatHead = createFormatHead(); - startDv = new DateValuePane(); - endDv = new DateValuePane(); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - UILabel formatLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Format")); - formatLabel.setVerticalAlignment(SwingConstants.TOP); - UILabel startDateLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_FS_Start_Date")); - startDateLabel.setVerticalAlignment(SwingConstants.TOP); - UILabel endDateLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_FS_End_Date")); - endDateLabel.setVerticalAlignment(SwingConstants.TOP); - Component[][] components = new Component[][]{ - new Component[]{formatLabel, formatHead}, - new Component[]{startDateLabel, startDv}, - new Component[]{endDateLabel, endDv}, - new Component[]{waterMarkDictPane, null}, - new Component[]{extraPane, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Date_Selector_Return_Type")), returnTypeComboBox } - }; - double[] rowSize = {p, p, p, p, p, p, p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 3},{1, 1},{1, 1},{1, 1},{1, 1}, {1, 1}}; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); - - - return panel; + startDv = new DateValuePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_FS_Start_Date")); + endDv = new DateValuePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_FS_End_Date")); + UILabel returnTypeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Widget_Date_Selector_Return_Type")); + + return column(LayoutConstants.VERTICAL_GAP, + cell(formatHead), + cell(startDv), + cell(endDv), + cell(waterMarkDictPane), + row( + cell(returnTypeLabel).weight(LEFT_WEIGHT), cell(returnTypeButtonGroup).weight(RIGHT_WEIGHT) + ) + ).getComponent(); } @Override @@ -90,20 +78,19 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane refreshPreviewLabel()); + timeFormatComboBox.addActionListener(e -> refreshPreviewLabel()); final UILabel dateSampleLabel = createSamplePane(); final UILabel timeSampleLabel = createSamplePane(); - JPanel fomatHeadPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); final CardLayout cardLayout = new CardLayout(); final JPanel customPane = new JPanel(cardLayout); JPanel dateFormatPane = createFormatPane(dateFormatComboBox, dateSampleLabel); JPanel timeFormatPane = createFormatPane(timeFormatComboBox, timeSampleLabel); customPane.add(dateFormatPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Date")); customPane.add(timeFormatPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Time")); - final String[] tabTitles = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Date"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Time")}; - fomatHeadGroup = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Date"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Time")}); - fomatHeadGroup.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - int newSelectedIndex = fomatHeadGroup.getSelectedIndex(); - cardLayout.show(customPane, tabTitles[newSelectedIndex]); - if(newSelectedIndex == 0){ - currentFormatComboBox = dateFormatComboBox; - currentSamplelabel = dateSampleLabel; - }else{ - currentFormatComboBox = timeFormatComboBox; - currentSamplelabel = timeSampleLabel; - } - refreshPreviewLabel(); + final String[] tabTitles = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Date"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Time")}; + formatButtonGroup = new UIButtonGroup<>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Date"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Time")}); + formatButtonGroup.addChangeListener(e -> { + int newSelectedIndex = formatButtonGroup.getSelectedIndex(); + cardLayout.show(customPane, tabTitles[newSelectedIndex]); + if(newSelectedIndex == 0){ + currentFormatComboBox = dateFormatComboBox; + currentSampleLabel = dateSampleLabel; + }else{ + currentFormatComboBox = timeFormatComboBox; + currentSampleLabel = timeSampleLabel; } + refreshPreviewLabel(); }); - fomatHeadPane.add(fomatHeadGroup, BorderLayout.NORTH); - fomatHeadPane.add(customPane, BorderLayout.CENTER); - return fomatHeadPane; + return column(LayoutConstants.VERTICAL_GAP, + row( + cell(formatLabel).weight(LEFT_WEIGHT), cell(formatButtonGroup).weight(RIGHT_WEIGHT) + ), + row(flex(LEFT_WEIGHT), cell(customPane).weight(RIGHT_WEIGHT)) + ).getComponent(); } - - private void refreshPreviewLabel() { String text = (String) currentFormatComboBox.getSelectedItem(); if (text != null && text.length() > 0) { @@ -174,14 +153,14 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane e super(); } - @Override protected JPanel setFirstContentPane() { - JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); + JPanel contentPane = column(LayoutConstants.VERTICAL_GAP).getComponent(); directWriteCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Edit"), false); - directWriteCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); waterMarkDictPane = new WaterMarkDictPane(); initExtraPane(); - Component[][] components = new Component[][]{ - new Component[]{waterMarkDictPane, null}, - new Component[]{extraPane, null}, - }; - double[] rowSize = {P, P}; - double[] columnSize = {P, F}; - int[][] rowCount = {{1, 1}, {1, 1}}; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); - contentPane.add(panel, BorderLayout.NORTH); + contentPane.add(column(LayoutConstants.VERTICAL_GAP, + cell(waterMarkDictPane), + cell(extraPane) + ).getComponent()); JPanel otherContentPane = this.setSecondContentPane(); if (otherContentPane != null) { - contentPane.add(otherContentPane, BorderLayout.CENTER); + contentPane.add(otherContentPane); } return contentPane; } public JPanel setValidatePane(){ - JPanel otherContentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - JPanel jPanel = GUICoreUtils.createFlowPane(new JComponent[]{directWriteCheckBox}, FlowLayout.LEFT, 0); - otherContentPane.add(jPanel, BorderLayout.NORTH); + JPanel otherContentPane = column(LayoutConstants.VERTICAL_GAP).getComponent(); + otherContentPane.add(directWriteCheckBox); return otherContentPane; } diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/FieldEditorDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/FieldEditorDefinePane.java index 7195343767..f5a12312fb 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/FieldEditorDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/FieldEditorDefinePane.java @@ -1,19 +1,20 @@ package com.fr.design.widget.ui; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.ErrorMsgTextFieldAdapter; import com.fr.design.beans.UITextFieldAdapter; +import com.fr.design.border.FineBorderFactory; import com.fr.design.constants.LayoutConstants; -import com.fr.design.designer.IntervalConstants; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.fun.TextFieldAdapterProvider; import com.fr.design.fun.WidgetAdvancedPaneProvider; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; +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.widgettheme.processor.WidgetThemeCreatorPaneAdder; import com.fr.form.ui.FieldEditor; import com.fr.general.GeneralContext; @@ -22,16 +23,18 @@ import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.collections.CollectionUtils; -import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; import java.util.ArrayList; import java.util.List; import java.util.Set; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; + /** * 字段编辑pane * @@ -47,6 +50,7 @@ public abstract class FieldEditorDefinePane extends Abstr protected final List> extraPaneList = new ArrayList<>(); protected JPanel extraPane; + protected JPanel corePane; protected static double F = TableLayout.FILL; protected static double P = TableLayout.PREFERRED; @@ -56,15 +60,15 @@ public abstract class FieldEditorDefinePane extends Abstr protected void initComponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); + corePane = column().getComponent(); JPanel contentPane = this.setFirstContentPane(); - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - jPanel.add(contentPane, BorderLayout.CENTER); - contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); if (contentPane != null) { - UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 24, jPanel); - this.add(uiExpandablePane, BorderLayout.NORTH); + contentPane.setBorder(new ScaledEmptyBorder(0, 0, 10, 0)); + UIExpandablePane advancedPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 24, contentPane); + corePane.add(advancedPane); } - this.addValidatePane(); + corePane.add(addValidatePane()); + this.add(corePane, BorderLayout.CENTER); } @@ -86,6 +90,10 @@ public abstract class FieldEditorDefinePane extends Abstr protected void initExtraPane() { initPluginListener(); refreshExtraAdvancedPane(); + if (extraPane == null) { + extraPane = new JPanel(); + extraPane.setVisible(false); + } } protected void refreshExtraAdvancedPane() { @@ -146,41 +154,30 @@ public abstract class FieldEditorDefinePane extends Abstr } - protected void addValidatePane() { - validatePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - final UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip")); + protected JPanel addValidatePane() { + validatePane = column(LayoutConstants.VERTICAL_GAP).getComponent(); + final UILabel errorTipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip")); initErrorMsgPane(); allowBlankCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Null")); - allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - final JPanel errorTipPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{uiLabel, errorMsgTextField.getErrorMsgTextField()}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); - errorTipPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L5, 0, 0)); - borderPane.add(errorTipPane, BorderLayout.CENTER); - allowBlankCheckBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - boolean isSelected = allowBlankCheckBox.isSelected(); - errorTipPane.setVisible(!isSelected); - } + final JPanel errorTipPane = row( + cell(errorTipLabel).weight(LEFT_WEIGHT), cell(errorMsgTextField.getErrorMsgTextField()).weight(RIGHT_WEIGHT) + ).getComponent(); + allowBlankCheckBox.addItemListener(e -> { + boolean selected = allowBlankCheckBox.isSelected(); + errorTipPane.setVisible(!selected); }); - - errorTipPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L5, 0, 0)); - Component[][] components = new Component[][]{ - new Component[]{allowBlankCheckBox}, - new Component[]{borderPane}, - }; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, 5, 5); - panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L6, 0)); - validatePane.add(panel, BorderLayout.NORTH); + validatePane.add(column(LayoutConstants.VERTICAL_GAP, + cell(allowBlankCheckBox), + cell(errorTipPane) + ).getComponent()); JPanel contentPane = this.setValidatePane(); if (contentPane != null) { - validatePane.add(contentPane, BorderLayout.CENTER); + validatePane.add(contentPane); } - - - UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Validate"), 280, 24, validatePane); - this.add(uiExpandablePane, BorderLayout.CENTER); + UIExpandablePane expandValidatePane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Basic_Validate"), 280, 24, validatePane); + expandValidatePane.setBorder(FineBorderFactory.createDefaultTopBorder()); + return expandValidatePane; } public JPanel setValidatePane() { diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/IframeEditorDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/IframeEditorDefinePane.java index d97aa6e9fc..a617e2a310 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/IframeEditorDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/IframeEditorDefinePane.java @@ -1,6 +1,7 @@ package com.fr.design.widget.ui; -import com.fr.design.designer.IntervalConstants; +import com.fine.theme.utils.FineUIScale; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.UIDialog; import com.fr.design.foldablepane.UIExpandablePane; @@ -10,21 +11,24 @@ import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.IframeEditor; import com.fr.log.FineLoggerFactory; import com.fr.stable.ParameterProvider; -import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingUtilities; -import java.awt.BorderLayout; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; + public class IframeEditorDefinePane extends AbstractDataModify { private static final int P_W = 610; @@ -43,36 +47,29 @@ public class IframeEditorDefinePane extends AbstractDataModify { private void initComponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); - JPanel attr = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); - attr.add(horizontalCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Preference_Horizontal_Scroll_Bar_Visible"))); - attr.add(verticalCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Preference_Vertical_Scroll_Bar_Visible"))); - contentPane.add(attr); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] rowSize = {p, p, p, p}; - double[] columnSize = {p, f}; + horizontalCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Preference_Horizontal_Scroll_Bar_Visible")); + verticalCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Preference_Vertical_Scroll_Bar_Visible")); parameterViewPaneButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); parameterViewPaneButton.addActionListener(parameterListener); parameterViewPane = new ReportletParameterViewPane(); - horizontalCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - verticalCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - java.awt.Component[][] coms = { - {horizontalCheck, null}, - {verticalCheck, null}, - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Form_Url")), srcTextField = new UITextField()}, - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameters")), parameterViewPaneButton}}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(coms, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1); - - - contentPane.add(panel); + srcTextField = new UITextField(); + + JPanel contentPane = column(LayoutConstants.VERTICAL_GAP, + cell(horizontalCheck), + cell(verticalCheck), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Form_Url"))).weight(LEFT_WEIGHT), + cell(srcTextField).weight(RIGHT_WEIGHT) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameters"))).weight(LEFT_WEIGHT), + cell(parameterViewPaneButton).weight(RIGHT_WEIGHT) + ) + ).getComponent(); UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 24, contentPane); - this.add(uiExpandablePane, BorderLayout.NORTH); + this.add(uiExpandablePane); } @@ -101,7 +98,7 @@ public class IframeEditorDefinePane extends AbstractDataModify { parameterViewPane.update(list); } }); - dialog.setSize(P_W, P_H); + dialog.setSize(FineUIScale.scale(new Dimension(P_W, P_H))); dialog.setVisible(true); } }; diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/ListEditorDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/ListEditorDefinePane.java index c198df96b1..d52c2f8ecc 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/ListEditorDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/ListEditorDefinePane.java @@ -4,15 +4,17 @@ import com.fr.data.Dictionary; import com.fr.design.data.DataCreatorUI; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor; import com.fr.form.ui.ListEditor; -import javax.swing.BorderFactory; import javax.swing.JPanel; -import java.awt.BorderLayout; import java.awt.Component; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.flex; + + public class ListEditorDefinePane extends WriteUnableRepeatEditorPane { private UICheckBox needHeadCheckBox; private AccessibleDictionaryEditor dictPane; @@ -34,12 +36,8 @@ public class ListEditorDefinePane extends WriteUnableRepeatEditorPane { private DictionaryComboBox acceptType; @@ -34,15 +34,12 @@ public class MultiFileEditorPane extends FieldEditorDefinePane @Override protected JPanel setFirstContentPane() { - JPanel contenter = new JPanel(new BorderLayout()); + JPanel center = new JPanel(new BorderLayout()); singleFileCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Single_File_Upload")); UIComponentUtils.setLineWrap(singleFileCheckBox); - singleFileCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays); -// acceptType.setPreferredSize(new Dimension(100, 20)); fileSizeField = new UISpinner(0, Integer.MAX_VALUE, 1, -1); - fileSizeField.setPreferredSize(new Dimension(140, 20)); JPanel fileSizePane = new JPanel(new BorderLayout()); UILabel fileTypeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_File_Type")); @@ -50,20 +47,17 @@ public class MultiFileEditorPane extends FieldEditorDefinePane fileSizePane.add(fileSizeField, BorderLayout.CENTER); fileSizePane.add(new UILabel(" KB"), BorderLayout.EAST); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - Component[][] components = new Component[][]{ - new Component[]{singleFileCheckBox, null}, - new Component[]{fileTypeLabel, acceptType}, - new Component[]{fileSizeLabel, fileSizePane}, - }; - double[] rowSize = {p, p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - contenter.add(panel, BorderLayout.CENTER); + center.add(column(LayoutConstants.VERTICAL_GAP, + cell(singleFileCheckBox), + row( + cell(fileTypeLabel).weight(LEFT_WEIGHT), cell(acceptType).weight(RIGHT_WEIGHT) + ), + row( + cell(fileSizeLabel).weight(LEFT_WEIGHT), cell(fileSizePane).weight(RIGHT_WEIGHT) + ) + ).getComponent()); - return contenter; + return center; } @Override diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/NumberEditorDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/NumberEditorDefinePane.java index 8285abbf30..91fb5dc219 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/NumberEditorDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/NumberEditorDefinePane.java @@ -1,19 +1,14 @@ package com.fr.design.widget.ui; -import javax.swing.JPanel; -import javax.swing.SwingConstants; - -import com.fr.design.ExtraDesignClassManager; -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.designer.IntervalConstants; -import com.fr.design.fun.WidgetAdvancedPaneProvider; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widget.component.NumberEditorValidatePane; import com.fr.form.ui.NumberEditor; -import java.awt.Component; -import java.util.Set; + +import javax.swing.JPanel; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP; public class NumberEditorDefinePane extends FieldEditorDefinePane { /** @@ -38,15 +33,21 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane(); waterMarkDictPane = new WaterMarkDictPane(); initExtraPane(); - Component[][] components = new Component[][]{ - new Component[]{waterMarkDictPane, null}, - new Component[]{extraPane, null} - }; - double[] rowSize = {P, P}; - double[] columnSize = {P, F}; - int[][] rowCount = {{1, 1}, {1, 1}}; - final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - content.add(panel); + + if (extraPane == null) { + content.add( + column(VERTICAL_GAP, + cell(waterMarkDictPane) + ).getComponent() + ); + } else { + content.add( + column(VERTICAL_GAP, + cell(waterMarkDictPane), + cell(extraPane) + ).getComponent() + ); + } return content; } diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/RadioGroupDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/RadioGroupDefinePane.java index 22f7a31d5b..d2d0fd3cf8 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/RadioGroupDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/RadioGroupDefinePane.java @@ -1,20 +1,13 @@ package com.fr.design.widget.ui; import javax.swing.JPanel; -import javax.swing.SwingConstants; -import com.fr.design.ExtraDesignClassManager; -import com.fr.design.beans.BasicBeanPane; +import com.fr.design.constants.LayoutConstants; import com.fr.design.data.DataCreatorUI; -import com.fr.design.designer.IntervalConstants; -import com.fr.design.fun.WidgetAdvancedPaneProvider; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.RadioGroup; -import java.awt.Component; -import java.util.Set; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; public class RadioGroupDefinePane extends FieldEditorDefinePane { @@ -34,17 +27,11 @@ public class RadioGroupDefinePane extends FieldEditorDefinePane { protected JPanel setFirstContentPane() { buttonGroupDictPane = new ButtonGroupDictPane(); initExtraPane(); - Component[][] components = new Component[][]{ - new Component[]{buttonGroupDictPane, null}, - new Component[]{extraPane, null} - }; - double[] rowSize = {P, P, P, P}; - double[] columnSize = {P, F}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; - final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane(); - content.add(panel); - return content; + + return column(LayoutConstants.VERTICAL_GAP, + cell(buttonGroupDictPane), + cell(extraPane) + ).getComponent(); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/TextFieldEditorDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/TextFieldEditorDefinePane.java index abc7a382d2..cef2f8849c 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/TextFieldEditorDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/TextFieldEditorDefinePane.java @@ -1,23 +1,21 @@ package com.fr.design.widget.ui; import com.fr.design.ExtraDesignClassManager; -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.designer.IntervalConstants; +import com.fr.design.constants.LayoutConstants; import com.fr.design.fun.RegPaneProvider; -import com.fr.design.fun.WidgetAdvancedPaneProvider; import com.fr.design.gui.frpane.RegFieldPane; import com.fr.design.gui.frpane.RegPane; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.TextEditor; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import javax.swing.JPanel; -import java.awt.Component; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; -import java.util.Set; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; + public class TextFieldEditorDefinePane extends FieldEditorDefinePane { protected RegFieldPane regPane; @@ -38,13 +36,11 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane regPane.removeRegChangeListener(this); } }; - final RegPane.PhoneRegListener pl = new RegPane.PhoneRegListener() { - public void phoneRegChangeAction(RegPane.PhoneRegEvent e) { - if (StringUtils.isNotEmpty(e.getPhoneRegString()) - && StringUtils.isEmpty(waterMarkDictPane.getWaterMark())) { - waterMarkDictPane.setWaterMark(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Example") + ":" + e.getPhoneRegString()); - regPane.addRegChangeListener(rl); - } + final RegPane.PhoneRegListener pl = e -> { + if (StringUtils.isNotEmpty(e.getPhoneRegString()) + && StringUtils.isEmpty(waterMarkDictPane.getWaterMark())) { + waterMarkDictPane.setWaterMark(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Example") + ":" + e.getPhoneRegString()); + regPane.addRegChangeListener(rl); } }; regPane.addPhoneRegListener(pl); @@ -57,17 +53,11 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane } }); initExtraPane(); - Component[][] components = new Component[][]{ - new Component[]{waterMarkDictPane, null}, - new Component[]{extraPane, null} - }; - double[] rowSize = {P, P}; - double[] columnSize = {P, F}; - int[][] rowCount = {{1, 1}, {1, 1}}; - final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane(); - content.add(panel); - return content; + + return column(LayoutConstants.VERTICAL_GAP, + cell(waterMarkDictPane), + cell(extraPane) + ).getComponent(); } public JPanel setValidatePane() { diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/TreeComboBoxEditorDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/TreeComboBoxEditorDefinePane.java index 54bf00a388..799c9699e8 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/TreeComboBoxEditorDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/TreeComboBoxEditorDefinePane.java @@ -1,25 +1,21 @@ package com.fr.design.widget.ui; -import java.awt.*; -import java.util.Set; - -import javax.swing.BorderFactory; import javax.swing.JPanel; -import com.fr.design.ExtraDesignClassManager; -import com.fr.design.beans.BasicBeanPane; +import com.fr.design.constants.LayoutConstants; import com.fr.design.data.DataCreatorUI; -import com.fr.design.designer.IntervalConstants; -import com.fr.design.fun.WidgetAdvancedPaneProvider; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itree.refreshabletree.TreeRootPane; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.widget.accessibles.AccessibleTreeModelEditor; import com.fr.design.widget.component.ReturnTypePane; import com.fr.form.ui.TreeComboBoxEditor; import com.fr.form.ui.TreeEditor; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; public class TreeComboBoxEditorDefinePane extends CustomWritableRepeatEditorPane { protected AccessibleTreeModelEditor treeSettingPane; @@ -34,12 +30,8 @@ public class TreeComboBoxEditorDefinePane extends CustomWritableRepeatEditorPane @Override protected JPanel setForthContentPane() { - JPanel content = FRGUIPaneFactory.createBorderLayout_L_Pane(); treeRootPane = new TreeRootPane(); returnTypePane = new ReturnTypePane(); - content.add(treeRootPane, BorderLayout.NORTH); - returnTypePane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); - content.add(returnTypePane, BorderLayout.CENTER); treeRootPane.addTreeAttrChangeListener(treeAttr -> { boolean showReturnTypePane = treeAttr.isMultipleSelection() && !treeAttr.isReturnFullPath(); returnTypePane.setVisible(showReturnTypePane); @@ -47,21 +39,22 @@ public class TreeComboBoxEditorDefinePane extends CustomWritableRepeatEditorPane returnTypePane.setReturnType(ReturnTypePane.ReturnType.ARRAY); } }); - content.add(treeRootPane, BorderLayout.NORTH); - return content; + return column(LayoutConstants.VERTICAL_GAP, + cell(treeRootPane), + cell(returnTypePane) + ).getComponent(); } @Override protected JPanel setFirstContentPane() { treeSettingPane = new AccessibleTreeModelEditor(); - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - JPanel north = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Create_Tree")), treeSettingPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1); - north.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); - JPanel center = super.setFirstContentPane(); - jPanel.add(north, BorderLayout.NORTH); - jPanel.add(center, BorderLayout.CENTER); - return jPanel; + return column(LayoutConstants.VERTICAL_GAP, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Create_Tree"))).weight(LEFT_WEIGHT), + cell(treeSettingPane).weight(RIGHT_WEIGHT) + ), + cell(super.setFirstContentPane()) + ).getComponent(); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/TreeEditorDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/TreeEditorDefinePane.java index 1abc355f94..e722f72ebf 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/TreeEditorDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/TreeEditorDefinePane.java @@ -1,23 +1,22 @@ package com.fr.design.widget.ui; -import com.fr.design.ExtraDesignClassManager; -import com.fr.design.beans.BasicBeanPane; +import com.fr.design.constants.LayoutConstants; import com.fr.design.data.DataCreatorUI; -import com.fr.design.designer.IntervalConstants; -import com.fr.design.fun.WidgetAdvancedPaneProvider; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itree.refreshabletree.TreeRootPane; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.widget.accessibles.AccessibleTreeModelEditor; import com.fr.design.widget.component.ReturnTypePane; import com.fr.form.ui.TreeEditor; -import javax.swing.*; -import java.awt.*; -import java.util.Set; +import javax.swing.JPanel; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; /* @@ -63,29 +62,24 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane { } protected JPanel setSecondContentPane() { + JPanel contentPane = column(LayoutConstants.VERTICAL_GAP).getComponent(); + accessibleTreeModelEditor = new AccessibleTreeModelEditor(); - JPanel createTree = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Create_Tree")), accessibleTreeModelEditor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1); - createTree.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); - JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - JPanel contenter = FRGUIPaneFactory.createBorderLayout_S_Pane(); - initExtraPane(); - double[] rowSize = {P, P}; - double[] columnSize = {P, F}; - int[][] rowCount = {{1, 1},{1, 1}}; - Component[][] components = new Component[][]{ - new Component[]{createTree, null}, - new Component[]{extraPane, null}, - }; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); - contentPane.add(contenter,BorderLayout.NORTH); removeRepeatCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Remove_Repeat_Data"), false); - removeRepeatCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - contenter.add(panel, BorderLayout.NORTH); - contenter.add(removeRepeatCheckBox, BorderLayout.CENTER); + initExtraPane(); + + contentPane.add(column(LayoutConstants.VERTICAL_GAP, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Create_Tree"))).weight(LEFT_WEIGHT), + cell(accessibleTreeModelEditor).weight(RIGHT_WEIGHT) + ), + cell(extraPane), + cell(removeRepeatCheckBox) + ).getComponent()); + JPanel otherContentPane = this.setThirdContentPane(); if (otherContentPane != null) { - contentPane.add(otherContentPane,BorderLayout.CENTER); + contentPane.add(otherContentPane); } return contentPane; } @@ -96,12 +90,8 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane { } protected JPanel setThirdContentPane() { - JPanel content = FRGUIPaneFactory.createBorderLayout_L_Pane(); treeRootPane = new TreeRootPane(); returnTypePane = new ReturnTypePane(); - content.add(treeRootPane, BorderLayout.NORTH); - returnTypePane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); - content.add(returnTypePane, BorderLayout.CENTER); treeRootPane.addTreeAttrChangeListener(treeAttr -> { boolean showReturnTypePane = treeAttr.isMultipleSelection() && !treeAttr.isReturnFullPath(); returnTypePane.setVisible(showReturnTypePane); @@ -109,8 +99,10 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane { returnTypePane.setReturnType(ReturnTypePane.ReturnType.ARRAY); } }); - //content.add(treeRootPane, BorderLayout.NORTH); - return content; + return column(LayoutConstants.VERTICAL_GAP, + cell(treeRootPane), + cell(returnTypePane) + ).getComponent(); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/WaterMarkDictPane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/WaterMarkDictPane.java index dc1bf72ca0..11ef829032 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/WaterMarkDictPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/WaterMarkDictPane.java @@ -1,17 +1,18 @@ package com.fr.design.widget.ui; -import com.fr.design.designer.IntervalConstants; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.WaterMark; - -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import java.awt.BorderLayout; import java.awt.event.KeyListener; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; + public class WaterMarkDictPane extends JPanel { private UITextField waterMarkTextField; @@ -21,17 +22,12 @@ public class WaterMarkDictPane extends JPanel { waterMarkTextField = new UITextField(); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark")), waterMarkTextField}, - }; - double[] rowSize = {p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}}; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1); -// panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - this.add(panel, BorderLayout.CENTER); + this.add( + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark"))).weight(LEFT_WEIGHT), + cell(waterMarkTextField).weight(RIGHT_WEIGHT) + ).getComponent() + ); } public void populate(WaterMark waterMark) { diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/WritableRepeatEditorPane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/WritableRepeatEditorPane.java index 8bb502d18c..750b2c47e2 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/WritableRepeatEditorPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/WritableRepeatEditorPane.java @@ -1,10 +1,11 @@ package com.fr.design.widget.ui; -import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.constants.LayoutConstants; import com.fr.form.ui.WriteAbleRepeatEditor; -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; + +import static com.fine.swing.ui.layout.Layouts.column; public abstract class WritableRepeatEditorPane extends DirectWriteEditorDefinePane { @@ -15,11 +16,10 @@ public abstract class WritableRepeatEditorPane @Override protected JPanel setSecondContentPane() { - JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + JPanel contentPane = column(LayoutConstants.VERTICAL_GAP).getComponent(); JPanel otherContentPane = this.setThirdContentPane(); if (otherContentPane != null) { - contentPane.add(otherContentPane,BorderLayout.CENTER); + contentPane.add(otherContentPane); } return contentPane; } diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/WriteUnableRepeatEditorPane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/WriteUnableRepeatEditorPane.java index fdfeb06a85..a65bc043fd 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/WriteUnableRepeatEditorPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/WriteUnableRepeatEditorPane.java @@ -1,17 +1,18 @@ package com.fr.design.widget.ui; -import java.awt.*; - -import javax.swing.BorderFactory; +import java.awt.Component; import javax.swing.JPanel; -import com.fr.design.designer.IntervalConstants; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.WriteUnableRepeatEditor; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; + public abstract class WriteUnableRepeatEditorPane extends FieldEditorDefinePane { // richer:是否去除重复的值 @@ -23,26 +24,21 @@ public abstract class WriteUnableRepeatEditorPane extends AbstractExtraButtonPane { private DefineAppendColumnRowPane defineColumnRowPane; -// @Override -// protected void initComponents() { -// super.initComponents(); -// defineColumnRowPane = new DefineAppendColumnRowPane(); -// add(defineColumnRowPane, BorderLayout.SOUTH); -// } - @Override protected Component createCenterPane() { defineColumnRowPane = new DefineAppendColumnRowPane(); diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/btn/ButtonSytleDefinedPane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/btn/ButtonSytleDefinedPane.java index 4483b3a842..830c2afe05 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/btn/ButtonSytleDefinedPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/btn/ButtonSytleDefinedPane.java @@ -7,9 +7,8 @@ import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; +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.mainframe.widget.accessibles.AccessibleBackgroundEditor; import com.fr.design.style.background.BackgroundButtonPane; import com.fr.form.ui.FreeButton; @@ -20,12 +19,19 @@ import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JPanel; import javax.swing.SwingUtilities; -import java.awt.BorderLayout; -import java.awt.Component; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.fix; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; + public class ButtonSytleDefinedPane extends BasicPane { protected AccessibleBackgroundEditor initBackgroundPane; protected AccessibleBackgroundEditor overBackgroundPane; @@ -40,20 +46,30 @@ public class ButtonSytleDefinedPane extends BasicPane { initBackgroundPane = new AccessibleBackgroundEditor(); overBackgroundPane = new AccessibleBackgroundEditor(); clickBackgroundPane = new AccessibleBackgroundEditor(); - double f = TableLayout.FILL; - final double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1},{1, 1},{1, 1}}; - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Initial")), initBackgroundPane}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Over")), overBackgroundPane}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Click")), clickBackgroundPane}, - }; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 7, 7); - panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - this.add(panel, BorderLayout.CENTER); - + this.add(row( + column(VERTICAL_GAP, + cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Style_Background_Setting"))).weight(1), + flex(1), + flex(1) + ).weight(LEFT_WEIGHT), + column(VERTICAL_GAP, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Initial"))).weight(1), + fix(2), + cell(initBackgroundPane).weight(1) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Over"))).weight(1), + fix(2), + cell(overBackgroundPane).weight(1) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Click"))).weight(1), + fix(2), + cell(clickBackgroundPane).weight(1) + ) + ).weight(RIGHT_WEIGHT) + ).getComponent()); } public void populate(FreeButton button) { diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/btn/DefineAppendColumnRowPane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/btn/DefineAppendColumnRowPane.java index 66081305a8..41c6d7b518 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/btn/DefineAppendColumnRowPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/btn/DefineAppendColumnRowPane.java @@ -1,23 +1,22 @@ package com.fr.design.widget.ui.btn; -import java.awt.Color; -import java.awt.Component; - -import javax.swing.BorderFactory; - -import com.fr.design.designer.IntervalConstants; +import com.fine.theme.utils.FineUIStyle; import com.fr.design.gui.ilable.UILabel; -import javax.swing.JPanel; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.dialog.BasicPane; import com.fr.design.editor.editor.ColumnRowEditor; import com.fr.report.web.button.write.AppendRowButton; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; + /** * Created by IntelliJ IDEA. Author : Richer Version: 6.5.6 Date : 11-11-16 Time * : 上午9:34 @@ -32,27 +31,25 @@ public class DefineAppendColumnRowPane extends BasicPane { } private void initComponents() { - double f = TableLayout.FILL; - - double p = TableLayout.PREFERRED; - double rowSize[] = { p, p ,p}; - double columnSize[] = { p, f}; crEditor = new ColumnRowEditor(); jNumberEditor = new UISpinner(0, 100 , 1, 0); - rowCountLable = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Edit_Row_Count")); - JPanel lpane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - lpane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Append_Delete_Row_Message")); - label.setForeground(new Color(0x8F8F92)); - lpane.add(label); - Component[][] components = { { new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Specify_Cell")), crEditor }, { rowCountLable, jNumberEditor } ,{lpane,null}}; - JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); - contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + UILabel tipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Append_Delete_Row_Message")); + FineUIStyle.setStyle(tipLabel, FineUIStyle.LABEL_TIP); this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.add(contentPane); + this.add(column(VERTICAL_GAP, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Specify_Cell"))).weight(LEFT_WEIGHT), + cell(crEditor).weight(RIGHT_WEIGHT) + ), + row( + cell(rowCountLable).weight(LEFT_WEIGHT), + cell(jNumberEditor).weight(RIGHT_WEIGHT) + ), + cell(tipLabel) + ).getComponent()); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/btn/DefineDeleteColumnRowPane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/btn/DefineDeleteColumnRowPane.java index e4ef8c5af5..428148960c 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/btn/DefineDeleteColumnRowPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/btn/DefineDeleteColumnRowPane.java @@ -1,26 +1,25 @@ package com.fr.design.widget.ui.btn; -import javax.swing.*; - -import com.fr.design.designer.IntervalConstants; +import com.fine.theme.utils.FineUIStyle; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.dialog.BasicPane; import com.fr.design.editor.editor.ColumnRowEditor; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; - import com.fr.report.web.button.write.DeleteRowButton; -import java.awt.*; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; /** * Created by IntelliJ IDEA. Author : Richer Version: 6.5.6 Date : 11-11-16 Time * : 上午10:56 */ public class DefineDeleteColumnRowPane extends BasicPane { - private static final int BORDER_LEFT = -10; private ColumnRowEditor crEditor; @@ -29,22 +28,20 @@ public class DefineDeleteColumnRowPane extends BasicPane { } private void initComponents() { - double f = TableLayout.FILL; - - double p = TableLayout.PREFERRED; - double rowSize[] = { p, p}; - double columnSize[] = { p, f}; + crEditor = new ColumnRowEditor(); crEditor = new ColumnRowEditor(); UILabel messageLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Append_Delete_Row_Message")); - messageLabel.setForeground(new Color(0x8F8F92)); - Component[][] components = { - { new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Specify_Cell")), crEditor }, - { messageLabel, null}}; - JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); - contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - setLayout(FRGUIPaneFactory.createBorderLayout()); - - add(contentPane); + FineUIStyle.setStyle(messageLabel, FineUIStyle.LABEL_TIP); + + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.add(column(VERTICAL_GAP, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Specify_Cell"))).weight(LEFT_WEIGHT), + cell(crEditor).weight(RIGHT_WEIGHT) + ), + cell(messageLabel) + + ).getComponent()); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/btn/TreeNodeToogleButtonDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/btn/TreeNodeToogleButtonDefinePane.java index 1796b3e054..5228a69d80 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/btn/TreeNodeToogleButtonDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/btn/TreeNodeToogleButtonDefinePane.java @@ -1,11 +1,8 @@ package com.fr.design.widget.ui.btn; -import com.fr.design.designer.IntervalConstants; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.Button; import com.fr.report.web.button.form.TreeNodeToggleButton; @@ -13,6 +10,11 @@ import com.fr.report.web.button.form.TreeNodeToggleButton; import javax.swing.*; import java.awt.*; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; + /** * 树节点按钮 * @@ -28,19 +30,14 @@ public class TreeNodeToogleButtonDefinePane exte protected void initComponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double rowSize[] = {p}; - double columnSize[] = {p, f}; initExtraPane(); - Component[][] n_components = { - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Button_Type")), createCustomButtonTypeComboBox()}, - }; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, IntervalConstants.INTERVAL_L2, 8); - JPanel borderPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - borderPanel.add(panel, BorderLayout.CENTER); - panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0)); - UIExpandablePane advancedPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, borderPanel); + + JPanel panel = row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Button_Type"))).weight(LEFT_WEIGHT), + cell(createCustomButtonTypeComboBox()).weight(RIGHT_WEIGHT) + ).getComponent(); + + UIExpandablePane advancedPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, panel); this.add(advancedPane); } diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/MultiFileEditorMobilePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/MultiFileEditorMobilePane.java index adfda17c2b..01c5254152 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/MultiFileEditorMobilePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/MultiFileEditorMobilePane.java @@ -2,24 +2,22 @@ package com.fr.design.widget.ui.mobile; import com.fr.base.mobile.FileUploadModeState; import com.fr.base.mobile.MultiFileUploaderMobileAttr; -import com.fr.design.constants.LayoutConstants; import com.fr.design.designer.properties.items.Item; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widget.mobile.WidgetMobilePane; import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.Widget; - -import javax.swing.BorderFactory; import javax.swing.JPanel; -import javax.swing.SwingConstants; import java.awt.BorderLayout; -import java.awt.Component; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; /** * Created by plough on 2018/4/25. @@ -60,20 +58,10 @@ public class MultiFileEditorMobilePane extends WidgetMobilePane { private UIExpandablePane getMobileSettingsPane() { initUploadModeComboBox(); - // 以后可能会扩展 - Component[][] components = new Component[][]{ - new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Upload_Mode"), SwingConstants.LEFT), uploadModeComboBox} - }; - - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = {p}; - double[] columnSize = {p,f}; - int[][] rowCount = {{1, 1}}; - final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 30, LayoutConstants.VGAP_LARGE); - panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); - panelWrapper.add(panel, BorderLayout.NORTH); + final JPanel panelWrapper = row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Upload_Mode"))).weight(LEFT_WEIGHT), + cell(uploadModeComboBox).weight(RIGHT_WEIGHT) + ).getComponent(); return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Terminal"), 280, 20, panelWrapper); } diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/TextEditorMobilePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/TextEditorMobilePane.java index 7c836389d7..5f0fb2fb70 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/TextEditorMobilePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/TextEditorMobilePane.java @@ -12,6 +12,9 @@ import com.fr.form.ui.Widget; import javax.swing.JPanel; import java.awt.BorderLayout; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; + /** * 文本控件移动端属性面板 * @@ -32,12 +35,13 @@ public class TextEditorMobilePane extends WidgetMobilePane { @Override protected void init() { - JPanel container = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); settingPane = new MobileTextFieldInputSettingPane(); textSettingPane = new MobileTextEditSettingPane(); - container.add(settingPane); - container.add(textSettingPane); + container.add(column( + cell(settingPane),cell(textSettingPane) + ).getComponent()); this.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, container), BorderLayout.NORTH); }