diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java index 7fa3a7d058..3bb48ea05b 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java @@ -187,6 +187,8 @@ public class FineLightIconSet extends AbstractIconSet { new SvgIconSource("tool_more_hover", "com/fine/theme/icon/toolbar/more_hover.svg"), new SvgIconSource("tool_config", "com/fine/theme/icon/toolbar/config.svg", true), new SvgIconSource("add_popup", "com/fine/theme/icon/toolbar/add_popup.svg", true), + new SvgIconSource("bracket", "com/fine/theme/icon/toolbar/bracket.svg", true), + new SvgIconSource("unBracket", "com/fine/theme/icon/toolbar/unBracket.svg", true), // 参数面板 new SvgIconSource("param_edit", "com/fine/theme/icon/param/edit.svg", true, 24), diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java b/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java index 058416fa15..b541811f8f 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java @@ -3,7 +3,9 @@ package com.fine.theme.utils; import com.fine.theme.light.ui.CollapsibleScrollBarLayerUI; import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.design.border.FineBorderFactory; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ilable.UILabel; import com.fr.stable.os.OperatingSystem; import com.fr.value.AtomicClearableLazyValue; @@ -23,6 +25,8 @@ import java.awt.geom.Path2D; import java.awt.geom.RoundRectangle2D; import java.lang.reflect.Field; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; import static com.fine.theme.light.ui.FineButtonUI.isLeftRoundButton; import static com.formdev.flatlaf.util.UIScale.scale; @@ -380,6 +384,21 @@ public class FineUIUtils { FineUIStyle.setStyle(label, FineUIStyle.LABEL_BOLD); } + /** + * 面板元素头部添加小标题 + * + * @param component 面板元素 + * @param title 标题文本 + * @return 包装面板 + */ + public static Component wrapComponentWithTitle(Component component, String title) { + UILabel label = new UILabel(title); + wrapBoldLabelWithUnderline(label); + return column(LayoutConstants.VERTICAL_GAP, + cell(label), cell(component) + ).getComponent(); + } + /** * 基于组件创建一个UIScrollPane的装饰层,内部的ScrollPane仅当悬浮时显示滚动条 * diff --git a/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java b/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java index 82c8ec340f..a6dc6aa107 100644 --- a/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java @@ -1,7 +1,12 @@ package com.fr.design.condition; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseFormula; -import com.fr.base.BaseUtils; import com.fr.data.DataConstants; import com.fr.data.condition.CommonCondition; import com.fr.data.condition.FormulaCondition; @@ -9,6 +14,8 @@ import com.fr.data.condition.JoinCondition; import com.fr.data.condition.ListCondition; import com.fr.data.condition.ObjectCondition; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.border.FineBorderFactory; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.formula.FormulaFactory; @@ -20,7 +27,6 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.scrollruler.ModLineBorder; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; @@ -46,6 +52,11 @@ import java.util.ArrayList; import java.util.Enumeration; 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.flex; +import static com.fine.swing.ui.layout.Layouts.row; + /** * peter: LiteCondition Pane. */ @@ -60,6 +71,7 @@ public abstract class LiteConditionPane extends BasicBeanPa private JPanel conditionCardPane; protected BasicBeanPane defaultConditionPane; // card2 + private UILabel conditionTitleLabel; private UITextArea formulaTextArea; private UIButton modifyButton; private UIButton addButton; @@ -71,10 +83,6 @@ public abstract class LiteConditionPane extends BasicBeanPa private UIButton moveDownButton; private UIButton bracketButton; private UIButton unBracketButton; - private static final int DOWN_PADDING = 4; - private static final int STRUT_ONE = 35; - private static final int STRUT_TWO = 4; - private static final int ADD_CONTROL_PANE_PADDING_RIGHT = -5; private ActionListener actionListener1 = new ActionListener() { @@ -407,74 +415,82 @@ public abstract class LiteConditionPane extends BasicBeanPa protected abstract VariableResolver variableResolver4FormulaPane(); protected void initComponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setLayout(new BorderLayout(0, FineUIScale.scale(10))); // north initNorth(); //center - JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + JPanel centerPane = new JPanel(new BorderLayout(0, FineUIScale.scale(10))); this.add(centerPane, BorderLayout.CENTER); - centerPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - - // Control - JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - centerPane.add(controlPane, BorderLayout.NORTH); - // controlPane.setLayout(FRGUIPaneFactory.createBorderLayout()); // conditionCardPane - initConditionCardPane(controlPane); + initConditionCardPane(); + centerPane.add(conditionCardPane, BorderLayout.NORTH); - // addControlPane, contains or,and Radio, add,modify Button - initControlPane(controlPane); + // northButtonPane, contains or,and Radio, add,modify Button + JPanel northButtonPane = initNorthButtonPane(); // Preview - JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - centerPane.add(previewPane, BorderLayout.CENTER); - previewPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 2, 0)); - - - // conTreeScrollPane.setPreferredSize(new Dimension(400, 125)); - previewPane.add(iniTreeScrollPane(), BorderLayout.CENTER); + JPanel buttonPane = initButtonPane(); + JScrollPane treeScrollPane = iniTreeScrollPane(); + // 滚动面板不能直接加入row-col布局,需设定宽高 + treeScrollPane.setPreferredSize(FineUIScale.scale(new Dimension(600, 250))); + JPanel previewPane = column( + cell(northButtonPane), + row( + cell(treeScrollPane).weight(0.75), cell(buttonPane).weight(0.25) + ) + ).with(it -> { + it.setBorder(new FineRoundBorder()); + it.setOpaque(true); + it.setBackground(FlatUIUtils.getUIColor("fill.normal", Color.WHITE)); + }).getComponent(); conditionsTree.addTreeSelectionListener(treeSelectionListener); - JPanel buttonPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); - previewPane.add(GUICoreUtils.createBorderPane(buttonPane, BorderLayout.NORTH), BorderLayout.EAST); - initButtonPane(buttonPane); + centerPane.add(previewPane, BorderLayout.CENTER); // peter:必须要检查Enabled. checkButtonEnabledForList(); } - private void initButtonPane(JPanel buttonPane) { + private JPanel initButtonPane() { removeButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove")); - buttonPane.add(removeButton); - removeButton.setIcon(BaseUtils.readIcon("com/fr/base/images/cell/control/remove.png")); + removeButton.setIcon(new LazyIcon("remove")); + removeButton.setDisabledIcon(new LazyIcon("remove").disabled()); removeButton.setEnabled(false); removeButton.addActionListener(actionListener3); moveUpButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Move_Up")); - buttonPane.add(moveUpButton); - moveUpButton.setIcon(BaseUtils.readIcon("com/fr/design/images/control/up.png")); + moveUpButton.setIcon(new LazyIcon("move_up")); + moveUpButton.setDisabledIcon(new LazyIcon("move_up").disabled()); moveUpButton.addActionListener(actionListener4); moveDownButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Move_Down")); - buttonPane.add(moveDownButton); - moveDownButton.setIcon(BaseUtils.readIcon("com/fr/design/images/control/down.png")); + moveDownButton.setIcon(new LazyIcon("move_down")); + moveDownButton.setDisabledIcon(new LazyIcon("move_down").disabled()); moveDownButton.addActionListener(actionListener5); // peter:加括号 bracketButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ConditionB_Add_bracket")); - buttonPane.add(bracketButton); - bracketButton.setIcon(BaseUtils.readIcon("com/fr/design/images/condition/bracket.png")); + bracketButton.setIcon(new LazyIcon("bracket")); + bracketButton.setDisabledIcon(new LazyIcon("bracket").disabled()); bracketButton.addActionListener(actionListener6); // peter:去掉括号 unBracketButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ConditionB_Remove_bracket")); - buttonPane.add(unBracketButton); - unBracketButton.setIcon(BaseUtils.readIcon("com/fr/design/images/condition/unBracket.png")); + unBracketButton.setIcon(new LazyIcon("unBracket")); + unBracketButton.setDisabledIcon(new LazyIcon("unBracket").disabled()); unBracketButton.addActionListener(actionListener7); + + return column(LayoutConstants.VERTICAL_GAP, + cell(removeButton), + cell(moveUpButton), + cell(moveDownButton), + cell(bracketButton), + cell(unBracketButton) + ).with(it -> it.setBorder(new ScaledEmptyBorder(5, 5, 0, 5))).getComponent(); } private JScrollPane iniTreeScrollPane() { @@ -484,26 +500,28 @@ public abstract class LiteConditionPane extends BasicBeanPa conditionsTree.setSelectionModel(new ContinuousTreeSelectionModel()); conditionsTree.addTreeExpansionListener(treeExpansionListener); conditionsTree.setShowsRootHandles(true); - return new JScrollPane(conditionsTree); + conditionsTree.setBackground(FlatUIUtils.getUIColor("fill.normal", Color.WHITE)); + JScrollPane scrollPane = new JScrollPane(conditionsTree); + scrollPane.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, + FineUIUtils.getUIColor("Label.borderColor", "defaultBorderColor"))); + return scrollPane; } private void initNorth() { - conditonTypePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.add(conditonTypePane, BorderLayout.NORTH); - conditonTypePane.setBorder(new ModLineBorder(ModLineBorder.BOTTOM)); - + conditionTitleLabel = new UILabel(); + FineUIUtils.wrapBoldLabelWithUnderline(conditionTitleLabel); UILabel conditionTypeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Type") + ":"); - conditonTypePane.add(conditionTypeLabel, BorderLayout.WEST); - conditionTypeLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, DOWN_PADDING, 0)); - - JPanel northPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2); - conditonTypePane.add(northPane, BorderLayout.CENTER); - northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, DOWN_PADDING, 0)); - northPane.add(GUICoreUtils.createFlowPane(commonRadioButton, FlowLayout.CENTER)); - northPane.add(GUICoreUtils.createFlowPane(formulaRadioButton, FlowLayout.CENTER)); commonRadioButton.addActionListener(radioActionListener); formulaRadioButton.addActionListener(radioActionListener); + conditonTypePane = row(10, + cell(conditionTypeLabel).weight(0.15), cell(commonRadioButton), cell(formulaRadioButton), flex() + ).getComponent(); + JPanel conditionWrapperPane = column(10, + cell(conditionTitleLabel), + cell(conditonTypePane) + ).getComponent(); + this.add(conditionWrapperPane, BorderLayout.NORTH); ButtonGroup mainBg = new ButtonGroup(); mainBg.add(commonRadioButton); @@ -511,74 +529,58 @@ public abstract class LiteConditionPane extends BasicBeanPa commonRadioButton.setSelected(true); } - private void initConditionCardPane(JPanel controlPane) { + private void initConditionCardPane() { conditionCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); - controlPane.add(conditionCardPane, BorderLayout.CENTER); conditionCardPane.setLayout(new CardLayout()); - conditionCardPane.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0)); - // defaultConditionPane conditionCardPane.add(defaultConditionPane = createUnFormulaConditionPane(), "DEFAULT"); - // formulaConditionPane JPanel formulaConditionPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); conditionCardPane.add(formulaConditionPane, "FORMULA"); - // formulaConditionPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - - // formulaPane - JPanel formulaPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - // 95106 公式区域限定宽高, 显示两行即可, 在新窗口编辑. - formulaPane.setPreferredSize(new Dimension(450, 40)); - formulaConditionPane.add(formulaPane, BorderLayout.CENTER); - formulaPane.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 2)); - formulaPane.add(GUICoreUtils.createBorderPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Lite_Condition_Formula") + "="), BorderLayout.NORTH), BorderLayout.WEST); formulaTextArea = new UITextArea(); - formulaPane.add(new JScrollPane(formulaTextArea), BorderLayout.CENTER); UIButton editFormulaButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Lite_Condition_Define")); - formulaPane.add(GUICoreUtils.createBorderPane(editFormulaButton, BorderLayout.NORTH), BorderLayout.EAST); + formulaConditionPane.add(row(10, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Lite_Condition_Formula") + " =")), + cell(formulaTextArea).weight(2), + cell(editFormulaButton)) + .getComponent()); editFormulaButton.addActionListener(actionListener1); + applyCardsPane(); } - private void initControlPane(JPanel controlPane) { - JPanel addControlPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); - addControlPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, ADD_CONTROL_PANE_PADDING_RIGHT)); - JPanel splitPane = new JPanel(); - splitPane.setBorder(new ModLineBorder(ModLineBorder.TOP)); - - JPanel addControlPaneWrapper = new JPanel(new BorderLayout()); - addControlPaneWrapper.add(addControlPane, BorderLayout.CENTER); - addControlPaneWrapper.add(splitPane, BorderLayout.NORTH); - controlPane.add(addControlPaneWrapper, BorderLayout.SOUTH); - + private JPanel initNorthButtonPane() { ButtonGroup bg = new ButtonGroup(); bg.add(andRadioButton); bg.add(orRadioButton); - andRadioButton.setSelected(true); - JPanel radioPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2); - addControlPane.add(radioPane); - radioPane.add(andRadioButton); - radioPane.add(orRadioButton); - - addControlPane.add(Box.createHorizontalStrut(STRUT_ONE)); - - addButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add"), BaseUtils.readIcon("com/fr/base/images/cell/control/add.png")); + addButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add"), new LazyIcon("add")); + addButton.setDisabledIcon(new LazyIcon("add").disabled()); addButton.setMnemonic('A'); - addControlPane.add(addButton); addButton.addActionListener(actionListener2); - - addControlPane.add(Box.createHorizontalStrut(STRUT_TWO)); - - modifyButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Modify"), BaseUtils.readIcon("com/fr/base/images/cell/control/rename.png")); + modifyButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Modify"), new LazyIcon("edit")); + modifyButton.setDisabledIcon(new LazyIcon("edit").disabled()); modifyButton.setMnemonic('M'); - addControlPane.add(modifyButton); modifyButton.addActionListener(actionListener8); - - // peter:当鼠标进入修改按钮的时候,如果是ListConditon内容编辑区域不可编辑 + // peter:当鼠标进入修改按钮的时候,如果是ListCondition内容编辑区域不可编辑 modifyButton.addMouseListener(mouseAdapter); + + return row( + row(5, + cell(andRadioButton).weight(0.5), + cell(orRadioButton).weight(0.5) + ).weight(0.25), + flex(0.5), + row(5, + cell(addButton).weight(0.5), + cell(modifyButton).weight(0.5) + ).with(it -> it.setBorder(new ScaledEmptyBorder(0, 8, 0, 0))).weight(0.25) + ).with(it -> it.setBorder(BorderFactory.createCompoundBorder( + FineBorderFactory.createDefaultUnderlineBorder(), + new ScaledEmptyBorder(5, 5, 5, 5)) + )).getComponent(); } @@ -662,10 +664,10 @@ public abstract class LiteConditionPane extends BasicBeanPa private void applyCardsPane() { CardLayout cl = (CardLayout) (conditionCardPane.getLayout()); if (this.commonRadioButton.isSelected()) { - this.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Lite_Condition_Common_Condition"), null)); + conditionTitleLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Lite_Condition_Common_Condition")); cl.show(conditionCardPane, "DEFAULT"); } else { - this.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Lite_Condition_Formula_Condition"), null)); + conditionTitleLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Lite_Condition_Formula_Condition")); cl.show(conditionCardPane, "FORMULA"); } } diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index 9caae7461a..6cfb221ca1 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -749,9 +749,9 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { public BasicDialog showLargeWindow(Window window, DialogActionListener l) { int width = 900; - int height = 900; - BasicDialog basicDialog = super.showWindowWithCustomSize(window, l, new Dimension(width, height)); - basicDialog.setMinimumSize(new Dimension(width, height)); + int height = 640; + BasicDialog basicDialog = super.showWindowWithCustomSize(window, l, FineUIScale.scale(new Dimension(width, height))); + basicDialog.setMinimumSize(FineUIScale.scale(new Dimension(width, height))); basicDialog.setResizable(true); return basicDialog; } diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/bracket.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/bracket.svg new file mode 100644 index 0000000000..fd415fcb5f --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/bracket.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/bracket_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/bracket_disable.svg new file mode 100644 index 0000000000..ac60d55fe8 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/bracket_disable.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/unBracket.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/unBracket.svg new file mode 100644 index 0000000000..6bb05f7c89 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/unBracket.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/unBracket_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/unBracket_disable.svg new file mode 100644 index 0000000000..f9b651d80c --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/unBracket_disable.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java index e1b8a676ad..5fe59ee85f 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java @@ -1,7 +1,7 @@ package com.fr.design.dscolumn; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseFormula; -import com.fr.design.border.UITitledBorder; import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; @@ -16,37 +16,31 @@ 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.design.sort.celldscolumn.CellDSColumnSortPane; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.report.cell.CellElement; import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.cellattr.CellExpandAttr; import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.cellattr.core.group.SelectCount; -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.SwingUtilities; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Font; 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.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.BOTTOM; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.SPECIFY; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.TOP; public class DSColumnAdvancedPane extends BasicPane { - private static final String InsetText = " "; private SortPane sortPane; private SelectCountPane selectCountPane; private ValuePane valuePane; @@ -66,78 +60,55 @@ public class DSColumnAdvancedPane extends BasicPane { } private void initScrollPane() { - ScrollPane scrollPane = new ScrollPane(contentPane); + this.setLayout(new BorderLayout()); + UIScrollPane scrollPane = new UIScrollPane(contentPane); this.add(scrollPane); } private void initContentPane(int setting) { contentPane = new JPanel(); - contentPane.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); contentPane.setLayout(FRGUIPaneFactory.createBorderLayout()); sortPane = new SortPane(); - sortPane.setBorder(UITitledBorder.createBorderWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sort_Sort_Order"))); - if (setting > DSColumnPane.SETTING_DSRELATED) { selectCountPane = new SelectCountPane(); - selectCountPane.setBorder(UITitledBorder.createBorderWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Results_Filter"))); } - valuePane = new ValuePane(); - valuePane.setBorder(UITitledBorder.createBorderWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Custom_Data_Appearance"))); - JPanel extendablePane = null; + Component extendablePane = null; if (setting > DSColumnPane.SETTING_DSRELATED) { - // extendableDirectionPane - JPanel extendableDirectionPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - - extendableDirectionPane.add(horizontalExtendableCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ExpandD_Horizontal_Extendable"))); - extendableDirectionPane.add(verticalExtendableCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ExpandD_Vertical_Extendable"))); - - extendablePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ExpandD_Expandable")); - extendablePane.setLayout(new BorderLayout()); - extendablePane.add(extendableDirectionPane, BorderLayout.CENTER); + horizontalExtendableCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ExpandD_Horizontal_Extendable")); + verticalExtendableCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ExpandD_Vertical_Extendable")); + extendablePane = row(10, + cell(horizontalExtendableCheckBox), cell(verticalExtendableCheckBox) + ).getComponent(); } - JPanel multiNumPane = null; + Component multiNumPane = null; if (setting > DSColumnPane.SETTING_DSRELATED) { - multiNumPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Fill_Blank_Data")); useMultiplyNumCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Column_Multiple")); - multiNumPane.add(useMultiplyNumCheckBox); - multiNumPane.add(new UILabel(InsetText)); - multiNumSpinner = new UISpinner(1, 10000, 1, 1); - multiNumPane.add(multiNumSpinner); - - useMultiplyNumCheckBox.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - checkButtonEnabled(); - } - }); + multiNumPane = row(10, + cell(useMultiplyNumCheckBox), cell(multiNumSpinner) + ).getComponent(); + useMultiplyNumCheckBox.addActionListener(e -> checkButtonEnabled()); } - - Component[][] components = null; + // 基于row-column布局的特性,null面板不渲染 if (setting > DSColumnPane.SETTING_DSRELATED) { - components = new Component[][]{ - {sortPane}, - {selectCountPane}, - {valuePane}, - {extendablePane}, - {multiNumPane} - }; + contentPane.add(column(20, + cell(wrapComponentWithTitle(sortPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sort_Sort_Order"))), + cell(wrapComponentWithTitle(selectCountPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Results_Filter"))), + cell(wrapComponentWithTitle(valuePane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Custom_Data_Appearance"))), + cell(wrapComponentWithTitle(extendablePane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ExpandD_Expandable"))), + cell(wrapComponentWithTitle(multiNumPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Fill_Blank_Data"))) + ).getComponent()); } else { - components = new Component[][]{ - {sortPane}, - {valuePane}, - }; + contentPane.add(column(20, + cell(wrapComponentWithTitle(sortPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sort_Sort_Order"))), + cell(wrapComponentWithTitle(valuePane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Custom_Data_Appearance"))) + ).getComponent()); } - - double[] rowSize = {TableLayout.PREFERRED, TableLayout.PREFERRED, - TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED}; - double[] columnSize = {TableLayout.FILL}; - - contentPane.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize), BorderLayout.CENTER); + contentPane.setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); } @Override @@ -234,21 +205,8 @@ public class DSColumnAdvancedPane extends BasicPane { } } - private static class ScrollPane extends UIScrollPane { - ScrollPane(Component component) { - super(component); - this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - } - - @Override - public Dimension getPreferredSize() { - return new Dimension(DSColumnPane.DEFAULT_DIMENSION.width - 20, DSColumnPane.DEFAULT_DIMENSION.height - 100); - } - } - private static class SortPane extends CellDSColumnSortPane { SortPane() { - this.setLayout(new FlowLayout(FlowLayout.LEFT)); } protected boolean needSortHeaderPane() { @@ -259,7 +217,6 @@ public class DSColumnAdvancedPane extends BasicPane { private static class SelectCountPane extends JPanel { CellElement cellElement; - // private Comparator sortComparator; private UIComboBox selectCountComboBox; private JPanel selectCountCardPane; private UITextField serialTextField; @@ -299,25 +256,24 @@ public class DSColumnAdvancedPane extends BasicPane { }); selectCountCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); - this.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(InsetText), selectCountComboBox, - new UILabel(InsetText), selectCountCardPane}, FlowLayout.LEFT), BorderLayout.WEST); -// selectCountCardPane.setLayout(new CardLayout()); - + this.add(row(10, + cell(selectCountComboBox),cell(selectCountCardPane) + ).getComponent()); //not define pane + JPanel undefinedPane = row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Undefined")))).getComponent(); - JPanel undefinedPane = GUICoreUtils.createFlowPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Undefined")), FlowLayout.LEFT); topFormulaPane = new JFormulaField("-1"); bottomFormulaPane = new JFormulaField("-1"); serialTextField = new UITextField(18); - JPanel oddPane = GUICoreUtils.createFlowPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Result_Serial_Number_Start_From_1") - + " " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Odd_Selected_(1,3,5...)")), FlowLayout.LEFT); - JPanel evenPane = GUICoreUtils.createFlowPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Result_Serial_Number_Start_From_1") - + " " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Even_Selected_(2,4,6...)")), FlowLayout.LEFT); - JPanel specifyPane = GUICoreUtils.createFlowPane(new JComponent[]{ - serialTextField, new UILabel( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_DSColumn_Result_Group_Format", "1,2-3,5,8", "$__count__") - ) - }, FlowLayout.LEFT); + + JPanel oddPane = row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Result_Serial_Number_Start_From_1") + + " " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Odd_Selected_(1,3,5...)")))).getComponent(); + JPanel evenPane = row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Result_Serial_Number_Start_From_1") + + " " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Even_Selected_(2,4,6...)")))).getComponent(); + JPanel specifyPane = row(10, + cell(serialTextField), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_DSColumn_Result_Group_Format", "1,2-3,5,8", "$__count__"))) + ).getComponent(); serialTextField.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Format") + ":=JOINARRAY(GREPARRAY(RANGE($__count__), item!=4), \",\")"); selectCountCardPane.add(undefinedPane, "UNDEFINE"); selectCountCardPane.add(topFormulaPane, "TOP"); @@ -337,7 +293,7 @@ public class DSColumnAdvancedPane extends BasicPane { this.cellElement = cellElement; Object value = cellElement.getValue(); - if (value == null || !(value instanceof DSColumn)) { + if (!(value instanceof DSColumn)) { return; } DSColumn dSColumn = (DSColumn) (cellElement.getValue()); @@ -362,7 +318,7 @@ public class DSColumnAdvancedPane extends BasicPane { return; } Object value = cellElement.getValue(); - if (value == null || !(value instanceof DSColumn)) { + if (!(value instanceof DSColumn)) { return; } DSColumn dSColumn = (DSColumn) (cellElement.getValue()); @@ -394,19 +350,18 @@ public class DSColumnAdvancedPane extends BasicPane { public JFormulaField(String defaultValue) { this.defaultValue = defaultValue; - this.setLayout(FRGUIPaneFactory.createBoxFlowLayout()); + this.setLayout(new BorderLayout()); UILabel bottomLabel = new UILabel("="); - bottomLabel.setFont(new Font("Dialog", Font.BOLD, 12)); - this.add(bottomLabel); formulaTextField = new UITextField(24); - this.add(formulaTextField); formulaTextField.setText(defaultValue); - UIButton bottomFrmulaButton = new UIButton("..."); - this.add(bottomFrmulaButton); - bottomFrmulaButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula") + "..."); - bottomFrmulaButton.setPreferredSize(new Dimension(25, formulaTextField.getPreferredSize().height)); - bottomFrmulaButton.addActionListener(formulaButtonActionListener); + UIButton bottomFormulaButton = new UIButton("..."); + bottomFormulaButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula") + "..."); + bottomFormulaButton.addActionListener(formulaButtonActionListener); + + this.add(row(10, + cell(bottomLabel), cell(formulaTextField), cell(bottomFormulaButton) + ).getComponent()); } public void populate(String formulaContent) { @@ -438,7 +393,7 @@ public class DSColumnAdvancedPane extends BasicPane { return; } Object value = cellElement.getValue(); - if (value == null || !(value instanceof DSColumn)) { + if (!(value instanceof DSColumn)) { return; } DSColumn dsColumn = (DSColumn) value; @@ -465,11 +420,12 @@ public class DSColumnAdvancedPane extends BasicPane { private JFormulaField formulaField; public ValuePane() { - this.setLayout(FRGUIPaneFactory.createBoxFlowLayout()); - - this.add(new UILabel(InsetText + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Value") + ":")); - this.add(Box.createHorizontalStrut(2)); - this.add((formulaField = new JFormulaField("$$$"))); + this.setLayout(new BorderLayout()); + formulaField = new JFormulaField("$$$"); + this.add(row(10, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Value") + ":")), + cell(formulaField) + ).getComponent()); } public void populate(CellElement cellElement) { @@ -478,7 +434,7 @@ public class DSColumnAdvancedPane extends BasicPane { } Object value = cellElement.getValue(); - if (value == null || !(value instanceof DSColumn)) { + if (!(value instanceof DSColumn)) { return; } DSColumn dSColumn = (DSColumn) value; @@ -497,7 +453,7 @@ public class DSColumnAdvancedPane extends BasicPane { return; } Object value = cellElement.getValue(); - if (value == null || !(value instanceof DSColumn)) { + if (!(value instanceof DSColumn)) { return; } DSColumn dSColumn = (DSColumn) (cellElement.getValue()); @@ -508,10 +464,6 @@ public class DSColumnAdvancedPane extends BasicPane { } private void checkButtonEnabled() { - if (useMultiplyNumCheckBox.isSelected()) { - multiNumSpinner.setEnabled(true); - } else { - multiNumSpinner.setEnabled(false); - } + multiNumSpinner.setEnabled(useMultiplyNumCheckBox.isSelected()); } } diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnBasicPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnBasicPane.java index b2e15604d0..a1b28bea88 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnBasicPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnBasicPane.java @@ -1,25 +1,23 @@ package com.fr.design.dscolumn; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.data.TableDataSource; import com.fr.design.dialog.BasicPane; import com.fr.design.expand.ConditionParentPane; import com.fr.design.expand.ExpandDirectionPane; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.ElementCasePane; -import com.fr.design.utils.gui.GUICoreUtils; - import com.fr.report.cell.CellElement; import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.cellattr.CellExpandAttr; -import javax.swing.BorderFactory; -import java.awt.BorderLayout; -import java.awt.Component; 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.theme.utils.FineUIUtils.wrapComponentWithTitle; + public class DSColumnBasicPane extends BasicPane { private SelectedDataColumnPane selectDataColumnPane; @@ -57,7 +55,7 @@ public class DSColumnBasicPane extends BasicPane { public DSColumnBasicPane(int setting) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); + this.setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); if (setting > DSColumnPane.SETTING_DSRELATED) { selectDataColumnPane = new SelectedDataColumnPane(); @@ -65,43 +63,30 @@ public class DSColumnBasicPane extends BasicPane { selectDataColumnPane = new SelectedConfirmedDataColumnPane(); } - selectDataColumnPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Select_Data_Column"), null)); - if (setting > DSColumnPane.SETTING_DSRELATED) { conditionParentPane = new ConditionParentPane(); - conditionParentPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ParentCell_Setting"), null)); } resultSetGroupPane = new ResultSetGroupPopUpPane(setting > DSColumnPane.SETTING_DSRELATED); - resultSetGroupPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Setting"), null)); if (setting > DSColumnPane.SETTING_DSRELATED) { expandDirectionPane = new ExpandDirectionPane(); - expandDirectionPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ExpandD_Expand_Direction"), null)); } - double[] rowSize = {TableLayout.PREFERRED, TableLayout.PREFERRED, - TableLayout.PREFERRED, TableLayout.PREFERRED}; - double[] columnSize = {TableLayout.FILL}; - - Component[][] components = null; - if (setting > DSColumnPane.SETTING_DSRELATED) { - components = new Component[][]{ - {selectDataColumnPane}, - {conditionParentPane}, - {resultSetGroupPane}, - {expandDirectionPane} - }; + this.add(column(20, + cell(wrapComponentWithTitle(selectDataColumnPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Select_Data_Column"))), + cell(wrapComponentWithTitle(conditionParentPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ParentCell_Setting"))), + cell(wrapComponentWithTitle(resultSetGroupPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Setting"))), + cell(wrapComponentWithTitle(expandDirectionPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ExpandD_Expand_Direction"))) + ).getComponent()); } else { - components = new Component[][]{ - {selectDataColumnPane}, - {resultSetGroupPane}, - }; + this.add(column(20, + cell(wrapComponentWithTitle(selectDataColumnPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Select_Data_Column"))), + cell(wrapComponentWithTitle(resultSetGroupPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Setting"))) + ).getComponent()); } - this.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize), BorderLayout.CENTER); - this.resultSetGroupPane.addListeners(summaryDirectionActionlistener, othergroupDirectionActionlistener, sdcupdateActionlistener); } diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnConditionsPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnConditionsPane.java index 4d6a1e62ac..81be2bc66d 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnConditionsPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnConditionsPane.java @@ -1,21 +1,22 @@ package com.fr.design.dscolumn; +import com.fine.swing.ui.layout.Column; +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.data.TableDataSource; import com.fr.design.condition.DSColumnLiteConditionPane; import com.fr.design.condition.DSColumnSimpleLiteConditionPane; import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.data.Condition; import com.fr.report.cell.CellElement; import com.fr.report.cell.cellattr.core.group.DSColumn; -import javax.swing.JPanel; import java.awt.BorderLayout; -import java.awt.FlowLayout; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; public class DSColumnConditionsPane extends BasicPane { //peter: Lite Condition. @@ -24,15 +25,24 @@ public class DSColumnConditionsPane extends BasicPane { //marks:是否继承父格条件 private UICheckBox reselectExpandCheckBox; //marks:作为布局的空字符串 - private static final String INSET_TEXT = " "; public DSColumnConditionsPane() { this(DSColumnPane.SETTING_ALL); } public DSColumnConditionsPane(int setting) { - this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); + this.setLayout(new BorderLayout()); + Column column = new Column(); + column.setSpacing(10); + if (setting > DSColumnPane.SETTING_DSRELATED) { + //alex:ReSelect + reselectExpandCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Extend_The_Conditions_of_Father_Cell(Applied_To_The_Data_Contains_Other_Data)"), false); + reselectExpandCheckBox.setSelected(true); + column.add(FineUIUtils.wrapComponentWithTitle( + row(cell(reselectExpandCheckBox)).getComponent(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_The_Conditions_Of_Father_Cell"))); + } if (setting > DSColumnPane.SETTING_DSRELATED) { liteConditionPane = new DSColumnLiteConditionPane() { protected boolean isNeedDoWithCondition(Condition liteCondition) { @@ -42,22 +52,10 @@ public class DSColumnConditionsPane extends BasicPane { } else { liteConditionPane = new DSColumnSimpleLiteConditionPane(); } - this.add(liteConditionPane, BorderLayout.CENTER); + column.add(liteConditionPane); + column.setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); + this.add(column); - if (setting > DSColumnPane.SETTING_DSRELATED) { - //alex:ReSelect - JPanel pane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); -// pane.setLayout(new BoxLayout(pane, BoxLayout.X_AXIS)); - pane.add(new UILabel(INSET_TEXT)); - - reselectExpandCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Extend_The_Conditions_of_Father_Cell(Applied_To_The_Data_Contains_Other_Data)"), false); - pane.add(reselectExpandCheckBox); - reselectExpandCheckBox.setSelected(true); - - JPanel reSelectPane = GUICoreUtils.createFlowPane(pane, FlowLayout.LEFT); - this.add(reSelectPane, BorderLayout.NORTH); - reSelectPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_The_Conditions_Of_Father_Cell"), null)); - } } @Override @@ -70,7 +68,7 @@ public class DSColumnConditionsPane extends BasicPane { return; } Object value = cellElement.getValue(); - if (value == null || !(value instanceof DSColumn)) { + if (!(value instanceof DSColumn)) { return; } DSColumn linearDSColumn = (DSColumn) value; @@ -90,7 +88,7 @@ public class DSColumnConditionsPane extends BasicPane { return; } Object value = cellElement.getValue(); - if (value == null || !(value instanceof DSColumn)) { + if (!(value instanceof DSColumn)) { return; } DSColumn linearDSColumn = (DSColumn) value; diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/ResultSetGroupPopUpPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/ResultSetGroupPopUpPane.java index a37dcf01e2..7058da827e 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/ResultSetGroupPopUpPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/ResultSetGroupPopUpPane.java @@ -1,37 +1,38 @@ package com.fr.design.dscolumn; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIRadioButton; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.icombobox.FunctionComboBox; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; import com.fr.report.cell.TemplateCellElement; -import com.fr.report.cell.cellattr.core.group.*; -import com.fr.stable.StringUtils; import com.fr.design.utils.gui.GUICoreUtils; - -import javax.swing.*; -import java.awt.*; +import com.fr.report.cell.cellattr.core.group.CustomGrouper; +import com.fr.report.cell.cellattr.core.group.DSColumn; +import com.fr.report.cell.cellattr.core.group.FunctionGrouper; +import com.fr.report.cell.cellattr.core.group.RecordGrouper; +import com.fr.report.cell.cellattr.core.group.SummaryGrouper; + +import javax.swing.ButtonGroup; +import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +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 ResultSetGroupPopUpPane extends ResultSetGroupPane { - private UIRadioButton groupRadioButton; private UIButton advancedButton; private UIRadioButton listRadioButton; private UIRadioButton summaryRadioButton; private FunctionComboBox functionComboBox; - - private String InsertText = StringUtils.BLANK; - public ResultSetGroupPopUpPane() { this(true); } @@ -43,7 +44,7 @@ public class ResultSetGroupPopUpPane extends ResultSetGroupPane { } public void initComponents(boolean isGroup) { - this.setLayout(FRGUIPaneFactory.create1ColumnGridLayout()); + this.setLayout(new BorderLayout()); // 分组 groupRadioButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Report_Bind_Column_Group(Merger_The_Items_Which_Have_The_Same_Value_in_Column)")); @@ -56,22 +57,25 @@ public class ResultSetGroupPopUpPane extends ResultSetGroupPane { }); advancedButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom")); advancedButton.addActionListener(groupAdvancedListener); - this.add(GUICoreUtils.createFlowPane( - new JComponent[]{new UILabel(InsertText), groupRadioButton, groupComboBox, advancedButton}, FlowLayout.LEFT)); // 列表 listRadioButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Report_Bind_Column_Select(Regardless_of_Having_the_Same_Value,Display_All_Item_in_Column)")); listRadioButton.addActionListener(checkEnabledActionListener); - this.add(GUICoreUtils.createFlowPane( - new JComponent[]{new UILabel(InsertText), listRadioButton}, FlowLayout.LEFT)); // 汇总 summaryRadioButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Report_Bind_Column_Summary(Including_SUM_,_AVERAGE_,_MAX_,_MIN_And_So_On)"), true); summaryRadioButton.addActionListener(checkEnabledActionListener); functionComboBox = new FunctionComboBox(GUICoreUtils.getFunctionArray()); - this.add(GUICoreUtils.createFlowPane( - new JComponent[]{new UILabel(InsertText), summaryRadioButton, functionComboBox}, FlowLayout.LEFT)); + this.add(column(LayoutConstants.VERTICAL_GAP, + row(10, + cell(groupRadioButton), cell(groupComboBox), cell(advancedButton) + ), + cell(listRadioButton), + row(10, + cell(summaryRadioButton), cell(functionComboBox) + ) + ).getComponent()); ButtonGroup resultSetGroupButtonGroup = new ButtonGroup(); resultSetGroupButtonGroup.add(groupRadioButton); @@ -142,7 +146,6 @@ public class ResultSetGroupPopUpPane extends ResultSetGroupPane { SummaryGrouper summaryGrouper = new SummaryGrouper(); summaryGrouper.setFunction(functionComboBox.getFunction()); recordGrouper = summaryGrouper; - } else { } dSColumn.setGrouper(recordGrouper); diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java index 969946908d..eb86266368 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java @@ -1,6 +1,5 @@ package com.fr.design.dscolumn; -import com.fine.swing.ui.layout.Layouts; import com.fr.base.Parameter; import com.fr.data.SimpleDSColumn; import com.fr.data.TableDataSource; @@ -16,8 +15,6 @@ import com.fr.design.gui.icombobox.LazyComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itableeditorpane.ParameterTableModel; import com.fr.design.gui.itableeditorpane.UITableEditorPane; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.widget.FRWidgetFactory; @@ -29,9 +26,7 @@ import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; import javax.swing.DefaultComboBoxModel; -import javax.swing.JPanel; import java.awt.BorderLayout; -import java.awt.Component; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -43,6 +38,7 @@ import java.util.Objects; import java.util.regex.Pattern; 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; /** @@ -157,28 +153,21 @@ public class SelectedDataColumnPane extends BasicPane { }; columnNameComboBox.setEditable(true); - double p = TableLayout.PREFERRED; UILabel dsLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_TableData") + ":"); UILabel dcLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Data_Column") + ":"); - if (showParameterButton) { - dsLabel.setPreferredSize(new Dimension(200, 25)); - dcLabel.setPreferredSize(new Dimension(200, 25)); - } - if (showParameterButton) { - Component[][] comps = {{dsLabel, null, dcLabel}, {tableNameComboBox, paramButton, columnNameComboBox}}; - this.add(TableLayoutHelper.createTableLayoutPane(comps, new double[]{p, p}, new double[]{p, p, p})); - } else { - double f = TableLayout.FILL; - double[] columnSize = {p, f}; - double[] rowSize = {p, p}; - Component[][] components = new Component[][]{ - new Component[]{dsLabel, tableNameComboBox}, - new Component[]{dcLabel, columnNameComboBox} - }; - JPanel jPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - this.setLayout(new BorderLayout()); - this.add(jPanel, BorderLayout.CENTER); - } + paramButton.setVisible(showParameterButton); + this.setLayout(new BorderLayout()); + this.add(row(10, + row( + cell(dsLabel).weight(0.1), + cell(tableNameComboBox).weight(0.3) + ).weight(0.3), + cell(paramButton).weight(0.2), + row( + cell(dcLabel).weight(0.1), + cell(columnNameComboBox).weight(0.3) + ).weight(0.3) + ).getComponent()); } @@ -200,7 +189,7 @@ public class SelectedDataColumnPane extends BasicPane { UILabel dpLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Dynamic_Parameter")); UILabel dcLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Data_Column")); this.setLayout(new BorderLayout()); - this.add(Layouts.column(LayoutConstants.VERTICAL_GAP, + this.add(column(LayoutConstants.VERTICAL_GAP, row( cell(dsLabel).weight(1.2), cell(tableNameComboBox).weight(3) ), diff --git a/designer-realize/src/main/java/com/fr/design/expand/ConditionParentPane.java b/designer-realize/src/main/java/com/fr/design/expand/ConditionParentPane.java index 579a8efbcf..eeb04df332 100644 --- a/designer-realize/src/main/java/com/fr/design/expand/ConditionParentPane.java +++ b/designer-realize/src/main/java/com/fr/design/expand/ConditionParentPane.java @@ -1,19 +1,18 @@ package com.fr.design.expand; -import java.awt.FlowLayout; -import java.awt.event.ActionListener; - -import javax.swing.JComponent; import com.fr.design.gui.ilable.UILabel; -import javax.swing.JPanel; - -import com.fr.design.layout.FRGUIPaneFactory; - import com.fr.design.mainframe.ElementCasePane; import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.cellattr.CellExpandAttr; -import com.fr.design.utils.gui.GUICoreUtils; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.event.ActionListener; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; public class ConditionParentPane extends JPanel { private ParentPane leftParentPane; @@ -29,21 +28,20 @@ public class ConditionParentPane extends JPanel { public void initComponents(ActionListener listener) { - JPanel innerthis=FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - this.add(innerthis); - - - JPanel eastPane =FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); - innerthis.add(eastPane); - - eastPane.add(GUICoreUtils.createFlowPane(new JComponent[] { - new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Left_Parent") + ": "), - leftParentPane = new ParentPane(ParentPane.LEFT, listener) }, FlowLayout.LEFT)); - - eastPane.add(GUICoreUtils.createFlowPane( - new JComponent[] { - new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Up_Parent") + ": "), - upParentPane = new ParentPane(ParentPane.UP, listener) }, FlowLayout.LEFT)); + this.setLayout(new BorderLayout()); + leftParentPane = new ParentPane(ParentPane.LEFT, listener); + upParentPane = new ParentPane(ParentPane.UP, listener); + this.add(row(10, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Left_Parent") + ": ")).weight(0.1), + cell(leftParentPane).weight(0.3) + ).weight(0.3), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Up_Parent") + ": ")).weight(0.1), + cell(upParentPane).weight(0.3) + ).weight(0.3), + flex(0.2) + ).getComponent()); } public void putElementcase(ElementCasePane t){ leftParentPane.putElementcase(t); diff --git a/designer-realize/src/main/java/com/fr/design/expand/ExpandDirectionPane.java b/designer-realize/src/main/java/com/fr/design/expand/ExpandDirectionPane.java index 03a0c1d039..439447832c 100644 --- a/designer-realize/src/main/java/com/fr/design/expand/ExpandDirectionPane.java +++ b/designer-realize/src/main/java/com/fr/design/expand/ExpandDirectionPane.java @@ -1,18 +1,16 @@ package com.fr.design.expand; import com.fr.design.gui.ibutton.UIRadioButton; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.report.cell.cellattr.CellExpandAttr; import com.fr.stable.Constants; -import com.fr.stable.StringUtils; import javax.swing.ButtonGroup; import javax.swing.JPanel; -import java.awt.Component; -import java.awt.FlowLayout; -import java.awt.GridLayout; +import java.awt.BorderLayout; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + /** * * @editor zhou @@ -23,7 +21,6 @@ public class ExpandDirectionPane extends JPanel { private UIRadioButton t2bRadioButton; private UIRadioButton l2rRadioButton; private UIRadioButton noneRadioButton; - private String InsertText = StringUtils.BLANK; public ExpandDirectionPane() { super(); @@ -31,9 +28,7 @@ public class ExpandDirectionPane extends JPanel { } public void initComponents() { - this.setLayout(new GridLayout(1, 3)); - JPanel innerthis=FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); - this.add(innerthis); + this.setLayout(new BorderLayout()); t2bRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Top_To_Bottom")); l2rRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("FIne-Design_Report_Utils_Left_To_Right")); noneRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ExpandD_Not_Expand")); @@ -41,12 +36,9 @@ public class ExpandDirectionPane extends JPanel { bg.add(t2bRadioButton); bg.add(l2rRadioButton); bg.add(noneRadioButton); - innerthis.add(GUICoreUtils.createFlowPane(new Component[]{new UILabel(InsertText), t2bRadioButton}, - FlowLayout.LEFT)); - innerthis.add(GUICoreUtils.createFlowPane(new Component[]{new UILabel(InsertText), l2rRadioButton}, - FlowLayout.LEFT)); - innerthis.add(GUICoreUtils.createFlowPane(new Component[]{new UILabel(InsertText), noneRadioButton}, - FlowLayout.LEFT)); + this.add(row(10, + cell(t2bRadioButton), cell(l2rRadioButton), cell(noneRadioButton) + ).getComponent()); } public void populate(CellExpandAttr cellExpandAttr) {