diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/popup/MobilePopupRegularPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/popup/MobilePopupRegularPane.java index bc10b89144..7978159c1c 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/popup/MobilePopupRegularPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/popup/MobilePopupRegularPane.java @@ -1,11 +1,13 @@ package com.fr.design.hyperlink.popup; +import com.fine.theme.utils.FineUIStyle; +import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.VerticalFlowLayout; import com.fr.stable.StringUtils; import javax.swing.*; @@ -13,6 +15,11 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +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; + public class MobilePopupRegularPane extends BasicPane { private String label; @@ -35,13 +42,15 @@ public class MobilePopupRegularPane extends BasicPane { private void initComponent() { this.setLayout(new BorderLayout()); - this.add(this.createRadioButtonGroupPane(), BorderLayout.NORTH); spinnerGroupPane = this.createSpinnerPane(); - this.add(spinnerGroupPane, BorderLayout.CENTER); + this.add(column(LayoutConstants.VERTICAL_GAP, + cell(this.createRadioButtonGroupPane()), + row(flex(1), cell(spinnerGroupPane).weight(3)) + ).getComponent()); } private JPanel createRadioButtonGroupPane() { - radiosPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5)); + radiosPane = new JPanel(new BorderLayout()); customRadio = new UIRadioButton(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Custom")); customRadio.addActionListener(radioActionListener); @@ -52,10 +61,8 @@ public class MobilePopupRegularPane extends BasicPane { radioButtons.add(customRadio); radioButtons.add(autoRadio); - radiosPane.add(customRadio); - radiosPane.add(autoRadio); - - return MobilePopupUIUtils.createLeftTileRightContentPanel(this.label, radiosPane, Color.GRAY, 20); + radiosPane.add(row(30, cell(customRadio), cell(autoRadio), flex()).getComponent()); + return row(cell(new UILabel(this.label, FineUIStyle.LABEL_SECONDARY)).weight(1), cell(radiosPane).weight(3)).getComponent(); } private ActionListener radioActionListener = new ActionListener() { @@ -66,40 +73,32 @@ public class MobilePopupRegularPane extends BasicPane { }; private JPanel createSpinnerPane() { - JPanel spinnerPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 15, 5)); - spinnerPane.setBorder(BorderFactory.createEmptyBorder(0, MobilePopupUIUtils.Left_Title_width, 0, 0)); + JPanel spinnerPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 15, 0)); + spinnerPane.setBorder(new ScaledEmptyBorder(0, 0, 0, 0)); widthSpinner = new UISpinner(0, 100, 1, 95); widthSpinnerPane = this.createSpinnerLabelPane(widthSpinner, Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Width")); heightSpinner = new UISpinner(0, 100, 1, 95); heightSpinnerPane = this.createSpinnerLabelPane(heightSpinner, Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Height")); - - spinnerPane.add(widthSpinnerPane); - spinnerPane.add(heightSpinnerPane); - + spinnerPane.add(row(cell(widthSpinnerPane), cell(heightSpinnerPane)).getComponent()); return spinnerPane; } private JPanel createSpinnerLabelPane(UISpinner spinner, String labelText) { - JPanel spinnerLabelPane = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 5)); - - JPanel spinnerPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 2,0)); + JPanel spinnerLabelPane = new JPanel(new BorderLayout()); UILabel percent = new UILabel("%"); - spinnerPane.add(spinner); - spinnerPane.add(percent); - UILabel label = new UILabel(labelText); label.setHorizontalAlignment(SwingConstants.CENTER); - - spinnerLabelPane.add(spinnerPane); - spinnerLabelPane.add(label); - + spinnerLabelPane.add(column(LayoutConstants.VGAP_SMALL, + row(cell(spinner).weight(1), cell(percent)).weight(1), + cell(label) + ).getComponent()); return spinnerLabelPane; } private void resetSpinnerGroupPane(boolean showHeightSpinnerPane) { spinnerGroupPane.removeAll(); spinnerGroupPane.add(widthSpinnerPane); - if(showHeightSpinnerPane) { + if (showHeightSpinnerPane) { spinnerGroupPane.add(heightSpinnerPane); } spinnerGroupPane.revalidate(); diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/popup/StyleSettingPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/popup/StyleSettingPane.java index 3073203496..701594bf12 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/popup/StyleSettingPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/popup/StyleSettingPane.java @@ -1,6 +1,8 @@ package com.fr.design.hyperlink.popup; +import com.fine.theme.utils.FineUIStyle; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; @@ -57,14 +59,11 @@ public class StyleSettingPane extends BasicBeanPane { JPanel typePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); popupTypeLabel = new UILabel(""); UILabel typeLabel = new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Type")); - typePane.add(row(44, - cell(typeLabel), - cell(popupTypeLabel) - ).getComponent()); + typePane.add(row(cell(typeLabel).weight(1), row(cell(popupTypeLabel), flex()).weight(6)).getComponent()); return typePane; } - private JPanel createStylePane() { + private JPanel createStylePane() { JPanel stylePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); stylePane.add(column(10, cell(this.createBorderSettingPane()), @@ -82,14 +81,11 @@ public class StyleSettingPane extends BasicBeanPane { borderColor = new NewColorSelectBox(100); borderRadiusSpinner = new UISpinner(0, maxBorderRadius, 1, 20); UILabel borderLabel = new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Border")); - borderPane.add(row(44, - column(10, - cell(borderLabel).weight(0.3), - flex().weight(0.7)), - column(10, - cell(MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Line"), borderType, Color.GRAY, 64)), - cell(MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Colors"), borderColor, Color.GRAY, 64)), - cell(MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Radius"), borderRadiusSpinner, Color.GRAY, 64))) + + borderPane.add(column(LayoutConstants.VERTICAL_GAP, + row(cell(borderLabel).weight(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Line"), FineUIStyle.LABEL_SECONDARY)).weight(1), cell(borderType).weight(2), flex(3)), + row(flex(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Colors"), FineUIStyle.LABEL_SECONDARY)).weight(1), cell(borderColor).weight(2), flex(3)), + row(flex(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Radius"), FineUIStyle.LABEL_SECONDARY)).weight(1), cell(borderRadiusSpinner).weight(2), flex(3)) ).getComponent()); return borderPane; } @@ -99,39 +95,31 @@ public class StyleSettingPane extends BasicBeanPane { bgPane.setLayout(new BorderLayout()); bgColor = new NewColorSelectBox(100); - JPanel transparencyPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.numberDragPane = new UINumberDragPane(0,100); + this.numberDragPane = new UINumberDragPane(0, 100); transparencyPane.add(numberDragPane, BorderLayout.CENTER); transparencyPane.add(new UILabel(" %"), BorderLayout.EAST); JLabel bgLabel = new JLabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Background")); - bgPane.add(row(44, - column(10, - cell(bgLabel).weight(0.6), - flex().weight(0.4)), - column(10, - cell(MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Colors"), bgColor, Color.GRAY, 64)), - cell(MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Opacity"), transparencyPane, Color.GRAY, 64)) - ) + + bgPane.add(column(LayoutConstants.VERTICAL_GAP, + row(cell(bgLabel).weight(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Colors"), FineUIStyle.LABEL_SECONDARY)).weight(1), cell(bgColor).weight(2), flex(3)), + row(flex(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Opacity"), FineUIStyle.LABEL_SECONDARY)).weight(1), cell(transparencyPane).weight(3), flex(2)) ).getComponent()); return bgPane; } private JPanel createPopupSizePane() { JPanel sizePane = new JPanel(new BorderLayout()); - mobileRegularPane = new MobilePopupRegularPane(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Mobile_Rules")); padRegularPane = new MobilePopupRegularPane(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Pad_Rules")); JLabel sizeLabel = new JLabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Size")); - sizePane.add(row(20, - column(10, - cell(sizeLabel).weight(0.16), - flex().weight(0.84)), - column(10, - cell(mobileRegularPane), - cell(padRegularPane) - ) + sizePane.add(column(LayoutConstants.VERTICAL_GAP, + row( + column(LayoutConstants.VERTICAL_GAP, cell(sizeLabel), flex()).weight(1), + cell(mobileRegularPane).weight(4), flex(2) + ), + row(flex(1), cell(padRegularPane).weight(4), flex(2)) ).getComponent()); return sizePane; } @@ -204,7 +192,7 @@ public class StyleSettingPane extends BasicBeanPane { private void updateBackgroundSettingBean(MobilePopupHyperlink link) { link.setBgColor(bgColor.getSelectObject()); - link.setBgOpacity((float)(numberDragPane.updateBean() / maxNumber)); + link.setBgOpacity((float) (numberDragPane.updateBean() / maxNumber)); } private void populatePopupSizeBean(MobilePopupHyperlink link) { diff --git a/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java b/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java index b6fbaea532..ee9ea9909a 100644 --- a/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java @@ -182,9 +182,9 @@ public class RootDesignDefinePane extends AbstractDataModify { cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background"))).weight(LEFT_WEIGHT), cell(backgroundPane).weight(RIGHT_WEIGHT) ), - cell(displayReport), - cell(useParamsTemplate), - cell(fireAfterEditor), + row(cell(displayReport)), + row(cell(useParamsTemplate)), + row(cell(fireAfterEditor)), row( cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Display_Position"))).weight(LEFT_WEIGHT), cell(hAlignmentPane).weight(RIGHT_WEIGHT)