From 5f2d8b7139c624c92d0ba3da37dd3a7fe38bd252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Wed, 27 Dec 2023 20:17:41 +0800 Subject: [PATCH 1/3] =?UTF-8?q?REPORT-111995=20=E4=B8=9C=E5=8C=BA=E4=B8=BB?= =?UTF-8?q?=E8=A6=81=E9=9D=A2=E6=9D=BF=E5=B8=83=E5=B1=80=E7=BF=BB=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fine/theme/light/ui/FineLightIconSet.java | 21 +- .../fr/design/constants/LayoutConstants.java | 10 + .../data/datapane/VerticalChoosePane.java | 45 +- .../com/fr/design/dialog/MultiTabPane.java | 2 +- .../editor/DoubleDeckValueEditorPane.java | 47 +- .../editor/editor/ColumnIndexEditor.java | 2 - .../fr/design/foldablepane/HeaderPane.java | 8 +- .../design/foldablepane/UIExpandablePane.java | 7 +- .../fr/design/formula/TinyFormulaPane.java | 22 +- .../AbstractShortCutFactory.java | 2 +- .../fr/design/gui/core/ReactiveCardPane.java | 72 +++ .../gui/frpane/AbstractAttrNoScrollPane.java | 13 +- .../fr/design/gui/frpane/UIComboBoxPane.java | 4 +- .../design/gui/frpane/UINumberDragPane.java | 50 +- .../gui/icombobox/ExtendedComboBox.java | 7 - .../icontainer/UIEastResizableContainer.java | 17 +- .../itableeditorpane/UITableEditorPane.java | 6 +- .../itableeditorpane/UITableModelAdapter.java | 14 +- .../fr/design/gui/style/AlignmentPane.java | 231 ++++---- .../fr/design/gui/style/BackgroundPane.java | 24 +- .../com/fr/design/gui/style/BorderPane.java | 98 ++-- .../com/fr/design/gui/style/FRFontPane.java | 213 ++----- .../design/gui/style/TextFontTippedPane.java | 37 +- .../fr/design/gui/style/TextFormatPane.java | 136 ++--- .../mainframe/EastRegionContainerPane.java | 16 +- .../GradientBackgroundQuickPane.java | 31 +- .../PatternBackgroundQuickPane.java | 54 +- .../theme/ThemedCellStyleListPane.java | 7 +- .../design/present/dict/DatabaseDictPane.java | 45 +- .../design/present/dict/DictionaryPane.java | 28 +- .../design/present/dict/FormulaDictPane.java | 6 +- .../present/dict/TableDataDictPane.java | 47 +- .../com/fine/theme/icon/cellelement.svg | 5 + .../fine/theme/icon/cellelement_disable.svg | 5 + .../com/fine/theme/icon/close/close.svg | 10 + .../fine/theme/icon/close/close_disable.svg | 10 + .../com/fine/theme/icon/close/close_round.svg | 11 + .../theme/icon/close/close_round_disable.svg | 11 + .../fine/theme/icon/font/add_parenthesis.svg | 4 + .../icon/font/add_parenthesis_disable.svg | 4 + .../theme/icon/font/remove_parenthesis.svg | 11 + .../icon/font/remove_parenthesis_disable.svg | 11 + .../com/fine/theme/icon/font/shadow.svg | 17 + .../fine/theme/icon/font/shadow_disable.svg | 17 + .../com/fine/theme/icon/font/strike.svg | 3 + .../fine/theme/icon/font/strike_disable.svg | 3 + .../com/fine/theme/icon/font/sub.svg | 3 + .../com/fine/theme/icon/font/sub_disable.svg | 3 + .../com/fine/theme/icon/font/super.svg | 3 + .../fine/theme/icon/font/super_disable.svg | 3 + .../resources/com/fine/theme/icon/select.svg | 4 + .../com/fine/theme/icon/select_disable.svg | 4 + .../com/fine/theme/icon/sort/fill/nosort.svg | 6 + .../fine/theme/icon/sort/fill/sort_asc.svg | 8 + .../fine/theme/icon/sort/fill/sort_desc.svg | 8 + .../com/fine/theme/icon/sort/nosort.svg | 6 + .../fine/theme/icon/sort/nosort_disable.svg | 6 + .../com/fine/theme/icon/sort/sort_asc.svg | 8 + .../fine/theme/icon/sort/sort_asc_disable.svg | 8 + .../sort_asc.svg => sort/sort_desc.svg} | 0 .../sort_desc_disable.svg} | 0 .../light/ui/laf/FineLightLaf.properties | 9 +- .../fr/design/expand/ExpandFatherPane.java | 76 +-- .../fr/design/mainframe/AbstractAttrPane.java | 28 +- .../mainframe/cell/CellElementEditPane.java | 39 +- .../cell/settingpane/CellExpandAttrPane.java | 78 ++- .../cell/settingpane/CellOtherSetPane.java | 554 ++++++++---------- .../CellDesensitizationGroupsPane.java | 43 +- .../com/fr/design/present/BarCodePane.java | 115 ++-- .../fr/design/present/CurrencyLinePane.java | 80 +-- .../CellDSColumnSortItemPane.java | 6 +- .../cellexpand/CellExpandSortItemPane.java | 8 +- .../sort/common/AbstractSortGroupPane.java | 29 +- .../sort/common/AbstractSortItemPane.java | 99 ++-- .../design/sort/common/SortColumnRowPane.java | 42 +- .../sort/common/SortUIExpandablePane.java | 41 +- .../expressionpane/CustomSequencePane.java | 28 +- .../CustomSequenceSortExpressionPane.java | 14 +- .../FormulaSortExpressionPane.java | 12 +- .../fr/design/sort/header/HeaderAreaPane.java | 196 +++---- .../design/sort/header/HeaderSettingPane.java | 37 +- .../sort/header/HeaderSortRulePane.java | 47 +- .../fr/design/sort/header/SortHeaderPane.java | 28 +- .../com/fr/quickeditor/CellQuickEditor.java | 73 +-- .../cellquick/CellDSColumnEditor.java | 42 +- .../cellquick/CellFormulaQuickEditor.java | 39 +- .../cellquick/CellStringQuickEditor.java | 4 +- 87 files changed, 1549 insertions(+), 1732 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/gui/core/ReactiveCardPane.java create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/cellelement.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/cellelement_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/close/close.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/close/close_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/close/close_round.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/close/close_round_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/font/add_parenthesis.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/font/add_parenthesis_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/font/remove_parenthesis.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/font/remove_parenthesis_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/font/shadow.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/font/shadow_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/font/strike.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/font/strike_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/font/sub.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/font/sub_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/font/super.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/font/super_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/select.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/select_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/sort/fill/nosort.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/sort/fill/sort_asc.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/sort/fill/sort_desc.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/sort/nosort.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/sort/nosort_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/sort/sort_asc.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/sort/sort_asc_disable.svg rename designer-base/src/main/resources/com/fine/theme/icon/{toolbar/sort_asc.svg => sort/sort_desc.svg} (100%) rename designer-base/src/main/resources/com/fine/theme/icon/{toolbar/sort_asc_disable.svg => sort/sort_desc_disable.svg} (100%) 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 b7fd93133..85c2ed651 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 @@ -37,6 +37,7 @@ public class FineLightIconSet extends AbstractIconSet { new SvgIconSource("down_arrow", "com/fine/theme/icon/down_arrow.svg", true), new SvgIconSource("down_arrow_12", "com/fine/theme/icon/down_arrow.svg", true, 12), new SvgIconSource("up_arrow_12", "com/fine/theme/icon/up_arrow.svg", true, 12), + new SvgIconSource("select", "com/fine/theme/icon/select.svg", true), // 数据集相关Icon new SvgIconSource("database", "com/fine/theme/icon/dataset/database.svg", true), @@ -144,7 +145,6 @@ public class FineLightIconSet extends AbstractIconSet { new SvgIconSource("tool_copy", "com/fine/theme/icon/toolbar/copy.svg", true), new SvgIconSource("move_down", "com/fine/theme/icon/toolbar/move_down.svg", true), new SvgIconSource("move_up", "com/fine/theme/icon/toolbar/move_up.svg", true), - new SvgIconSource("sort_asc", "com/fine/theme/icon/toolbar/sort_asc.svg", true), new SvgIconSource("tool_edit", "com/fine/theme/icon/toolbar/edit.svg", true), new SvgIconSource("tool_edit_white", "com/fine/theme/icon/toolbar/edit_white.svg", true), @@ -159,6 +159,8 @@ public class FineLightIconSet extends AbstractIconSet { new SvgIconSource("notification", "com/fine/theme/icon/notification/notification.svg"), new SvgIconSource("notification_dot", "com/fine/theme/icon/notification/notification_dot.svg"), + //东区面板 + new SvgIconSource("cellelement_small", "com/fine/theme/icon/cellelement.svg"), // 三角 new SvgIconSource("triangle_down", "com/fine/theme/icon/triangle/triangle_down.svg"), @@ -172,6 +174,23 @@ public class FineLightIconSet extends AbstractIconSet { new SvgIconSource("zoomIn", "com/fine/theme/icon/zoom/zoomIn.svg", true), new SvgIconSource("zoomOut", "com/fine/theme/icon/zoom/zoomOut.svg", true), + //排序 + new SvgIconSource("sort_asc", "com/fine/theme/icon/sort/sort_asc.svg", true), + new SvgIconSource("sort_desc", "com/fine/theme/icon/sort/sort_desc.svg", true), + new SvgIconSource("nosort", "com/fine/theme/icon/sort/nosort.svg", true), + + // 关闭 + new SvgIconSource("close", "com/fine/theme/icon/close/close.svg", true), + new SvgIconSource("close_round", "com/fine/theme/icon/close/close_round.svg", true), + + // 文字样式 + new SvgIconSource("add_parenthesis", "com/fine/theme/icon/font/add_parenthesis.svg", true), + new SvgIconSource("remove_parenthesis", "com/fine/theme/icon/font/remove_parenthesis.svg", true), + new SvgIconSource("shadow", "com/fine/theme/icon/font/shadow.svg", true), + new SvgIconSource("strike", "com/fine/theme/icon/font/strike.svg", true), + new SvgIconSource("sub", "com/fine/theme/icon/font/sub.svg", true), + new SvgIconSource("super", "com/fine/theme/icon/font/super.svg", true), + new SvgIconSource("dot", "com/fine/theme/icon/dot.svg", true), new SvgIconSource("expand_popup", "com/fine/theme/icon/popup/expand_popup.svg"), new SvgIconSource("collapse_popup", "com/fine/theme/icon/popup/collapse_popup.svg") 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 149923c1a..a4150dbfa 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 @@ -42,4 +42,14 @@ public class LayoutConstants { * 图表属性表中二级菜单距离右边框的距离 */ public static final int CHART_ATTR_TOMARGIN = 46; + + /** + * 主题化布局:水平间隙 + */ + public static final int HORIZONTAL_GAP = 10; + + /** + * 主题化布局:垂直间隙 + */ + public static final int VERTICAL_GAP = 10; } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/VerticalChoosePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/VerticalChoosePane.java index 374efb112..fd43af24f 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/VerticalChoosePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/VerticalChoosePane.java @@ -1,23 +1,22 @@ package com.fr.design.data.datapane; +import com.fine.swing.ui.layout.Layouts; import com.fr.design.constants.LayoutConstants; import com.fr.design.data.datapane.preview.PreviewLabel; import com.fr.design.data.datapane.preview.PreviewLabel.Previewable; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerBean; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; -import javax.swing.*; import java.awt.*; +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 VerticalChoosePane extends ChoosePane implements DesignerBean { - private static final int RIGHTBORDER = 5; private static final int MAX_WIDTH = 60; public VerticalChoosePane(Previewable previewable) { @@ -31,35 +30,23 @@ public class VerticalChoosePane extends ChoosePane implements DesignerBean { @Override protected void initComponentsLayout(PreviewLabel previewLabel, int labelSize) { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, f}; - double[] rowSize = {p, p, p}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; - JPanel rs = new JPanel(new BorderLayout(0, 0)); - rs.add(tableNameComboBox, BorderLayout.CENTER); - rs.add(GUICoreUtils.createFlowPane(new Component[]{new RefreshLabel(this), previewLabel}, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE), BorderLayout.EAST); - rs.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, -RIGHTBORDER)); UILabel l1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database"), UILabel.LEFT); UILabel l2 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Model"), UILabel.LEFT); UILabel l3 = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Select_Table"), MAX_WIDTH, UILabel.LEFT); - if (labelSize > 0) { - Dimension pSize = new Dimension(labelSize, 20); - l1.setPreferredSize(pSize); - l2.setPreferredSize(pSize); - l3.setPreferredSize(pSize); - } - - Component[][] components = new Component[][]{ - new Component[]{l1, dsNameComboBox}, - new Component[]{l2, schemaBox}, - new Component[]{l3, UIComponentUtils.wrapWithBorderLayoutPane(rs)} - }; - JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_HUGER, LayoutConstants.VGAP_LARGE); this.setLayout(new BorderLayout()); - this.add(content, BorderLayout.CENTER); + this.add(Layouts.column(LayoutConstants.VERTICAL_GAP, + row(cell(l1).weight(1), cell(dsNameComboBox).weight(2)), + row(cell(l2).weight(1), cell(schemaBox).weight(2)), + row( + cell(l3).weight(1), + cell(tableNameComboBox).weight(1.2), + flex(0.1), + cell(new RefreshLabel(this)).weight(0.3), + flex(0.1), + cell(previewLabel).weight(0.3)) + ).getComponent(), BorderLayout.CENTER); } diff --git a/designer-base/src/main/java/com/fr/design/dialog/MultiTabPane.java b/designer-base/src/main/java/com/fr/design/dialog/MultiTabPane.java index 15fa17dd2..10dfe6600 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/MultiTabPane.java +++ b/designer-base/src/main/java/com/fr/design/dialog/MultiTabPane.java @@ -81,7 +81,7 @@ public abstract class MultiTabPane extends FurtherBasicBeanPane{ } protected void initLayout() { - this.setLayout(new BorderLayout(0, 4)); + this.setLayout(new BorderLayout()); this.add(tabPane, BorderLayout.NORTH); this.add(centerPane, BorderLayout.CENTER); } diff --git a/designer-base/src/main/java/com/fr/design/editor/DoubleDeckValueEditorPane.java b/designer-base/src/main/java/com/fr/design/editor/DoubleDeckValueEditorPane.java index 800e1596b..632d914af 100644 --- a/designer-base/src/main/java/com/fr/design/editor/DoubleDeckValueEditorPane.java +++ b/designer-base/src/main/java/com/fr/design/editor/DoubleDeckValueEditorPane.java @@ -1,7 +1,9 @@ package com.fr.design.editor; +import com.fine.swing.ui.layout.Layouts; import com.fr.base.BaseFormula; import com.fr.design.DesignerEnvManager; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.editor.editor.ColumnIndexEditor; @@ -25,12 +27,12 @@ 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 java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fine.swing.ui.layout.Layouts.cell; + /** * Created by MoMeak on 2017/7/26. */ @@ -45,7 +47,6 @@ public class DoubleDeckValueEditorPane extends BasicPane implements UIObserver, private UIButton arrowButton; private JPopupMenu menu; private JPanel centerPane; - private CardLayout cardLayout; private Object value; private UIButtonGroup upButton; private GlobalNameListener globalNameListener = null; @@ -76,42 +77,38 @@ public class DoubleDeckValueEditorPane extends BasicPane implements UIObserver, private void initComponents(final Editor[] cards, String popupName, String textEditorValue, int centerPaneWidth) { - this.setLayout(new BorderLayout(0, 4)); + this.setLayout(new BorderLayout()); this.cards = cards; final String[] nameArray = new String[cards.length]; for (int i = 0; i < cards.length; i++) { nameArray[i] = cards[i].getName(); } - upButton = new UIButtonGroup(nameArray); + upButton = new UIButtonGroup<>(nameArray); upButton.setAllToolTips(nameArray); - this.add(upButton, BorderLayout.NORTH); - centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - setCurrentEditor(0); - centerPane.setPreferredSize(new Dimension(centerPaneWidth, centerPane.getPreferredSize().height)); menu = createPopMenu(); - upButton.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - if (globalNameListener != null) { - globalNameListener.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_CellWrite_InsertRow_Policy")); - } - Object oldValue = currentEditor.getValue(); - setCurrentEditor(upButton.getSelectedIndex()); - currentEditor.selected(); - value = currentEditor.getValue(); - if (uiObserverListener != null) { - uiObserverListener.doChange(); - } - - DoubleDeckValueEditorPane.this.firePropertyChange("value", oldValue, value); + upButton.addChangeListener(e -> { + if (globalNameListener != null) { + globalNameListener.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_CellWrite_InsertRow_Policy")); } + Object oldValue = currentEditor.getValue(); + setCurrentEditor(upButton.getSelectedIndex()); + currentEditor.selected(); + value = currentEditor.getValue(); + if (uiObserverListener != null) { + uiObserverListener.doChange(); + } + + DoubleDeckValueEditorPane.this.firePropertyChange("value", oldValue, value); }); - this.add(centerPane, BorderLayout.CENTER); + this.add(Layouts.column(LayoutConstants.VERTICAL_GAP, + cell(upButton), + cell(centerPane) + ).getComponent(), BorderLayout.CENTER); } diff --git a/designer-base/src/main/java/com/fr/design/editor/editor/ColumnIndexEditor.java b/designer-base/src/main/java/com/fr/design/editor/editor/ColumnIndexEditor.java index e3b5daccc..47ead39d4 100644 --- a/designer-base/src/main/java/com/fr/design/editor/editor/ColumnIndexEditor.java +++ b/designer-base/src/main/java/com/fr/design/editor/editor/ColumnIndexEditor.java @@ -41,8 +41,6 @@ public class ColumnIndexEditor extends Editor { } this.add(valueColumnIndexComboBox, BorderLayout.CENTER); this.setName(name); - valueColumnIndexComboBox.setBorder(null); - } @Override diff --git a/designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java b/designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java index cefeda51f..d339f85f4 100644 --- a/designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java +++ b/designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java @@ -2,7 +2,7 @@ package com.fr.design.foldablepane; import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineUIScale; -import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.GraphHelper; import javax.swing.BorderFactory; @@ -92,13 +92,9 @@ public class HeaderPane extends JPanel { this.isShow = true; triangleDown = new LazyIcon("triangle_down"); triangleRight = new LazyIcon("triangle_right"); - int width = FineUIUtils.getAndScaleInt("HeaderPane.width", defaultWidth); - int height = FineUIUtils.getAndScaleInt("HeaderPane.height", defaultHeight); - this.setPreferredSize(new Dimension(width, height)); - Insets insets = FineUIUtils.getAndScaleUIInsets("ExpandablePane.HeaderPane.borderInsets", defaultInsets); this.setForeground(UIManager.getColor("ExpandablePane.HeaderPane.foreground")); this.setFont(getFont().deriveFont(Font.BOLD)); - this.setBorder(BorderFactory.createEmptyBorder(insets.top, insets.left, insets.bottom, insets.right)); + this.setBorder(new ScaledEmptyBorder(17, 0, 17, 0)); } public HeaderPane(Color bgColor, String title, int headHeight) { diff --git a/designer-base/src/main/java/com/fr/design/foldablepane/UIExpandablePane.java b/designer-base/src/main/java/com/fr/design/foldablepane/UIExpandablePane.java index d61544325..9003660e0 100644 --- a/designer-base/src/main/java/com/fr/design/foldablepane/UIExpandablePane.java +++ b/designer-base/src/main/java/com/fr/design/foldablepane/UIExpandablePane.java @@ -1,10 +1,7 @@ package com.fr.design.foldablepane; -import com.fine.theme.utils.FineUIScale; -import javax.swing.BorderFactory; import javax.swing.JPanel; -import javax.swing.UIManager; import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.MouseAdapter; @@ -16,7 +13,6 @@ import java.awt.event.MouseEvent; */ public class UIExpandablePane extends JPanel { - private static final int LEFT_BORDER = 5; private static final long serialVersionUID = 1L; private HeaderPane headerPanel; private JPanel contentPanel; @@ -47,7 +43,7 @@ public class UIExpandablePane extends JPanel { } private void initComponents() { - this.setLayout(new BorderLayout(0, FineUIScale.scale(UIManager.getInt("ExpandablePane.vGap")))); + this.setLayout(new BorderLayout()); headerPanel = new HeaderPane(color, title, headHeight); headerPanel.addMouseListener(new PanelAction()); @@ -58,7 +54,6 @@ public class UIExpandablePane extends JPanel { } protected void setcontentPanelontentPanelBorder (){ - contentPanel.setBorder(BorderFactory.createEmptyBorder(0 ,LEFT_BORDER, 0, 0)); } diff --git a/designer-base/src/main/java/com/fr/design/formula/TinyFormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/TinyFormulaPane.java index e5594ddd1..e4e81f7eb 100644 --- a/designer-base/src/main/java/com/fr/design/formula/TinyFormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/TinyFormulaPane.java @@ -1,21 +1,19 @@ package com.fr.design.formula; +import com.fine.theme.icon.LazyIcon; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseFormula; -import com.fr.base.BaseUtils; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.layout.TableLayout; import com.fr.design.mainframe.DesignerContext; -import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Cursor; -import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -40,9 +38,8 @@ public class TinyFormulaPane extends BasicBeanPane implements UIObserver formulaTextField.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ExpandD_Sort_After_Expand")); // 添加一公式编辑器按钮 - formulaTextFieldButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); + formulaTextFieldButton = new UIButton(new LazyIcon("formula")); formulaTextFieldButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula") + "..."); - formulaTextFieldButton.setPreferredSize(new Dimension(24, 20)); formulaTextFieldButton.setOpaque(false); formulaTextFieldButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); formulaTextFieldButton.addActionListener(new ActionListener() { @@ -73,12 +70,10 @@ public class TinyFormulaPane extends BasicBeanPane implements UIObserver } protected void initLayout() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - JPanel pane = new JPanel(new BorderLayout(0,0)); - JPanel pane1 = new JPanel(new BorderLayout(0,0)); + JPanel pane = new JPanel(new BorderLayout()); + JPanel pane1 = new JPanel(new BorderLayout()); pane1.add(formulaTextField, BorderLayout.NORTH); - pane1.setBorder(BorderFactory.createEmptyBorder(0,0,0,5)); + pane1.setBorder(new ScaledEmptyBorder(0,0,0,5)); pane.add(pane1,BorderLayout.CENTER); pane.add(formulaTextFieldButton,BorderLayout.EAST); @@ -112,11 +107,6 @@ public class TinyFormulaPane extends BasicBeanPane implements UIObserver return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Present_Formula_Present"); } - @Override - public Dimension getPreferredSize() { - return new Dimension(super.getPreferredSize().width, 20); - } - @Override public void registerChangeListener(UIObserverListener listener) { if(formulaTextField != null) { diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/AbstractShortCutFactory.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/AbstractShortCutFactory.java index 673349e9b..cf95c6f0b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/AbstractShortCutFactory.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/AbstractShortCutFactory.java @@ -162,7 +162,7 @@ public abstract class AbstractShortCutFactory { SortItemAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Action_Sort")); this.setMnemonic('S'); - this.setSmallIcon(new LazyIcon("sort_asc")); + this.setSmallIcon(new LazyIcon("sort_desc")); } @Override diff --git a/designer-base/src/main/java/com/fr/design/gui/core/ReactiveCardPane.java b/designer-base/src/main/java/com/fr/design/gui/core/ReactiveCardPane.java new file mode 100644 index 000000000..9c05fb461 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/core/ReactiveCardPane.java @@ -0,0 +1,72 @@ +package com.fr.design.gui.core; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Supplier; + +/** + * 简单的响应式面板容器,提供切换布局的功能 + * + * @author Levy.Xie + * @since 11.0 + * Created on 2023/12/25 + */ +public class ReactiveCardPane extends JPanel { + + String selectKey; + Map> cardFactory = new HashMap<>(); + + /** + * 创建响应式面板容器 + * + * @return 面板 + */ + public static ReactiveCardPane create() { + ReactiveCardPane container = new ReactiveCardPane(); + container.setLayout(new BorderLayout()); + return container; + } + + /** + * 添加创建布局卡片的supplier + *

由于swing的布局生成机制,单一组件不能在不同布局中出现,因此无法存储构建好的布局,可以存储工厂方法,使用时调用

+ * + * @param key supplier标识 + * @param supplier 工厂方法 + * @return this + */ + public ReactiveCardPane addSupplier(String key, Supplier supplier) { + cardFactory.put(key, supplier); + return this; + } + + /** + * 选择布局 + * + * @param key supplier标识 + * @return this + */ + public ReactiveCardPane select(String key) { + this.selectKey = key; + return this; + } + + /** + * 渲染卡片 + * + * @throws IllegalArgumentException 非法key值 + */ + public void populate() throws IllegalArgumentException { + if (selectKey == null || !cardFactory.containsKey(selectKey)) { + throw new IllegalArgumentException("container select key is illegal!"); + } + removeAll(); + add(cardFactory.get(selectKey).get(), BorderLayout.CENTER); + revalidate(); + repaint(); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java index 15d50d00c..57e4095ff 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java @@ -1,5 +1,7 @@ package com.fr.design.gui.frpane; +import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; @@ -17,7 +19,6 @@ import java.awt.*; * 用于属性表中的面板,主要是为了给包含于这个面板内部的众多UI控件加监听事件,在UI控件改变的时候,通知模板做相应的变化 */ public abstract class AbstractAttrNoScrollPane extends BasicPane { - private static final int DEFAULT_HEIGHT = 250; private static boolean hasChangeListener; protected JPanel leftContentPane; @@ -59,7 +60,7 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane { protected void initContentPane() { leftContentPane = createContentPane(); if (leftContentPane != null) { - leftContentPane.setBorder(BorderFactory.createMatteBorder(10, 10, 0, 0, original)); + leftContentPane.setBorder(new ScaledEmptyBorder(LayoutConstants.VERTICAL_GAP, 0, 0, 0)); this.add(leftContentPane, BorderLayout.CENTER); } } @@ -125,14 +126,6 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane { return hasChangeListener; } - /** - * 返回预定义的大小. - */ - public Dimension getPreferredSize() { - return new Dimension(super.getPreferredSize().width, DEFAULT_HEIGHT); - } - - /** * 返回绑定的属性事件. * @param listener 增加监听 diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/UIComboBoxPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/UIComboBoxPane.java index de8a10b1c..24c46449e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/UIComboBoxPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/UIComboBoxPane.java @@ -1,7 +1,9 @@ package com.fr.design.gui.frpane; +import com.fine.theme.utils.FineUIScale; import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.icombobox.UIComboBox; import javax.swing.*; @@ -92,7 +94,7 @@ public abstract class UIComboBoxPane extends BasicBeanPane { * august 如果需要的布局有变化,覆盖之 */ protected void initLayout() { - this.setLayout(new BorderLayout(0, 6)); + this.setLayout(new BorderLayout(0, FineUIScale.scale(LayoutConstants.VERTICAL_GAP))); JPanel northPane = new JPanel(new BorderLayout()); northPane.add(jcb, BorderLayout.CENTER); this.add(northPane, BorderLayout.NORTH); diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPane.java index 99bc1205a..053b5a56d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPane.java @@ -1,23 +1,26 @@ package com.fr.design.gui.frpane; +import com.fine.swing.ui.layout.Layouts; import com.fr.design.beans.BasicBeanPane; import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; import com.fr.design.gui.islider.UISlider; import com.fr.design.gui.ispinner.UISpinner; -import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.Dimension; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.flex; + public class UINumberDragPane extends BasicBeanPane implements GlobalNameObserver { private static final long serialVersionUID = -8681716725163358249L; private UISlider dragBar; private UISpinner spinner; private boolean isEditing = false; - private String numberDargPaneName = ""; + private String numberDragPaneName = ""; private GlobalNameListener globalNameListener = null; /** @@ -38,31 +41,26 @@ public class UINumberDragPane extends BasicBeanPane implements GlobalNam dragBar.setMajorTickSpacing((int) maxValue); spinner = createUISpinner(minValue, maxValue, dierta); spinner.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")); - this.setLayout(new BorderLayout(4, 0)); - this.add(spinner, BorderLayout.EAST); - this.add(dragBar, BorderLayout.CENTER); - dragBar.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - if (globalNameListener != null && shouldResponseNameListener()) { - globalNameListener.setGlobalName(numberDargPaneName); - } - spinner.setValue(dragBar.getValue()); - if (isEditing) { - userEvent(updateBean()); - } + this.setLayout(new BorderLayout()); + this.add(Layouts.row( + cell(dragBar).weight(0.7), flex(0.1), cell(spinner).weight(0.7) + ).getComponent()); + dragBar.addChangeListener(e -> { + if (globalNameListener != null && shouldResponseNameListener()) { + globalNameListener.setGlobalName(numberDragPaneName); + } + spinner.setValue(dragBar.getValue()); + if (isEditing) { + userEvent(updateBean()); } }); - spinner.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - if (globalNameListener != null && shouldResponseNameListener()) { - globalNameListener.setGlobalName(numberDargPaneName); - } - dragBar.setValue((int) spinner.getValue()); - if (isEditing) { - userEvent(updateBean()); - } + spinner.addChangeListener(e -> { + if (globalNameListener != null && shouldResponseNameListener()) { + globalNameListener.setGlobalName(numberDragPaneName); + } + dragBar.setValue((int) spinner.getValue()); + if (isEditing) { + userEvent(updateBean()); } }); } @@ -93,7 +91,7 @@ public class UINumberDragPane extends BasicBeanPane implements GlobalNam * @param name */ public void setGlobalName(String name) { - numberDargPaneName = name; + numberDragPaneName = name; } @Override diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/ExtendedComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/ExtendedComboBox.java index 9fc3d9e17..dd85ab5a4 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/ExtendedComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/ExtendedComboBox.java @@ -47,13 +47,6 @@ public class ExtendedComboBox extends UIComboBox { setUI(new ExtendedComboBoxUI()); } - @Override - public Dimension getPreferredSize() { - Dimension dim = super.getPreferredSize(); - dim.width = VALUE120; - return dim; - } - static class ExtendedComboBoxUI extends FineComboBoxUI { public static ComponentUI createUI(JComponent c) { return new ExtendedComboBoxUI(); diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java index c99702414..994b7b425 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java @@ -2,6 +2,7 @@ package com.fr.design.gui.icontainer; import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIScale; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; @@ -33,13 +34,13 @@ import java.awt.event.MouseMotionListener; public class UIEastResizableContainer extends JPanel { private static final long serialVersionUID = 1854340560790476907L; - public static final int MAX_CONTAINER_WIDTH = 340; - public static final int MIN_CONTAINER_WIDTH = 286; + public static final int MAX_CONTAINER_WIDTH = FineUIScale.scale(340); + public static final int MIN_CONTAINER_WIDTH = FineUIScale.scale(286); - private int containerWidth = 240; - private int preferredWidth = 240; - private int topToolPaneHeight = 40; - private int leftPaneWidth = 42; + private int containerWidth = FineUIScale.scale(240); + private int preferredWidth = FineUIScale.scale(240); + private int topToolPaneHeight = FineUIScale.scale(40); + private int leftPaneWidth = FineUIScale.scale(42); private JComponent leftPane; private JComponent rightPane; @@ -47,8 +48,8 @@ public class UIEastResizableContainer extends JPanel { private TopToolPane topToolPane; - private static final int ARROW_MARGIN = 15; - private static final int ARROW_RANGE = 35; + private static final int ARROW_MARGIN = FineUIScale.scale(15); + private static final int ARROW_RANGE = FineUIScale.scale(35); public UIEastResizableContainer() { diff --git a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java index f385874b5..53214b869 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java @@ -1,7 +1,6 @@ package com.fr.design.gui.itableeditorpane; -import com.fr.design.border.UIRoundedBorder; -import com.fr.design.constants.UIConstants; +import com.fine.theme.light.ui.FineRoundBorder; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; @@ -51,10 +50,9 @@ public class UITableEditorPane extends BasicPane { UILabel l = new UILabel(leftLabelName); editTable = tableModel.createTable(); -// editTable.getTableHeader().setBackground(UIConstants.DEFAULT_BG_RULER); UIScrollPane scrollPane = new UIScrollPane(editTable); - scrollPane.setBorder(new UIRoundedBorder(UIConstants.TITLED_BORDER_COLOR, 1, UIConstants.ARC)); + scrollPane.setBorder(new FineRoundBorder()); pane.add(scrollPane, BorderLayout.CENTER); initbuttonPane(action); JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); diff --git a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java index 8b046f3d0..ae283a659 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java +++ b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java @@ -1,6 +1,6 @@ package com.fr.design.gui.itableeditorpane; -import com.fr.base.BaseUtils; +import com.fine.theme.icon.LazyIcon; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.mainframe.DesignerContext; import com.fr.log.FineLoggerFactory; @@ -198,7 +198,7 @@ public abstract class UITableModelAdapter extends AbstractTableModel implemen protected abstract class AddTableRowAction extends UITableEditAction { public AddTableRowAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Insert")); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png")); + this.setSmallIcon(new LazyIcon("add")); } @Override @@ -215,7 +215,7 @@ public abstract class UITableModelAdapter extends AbstractTableModel implemen public EditAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Edit")); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/edit.png")); + this.setSmallIcon(new LazyIcon("edit")); } @Override @@ -239,13 +239,13 @@ public abstract class UITableModelAdapter extends AbstractTableModel implemen public DeleteAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Delete")); this.setDeleteTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?"); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/remove.png")); + this.setSmallIcon(new LazyIcon("remove")); } public DeleteAction(Component component){ this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Delete")); this.setDeleteTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?"); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/remove.png")); + this.setSmallIcon(new LazyIcon("remove")); this.component = component; } @@ -309,7 +309,7 @@ public abstract class UITableModelAdapter extends AbstractTableModel implemen protected class MoveUpAction extends UITableEditAction { public MoveUpAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Move_Up")); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/up.png")); + this.setSmallIcon(new LazyIcon("move_up")); } @Override @@ -333,7 +333,7 @@ public abstract class UITableModelAdapter extends AbstractTableModel implemen public MoveDownAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Move_Down")); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/down.png")); + this.setSmallIcon(new LazyIcon("move_down")); } @Override diff --git a/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java b/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java index eb72db81c..4a9c4cee3 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java @@ -4,6 +4,8 @@ package com.fr.design.gui.style; * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. */ +import com.fine.swing.ui.layout.Layouts; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseUtils; import com.fr.base.Style; import com.fr.design.ExtraDesignClassManager; @@ -12,15 +14,13 @@ import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.fun.IndentationUnitProcessor; +import com.fr.design.gui.core.ReactiveCardPane; import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icombobox.UIComboBox; 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.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.event.EventDispatcher; import com.fr.general.ComparatorUtils; @@ -39,35 +39,28 @@ import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JPanel; import javax.swing.SwingConstants; +import javax.swing.UIManager; import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; import java.util.ArrayList; import java.util.Arrays; +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; +import static com.fine.swing.ui.layout.Layouts.fix; + /** * Pane to edit cell alignment. */ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameObserver { private static final int ANGEL = 90; - private static final int GAP = 23; - private static final int VERGAP = 3; - private static final Dimension SPINNER_DIMENSION = new Dimension(75, 20); private static final String[] TEXT = {Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Wrap_Text"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Single_Line"), Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Single_Line(Adjust_Font)"), Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Multi_Line(Adjust_Font)")}; private static final String[] LAYOUT = {Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Default"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Image_Titled"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Image_Extend"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Image_Adjust")}; - private JPanel hPaneContainer; - private JPanel vPaneContainer; - private JPanel rotationBarCC; - private JPanel basicPane; - private JPanel seniorPane; + private ReactiveCardPane rotationBarPane; private UIComboBox textComboBox; private UIComboBox textRotationComboBox; @@ -95,8 +88,9 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO protected void initComponents() { textComboBox = new UIComboBox(TEXT); imageLayoutComboBox = new UIComboBox(LAYOUT); - initTextRotationCombox(); + initTextRotationComboBox(); + // todo: 换新图标及反白问题 Icon[][] hAlignmentIconArray = {{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal_white.png")}, {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal_white.png")}, {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal_white.png")}, @@ -106,9 +100,6 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO hAlignmentPane = new UIButtonGroup<>(hAlignmentIconArray, hAlignment); hAlignmentPane.setAllToolTips(new String[]{Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Left"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Right"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Distributed"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_DEFAULT")}); - hPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); - vPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); - Icon[][] vAlignmentIconArray = {{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_top_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_top_normal_white.png")}, {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal_white.png")}, {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal_white.png")}}; @@ -146,8 +137,6 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO } private void initOtherComponent() { - hPaneContainer.add(hAlignmentPane); - vPaneContainer.add(vAlignmentPane); rotationPane = new UINumberDragPane(-ANGEL, ANGEL); leftIndentSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); @@ -157,24 +146,11 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO spaceAfterSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); lineSpaceSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); - rotationBarCC = new JPanel(new CardLayout()); - rotationBarCC.add(rotationPane, "show"); - rotationBarCC.add(new JPanel(), "hide"); - this.setLayout(new BorderLayout()); this.add(createPane(), BorderLayout.CENTER); - - textRotationComboBox.addItemListener(new ItemListener() { - - @Override - public void itemStateChanged(ItemEvent e) { - CardLayout cc = (CardLayout) rotationBarCC.getLayout(); - cc.show(rotationBarCC, textRotationComboBox.getSelectedIndex() == 0 ? "show" : "hide"); - } - }); } - private void initTextRotationCombox() { + private void initTextRotationComboBox() { ArrayList selectOption = new ArrayList<>(); selectOption.add(Toolkit.i18nText("Fine-Design_Basic_Custom_Angle")); VerticalTextProcessor processor = ExtraClassManager.getInstance().getSingle(VerticalTextProcessor.XML_TAG, DefaultVerticalTextProcessor.class); @@ -198,101 +174,118 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO } private JPanel createPane() { - JPanel jp1 = new JPanel(new BorderLayout()); - basicPane = new JPanel(); - seniorPane = new JPanel(); - basicPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Basic"), 290, 24, basicPane()); - seniorPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Basic_Advanced"), 290, 24, seniorPane()); - - jp1.add(basicPane, BorderLayout.NORTH); - jp1.add(seniorPane, BorderLayout.CENTER); - - return jp1; + JPanel basicPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Basic"), 290, 24, basicPane()); + JPanel seniorPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Basic_Advanced"), 290, 24, seniorPane()); + return Layouts.column( + cell(basicPane), + fix(1).with(it -> it.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor")))), + cell(seniorPane) + ).getComponent(); } private JPanel basicPane() { - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; UILabel horizontalLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Horizontal") + " ", SwingConstants.LEFT); + UILabel verticalLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Vertical") + " ", SwingConstants.LEFT); UIComponentUtils.setLineWrap(horizontalLabel); - Component[][] components = new Component[][]{ - new Component[]{null, null}, - new Component[]{horizontalLabel, hPaneContainer}, - new Component[]{null, null}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Vertical") + " ", SwingConstants.RIGHT), vPaneContainer}, - new Component[]{null, 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}}; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); + UIComponentUtils.setLineWrap(verticalLabel); + return Layouts.column(LayoutConstants.VERTICAL_GAP, + row( + cell(horizontalLabel).weight(1.2), + cell(hAlignmentPane).weight(3)), + row( + cell(verticalLabel).weight(1.2), + cell(vAlignmentPane).weight(1.8), + flex(1.2)) + ).with(it -> it.setBorder(new ScaledEmptyBorder(0, 0, LayoutConstants.VERTICAL_GAP, 0))).getComponent(); } private JPanel seniorPane() { - JPanel senPane = new JPanel(new BorderLayout()); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - Component[][] components = new Component[][]{ - new Component[]{null, null}, - new Component[]{new UILabel((Toolkit.i18nText("Fine-Design_Basic_Image_Layout")) + " ", SwingConstants.LEFT), imageLayoutComboBox}, - new Component[]{null, null}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Text_Style") + " ", SwingConstants.LEFT), textComboBox}, - new Component[]{null, null}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation") + " ", SwingConstants.LEFT), textRotationComboBox}, - new Component[]{null, rotationBarCC}, - new Component[]{null, null}, - }; - double[] rowSize = {p, p, p, p, p, p, p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; - JPanel tempPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); - senPane.add(tempPane, BorderLayout.NORTH); - senPane.add(seniorDownPane(), BorderLayout.CENTER); - return senPane; + return Layouts.column(LayoutConstants.VERTICAL_GAP, + cell(seniorUpPane()), + cell(seniorMiddlePane()), + cell(seniorDownPane()) + ).getComponent(); } - private JPanel seniorDownPane() { - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - leftIndentSpinner.setPreferredSize(SPINNER_DIMENSION); - rightIndentSpinner.setPreferredSize(SPINNER_DIMENSION); - spaceBeforeSpinner.setPreferredSize(SPINNER_DIMENSION); - spaceAfterSpinner.setPreferredSize(SPINNER_DIMENSION); - lineSpaceSpinner.setPreferredSize(SPINNER_DIMENSION); - - JPanel indentationPane = new JPanel(new BorderLayout()); - indentationPane.add(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Style_Indentation")), SwingConstants.LEFT)); - indentationPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, GAP)); - JPanel partSpacingPane = new JPanel(new BorderLayout()); - partSpacingPane.add(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Style_Part_Spacing")), SwingConstants.LEFT)); - partSpacingPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, GAP)); - JPanel spacingPane = new JPanel(new BorderLayout()); - spacingPane.add(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Style_Line_Spacing")), SwingConstants.LEFT)); - spacingPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, GAP)); - - Component[][] components = new Component[][]{ - new Component[]{null, null, null}, - new Component[]{indentationPane, creatSpinnerPane(leftIndentSpinner), creatSpinnerPane(rightIndentSpinner)}, - new Component[]{null, new UILabel((Toolkit.i18nText("Fine-Design_Report_Left")), SwingConstants.CENTER), new UILabel((Toolkit.i18nText("Fine-Design_Basic_Right")), SwingConstants.CENTER)}, - new Component[]{null, null, null}, - new Component[]{null, null, null}, - new Component[]{partSpacingPane, creatSpinnerPane(spaceBeforeSpinner), creatSpinnerPane(spaceAfterSpinner)}, - new Component[]{null, new UILabel((Toolkit.i18nText("Fine-Design_Basic_Front")), SwingConstants.CENTER), new UILabel((Toolkit.i18nText("Fine-Design_Basic_Behind")), SwingConstants.CENTER)}, - new Component[]{null, null, null}, - new Component[]{null, null, null}, - new Component[]{spacingPane, creatSpinnerPane(lineSpaceSpinner), null}, - }; - double[] rowSize = {p, p, p, p, p, p, p, p, p, p}; - double[] columnSize = {p, f, f}; - int[][] rowCount = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}}; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, VERGAP); + private JPanel seniorUpPane() { + return Layouts.column(LayoutConstants.VERTICAL_GAP, + row( + cell(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Image_Layout")), SwingConstants.LEFT)).weight(1.2), + cell(imageLayoutComboBox).weight(3.0) + ), + row( + cell(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Text_Style")), SwingConstants.LEFT)).weight(1.2), + cell(textComboBox).weight(3.0) + ) + ).getComponent(); } - private JPanel creatSpinnerPane(Component comp) { - JPanel jp = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - jp.add(comp); - return jp; + private JPanel seniorMiddlePane() { + rotationBarPane = ReactiveCardPane.create() + .addSupplier("hide", () -> Layouts.row( + cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation"), SwingConstants.LEFT)).weight(1.2), + cell(textRotationComboBox).weight(3) + ).getComponent()) + .addSupplier("show", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, + row( + cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation"), SwingConstants.LEFT)).weight(1.2), + cell(textRotationComboBox).weight(3) + ), + row( + flex(1.2), + cell(rotationPane).weight(3) + ) + ).getComponent()); + rotationBarPane.select("show").populate(); + + textRotationComboBox.addItemListener(e -> { + String key = (textRotationComboBox.getSelectedIndex() == 0) ? "show" : "hide"; + rotationBarPane.select(key).populate(); + }); + return rotationBarPane; + } + + private JPanel seniorDownPane() { + UILabel indentationLabel = new UILabel((Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Style_Indentation")), SwingConstants.LEFT); + UILabel partSpacingLabel = new UILabel((Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Style_Part_Spacing")), SwingConstants.LEFT); + UILabel spacingLabel = new UILabel((Toolkit.i18nText("Fine-Design_Basic_Style_Line_Spacing")), SwingConstants.LEFT); + + return Layouts.column( + row( + cell(indentationLabel).weight(1.2), + cell(leftIndentSpinner).weight(1.4), + flex(0.2), + cell(rightIndentSpinner).weight(1.4) + ), + fix(2), + row( + flex(1.2), + cell(new UILabel((Toolkit.i18nText("Fine-Design_Report_Left")), SwingConstants.CENTER)).weight(1.4), + flex(0.2), + cell(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Right")), SwingConstants.CENTER)).weight(1.4) + ), + fix(10), + row( + cell(partSpacingLabel).weight(1.2), + cell(spaceBeforeSpinner).weight(1.4), + flex(0.2), + cell(spaceAfterSpinner).weight(1.4) + ), + fix(2), + row( + flex(1.2), + cell(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Front")), SwingConstants.CENTER)).weight(1.4), + flex(0.2), + cell(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Behind")), SwingConstants.CENTER)).weight(1.4) + ), + fix(10), + row( + cell(spacingLabel).weight(1.2), + cell(lineSpaceSpinner).weight(1.4), + flex(1.6) + ) + ).getComponent(); } /** diff --git a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java b/designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java index 3e0f6c213..0b3f94f0a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java @@ -1,13 +1,11 @@ package com.fr.design.gui.style; +import com.fine.swing.ui.layout.Layouts; import com.fr.base.Style; import com.fr.design.ExtraDesignClassManager; import com.fr.design.constants.LayoutConstants; import com.fr.design.fun.BackgroundQuickUIProvider; import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.backgroundpane.*; import com.fr.general.Background; @@ -21,6 +19,8 @@ import java.awt.event.ItemListener; import java.util.ArrayList; import java.util.Set; +import static com.fine.swing.ui.layout.Layouts.cell; + /** * @author zhou * @since 2012-5-28下午6:22:09 @@ -45,7 +45,7 @@ public class BackgroundPane extends AbstractBasicStylePane { } protected void initComponents() { - this.setLayout(new BorderLayout(0, 6)); + this.setLayout(new BorderLayout()); typeComboBox = new UIComboBox(); final CardLayout cardlayout = new CardLayout(); @@ -75,19 +75,9 @@ public class BackgroundPane extends AbstractBasicStylePane { } }); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - Component[][] components = new Component[][]{ - new Component[]{null}, - new Component[]{typeComboBox}, - new Component[]{centerPane} - }; - double[] rowSize = {p, p, p}; - double[] columnSize = {f}; - int[][] rowCount = {{1},{1},{1}}; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); - this.add(panel, BorderLayout.CENTER); - + this.add(Layouts.column(LayoutConstants.VERTICAL_GAP, + cell(typeComboBox), cell(centerPane) + ).getComponent(),BorderLayout.CENTER); } protected BackgroundQuickPane[] supportKindsOfBackgroundUI() { diff --git a/designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java b/designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java index d2a302ea0..2477d4e2e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java @@ -4,6 +4,8 @@ package com.fr.design.gui.style; * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. */ +import com.fine.swing.ui.layout.Layouts; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.CellBorderStyle; import com.fr.base.Style; import com.fr.design.constants.LayoutConstants; @@ -13,8 +15,6 @@ import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane; import com.fr.design.style.color.NewColorSelectBox; import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils; @@ -22,29 +22,33 @@ import com.fr.general.IOUtils; import com.fr.stable.Constants; import com.fr.stable.CoreConstants; +import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JPanel; import javax.swing.SwingConstants; +import javax.swing.UIManager; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; import java.awt.GridLayout; import java.util.Arrays; import java.util.HashSet; import java.util.Set; +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.fix; + /** * @author zhou * @since 2012-5-28下午6:22:04 */ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObserver { - private static final String[] BORDERARRAY = {"currentLineCombo", "currentLineColorPane", "outerToggleButton", "topToggleButton", + private static final String[] BORDER_ARRAY = {"currentLineCombo", "currentLineColorPane", "outerToggleButton", "topToggleButton", "leftToggleButton", "bottomToggleButton", "rightToggleButton", "innerToggleButton", "horizontalToggleButton", "verticalToggleButton"}; - private static final Set BORDER_SET = new HashSet<>(Arrays.asList(BORDERARRAY)); + private static final Set BORDER_SET = new HashSet<>(Arrays.asList(BORDER_ARRAY)); private UIToggleButton topToggleButton; private UIToggleButton horizontalToggleButton; @@ -67,7 +71,22 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse protected void initComponents() { initButtonsWithIcon(); - this.setLayout(new BorderLayout(0, 0)); + + JPanel borderPane = initBorderPane(); + JPanel backgroundPane = initBackgroundPane(); + this.setLayout(new BorderLayout()); + this.add(Layouts.column( + cell(new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Border"), 280, 24, borderPane)), + fix(1).with(it -> it.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor")))), + cell(new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), 280, 24, backgroundPane)) + ).getComponent()); + + initAllNames(); + outerToggleButton.addChangeListener(outerToggleButtonChangeListener); + innerToggleButton.addChangeListener(innerToggleButtonChangeListener); + } + + private JPanel initBorderPane() { JPanel externalPane = new JPanel(new GridLayout(0, 4)); externalPane.add(topToggleButton); externalPane.add(leftToggleButton); @@ -76,40 +95,42 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse JPanel insidePane = new JPanel(new GridLayout(0, 2)); insidePane.add(horizontalToggleButton); insidePane.add(verticalToggleButton); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - Component[][] components = new Component[][]{ - new Component[]{null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Style") + " ", SwingConstants.LEFT), currentLineCombo}, - new Component[]{null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Color") + " ", SwingConstants.LEFT), currentLineColorPane}, - new Component[]{null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Out_Border") + " ", SwingConstants.LEFT), outerToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("com/fr/design/images/m_format/out.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/out_white.png")}, false)}, - new Component[]{null, externalPane}, - new Component[]{null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_In_Border") + " ", SwingConstants.LEFT), innerToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("com/fr/design/images/m_format/in.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/in_white.png")}, false)}, - new Component[]{null, insidePane}, - new Component[]{null, null} - }; - double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); - JPanel borderPanel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Border"), 280, 24, panel); - this.add(borderPanel, BorderLayout.NORTH); + return Layouts.column(LayoutConstants.VERTICAL_GAP, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Style"), SwingConstants.LEFT)).weight(1.2), + cell(currentLineCombo).weight(3)), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Color"), SwingConstants.LEFT)).weight(1.2), + cell(currentLineColorPane).weight(3)), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Out_Border"), SwingConstants.LEFT)).weight(1.2), + cell(outerToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("com/fr/design/images/m_format/out.png"), + IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/out_white.png")}, false)).weight(3)), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_In_Border"), SwingConstants.LEFT)).weight(1.2), + cell(externalPane).weight(3)), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_In_Border"), SwingConstants.LEFT)).weight(1.2), + cell(innerToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("com/fr/design/images/m_format/in.png"), + IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/in_white.png")}, false)).weight(3)), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_In_Border"), SwingConstants.LEFT)).weight(1.2), + cell(insidePane).weight(3)) + ).with(it -> it.setBorder(new ScaledEmptyBorder(0, 0, LayoutConstants.VERTICAL_GAP, 0))).getComponent(); + } + private JPanel initBackgroundPane() { UILabel backgroundFillLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Background_Fill")); - backgroundFillLabel.setPreferredSize(new Dimension(60, 20)); - backgroundPane = new BackgroundPane(); - JPanel backgroundContainPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{backgroundFillLabel, backgroundPane}}, - TableLayoutHelper.FILL_LASTCOLUMN, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); - - JPanel backgroundPanel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), 280, 24, backgroundContainPane); - this.add(backgroundPanel, BorderLayout.CENTER); - initAllNames(); - outerToggleButton.addChangeListener(outerToggleButtonChangeListener); - innerToggleButton.addChangeListener(innerToggleButtonChangeListener); + return Layouts.column(LayoutConstants.VERTICAL_GAP, + row( + cell(backgroundFillLabel).with(it -> { + it.setBorder(new ScaledEmptyBorder(LayoutConstants.VGAP_MEDIUM, 0, 0, 0)); + it.setVerticalAlignment(SwingConstants.TOP); + }).weight(1.2), + cell(backgroundPane).weight(3) + ) + ).getComponent(); } ChangeListener outerToggleButtonChangeListener = new ChangeListener() { @@ -133,6 +154,7 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse }; private void initButtonsWithIcon() { + // todo: 暂缺视觉反白图标 topToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/top.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/top_white.png")}, false); leftToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/left.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/left_white.png")}, false); bottomToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/bottom.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bottom_white.png")}, false); diff --git a/designer-base/src/main/java/com/fr/design/gui/style/FRFontPane.java b/designer-base/src/main/java/com/fr/design/gui/style/FRFontPane.java index 8af5c08d4..8a7431fd2 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/FRFontPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/FRFontPane.java @@ -4,7 +4,8 @@ package com.fr.design.gui.style; * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. */ -import com.fr.base.BaseUtils; +import com.fine.swing.ui.layout.Layouts; +import com.fine.theme.icon.LazyIcon; import com.fr.base.FRContext; import com.fr.base.Style; import com.fr.base.Utils; @@ -12,12 +13,11 @@ import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; +import com.fr.design.gui.core.ReactiveCardPane; import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; @@ -26,24 +26,19 @@ import com.fr.general.FRFont; import com.fr.stable.Constants; -import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; -import java.awt.CardLayout; import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.GridLayout; -import java.awt.RenderingHints; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; import java.util.Vector; +import static com.fine.swing.ui.layout.Layouts.Cell; +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; + /** * Pane to edit Font. */ @@ -54,12 +49,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse 36, 38, 40, 48, 64, 72, 128 }; private static final int MAX_FONT_SIZE = 100; - private static final Dimension BUTTON_SIZE = new Dimension(20, 18); - private static final Dimension UNDER_LINE_SIZE = new Dimension(87, 20); - private static final Dimension HIDE_SIZE = new Dimension(0, 0); private final String[] fontSizeStyles = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Plain"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Bold"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Italic"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Bolditalic")}; - private JPanel buttonPane; - private JPanel isSuperOrSubPane; private UIComboBox fontNameComboBox; private UIComboBox fontSizeStyleComboBox; protected UIComboBox fontSizeComboBox; @@ -76,19 +66,14 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse private UIToggleButton isShadowCheckBox; private UIToggleButton superPane; private UIToggleButton subPane; - private JPanel linePane; - private int italic_bold; - /** - * LeftPane和RightPane之间的间隙,也是fontSizeStyleComboBox与fontSizeComboBox之间的间隙,之前的默认值为VGAP_LARGE - */ - private int hGapBetweenLeftPaneAndRightPane = LayoutConstants.VGAP_LARGE; + private ReactiveCardPane styleContainer; public FRFontPane() { this.initComponents(); } + @Deprecated public FRFontPane(int hGapBetweenLeftPaneAndRightPane) { - this.hGapBetweenLeftPaneAndRightPane = hGapBetweenLeftPaneAndRightPane; this.initComponents(); } @@ -123,17 +108,12 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse this.colorSelectPane.setColor(frFont.getForeground()); this.colorSelectPane.repaint(); // update frFont. - - CardLayout cly = (CardLayout) linePane.getLayout(); int line = frFont.getUnderline(); if (line == Constants.LINE_NONE) { underline.setSelected(false); - cly.show(linePane, "none"); - linePane.setPreferredSize(HIDE_SIZE); + styleContainer.removeAll(); } else { underline.setSelected(true); - cly.show(linePane, "combobox"); - linePane.setPreferredSize(UNDER_LINE_SIZE); this.underlineCombo.setSelectedLineStyle(line); } // effects @@ -149,6 +129,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse this.superPane.setSelected(false); this.subPane.setSelected(false); } + styleContainer.select(underline.isSelected() ? "showLine" : "hideLine").populate(); } /** @@ -231,7 +212,6 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse @Override public Style update(Style style) { - // TODO Auto-generated method stub FRFont frFont = style.getFRFont(); frFont = this.update(frFont); return style.deriveFRFont(frFont); @@ -248,44 +228,54 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse protected void initComponents() { fontSizeStyleComboBox = new UIComboBox(fontSizeStyles); fontNameComboBox = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report()); - fontNameComboBox.setPreferredSize(new Dimension(144, 20)); fontSizeComboBox = new UIComboBox(getFontSizes()); fontSizeComboBox.setEditable(true); - this.underlineCombo = new LineComboBox(UIConstants.BORDER_LINE_STYLE_ARRAY); + underlineCombo = new LineComboBox(UIConstants.BORDER_LINE_STYLE_ARRAY); colorSelectPane = new UIColorButton(); - bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); - italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); - underline = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline.png")); - bold.setPreferredSize(BUTTON_SIZE); - italic.setPreferredSize(BUTTON_SIZE); - underline.setPreferredSize(BUTTON_SIZE); - isStrikethroughCheckBox = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/strikethrough.png")); - isStrikethroughCheckBox.setPreferredSize(BUTTON_SIZE); - isShadowCheckBox = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/shadow.png")); - isShadowCheckBox.setPreferredSize(BUTTON_SIZE); - superPane = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/sup.png")); - superPane.setPreferredSize(BUTTON_SIZE); - subPane = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/sub.png")); - subPane.setPreferredSize(BUTTON_SIZE); - Component[] SuperOrSubComponents = new Component[]{ - superPane, subPane - }; - isSuperOrSubPane = new JPanel(new BorderLayout()); - isSuperOrSubPane.add(GUICoreUtils.createFlowPane(SuperOrSubComponents, FlowLayout.LEFT, LayoutConstants.HGAP_SMALL)); - Component[] components_font = new Component[]{ - colorSelectPane, underline, isStrikethroughCheckBox, isShadowCheckBox - }; - buttonPane = new JPanel(new BorderLayout()); - buttonPane.add(GUICoreUtils.createFlowPane(components_font, FlowLayout.LEFT, LayoutConstants.HGAP_SMALL)); - linePane = new JPanel(new CardLayout()); + bold = new UIToggleButton(new LazyIcon("bold")); + italic = new UIToggleButton(new LazyIcon("italic")); + underline = new UIToggleButton(new LazyIcon("underline")); + isStrikethroughCheckBox = new UIToggleButton(new LazyIcon("strike")); + isShadowCheckBox = new UIToggleButton(new LazyIcon("shadow")); + superPane = new UIToggleButton(new LazyIcon("super")); + subPane = new UIToggleButton(new LazyIcon("sub")); + styleContainer = ReactiveCardPane.create() + .addSupplier("showLine", this::createContentWithLine) + .addSupplier("hideLine", this:: createContentNoLine); initAllNames(); setToolTips(); + initListeners(); + + styleContainer.select("hideLine").populate(); this.setLayout(new BorderLayout()); - this.add(createPane(), BorderLayout.CENTER); + this.add(Layouts.column(LayoutConstants.VERTICAL_GAP, + cell(fontNameComboBox), + row(5, + cell(fontSizeStyleComboBox).weight(1), + cell(fontSizeComboBox).weight(1)), + cell(styleContainer) + ).getComponent(), BorderLayout.CENTER); + DefaultValues defaultValues = FRContext.getDefaultValues(); populateBean(defaultValues.getFRFont()); } + private Component createContentNoLine() { + return createFontButtonRow().getComponent(); + } + + private Component createContentWithLine() { + return column(LayoutConstants.VERTICAL_GAP, + createFontButtonRow(), + cell(underlineCombo) + ).getComponent(); + } + + private Cell createFontButtonRow() { + return row(3, cell(colorSelectPane), cell(underline), cell(isStrikethroughCheckBox), cell(isShadowCheckBox), + cell(superPane), cell(subPane)); + } + private void initAllNames() { fontSizeStyleComboBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Style")); fontNameComboBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name")); @@ -312,63 +302,13 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse subPane.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Subscript")); } - - private JPanel createLinePane() { - linePane.add(new JPanel(), "none"); - JPanel gap = new JPanel(new GridLayout(0, 1)); - gap.add(underlineCombo); - linePane.add(gap, "combobox"); + private void initListeners() { underline.addChangeListener(new ChangeListener() { - @Override public void stateChanged(ChangeEvent e) { - CardLayout cly = (CardLayout) linePane.getLayout(); - cly.show(linePane, underline.isSelected() ? "combobox" : "none"); - if(underline.isSelected()){ - linePane.setPreferredSize(UNDER_LINE_SIZE); - }else{ - linePane.setPreferredSize(HIDE_SIZE); - } + styleContainer.select(underline.isSelected() ? "showLine" : "hideLine").populate(); } }); - - return linePane; - } - - private JPanel createLeftPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p}; - double[] rowSize = {p, p, p}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; - Component[][] components = new Component[][]{ - new Component[]{fontSizeStyleComboBox}, - new Component[]{buttonPane}, - new Component[]{createLinePane()} - }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); - } - - protected JPanel createRightPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {f}; - double[] rowSize = {p, p}; - int[][] rowCount = {{1, 1}, {1, 1}}; - Component[][] components = new Component[][]{ - new Component[]{fontSizeComboBox}, - new Component[]{isSuperOrSubPane} - }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); - } - - private JPanel createPane() { - JPanel createPane = new JPanel(new BorderLayout()); - createPane.add(fontNameComboBox, BorderLayout.NORTH); - JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{createLeftPane(), createRightPane()}}, TableLayoutHelper.FILL_LASTCOLUMN, hGapBetweenLeftPaneAndRightPane, LayoutConstants.VGAP_LARGE); - jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - createPane.add(jPanel, BorderLayout.CENTER); - return createPane; } /** @@ -388,53 +328,4 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse public void setGlobalName(String name) { } - private class TwoButtonPane extends JPanel { - public UIToggleButton leftButton; - public UIToggleButton rightButton; - - public TwoButtonPane(UIToggleButton leftButton, UIToggleButton rightButton) { - this.leftButton = leftButton; - this.rightButton = rightButton; - this.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0)); - this.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); - initButton(leftButton); - initButton(rightButton); - initListener(); - } - - private void initListener() { - leftButton.addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent e) { - rightButton.setSelected(false); - } - }); - rightButton.addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent e) { - leftButton.setSelected(false); - } - }); - } - - private void initButton(UIToggleButton button) { - button.setRoundBorder(false); - button.setBorderPainted(false); - this.add(button); - } - - - protected void paintBorder(Graphics g) { - Graphics2D g2d = (Graphics2D) g; - g2d.setColor(UIConstants.LINE_COLOR); - int buttonX = getComponent(0).getX(); - int buttonY = getComponent(0).getY(); - int height = getComponent(0).getHeight(); - int width = getComponent(0).getWidth(); - g.drawLine(buttonX + width, 0, buttonX + width, height); - width += getComponent(1).getWidth(); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - - g2d.drawRoundRect(buttonX - 1, buttonY - 1, width + 2, getHeight() - 1, UIConstants.ARC, UIConstants.ARC); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); - } - } } diff --git a/designer-base/src/main/java/com/fr/design/gui/style/TextFontTippedPane.java b/designer-base/src/main/java/com/fr/design/gui/style/TextFontTippedPane.java index 7f11b0d4b..0924eb7a7 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/TextFontTippedPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/TextFontTippedPane.java @@ -1,21 +1,21 @@ package com.fr.design.gui.style; +import com.fine.swing.ui.layout.Layouts; +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.Style; import com.fr.design.constants.LayoutConstants; -import com.fr.design.designer.IntervalConstants; 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.theme.edit.ui.LabelUtils; -import javax.swing.BorderFactory; +import javax.swing.SwingConstants; import javax.swing.JPanel; import javax.swing.JTextArea; import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; + +import static com.fine.swing.ui.layout.Layouts.cell; /** @@ -33,7 +33,7 @@ public class TextFontTippedPane extends AbstractBasicStylePane { private void initializePane(boolean showFormatTip) { setLayout(new BorderLayout()); - setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0)); + setBorder(new ScaledEmptyBorder(LayoutConstants.VERTICAL_GAP, 0, 0, 0)); fontPane = new FRFontPane(); this.add(createLabeledPane(Toolkit.i18nText("Fine-Design_Form_FR_Font"), fontPane), BorderLayout.NORTH); @@ -45,24 +45,21 @@ public class TextFontTippedPane extends AbstractBasicStylePane { } private JPanel createLabeledPane(String text, JPanel panel) { - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = { p }; - double[] columnSize = {p, f}; - UILabel uiLabel = new UILabel(text); - JPanel uiLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - uiLabelPane.add(uiLabel, BorderLayout.NORTH); - - return TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ - new Component[] { uiLabelPane, panel }, - }, rowSize, columnSize, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); + return Layouts.row( + cell(uiLabel).with(it -> { + it.setVerticalAlignment(SwingConstants.TOP); + it.setBorder(new ScaledEmptyBorder(5, 0, 0, 0)); + }).weight(1), + cell(panel).weight(3) + ).getComponent(); } private JPanel createFormatTipPane() { JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); - container.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0)); - JTextArea formatMigratedTip = LabelUtils.createAutoWrapLabel(Toolkit.i18nText("Fine-Design_Report_Format_Style_Migrated_Tip"), new Color(153, 153, 153)); + container.setBorder(new ScaledEmptyBorder(LayoutConstants.VERTICAL_GAP, 0, 0, 0)); + JTextArea formatMigratedTip = LabelUtils.createAutoWrapLabel(Toolkit.i18nText("Fine-Design_Report_Format_Style_Migrated_Tip"), + FineUIUtils.getUIColor("Label.tipColor", "inactiveCaption")); container.add(formatMigratedTip, BorderLayout.NORTH); return container; diff --git a/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java b/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java index 27ae3d04b..790208bb6 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java @@ -1,5 +1,9 @@ package com.fr.design.gui.style; +import com.fine.swing.ui.layout.Column; +import com.fine.swing.ui.layout.Layouts; +import com.fine.swing.ui.layout.Row; +import com.fine.theme.utils.FineUIUtils; import com.fr.base.CoreDecimalFormat; import com.fr.base.GraphHelper; import com.fr.base.Style; @@ -7,10 +11,12 @@ import com.fr.base.TextFormat; import com.fr.data.core.FormatField; import com.fr.data.core.FormatField.FormatContents; import com.fr.design.border.UIRoundedBorder; +import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.core.ReactiveCardPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.TextFontComboBox; import com.fr.design.gui.icombobox.UIComboBox; @@ -21,17 +27,14 @@ import com.fr.general.ComparatorUtils; import com.fr.stable.StringUtils; import javax.swing.BorderFactory; -import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JList; -import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.border.Border; import javax.swing.border.TitledBorder; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; -import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.event.ItemEvent; @@ -40,6 +43,10 @@ import java.math.RoundingMode; import java.text.Format; import java.text.SimpleDateFormat; +import static com.fine.swing.ui.layout.Layouts.Cell; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + /** * @author Starryi * @version 1.0 @@ -72,6 +79,7 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName private boolean isRightFormat; private boolean isDate = false; private GlobalNameListener globalNameListener = null; + protected ReactiveCardPane cardPane; public TextFormatPane() { @@ -81,10 +89,6 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName initPreviewLabel4GeneralFormat(); initLayout(); - - setTextFieldVisible(false); - setRoundingBoxVisible(false); - setPreviewLabelVisible(false); } private void initFormatTypesComboBox() { @@ -103,21 +107,15 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName private void initRoundingCheckBox4PercentFormat() { roundingBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Base_Option_Half_Up")); - roundingBox.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); - roundingBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - } - }); roundingBox.setGlobalName("roundingBox"); } private void initPreviewLabel4GeneralFormat() { - Border interBorder = new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 4); + Color labelColor = FineUIUtils.getUIColor("Label.tipColor", "inactiveCaption"); + Border interBorder = new UIRoundedBorder(UIConstants.LINE_COLOR, 0, 4); String title = Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample"); - Border border = BorderFactory.createTitledBorder(interBorder, title, TitledBorder.LEFT, 0, null, UIConstants.LINE_COLOR); + Border border = BorderFactory.createTitledBorder(interBorder, title, TitledBorder.ABOVE_TOP, 0, null, labelColor); previewLabel = new UILabel(FormatField.getInstance().getFormatValue()) { - @Override public void paint(Graphics g) { super.paint(g); @@ -125,7 +123,7 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName Color original = g.getColor(); g.setColor(getBackground()); g.fillRect(LABEL_X, LABEL_Y, width - LABEL_DELTA_WIDTH, LABEL_HEIGHT); - g.setColor(UIConstants.LINE_COLOR); + g.setColor(labelColor); FontMetrics cellFM = g.getFontMetrics(); int textWidth = cellFM.stringWidth(getText()); GraphHelper.drawString(g, getText(), (width - textWidth) / 2F, 26); @@ -137,43 +135,42 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName } protected void initLayout() { - JPanel labeledFormatTypeComboBoxPane = new JPanel(new BorderLayout(20, 0)); - labeledFormatTypeComboBoxPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format")), BorderLayout.WEST); - labeledFormatTypeComboBoxPane.add(typeComboBox, BorderLayout.CENTER); - - JPanel labeledRoundingCheckboxPane = new JPanel(new BorderLayout(0, 0)); - labeledRoundingCheckboxPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Option")), BorderLayout.WEST); - labeledRoundingCheckboxPane.add(roundingBox, BorderLayout.CENTER); - - addComponents(4, new JComponent[] { labeledFormatTypeComboBoxPane, textField, labeledRoundingCheckboxPane, previewLabel}); - } - - protected void setTextFieldVisible(boolean visible) { - textField.setVisible(visible); - } - - protected void setRoundingBoxVisible(boolean visible) { - roundingBox.getParent().setVisible(visible); - } - - protected void setPreviewLabelVisible(boolean visible) { - previewLabel.setVisible(visible); - } - - protected void addComponents(int gap, JComponent[] components) { - JPanel container = this; - container.setLayout(new BorderLayout(0, gap)); - for (JComponent component: components) { - if (component != null) { - container.add(component, BorderLayout.NORTH); - JPanel nextContainer = new JPanel(new BorderLayout(0, gap)); - container.add(nextContainer, BorderLayout.CENTER); - container = nextContainer; - } - } - if (container.getComponentCount() == 0) { - container.getParent().remove(container); - } + this.setLayout(new BorderLayout()); + cardPane = ReactiveCardPane.create() + .addSupplier("normal", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, + createTypeRow() + ).getComponent()) + .addSupplier("preview", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, + createTypeRow(), + createPreviewRow() + ).getComponent()) + .addSupplier("previewAndCheck", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, + createTypeRow(), + createPreviewRow(), + createRoundBoxRow() + ).getComponent()); + cardPane.select("normal").populate(); + this.add(cardPane); + } + + private Cell createTypeRow() { + return row( + cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format"))).weight(1.2), + cell(typeComboBox).weight(3) + ); + } + + private Cell createRoundBoxRow() { + return row( + cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Option"))).weight(1.2), + cell(roundingBox).with(it -> it.setBorder(null)).weight(3) + ); + } + + private Cell createPreviewRow() { + return row( + cell(previewLabel).weight(1) + ); } protected UIComboBoxRenderer createComBoxRender() { @@ -189,18 +186,6 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName }; } - - @Override - /** - * 得到合适的大小 - */ - public Dimension getPreferredSize() { - if (this.typeComboBox.getSelectedIndex() == FormatContents.NULL) { - return typeComboBox.getPreferredSize(); - } - return super.getPreferredSize(); - } - /** * 弹出框标题 * @@ -329,6 +314,11 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName return contents == FormatContents.TEXT || contents == FormatContents.NULL; } + private boolean isRoundFormat() { + int contents = getFormatContents(); + return contents == FormatContents.PERCENT || contents == FormatContents.THOUSANDTHS; + } + /** * Radio selection listener. */ @@ -338,16 +328,16 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { int contents = getFormatContents(); - + Column contentContainer; if (!isTextOrNull()) { textField.removeAllItems(); String[] items = FormatField.getInstance().getFormatArray(contents, false); textField.setItemArray(items); textField.setSelectedIndex(0); + cardPane.select(isRoundFormat() ? "previewAndCheck" : "preview").populate(); + } else { + cardPane.select("normal").populate(); } - setTextFieldVisible(!isTextOrNull()); - setPreviewLabelVisible(!isTextOrNull()); - setRoundingBoxVisible(getFormatContents() == FormatContents.PERCENT || getFormatContents() == FormatContents.THOUSANDTHS); } } @@ -363,17 +353,11 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName }; @Override - /** - * populate - */ public void populateBean(Style style) { this.populateBean(style.getFormat()); } @Override - /** - * update - */ public Style update(Style style) { return updateByGlobalNamedSetting(style); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 14a8f216f..acf32c4ef 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -79,14 +79,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private FixedPopupPane currentPopupPane; private UIButton currentButton; private static final int CONTAINER_WIDTH = containerWidth(); - private static final int TAB_WIDTH = 42; - private static final int TAB_BUTTON_WIDTH = 40; - private static final int TAB_BUTTON_HEIGHT = 40; + private static final int TAB_WIDTH = FineUIScale.scale(42); + private static final int TAB_BUTTON_WIDTH = FineUIScale.scale(40); + private static final int TAB_BUTTON_HEIGHT = FineUIScale.scale(40); private static final int CONTENT_WIDTH = CONTAINER_WIDTH - TAB_WIDTH; - private static final int ARROW_RANGE_START = CONTENT_WIDTH - 30; + private static final int ARROW_RANGE_START = CONTENT_WIDTH - FineUIScale.scale(30); // 弹出对话框高度 - private static final int POPUP_MIN_HEIGHT = 145; - private static final int POPUP_DEFAULT_HEIGHT = 356; + private static final int POPUP_MIN_HEIGHT = FineUIScale.scale(145); + private static final int POPUP_DEFAULT_HEIGHT = FineUIScale.scale(356); public static final String KEY_CELL_ELEMENT = "cellElement"; public static final String KEY_CELL_ATTR = "cellAttr"; public static final String KEY_FLOAT_ELEMENT = "floatElement"; @@ -416,14 +416,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer { // 左侧按钮面板 private void initLeftPane() { leftPane = new JPanel(); - leftPane.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 1, 0)); + leftPane.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0)); for (PropertyItem item : propertyItemMap.values()) { if (item.isPoppedOut() || !item.isVisible()) { continue; } leftPane.add(item.getButton()); } - leftPane.setBorder(new FlatLineBorder(new Insets(0,0,0,0), UIManager.getColor("East.border"))); + leftPane.setBorder(new FlatLineBorder(new Insets(0,1,0,1), UIManager.getColor("East.border"))); replaceLeftPane(leftPane); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/GradientBackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/GradientBackgroundQuickPane.java index 6c3ea9e72..176cd9b8c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/GradientBackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/GradientBackgroundQuickPane.java @@ -1,20 +1,20 @@ package com.fr.design.mainframe.backgroundpane; +import com.fine.swing.ui.layout.Layouts; import com.fr.base.background.GradientBackground; +import com.fr.design.constants.LayoutConstants; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.style.background.gradient.GradientBar; import com.fr.general.Background; -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; + /** * @author zhou * @since 2012-5-30上午10:36:21 @@ -39,24 +39,17 @@ public class GradientBackgroundQuickPane extends BackgroundQuickPane { } private void constructPane(){ - String[] textArray = {com.fr.design.i18n.Toolkit.i18nText("FIne-Design_Report_Utils_Left_To_Right"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Top_To_Bottom")}; + String[] textArray = {com.fr.design.i18n.Toolkit.i18nText("FIne-Design_Report_Utils_Left_To_Right"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Top_To_Bottom")}; Integer[] valueArray = {GradientBackground.LEFT2RIGHT, GradientBackground.TOP2BOTTOM}; - directionPane = new UIButtonGroup(textArray, valueArray); + directionPane = new UIButtonGroup<>(textArray, valueArray); directionPane.setSelectedIndex(0); gradientBar = new GradientBar(4, this.gradientBarWidth); - - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, f}; - double[] rowSize = {p, p,}; - - Component[][] components = new Component[][]{ - new Component[]{gradientBar, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Gradient_Direction")), directionPane} - }; - JPanel Gradient = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); this.setLayout(new BorderLayout()); - this.add(Gradient, BorderLayout.CENTER); + this.add(Layouts.column(LayoutConstants.VERTICAL_GAP, + cell(gradientBar), + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Gradient_Direction"))).weight(1), cell(directionPane).weight(2)) + ).getComponent(), BorderLayout.CENTER); } public void populateBean(Background background) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java index 8f4c2ecfb..789bcd16c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java @@ -1,15 +1,16 @@ package com.fr.design.mainframe.backgroundpane; +import com.fine.swing.ui.layout.Layouts; +import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.GraphHelper; import com.fr.base.background.PatternBackground; -import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; import com.fr.design.event.UIObserverListener; 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.style.color.ColorSelectBox; import com.fr.general.Background; @@ -22,6 +23,9 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.geom.Rectangle2D; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + /** * @author zhou * @since 2012-5-29下午1:12:33 @@ -29,7 +33,6 @@ import java.awt.geom.Rectangle2D; public class PatternBackgroundQuickPane extends BackgroundQuickPane { private int patternIndex = 0; // pattern setIndex. - private final static int DEFAULT_DIM_HEIGHT = 210; private final static Color DEFAULT_FOREGROUND = Color.lightGray; private final static Color DEFAULT_BACKGROUND = Color.black; private ColorSelectBox foregroundColorPane; @@ -40,11 +43,11 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane { this.setLayout(new BorderLayout(0, 4)); JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); this.add(contentPane, BorderLayout.NORTH); - contentPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5)); + contentPane.setBorder(new FineRoundBorder()); JPanel typePane2 = new JPanel(); contentPane.add(typePane2); typePane2.setLayout(new GridLayout(0, 8, 1, 1)); - typePane2.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8)); + typePane2.setBorder(new ScaledEmptyBorder(8, 8, 8, 8)); ButtonGroup patternButtonGroup = new ButtonGroup(); patternButtonArray = new PatternButton[PatternBackground.PATTERN_COUNT]; for (int i = 0; i < PatternBackground.PATTERN_COUNT; i++) { @@ -52,41 +55,22 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane { patternButtonGroup.add(patternButtonArray[i]); typePane2.add(patternButtonArray[i]); } - foregroundColorPane = new ColorSelectBox(60); - backgroundColorPane = new ColorSelectBox(60); + foregroundColorPane = new ColorSelectBox(FineUIScale.scale(60)); + backgroundColorPane = new ColorSelectBox(FineUIScale.scale(60)); foregroundColorPane.setSelectObject(DEFAULT_FOREGROUND); foregroundColorPane.setSelectObject(DEFAULT_BACKGROUND); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - Component[][] components = new Component[][]{ - new Component[]{null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Foreground"), UILabel.LEFT), foregroundColorPane}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), UILabel.LEFT), backgroundColorPane}, - }; - double[] rowSize = {p, p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; - JPanel colorPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_LARGE); - this.add(colorPane, BorderLayout.CENTER); + this.add(Layouts.column(LayoutConstants.VERTICAL_GAP, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Foreground"), UILabel.LEFT)).weight(1), + cell(foregroundColorPane).weight(4)), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), UILabel.LEFT)).weight(1), + cell(backgroundColorPane).weight(4)) + ).with(it -> it.setBorder(new ScaledEmptyBorder(LayoutConstants.VERTICAL_GAP, 0, 0, 0))).getComponent(), BorderLayout.CENTER); foregroundColorPane.addSelectChangeListener(colorChangeListener); backgroundColorPane.addSelectChangeListener(colorChangeListener); } - @Override - public Dimension getPreferredSize() { - Dimension dim = super.getPreferredSize(); - dim.height = DEFAULT_DIM_HEIGHT; - return dim; - } - - private JPanel createLabelColorPane(String text, JComponent colorPane) { - JPanel labelColorPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); - labelColorPane.add(new UILabel(text)); - labelColorPane.add(colorPane); - - return labelColorPane; - } - public void populateBean(Background background) { PatternBackground patternBackground = (PatternBackground) background; int patternIndex = patternBackground.getPatternIndex(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java index b3362e5fb..d57ab7f30 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.theme; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.settings.ThemedCellStyle; import com.fr.design.beans.FurtherBasicBeanPane; @@ -54,7 +55,7 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane implements Previewable, UIObserver { /** * richer:数据字典和数据链面板 */ - private static final int GAP_HUGER = 32; protected com.fr.data.impl.Connection database; protected DoubleDeckValueEditorPane keyColumnPane; protected DoubleDeckValueEditorPane valueDictPane; @@ -60,31 +62,32 @@ public class DatabaseDictPane extends FurtherBasicBeanPane i private void initBasicComponet() { -// keyColumnPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()}); keyColumnPane = new DoubleDeckValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()}); FormulaEditor formulaEditor = new FormulaEditor(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_Parameter_Formula")); formulaEditor.setEnabled(true); -// valueDictPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor}); valueDictPane = new DoubleDeckValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor}); } private void initComponet() { chooseTable = new VerticalChoosePane(this); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, f}; - double[] rowSize = {p, p, p, p, p}; - int[][] rowCount = {{1, 1}, {1, 3}, {1, 3}}; - - Component[][] components = new Component[][]{ - new Component[]{null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Actual_Value"), UILabel.LEFT), keyColumnPane}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Display_Value"), UILabel.LEFT), valueDictPane} - }; - JPanel dbDictPanel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, GAP_HUGER, LayoutConstants.VGAP_LARGE); - this.setLayout(new BorderLayout(0, 4)); - this.add(chooseTable, BorderLayout.NORTH); - this.add(dbDictPanel, BorderLayout.CENTER); + this.setLayout(new BorderLayout()); + this.add(Layouts.column(LayoutConstants.VERTICAL_GAP, + cell(chooseTable), + row( + column(LayoutConstants.VERTICAL_GAP, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Actual_Value"), UILabel.LEFT)).weight(1), + flex(1) + ).weight(1), + cell(keyColumnPane).weight(2) + ), + row( + column(LayoutConstants.VERTICAL_GAP, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Display_Value"), UILabel.LEFT)).weight(1), + flex(1) + ).weight(1), + cell(valueDictPane).weight(2) + ) + ).getComponent(), BorderLayout.CENTER); } diff --git a/designer-base/src/main/java/com/fr/design/present/dict/DictionaryPane.java b/designer-base/src/main/java/com/fr/design/present/dict/DictionaryPane.java index 94e4b3f0f..cfa9439d3 100644 --- a/designer-base/src/main/java/com/fr/design/present/dict/DictionaryPane.java +++ b/designer-base/src/main/java/com/fr/design/present/dict/DictionaryPane.java @@ -1,5 +1,6 @@ package com.fr.design.present.dict; +import com.fine.swing.ui.layout.Layouts; import com.fr.data.Dictionary; import com.fr.data.impl.DynamicSQLDict; import com.fr.design.beans.FurtherBasicBeanPane; @@ -8,8 +9,6 @@ import com.fr.design.data.DataCreatorUI; import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import javax.swing.*; @@ -17,6 +16,9 @@ import java.awt.*; 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.row; + /** * @author zhou * @since 2012-5-31下午12:20:41 @@ -29,20 +31,14 @@ public class DictionaryPane extends UIComboBoxPane implements DataCr @Override protected void initLayout() { - this.setLayout(new BorderLayout(0, 4)); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, f}; - double[] rowSize = {p, p}; - int[][] rowCount = {{1, 1}, {1, 1}}; - - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Type_Set"), UILabel.LEFT), jcb}, - new Component[]{null, null} - }; - JPanel northPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_HUGER, LayoutConstants.VGAP_MEDIUM); - this.add(northPane, BorderLayout.NORTH); - this.add(cardPane, BorderLayout.CENTER); + this.setLayout(new BorderLayout()); + this.add(Layouts.column(LayoutConstants.VERTICAL_GAP, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Type_Set"), UILabel.LEFT)).weight(1), + cell(jcb).weight(2) + ), + cell(cardPane) + ).getComponent()); } @Override diff --git a/designer-base/src/main/java/com/fr/design/present/dict/FormulaDictPane.java b/designer-base/src/main/java/com/fr/design/present/dict/FormulaDictPane.java index 2eca81466..c3083dc0c 100644 --- a/designer-base/src/main/java/com/fr/design/present/dict/FormulaDictPane.java +++ b/designer-base/src/main/java/com/fr/design/present/dict/FormulaDictPane.java @@ -1,5 +1,6 @@ package com.fr.design.present.dict; +import com.fine.theme.icon.LazyIcon; import com.fr.base.BaseFormula; import com.fr.base.BaseUtils; import com.fr.data.impl.FormulaDictionary; @@ -34,8 +35,7 @@ public class FormulaDictPane extends FurtherBasicBeanPane { keyFormulaEditor.setColumns(EDITOR_COLUMN); JPanel keyFormulaContainer = new JPanel(new FlowLayout(FlowLayout.RIGHT, LEFT_BORDER, 0)); keyFormulaContainer.setBorder(BorderFactory.createEmptyBorder(0, -LEFT_BORDER, 0, -LEFT_BORDER)); - keyFormulaEditor.setPreferredSize(new Dimension(144, 20)); - Icon icon = BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png"); + Icon icon = new LazyIcon("formula"); keyFormulaContainer.add(new JLabel(icon)); keyFormulaContainer.add(keyFormulaEditor); @@ -50,7 +50,6 @@ public class FormulaDictPane extends FurtherBasicBeanPane { UILabel tag = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_Dictionary_Display_Examples_Html")); tag.setForeground(new Color(143, 143, 146)); - tag.setPreferredSize(new Dimension(225, 80)); JPanel t = new JPanel(new BorderLayout()); t.add(tag, BorderLayout.CENTER); @@ -59,7 +58,6 @@ public class FormulaDictPane extends FurtherBasicBeanPane { JPanel valueFormulaContainer = new JPanel(new FlowLayout(FlowLayout.RIGHT, LEFT_BORDER, 0)); valueFormulaContainer.setBorder(BorderFactory.createEmptyBorder(0, -LEFT_BORDER, 0, -LEFT_BORDER)); - valueFormulaEditor.setPreferredSize(new Dimension(144, 20)); valueFormulaContainer.add(new JLabel(icon)); valueFormulaContainer.add(valueFormulaEditor); diff --git a/designer-base/src/main/java/com/fr/design/present/dict/TableDataDictPane.java b/designer-base/src/main/java/com/fr/design/present/dict/TableDataDictPane.java index 5ebd42659..a651bbdbc 100644 --- a/designer-base/src/main/java/com/fr/design/present/dict/TableDataDictPane.java +++ b/designer-base/src/main/java/com/fr/design/present/dict/TableDataDictPane.java @@ -1,5 +1,6 @@ package com.fr.design.present.dict; +import com.fine.swing.ui.layout.Layouts; import com.fr.base.BaseFormula; import com.fr.base.TableData; import com.fr.data.TableDataSource; @@ -27,24 +28,20 @@ import com.fr.design.editor.editor.FormulaEditor; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; -import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; import javax.swing.JFrame; import javax.swing.JPanel; -import javax.swing.SwingWorker; 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.concurrent.ExecutionException; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; /** * 数据字典的数据查询面板 @@ -55,9 +52,7 @@ import java.util.concurrent.ExecutionException; public class TableDataDictPane extends FurtherBasicBeanPane implements Previewable, UIObserver, Prepare4DataSourceChange { private static final int BEGIN = 1; private static final int END = 10; - private static final int VGAP = 24; private static final long serialVersionUID = -5469742115988153206L; - private static final int SELECTED_NO_TABLEDATA = -2; public TableDataComboBox tableDataNameComboBox; private DoubleDeckValueEditorPane keyColumnPane; private DoubleDeckValueEditorPane valueDictPane; @@ -89,35 +84,32 @@ public class TableDataDictPane extends FurtherBasicBeanPane tdChange(e); } }); -// keyColumnPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()}); keyColumnPane = new DoubleDeckValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()}); FormulaEditor formulaEditor = new FormulaEditor(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter_Formula")); formulaEditor.setEnabled(true); -// valueDictPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor}); valueDictPane = new DoubleDeckValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor}); } private void initComponents() { - - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, f}; - double[] rowSize = {p, p, p, p, p}; - int[][] rowCount = {{1, 1}, {1, 3}, {1, 3}}; - JPanel firstLine = new JPanel(new BorderLayout(4, 0)); firstLine.add(tableDataNameComboBox, BorderLayout.CENTER); firstLine.add(new PreviewLabel(this), BorderLayout.EAST); - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Table_Data") + " ", UILabel.LEFT), firstLine}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Actual_Value") + " ", UILabel.LEFT), keyColumnPane}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Display_Value") + " ", UILabel.LEFT), valueDictPane}, - }; - - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, VGAP, LayoutConstants.VGAP_MEDIUM); this.setLayout(new BorderLayout()); - this.add(panel, BorderLayout.CENTER); + this.add(Layouts.column(LayoutConstants.VERTICAL_GAP, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Table_Data"), UILabel.LEFT)).weight(1), + cell(firstLine).weight(2) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Actual_Value"), UILabel.LEFT)).weight(1), + cell(keyColumnPane).weight(2) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Display_Value"), UILabel.LEFT)).weight(1), + cell(valueDictPane).weight(2) + ) + ).getComponent(), BorderLayout.CENTER); } @@ -195,9 +187,6 @@ public class TableDataDictPane extends FurtherBasicBeanPane } @Override - /** - * - */ public void populateBean(TableDataDictionary tableDataDict) { populate(tableDataDict, ""); } diff --git a/designer-base/src/main/resources/com/fine/theme/icon/cellelement.svg b/designer-base/src/main/resources/com/fine/theme/icon/cellelement.svg new file mode 100644 index 000000000..0f4624457 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/cellelement.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/cellelement_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/cellelement_disable.svg new file mode 100644 index 000000000..c4f26a528 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/cellelement_disable.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/close/close.svg b/designer-base/src/main/resources/com/fine/theme/icon/close/close.svg new file mode 100755 index 000000000..3b296b0df --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/close/close.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/close/close_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/close/close_disable.svg new file mode 100755 index 000000000..b193f3321 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/close/close_disable.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/close/close_round.svg b/designer-base/src/main/resources/com/fine/theme/icon/close/close_round.svg new file mode 100755 index 000000000..280c99d21 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/close/close_round.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/close/close_round_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/close/close_round_disable.svg new file mode 100755 index 000000000..1512a9aff --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/close/close_round_disable.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/font/add_parenthesis.svg b/designer-base/src/main/resources/com/fine/theme/icon/font/add_parenthesis.svg new file mode 100644 index 000000000..fd415fcb5 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/font/add_parenthesis.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/font/add_parenthesis_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/font/add_parenthesis_disable.svg new file mode 100644 index 000000000..ac60d55fe --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/font/add_parenthesis_disable.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/font/remove_parenthesis.svg b/designer-base/src/main/resources/com/fine/theme/icon/font/remove_parenthesis.svg new file mode 100644 index 000000000..72c7c4ae3 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/font/remove_parenthesis.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/font/remove_parenthesis_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/font/remove_parenthesis_disable.svg new file mode 100644 index 000000000..538bb9d9a --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/font/remove_parenthesis_disable.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/font/shadow.svg b/designer-base/src/main/resources/com/fine/theme/icon/font/shadow.svg new file mode 100644 index 000000000..893dd6905 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/font/shadow.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/font/shadow_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/font/shadow_disable.svg new file mode 100644 index 000000000..1db03fefa --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/font/shadow_disable.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/font/strike.svg b/designer-base/src/main/resources/com/fine/theme/icon/font/strike.svg new file mode 100644 index 000000000..36ea144a5 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/font/strike.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/font/strike_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/font/strike_disable.svg new file mode 100644 index 000000000..77be0838e --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/font/strike_disable.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/font/sub.svg b/designer-base/src/main/resources/com/fine/theme/icon/font/sub.svg new file mode 100644 index 000000000..71f1a3caa --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/font/sub.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/font/sub_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/font/sub_disable.svg new file mode 100644 index 000000000..559755ab6 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/font/sub_disable.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/font/super.svg b/designer-base/src/main/resources/com/fine/theme/icon/font/super.svg new file mode 100644 index 000000000..9ee840c36 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/font/super.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/font/super_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/font/super_disable.svg new file mode 100644 index 000000000..4e07a44a8 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/font/super_disable.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/select.svg b/designer-base/src/main/resources/com/fine/theme/icon/select.svg new file mode 100644 index 000000000..7eb7a4ee4 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/select.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/select_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/select_disable.svg new file mode 100644 index 000000000..9a9ab1d2b --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/select_disable.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/sort/fill/nosort.svg b/designer-base/src/main/resources/com/fine/theme/icon/sort/fill/nosort.svg new file mode 100644 index 000000000..a23aaa88b --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/sort/fill/nosort.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/sort/fill/sort_asc.svg b/designer-base/src/main/resources/com/fine/theme/icon/sort/fill/sort_asc.svg new file mode 100644 index 000000000..a91d50701 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/sort/fill/sort_asc.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/sort/fill/sort_desc.svg b/designer-base/src/main/resources/com/fine/theme/icon/sort/fill/sort_desc.svg new file mode 100644 index 000000000..cb9b5d390 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/sort/fill/sort_desc.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/sort/nosort.svg b/designer-base/src/main/resources/com/fine/theme/icon/sort/nosort.svg new file mode 100644 index 000000000..29fdee5e2 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/sort/nosort.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/sort/nosort_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/sort/nosort_disable.svg new file mode 100644 index 000000000..446eb9106 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/sort/nosort_disable.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/sort/sort_asc.svg b/designer-base/src/main/resources/com/fine/theme/icon/sort/sort_asc.svg new file mode 100644 index 000000000..31d9cac71 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/sort/sort_asc.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/sort/sort_asc_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/sort/sort_asc_disable.svg new file mode 100644 index 000000000..2b7f11e78 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/sort/sort_asc_disable.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/sort_asc.svg b/designer-base/src/main/resources/com/fine/theme/icon/sort/sort_desc.svg similarity index 100% rename from designer-base/src/main/resources/com/fine/theme/icon/toolbar/sort_asc.svg rename to designer-base/src/main/resources/com/fine/theme/icon/sort/sort_desc.svg diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/sort_asc_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/sort/sort_desc_disable.svg similarity index 100% rename from designer-base/src/main/resources/com/fine/theme/icon/toolbar/sort_asc_disable.svg rename to designer-base/src/main/resources/com/fine/theme/icon/sort/sort_desc_disable.svg 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 d0241bc58..51b2c5278 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 @@ -49,6 +49,7 @@ Component.defaultVGap=10 @BrandHoverColor = #5493F2 @BrandPressedColor = #105DD1 @BrandHoverColorSP = #2576EF 12% +@BrandTipColor = #0a1c3877 @marginSmall = 4 @marginLarge = 10 @@ -139,7 +140,7 @@ tooltip.disabled=#A3ADBD #---- Button ---- Button.border = com.formdev.flatlaf.ui.FlatButtonBorder -Button.arc = 3 +Button.arc = 6 Button.minimumWidth = 72 Button.margin = 2,12,2,12 Button.iconTextGap = 4 @@ -354,6 +355,9 @@ FormattedTextField.selectionBackground=$color.brand4 FormattedTextField.placeholderForeground = @disabledForeground FormattedTextField.iconTextGap = 4 +# ---- Label ---- +Label.tipColor = @BrandTipColor + #---- HelpButton ---- HelpButton.questionMarkColor = @accentCheckmarkColor @@ -993,7 +997,6 @@ ToggleButton.margin = $Button.margin ToggleButton.compact.margin = 2,0,2,0 ToggleButton.iconTextGap = $Button.iconTextGap ToggleButton.rollover = $Button.rollover - ToggleButton.background = $Button.background ToggleButton.pressedBackground = @BrandPressedColor ToggleButton.selectedBackground = @BrandColor @@ -1112,7 +1115,7 @@ Tree.hash = darken($Tree.background,10%) West.border = $defaultBorderColor #---- ExpandablePane ---- ExpandablePane.HeaderPane.borderInsets=0, 6, 0, 6 -ExpandablePane.HeaderPane.hGap=2 +ExpandablePane.HeaderPane.hGap=0 ExpandablePane.HeaderPane.foreground=$text.highlight ExpandablePane.vGap=5 HeaderPane.width=248 diff --git a/designer-realize/src/main/java/com/fr/design/expand/ExpandFatherPane.java b/designer-realize/src/main/java/com/fr/design/expand/ExpandFatherPane.java index de0580edb..5a32b0e61 100644 --- a/designer-realize/src/main/java/com/fr/design/expand/ExpandFatherPane.java +++ b/designer-realize/src/main/java/com/fr/design/expand/ExpandFatherPane.java @@ -1,10 +1,12 @@ package com.fr.design.expand; -import com.fr.base.BaseUtils; +import com.fine.swing.ui.layout.Layouts; +import com.fine.theme.icon.LazyIcon; import com.fr.design.constants.LayoutConstants; import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; import com.fr.design.gui.columnrow.ColumnRowPane; +import com.fr.design.gui.core.ReactiveCardPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.mainframe.ElementCasePane; @@ -20,8 +22,8 @@ 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 static com.fine.swing.ui.layout.Layouts.cell; public abstract class ExpandFatherPane extends JPanel implements GlobalNameObserver { @@ -33,24 +35,15 @@ public abstract class ExpandFatherPane extends JPanel implements GlobalNameObser private String expandFatherName = ""; private GlobalNameListener globalNameListener = null; private boolean isAlreadyAddListener = false; - public JPanel customPane; - private CardLayout cardLayout; + private ReactiveCardPane cardPane; public ExpandFatherPane() { - this.setLayout(new BorderLayout(0, LayoutConstants.VGAP_SMALL)); + this.setLayout(new BorderLayout()); comboBox = new UIComboBox(new String[]{ com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_None"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom")}); - cardLayout = new CardLayout(); - customPane = new JPanel(cardLayout); customParentColumnRowPane = new ColumnRowPane() { - - @Override - public Dimension getPreferredSize() { - return new Dimension(super.getPreferredSize().width, 20); - } - public void setGlobalName() { if (shouldResponseNameListener()) { globalNameListener.setGlobalName(expandFatherName); @@ -58,54 +51,31 @@ public abstract class ExpandFatherPane extends JPanel implements GlobalNameObser } }; - UIButton imageButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/buttonicon/select.png")); - imageButton.setPreferredSize(new Dimension(24, 20)); + UIButton imageButton = new UIButton(new LazyIcon("select")); JPanel cc = new JPanel(new BorderLayout(LayoutConstants.HGAP_SMALL, 0)); cc.add(customParentColumnRowPane, BorderLayout.CENTER); cc.add(imageButton, BorderLayout.EAST); - customPane.add(cc, "content"); - customPane.add(new JPanel(), "none"); - customPane.setPreferredSize(new Dimension(0, 0)); - this.add(comboBox, BorderLayout.NORTH); - this.add(customPane, BorderLayout.CENTER); - - comboBox.addItemListener(new ItemListener() { - - @Override - public void itemStateChanged(ItemEvent e) { - if (comboBox.getSelectedIndex() == 2) { - customPane.setPreferredSize(new Dimension(100, 20)); - cardLayout.show(customPane, "content"); - } else { - cardLayout.show(customPane, "none"); - customPane.setPreferredSize(new Dimension(0, 0)); - } -// cardLayout.show(customPane, comboBox.getSelectedIndex() == 2 ? "content" : "none"); - if (globalNameListener != null && shouldResponseNameListener()) { - globalNameListener.setGlobalName(expandFatherName); - } - } - }); - imageButton.addActionListener(imageActionListener); - comboBox.setSelectedIndex(1); - } - - ItemListener comboBoxItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { + cardPane = ReactiveCardPane.create() + .addSupplier("content", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, + cell(comboBox), + cell(cc)).getComponent()) + .addSupplier("none", () -> Layouts.cell(comboBox).getComponent()); + cardPane.select("none").populate(); + this.add(cardPane); + comboBox.addItemListener(e -> { if (comboBox.getSelectedIndex() == 2) { - customPane.setPreferredSize(new Dimension(100, 20)); - cardLayout.show(customPane, "content"); + cardPane.select("content").populate(); } else { - cardLayout.show(customPane, "none"); - customPane.setPreferredSize(new Dimension(0, 0)); + cardPane.select("none").populate(); + } -// cardLayout.show(customPane, comboBox.getSelectedIndex() == 2 ? "content" : "none"); if (globalNameListener != null && shouldResponseNameListener()) { globalNameListener.setGlobalName(expandFatherName); } - } - }; + }); + imageButton.addActionListener(imageActionListener); + comboBox.setSelectedIndex(1); + } ActionListener imageActionListener = new ActionListener() { @Override diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/AbstractAttrPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/AbstractAttrPane.java index 82d6484e2..ea888a0b6 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/AbstractAttrPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/AbstractAttrPane.java @@ -1,9 +1,9 @@ package com.fr.design.mainframe; +import com.fine.theme.utils.FineUIScale; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.iscrollbar.UIScrollBar; -import javax.swing.*; import java.awt.*; import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; @@ -15,15 +15,12 @@ import java.awt.event.MouseWheelListener; * 几点:子类不需要写构造函数了,所有的组件都放在createContentPane()方法生成的pane里面,它不需要考虑border。 */ public abstract class AbstractAttrPane extends AbstractAttrNoScrollPane { - private static final int MAXVALUE = 100; - private static final int TITLE_HEIGHT = 50; - private static final int MOUSE_WHEEL_SPEED = 5; - private static final int CONTENTPANE_WIDTH_GAP = 4; - private static final int SCROLLBAR_WIDTH = 8; - private int maxHeight = 280; - private int beginY = 0; + private static final int MAXVALUE = FineUIScale.scale(100); + private static final int TITLE_HEIGHT = FineUIScale.scale(50); + private static final int MOUSE_WHEEL_SPEED = 5; + private int maxHeight = FineUIScale.scale(280); - private UIScrollBar scrollBar; + private final UIScrollBar scrollBar; public AbstractAttrPane() { this.setLayout(new BarLayout()); @@ -98,21 +95,16 @@ public abstract class AbstractAttrPane extends AbstractAttrNoScrollPane { @Override public void layoutContainer(Container parent) { maxHeight = getMaxHeight(); - if ((MAXVALUE - scrollBar.getVisibleAmount()) == 0) { - beginY = 0; - } else { + int beginY = 0; + if ((MAXVALUE - scrollBar.getVisibleAmount()) != 0) { int preferredHeight = leftContentPane.getPreferredSize().height; int value = scrollBar.getValue(); beginY = value * (preferredHeight - maxHeight) / (MAXVALUE - scrollBar.getVisibleAmount()); } int width = parent.getWidth(); int height = parent.getHeight(); - if (leftContentPane.getPreferredSize().height > maxHeight) { - leftContentPane.setBounds(0, -beginY, width - scrollBar.getWidth() - CONTENTPANE_WIDTH_GAP, height + beginY); - scrollBar.setBounds(width - scrollBar.getWidth() - 1, 0, scrollBar.getWidth(), height); - } else { - leftContentPane.setBounds(0, 0, width - SCROLLBAR_WIDTH - CONTENTPANE_WIDTH_GAP, height); - } + leftContentPane.setBounds(0, -beginY, width - scrollBar.getWidth(), height + beginY); + scrollBar.setBounds(width - scrollBar.getWidth() - 1, 0, scrollBar.getWidth(), height); leftContentPane.validate(); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java index 34c4ea8e1..bbf305d94 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java @@ -1,5 +1,7 @@ package com.fr.design.mainframe.cell; +import com.fine.swing.ui.layout.Layouts; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.ExtraDesignClassManager; import com.fr.design.dialog.BasicPane; import com.fr.design.fun.CellAttributeProvider; @@ -12,7 +14,6 @@ import com.fr.design.mainframe.cell.settingpane.CellExpandAttrPane; import com.fr.design.mainframe.cell.settingpane.CellOtherSetPane; import com.fr.design.mainframe.cell.settingpane.CellPresentPane; import com.fr.design.mainframe.cell.settingpane.CellStylePane; -import com.fr.design.mainframe.cell.settingpane.*; import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase; import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils; @@ -23,14 +24,14 @@ import com.fr.report.cell.CellElement; import com.fr.report.cell.TemplateCellElement; import com.fr.report.elementcase.TemplateElementCase; -import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.CardLayout; -import java.awt.Dimension; import java.util.ArrayList; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; + /** * the new 单元格属性表 !!!:只对当前选中的设置面板进行数据的populate和update操作 * @@ -38,8 +39,8 @@ import java.util.List; * @since 2012-5-8下午12:18:53 */ public class CellElementEditPane extends BasicPane { - private static final int LEFT_BORDER = -5; - private static final int RIGHT_BORDER = 5; + private static final int LEFT_BORDER = 10; + private static final int RIGHT_BORDER = 10; private List paneList; private TemplateCellElement cellelement; private ElementCasePane ePane; @@ -48,14 +49,12 @@ public class CellElementEditPane extends BasicPane { private boolean isEditing; private CardLayout card; private JPanel center; - private JPanel downTitle; private TitleChangeListener titleChangeListener = null; private CellAttributeProvider cellAttributeProvider = null; public CellElementEditPane() { - setLayout(new BorderLayout()); initPaneList(); String[] iconArray = new String[paneList.size()]; card = new CardLayout(); @@ -65,7 +64,6 @@ public class CellElementEditPane extends BasicPane { iconArray[i] = pane.getIconPath(); center.add(pane, pane.title4PopupWindow()); } - tabsHeaderIconPane = new UIHeadGroup(iconArray) { @Override public void tabChanged(int index) { @@ -76,22 +74,18 @@ public class CellElementEditPane extends BasicPane { } } }; - - downTitle = new JPanel(); - downTitle.setLayout(new BorderLayout()); - downTitle.add(tabsHeaderIconPane, BorderLayout.NORTH); - center.setBorder(BorderFactory.createEmptyBorder(0, LEFT_BORDER, 0, 0)); - downTitle.add(center, BorderLayout.CENTER); - - this.add(downTitle, BorderLayout.CENTER); - + this.setLayout(new BorderLayout()); + this.add(Layouts.column( + cell(tabsHeaderIconPane), + cell(center) + ).with(it -> it.setBorder(new ScaledEmptyBorder(0,LEFT_BORDER,0,RIGHT_BORDER))).getComponent()); } public void setSelectedIndex(String... id) { - String firstid = id[0]; + String firstId = id[0]; for (int i = 0; i < paneList.size(); i++) { - if (ComparatorUtils.equals(firstid, paneList.get(i).title4PopupWindow())) { + if (ComparatorUtils.equals(firstId, paneList.get(i).title4PopupWindow())) { tabsHeaderIconPane.setSelectedIndex(i); if (id.length == 2) { paneList.get(i).setSelectedByIds(1, id); @@ -178,13 +172,8 @@ public class CellElementEditPane extends BasicPane { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellElement_Property_Table"); } - @Override - public Dimension getPreferredSize() { - return new Dimension(240, 340); - } - private void initPaneList() { - paneList = new ArrayList(); + paneList = new ArrayList<>(); paneList.add(new CellExpandAttrPane()); paneList.add(new CellStylePane()); paneList.add(new CellPresentPane()); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java index 9549a3a7e..7cff6e11a 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java @@ -1,7 +1,8 @@ package com.fr.design.mainframe.cell.settingpane; +import com.fine.swing.ui.layout.Layouts; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.constants.LayoutConstants; -import com.fr.design.constants.UIConstants; import com.fr.design.expand.ExpandLeftFatherPane; import com.fr.design.expand.ExpandUpFatherPane; import com.fr.design.foldablepane.UIExpandablePane; @@ -9,8 +10,6 @@ import com.fr.design.gui.ibutton.UIButtonGroup; 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.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase; import com.fr.design.sort.cellexpand.CellExpandSortPane; import com.fr.general.ComparatorUtils; @@ -21,18 +20,21 @@ import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.Constants; import javax.swing.Icon; +import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingConstants; +import javax.swing.UIManager; import java.awt.BorderLayout; -import java.awt.Component; import java.awt.Rectangle; +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.fix; + /** * 单元格扩展属性面板,是属性表面板的一个种类 */ public class CellExpandAttrPane extends AbstractCellAttrPane { - private static final int SENIOR_HORIZONTAL_GAP = 12; - private static final int BASIC_HORIZONTAL_GAP = 20; private UIButtonGroup expandDirectionButton; private ExpandLeftFatherPane leftFatherPane; private ExpandUpFatherPane rightFatherPane; @@ -66,6 +68,13 @@ public class CellExpandAttrPane extends AbstractCellAttrPane { return layoutPane(); } + protected void initContentPane() { + leftContentPane = createContentPane(); + if (leftContentPane != null) { + this.add(leftContentPane, BorderLayout.CENTER); + } + } + private void initAllNames() { expandDirectionButton.setGlobalName(Toolkit.i18nText("Fine-Design_Report_ExpandD_Expand_Direction")); leftFatherPane.setGlobalName(Toolkit.i18nText("Fine-Design_Report_LeftParent")); @@ -75,19 +84,19 @@ public class CellExpandAttrPane extends AbstractCellAttrPane { } private JPanel layoutPane() { - layoutPane = new JPanel(new BorderLayout()); - basicPane = new JPanel(); - seniorPane = new JPanel(); basicPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Basic"), 223, 24, basicPane()); seniorPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 223, 24, seniorPane()); JPanel sortUIExpandablePane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Expend_Sort"), 223, 24, cellExpandSortPane = new CellExpandSortPane(this)); - layoutPane.add(basicPane, BorderLayout.NORTH); - layoutPane.add(seniorPane, BorderLayout.CENTER); - layoutPane.add(sortUIExpandablePane, BorderLayout.SOUTH); + layoutPane = Layouts.column( + cell(basicPane), + fix(1).with(it -> it.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor")))), + cell(seniorPane), + fix(1).with(it -> it.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor")))), + cell(sortUIExpandablePane) + ).getComponent(); extraPane = CellExpandExtraAttrPane.getInstance(); - JPanel content = new JPanel(new BorderLayout()); content.add(layoutPane, BorderLayout.NORTH); content.add(extraPane, BorderLayout.CENTER); @@ -95,43 +104,23 @@ public class CellExpandAttrPane extends AbstractCellAttrPane { } private JPanel basicPane() { - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; UILabel direction = new UILabel(Toolkit.i18nText("Fine-Design_Report_ExpandD_Expand_Direction"), SwingConstants.LEFT); - JPanel directionPane = new JPanel(new BorderLayout()); - directionPane.add(direction, BorderLayout.NORTH); UILabel left = new UILabel(Toolkit.i18nText("Fine-Design_Report_LeftParent"), SwingConstants.LEFT); - JPanel leftPane = new JPanel(new BorderLayout()); - leftPane.add(left, BorderLayout.NORTH); UILabel up = new UILabel(Toolkit.i18nText("Fine-Design_Report_ExpandD_Up_Father_Cell"), SwingConstants.LEFT); - JPanel upPane = new JPanel(new BorderLayout()); - upPane.add(up, BorderLayout.NORTH); - Component[][] components = new Component[][]{ - new Component[]{null, null}, - new Component[]{directionPane, expandDirectionButton}, - new Component[]{leftPane, leftFatherPane}, - new Component[]{upPane, rightFatherPane}, - }; - double[] rowSize = {p, p, p, p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, BASIC_HORIZONTAL_GAP, LayoutConstants.VGAP_LARGE); + return Layouts.column(LayoutConstants.VERTICAL_GAP, + row(cell(direction).weight(1.2), cell(expandDirectionButton).weight(3.0)), + row(cell(left).weight(1.2), cell(leftFatherPane).weight(3.0)), + row(cell(up).weight(1.2), cell(rightFatherPane).weight(3.0)) + ).with(it -> it.setBorder(new ScaledEmptyBorder(0, 0, 10, 0)) + ).getComponent(); } private JPanel seniorPane() { - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - horizontalExpandableCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); - verticalExpandableCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); - Component[][] components = new Component[][]{ - new Component[]{null, null}, - new Component[]{horizontalExpandableCheckBox, null}, - new Component[]{verticalExpandableCheckBox, null}, - }; - double[] rowSize = {p, p, p, p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, SENIOR_HORIZONTAL_GAP, LayoutConstants.VGAP_LARGE); + return Layouts.column(LayoutConstants.VERTICAL_GAP, + cell(horizontalExpandableCheckBox), + cell(verticalExpandableCheckBox) + ).with(it -> it.setBorder(new ScaledEmptyBorder(0, 0, 10, 0)) + ).getComponent(); } @@ -174,7 +163,6 @@ public class CellExpandAttrPane extends AbstractCellAttrPane { @Override public String getIconPath() { -// return "com/fr/design/images/expand/cellAttr.gif"; return Toolkit.i18nText("Fine-Design_Report_Expand"); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java index 3578a7d64..150b4d851 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java @@ -1,14 +1,16 @@ package com.fr.design.mainframe.cell.settingpane; -import com.fine.theme.utils.FineUIScale; +import com.fine.swing.ui.layout.Layouts; +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.Style; import com.fr.design.constants.LayoutConstants; -import com.fr.design.constants.UIConstants; import com.fr.design.dialog.link.MessageWithLink; import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPaneFactory; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.core.ReactiveCardPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icheckbox.UICheckBox; @@ -17,10 +19,6 @@ 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.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.locale.impl.DataMaskMark; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.JTemplate; @@ -46,19 +44,18 @@ import javax.swing.ButtonGroup; import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.UIManager; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import java.awt.BorderLayout; -import java.awt.CardLayout; import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Insets; import java.awt.Rectangle; import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; import java.util.ArrayList; +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; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; + /** * @author zhou * @since 2012-5-11下午5:24:31 @@ -67,12 +64,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane { private static final int HEAD_WDITH = 290; private static final int HEAD_HEIGTH = 24; - private static final int COMBO_WIDTH = 154; - private static final int BUTTON_GROUP_WIDTH = 140; - private static final double f = TableLayout.FILL; - private static final double p = TableLayout.PREFERRED; - // normal - private UIButtonGroup autoshrik; + private static final int DOWNLOAD_INDEX = 3; private UICheckBox previewCellContent; private UICheckBox printAndExportContent; @@ -81,22 +73,20 @@ public class CellOtherSetPane extends AbstractCellAttrPane { private UIComboBox showContent; //内容提示 + private ReactiveCardPane showContentPane; private UIButtonGroup tooltipButtonGroup; - private CardLayout tooltipLayout; - private JPanel tooltipPane; + private ReactiveCardPane tooltipPane; private UITextField tooltipTextField; + private UITextField fileNameTextField; //文本超出时隐藏 + private ReactiveCardPane overflowPane; private UICheckBox textOverflowCheckBox; private int curSelectedIndex; private UIComboBox showPartComboBox; - private CardLayout showPartLayout; - private JPanel showPartPane; private UISpinner showCharNums; private UIComboBox textOverflowTypeComboBox; - private UITextField fileNameTextField; - // 分页 private UICheckBox pageBeforeRowCheckBox; private UICheckBox pageAfterRowCheckBox; @@ -121,21 +111,22 @@ public class CellOtherSetPane extends AbstractCellAttrPane { // 插入行策略 private UIButtonGroup insertRowPolicyButtonGroup; private ValueEditorPane valueEditor; - private CardLayout insertRowLayout; - private JPanel insertRowPane; - private JPanel insertRowPolicyPane; - private JPanel defaultValuePane; + private ReactiveCardPane insertRowPolicyPane; + private UILabel insertRowPolicyLabel; - // 数据脱敏 - private UILabel scopeLabel; private UIRadioButton exportButton; private UIRadioButton previewAndExportButton; - private UIRadioButton[] desensitizationButtons; private CellDesensitizationGroupsPane groupsPane; private final int EXPORT_SCOPE = CellDesensitizationAttr.EXPORT_SCOPE; - private final int PREVIEW_AND_EXPORT_SCOPE = CellDesensitizationAttr.PREVIEW_AND_EXPORT_SCOPE; - private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92); + private static Color TIPS_FONT_COLOR = FineUIUtils.getUIColor("Label.tipColor", "inactiveCaption"); + + protected void initContentPane() { + leftContentPane = createContentPane(); + if (leftContentPane != null) { + this.add(leftContentPane, BorderLayout.CENTER); + } + } /** * 初始化 @@ -143,18 +134,17 @@ public class CellOtherSetPane extends AbstractCellAttrPane { * @return 面板 */ public JPanel createContentPane() { - - Component[][] components = new Component[][]{ - new Component[]{new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Basic"), HEAD_WDITH, HEAD_HEIGTH, basicPane())}, - new Component[]{new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advaced"), HEAD_WDITH, HEAD_HEIGTH, seniorPane())}, - new Component[]{new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Pagination"), HEAD_WDITH, HEAD_HEIGTH, pagePane())}, - new Component[]{new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Desensitization"), HEAD_WDITH, HEAD_HEIGTH, desensitizePane())} - }; - - JPanel tableLayoutPane = TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p, p, p}, new double[]{f}); - + JPanel pane = Layouts.column( + cell(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Basic"), HEAD_WDITH, HEAD_HEIGTH, basicPane())), + fix(1).with(it -> it.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor")))), + cell(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advaced"), HEAD_WDITH, HEAD_HEIGTH, seniorPane())), + fix(1).with(it -> it.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor")))), + cell(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Pagination"), HEAD_WDITH, HEAD_HEIGTH, pagePane())), + fix(1).with(it -> it.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor")))), + cell(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Desensitization"), HEAD_WDITH, HEAD_HEIGTH, desensitizePane())) + ).getComponent(); initAllNames(); - return tableLayoutPane; + return pane; } private JPanel desensitizePane() { @@ -174,24 +164,22 @@ public class CellOtherSetPane extends AbstractCellAttrPane { ); groupsPane = new CellDesensitizationGroupsPane(this); - - JPanel contentPane = FRGUIPaneFactory.createVerticalFlowLayout_F_Pane(true, VerticalFlowLayout.TOP, 0, 10, true); - contentPane.add(scopePane); - contentPane.add(hyperlink); - contentPane.add(groupsPane); - - return contentPane; + return Layouts.column(LayoutConstants.VERTICAL_GAP, + cell(scopePane), + cell(hyperlink), + cell(groupsPane) + ).getComponent(); } /** * 脱敏设置应用范围panel - * @return */ private JPanel initScopePane() { - scopeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Desensitization_Scope")); + // 数据脱敏 + UILabel scopeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Desensitization_Scope")); exportButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Report_Desensitization_Export")); previewAndExportButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Report_Desensitization_Preview_Export")); - desensitizationButtons = new UIRadioButton[]{ + UIRadioButton[] desensitizationButtons = new UIRadioButton[]{ exportButton, previewAndExportButton }; @@ -199,13 +187,9 @@ public class CellOtherSetPane extends AbstractCellAttrPane { for (UIRadioButton radioButton : desensitizationButtons) { buttonGroup.add(radioButton); } - - JPanel head = new JPanel(); - head.setLayout(new BorderLayout()); - head.add(scopeLabel, BorderLayout.NORTH); - head.add(exportButton, BorderLayout.CENTER); - head.add(previewAndExportButton, BorderLayout.SOUTH); - return head; + return row( + cell(scopeLabel).weight(1.2), cell(exportButton).weight(1.2), cell(previewAndExportButton).weight(1.8) + ).getComponent(); } private JPanel basicPane() { @@ -216,228 +200,211 @@ public class CellOtherSetPane extends AbstractCellAttrPane { adjustRadioButtons = new UIRadioButton[]{ defaultAutoRadioButton, noAutoRadioButton, autoHeightRadioButton, autoWidthRadioButton }; - // 指定分组 ButtonGroup autoBG = new ButtonGroup(); for (UIRadioButton radioButton : adjustRadioButtons) { autoBG.add(radioButton); } - - JPanel basicPane = new JPanel() { - @Override - public Insets getInsets() { - return new Insets(LayoutConstants.VGAP_MEDIUM, 0, LayoutConstants.VGAP_MEDIUM, 0); - } - }; - VerticalFlowLayout verticalFlowLayout = new VerticalFlowLayout(VerticalFlowLayout.CENTER, 0, 0); - verticalFlowLayout.setAlignLeft(true); - basicPane.setLayout(verticalFlowLayout); - basicPane.add(defaultAutoRadioButton); - basicPane.add(noAutoRadioButton); - basicPane.add(autoHeightRadioButton); - basicPane.add(autoWidthRadioButton); - - return basicPane; + return Layouts.column(LayoutConstants.VERTICAL_GAP, + cell(defaultAutoRadioButton), + cell(noAutoRadioButton), + cell(autoHeightRadioButton), + cell(autoWidthRadioButton) + ).with(it -> it.setBorder(new ScaledEmptyBorder(0, 0, LayoutConstants.VERTICAL_GAP, 0)) + ).getComponent(); } private JPanel seniorPane() { initInsertRowPolicyPane(); - JPanel seniorPane = new JPanel(new BorderLayout()); - seniorPane.add(seniorUpPane(), BorderLayout.NORTH); - seniorPane.add(insertRowPolicyPane, BorderLayout.CENTER); - insertRowPolicyPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); - return seniorPane; + return Layouts.column(LayoutConstants.VERTICAL_GAP, + cell(seniorUpPane()), + cell(insertRowPolicyPane) + ).with(it -> it.setBorder(new ScaledEmptyBorder(0, 0, LayoutConstants.VERTICAL_GAP, 0)) + ).getComponent(); } private void initInsertRowPolicyPane() { // 插入行策略 - insertRowPolicyButtonGroup = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_NULL"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Estate_Default_Text"), + insertRowPolicyButtonGroup = new UIButtonGroup(new String[]{ + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_NULL"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Estate_Default_Text"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_COPY")}); - defaultValuePane = new JPanel(new BorderLayout(4, 0)); valueEditor = ValueEditorPaneFactory.createBasicValueEditorPane(); - defaultValuePane.add(valueEditor, BorderLayout.CENTER); - insertRowLayout = new CardLayout(); - insertRowPane = new JPanel(insertRowLayout); - insertRowPane.add(new JPanel(), "none"); - insertRowPane.add(defaultValuePane, "content"); - insertRowPane.setPreferredSize(new Dimension(0, 0)); - insertRowPolicyButtonGroup.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - if (insertRowPolicyButtonGroup.getSelectedIndex() == 1) { - insertRowPane.setPreferredSize(new Dimension(100, FineUIScale.scale(UIManager.getInt("CellOtherSetPane.height")))); - insertRowLayout.show(insertRowPane, "content"); - } else { - insertRowLayout.show(insertRowPane, "none"); - insertRowPane.setPreferredSize(new Dimension(0, 0)); - } - } - }); - - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - UILabel insertRowPolicyLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy", SwingConstants.LEFT)); + insertRowPolicyLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy", SwingConstants.LEFT)); UIComponentUtils.setLineWrap(insertRowPolicyLabel); - // 如果右侧需要很宽的空间,就用3行1列的布局 - if (insertRowPolicyButtonGroup.getPreferredSize().getWidth() > BUTTON_GROUP_WIDTH) { - double[] rowSize = {p, p, p}; - double[] columnSize = {f}; - - Component[][] components = new Component[][]{ - new Component[]{insertRowPolicyLabel}, - new Component[]{insertRowPolicyButtonGroup}, - new Component[]{insertRowPane}, - }; - insertRowPolicyPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); - } else { - double[] rowSize = {p, p}; - double[] columnSize = {f, BUTTON_GROUP_WIDTH}; - Component[][] components = new Component[][]{ - new Component[]{insertRowPolicyLabel, insertRowPolicyButtonGroup}, - new Component[]{null, insertRowPane}, - }; - insertRowPolicyPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); - } + insertRowPolicyPane = ReactiveCardPane.create() + .addSupplier("empty", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, + row( + cell(insertRowPolicyLabel).weight(1.2), + cell(insertRowPolicyButtonGroup).weight(3) + ) + ).getComponent()) + .addSupplier("default", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, + row( + cell(insertRowPolicyLabel).weight(1.2), + cell(insertRowPolicyButtonGroup).weight(3) + ), + row( + flex(1.2), + cell(valueEditor).weight(3) + ) + ).getComponent() + ); + insertRowPolicyPane.select("empty").populate(); + + insertRowPolicyButtonGroup.addChangeListener(e -> { + String key = insertRowPolicyButtonGroup.getSelectedIndex() == 1 ? "default" : "empty"; + insertRowPolicyPane.select(key).populate(); + }); } private JPanel seniorUpPane() { - JPanel pane = new JPanel(new BorderLayout()); - // TODO: 方法之间的耦合还比较严重。现在必须先执行 createShowContentPane,再执行 createSeniorCheckPane。否则出现 npe。 - pane.add(createTextOverflowPane(), BorderLayout.SOUTH); - pane.add(createShowContentPane(), BorderLayout.CENTER); - pane.add(createSeniorCheckPane(), BorderLayout.NORTH); - return pane; + initTextOverflowPane(); + initShowContentPane(); + return Layouts.column(LayoutConstants.VERTICAL_GAP, + cell(createSeniorCheckPane()), + cell(showContentPane), + cell(overflowPane) + ).getComponent(); } - private JPanel createShowContentPane() { - double[] rowSize = {p, p, p, p}; - double[] colSize = {f, COMBO_WIDTH}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; - - JPanel fileNamePane = createNormal(); - fileNamePane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); + private void initShowContentPane() { + showContent = new UIComboBox(new String[]{ + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Show_As_Image"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Show_As_HTML"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_As_Download")}); + UILabel downloadLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_File_Name_For_Download")); + fileNameTextField = new UITextField(); UILabel showContentLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_Content"), SwingConstants.LEFT); UIComponentUtils.setLineWrap(showContentLabel); - UILabel toolTipLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip")); - tooltipLayout = new CardLayout(); - tooltipPane = new JPanel(tooltipLayout); - tooltipPane.add(new JPanel(), "none"); - tooltipPane.add(tooltipTextField, "content"); - tooltipPane.setPreferredSize(new Dimension(0, 0)); - tooltipButtonGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_Custom"), Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_CellValue")}); - tooltipButtonGroup.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - if (tooltipButtonGroup.getSelectedIndex() == 0) { - tooltipPane.setPreferredSize(new Dimension(154, FineUIScale.scale(UIManager.getInt("CellOtherSetPane.height")))); - tooltipLayout.show(tooltipPane, "content"); + initTooltipPane(); + showContentPane = ReactiveCardPane.create() + .addSupplier("default", () -> column(LayoutConstants.VERTICAL_GAP, + row( + cell(showContentLabel).weight(1.2), cell(showContent).weight(3.0) + ), + cell(tooltipPane) + ).getComponent()) + .addSupplier("download", () -> column(LayoutConstants.VERTICAL_GAP, + row( + cell(showContentLabel).weight(1.2), cell(showContent).weight(3.0) + ), + row( + cell(downloadLabel).weight(1.2), cell(fileNameTextField).weight(3.0) + ), + cell(tooltipPane) + ).getComponent()); + showContentPane.select("default").populate(); + + showContent.addItemListener(e -> { + if (e.getStateChange() == ItemEvent.SELECTED) { + if (showContent.getSelectedIndex() == DOWNLOAD_INDEX) { + showContentPane.select("download").populate(); } else { - tooltipLayout.show(tooltipPane, "none"); - tooltipPane.setPreferredSize(new Dimension(0, 0)); + showContentPane.select("default").populate(); } + handleCellShowStyleChange(e); } }); + } - Component[][] components = new Component[][]{ - new Component[]{showContentLabel, UIComponentUtils.wrapWithBorderLayoutPane(showContent)}, - new Component[]{fileNamePane, null}, // 选择"用下载连接显示二进制内容"时,会显示这一行的面板 - new Component[]{toolTipLabel, tooltipButtonGroup}, // “自定义”or"单元格值" - new Component[]{null, tooltipPane} // 选择“自定义”时显示这一行 - }; - - JPanel showContentPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, colSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); - showContentPane.setBorder(BorderFactory.createEmptyBorder(6, 0, 6, 0)); - - return showContentPane; + private void initTooltipPane() { + UILabel toolTipLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip")); + tooltipButtonGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_Custom"), + Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_CellValue")}); + tooltipTextField = new UITextField(); + tooltipPane = ReactiveCardPane.create() + .addSupplier("define", () -> column(LayoutConstants.VERTICAL_GAP, + row( + cell(toolTipLabel).weight(1.2), cell(tooltipButtonGroup).weight(3.0) + ), + row( + flex(1.2), cell(tooltipTextField).weight(3.0) + ) + ).getComponent()) + .addSupplier("cellValue", () -> column(LayoutConstants.VERTICAL_GAP, + row( + cell(toolTipLabel).weight(1.2), cell(tooltipButtonGroup).weight(3.0) + ) + ).getComponent()); + tooltipPane.select("define").populate(); + + tooltipButtonGroup.addChangeListener(e -> { + if (tooltipButtonGroup.getSelectedIndex() == 0) { + tooltipPane.select("define").populate(); + } else { + tooltipPane.select("cellValue").populate(); + } + }); } - private JPanel createTextOverflowPane() { - showPartLayout = new CardLayout(); - showPartPane = new JPanel(showPartLayout); + private void initTextOverflowPane() { showCharNums = new UISpinner(0, Integer.MAX_VALUE, 1, 10); - JPanel showPartNumPane = new JPanel(new BorderLayout(4, 0)); - showPartNumPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Nums")), BorderLayout.WEST); - showPartNumPane.add(showCharNums, BorderLayout.CENTER); - showPartPane.add(new JPanel(), "none"); - showPartPane.add(showPartNumPane, "content"); + UILabel numberLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Nums")); showPartComboBox = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_CharNum"), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_CellWidth")}); - showPartComboBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { + textOverflowTypeComboBox = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Ellipsis"), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_NoneSymbol")}); + UILabel showPartLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_ShowPart")); + UILabel hideTypeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideType")); + textOverflowCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideWhenOverflow")); + + overflowPane = ReactiveCardPane.create() + .addSupplier("empty", () -> column(LayoutConstants.VERTICAL_GAP, + cell(textOverflowCheckBox) + ).getComponent()) + .addSupplier("showChar", () -> column(LayoutConstants.VERTICAL_GAP, + cell(textOverflowCheckBox), + row(cell(showPartLabel).weight(1.2), cell(showPartComboBox).weight(1.6), flex(0.1), cell(numberLabel).weight(0.5), cell(showCharNums).weight(0.8)), + row(cell(hideTypeLabel).weight(1.2), cell(textOverflowTypeComboBox).weight(3.0)) + ).getComponent()) + .addSupplier("showCell", () -> column(LayoutConstants.VERTICAL_GAP, + cell(textOverflowCheckBox), + row(cell(showPartLabel).weight(1.2), cell(showPartComboBox).weight(3.0)), + row(cell(hideTypeLabel).weight(1.2), cell(textOverflowTypeComboBox).weight(3.0)) + ).getComponent()); + overflowPane.select("empty").populate(); + showPartComboBox.addItemListener(e -> { + if (showPartComboBox.getSelectedIndex() == 0) { + overflowPane.select("showChar").populate(); + } else { + overflowPane.select("showCell").populate(); + } + }); + textOverflowCheckBox.addItemListener(e -> { + if (e.getStateChange() == ItemEvent.SELECTED) { if (showPartComboBox.getSelectedIndex() == 0) { - showPartPane.setPreferredSize(new Dimension(70, FineUIScale.scale(UIManager.getInt("CellOtherSetPane.height")))); - showPartLayout.show(showPartPane, "content"); + overflowPane.select("showChar").populate(); } else { - showPartLayout.show(showPartPane, "none"); - showPartPane.setPreferredSize(new Dimension(0, 0)); + overflowPane.select("showCell").populate(); } - } - }); - - textOverflowTypeComboBox = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Ellipsis"), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_NoneSymbol")}); - UILabel showPartLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_ShowPart") + ":"); - UILabel hideTypeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideType") + ":"); - Component[][] textOverflowComponents = new Component[][]{ - new Component[]{showPartLabel, showPartComboBox, showPartPane}, - new Component[]{hideTypeLabel, textOverflowTypeComboBox, null} - }; - JPanel textOverflowComPane = TableLayoutHelper.createTableLayoutPane(textOverflowComponents, new double[]{p, p}, new double[]{p, f, p}); - textOverflowComPane.setVisible(false); - textOverflowCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideWhenOverflow")); - textOverflowCheckBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - textOverflowComPane.setVisible(e.getStateChange() == ItemEvent.SELECTED); - if (e.getStateChange() == ItemEvent.SELECTED) { - if (showPartComboBox.getSelectedIndex() == 0) { - showPartPane.setPreferredSize(new Dimension(70, FineUIScale.scale(UIManager.getInt("CellOtherSetPane.height")))); - showPartLayout.show(showPartPane, "content"); - } else { - showPartLayout.show(showPartPane, "none"); - showPartPane.setPreferredSize(new Dimension(0, 0)); - } - // 记录目前自动调整哪个被选中 - for (int i = 0; i < adjustRadioButtons.length; i++) { - if (adjustRadioButtons[i].isSelected()) { - curSelectedIndex = i; - break; - } + // 记录目前自动调整哪个被选中 + for (int i = 0; i < adjustRadioButtons.length; i++) { + if (adjustRadioButtons[i].isSelected()) { + curSelectedIndex = i; + break; } - noAutoRadioButton.setSelected(true); - } else { - adjustRadioButtons[curSelectedIndex].setSelected(true); } + noAutoRadioButton.setSelected(true); + } else { + overflowPane.select("empty").populate(); + adjustRadioButtons[curSelectedIndex].setSelected(true); } }); - JPanel dynamicPaneWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); - dynamicPaneWrapper.add(textOverflowComPane); - JPanel textOverflowPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - textOverflowPane.add(textOverflowCheckBox, BorderLayout.NORTH); - textOverflowPane.add(dynamicPaneWrapper, BorderLayout.CENTER); - textOverflowPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); - return textOverflowPane; } private JPanel createSeniorCheckPane() { - previewCellContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); - printAndExportContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); - printAndExportBackground.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; - Component[][] components = new Component[][]{ - new Component[]{null, null}, - new Component[]{previewCellContent, null}, - new Component[]{printAndExportContent, null}, - new Component[]{printAndExportBackground, null}, - }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_LARGE); + previewCellContent = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Preview_Cell_Content")); + printAndExportContent = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Print_Content")); + printAndExportBackground = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Print_Background")); + return Layouts.column(LayoutConstants.VERTICAL_GAP, + cell(previewCellContent), + cell(printAndExportContent), + cell(printAndExportBackground) + ).getComponent(); } private JPanel pagePane() { @@ -451,73 +418,31 @@ public class CellOtherSetPane extends AbstractCellAttrPane { canBreakOnPaginateCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_CellPage_Can_Break_On_Paginate")); repeatCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_CellPage_Repeat_Content_When_Paging")); pageFixedRowDataCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_CellWrite_Page_Fixed_Row_Cell")); - currentPageFixedRowDataTipLabel = new UILabel(" (" + Toolkit.i18nText("Fine-Design_Report_CellWrite_No_Page_Fixed_Row_Cell") +")"); - - pageBeforeRowCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); - pageAfterRowCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); - pageBeforeColumnCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); - pageAfterColumnCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); - canBreakOnPaginateCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); - repeatCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); - pageFixedRowDataCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); - currentPageFixedRowDataTipLabel.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); - currentPageFixedRowDataTipLabel.setForeground(TIPS_FONT_COLOR); - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p, p}; - double[] columnSize = {p}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; - Component[][] components = new Component[][]{ - new Component[]{null}, - new Component[]{pageBeforeRowCheckBox}, - new Component[]{pageAfterRowCheckBox}, - new Component[]{null}, - new Component[]{pageBeforeColumnCheckBox}, - new Component[]{pageAfterColumnCheckBox}, - new Component[]{null}, - new Component[]{canBreakOnPaginateCheckBox}, - new Component[]{repeatCheckBox}, - new Component[]{null}, - new Component[]{pageFixedRowDataCheckBox}, - new Component[]{currentPageFixedRowDataTipLabel} - }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_LARGE); + currentPageFixedRowDataTipLabel = new UILabel(" (" + Toolkit.i18nText("Fine-Design_Report_CellWrite_No_Page_Fixed_Row_Cell") +")", SwingConstants.LEFT); - } + currentPageFixedRowDataTipLabel.setForeground(TIPS_FONT_COLOR); + return Layouts.column( + cell(pageBeforeRowCheckBox), + fix(LayoutConstants.VERTICAL_GAP), + cell(pageAfterRowCheckBox), + fix(LayoutConstants.VGAP_SMALL + LayoutConstants.VERTICAL_GAP), + + cell(pageBeforeColumnCheckBox), + fix(LayoutConstants.VERTICAL_GAP), + cell(pageAfterColumnCheckBox), + fix(LayoutConstants.VGAP_SMALL + LayoutConstants.VERTICAL_GAP), + + cell(canBreakOnPaginateCheckBox), + fix(LayoutConstants.VERTICAL_GAP), + cell(repeatCheckBox), + fix(LayoutConstants.VGAP_SMALL + LayoutConstants.VERTICAL_GAP), + + cell(pageFixedRowDataCheckBox), + fix(LayoutConstants.VERTICAL_GAP), + cell(currentPageFixedRowDataTipLabel) + ).with(it -> it.setBorder(new ScaledEmptyBorder(0, 0, LayoutConstants.VERTICAL_GAP, 0)) + ).getComponent(); - private JPanel createNormal() { - previewCellContent = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Preview_Cell_Content")); - printAndExportContent = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Print_Content")); - printAndExportBackground = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Print_Background")); - showContent = new UIComboBox(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Show_As_Image"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Show_As_HTML"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_As_Download")}); - final CardLayout fileNameLayout = new CardLayout(); - final JPanel fileNamePane = new JPanel(fileNameLayout); - JPanel fileNameCCPane = new JPanel(new BorderLayout(4, 0)); - fileNameCCPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_File_Name_For_Download")), BorderLayout.WEST); - fileNameTextField = new UITextField(); - tooltipTextField = new UITextField(); - tooltipTextField.getUI(); - fileNamePane.add(new JPanel(), "none"); - fileNamePane.add(fileNameCCPane, "content"); - fileNamePane.setPreferredSize(new Dimension(0, 0)); - fileNameCCPane.add(fileNameTextField, BorderLayout.CENTER); - showContent.addItemListener(new ItemListener() { - - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - if (showContent.getSelectedIndex() == 3) { - fileNamePane.setPreferredSize(new Dimension(100, FineUIScale.scale(UIManager.getInt("CellOtherSetPane.height")))); - fileNameLayout.show(fileNamePane, "content"); - } else { - fileNameLayout.show(fileNamePane, "none"); - fileNamePane.setPreferredSize(new Dimension(0, 0)); - } - handleCellShowStyleChange(e); - } - } - }); - return fileNamePane; } private void handleCellShowStyleChange(ItemEvent itemEvent) { @@ -567,7 +492,6 @@ public class CellOtherSetPane extends AbstractCellAttrPane { @Override public String getIconPath() { -// return "com/fr/design/images/m_format/cellstyle/otherset.png"; return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Other"); } @@ -632,11 +556,9 @@ public class CellOtherSetPane extends AbstractCellAttrPane { tooltipButtonGroup.setSelectedIndex(1); } if (tooltipButtonGroup.getSelectedIndex() == 0) { - tooltipPane.setPreferredSize(new Dimension(100, FineUIScale.scale(UIManager.getInt("CellOtherSetPane.height")))); - tooltipLayout.show(tooltipPane, "content"); + tooltipPane.select("define").populate(); } else { - tooltipLayout.show(tooltipPane, "none"); - tooltipPane.setPreferredSize(new Dimension(0, 0)); + tooltipPane.select("cellValue").populate(); } tooltipPane.setVisible(true); if (cellGUIAttr.isHideTextWhenOverflow()) { @@ -647,7 +569,6 @@ public class CellOtherSetPane extends AbstractCellAttrPane { } else { showPartComboBox.setSelectedIndex(1); } - showPartPane.setVisible(true); if (cellGUIAttr.isTextOverflowEllipsis()) { textOverflowTypeComboBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Ellipsis")); } else { @@ -684,19 +605,13 @@ public class CellOtherSetPane extends AbstractCellAttrPane { insertRowPolicyButtonGroup.setSelectedIndex(0); this.valueEditor.populate(StringUtils.EMPTY); } - if (insertRowPolicyButtonGroup.getSelectedIndex() == 1) { - insertRowPane.setPreferredSize(new Dimension(100, FineUIScale.scale(UIManager.getInt("CellOtherSetPane.height")))); - insertRowLayout.show(insertRowPane, "content"); - } else { - insertRowLayout.show(insertRowPane, "none"); - insertRowPane.setPreferredSize(new Dimension(0, 0)); - } + String key = insertRowPolicyButtonGroup.getSelectedIndex() == 1 ? "default" : "empty"; + insertRowPolicyPane.select(key).populate(); insertRowPolicyPane.setVisible(true); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (!jTemplate.isJWorkBook()) { //表单中报表块编辑屏蔽掉 插入行策略 - insertRowPolicyPane.setVisible(false); + insertRowPolicyPane.select("empty").populate(); } - populateDesensitizationBean(cellElement); } @@ -816,7 +731,8 @@ public class CellOtherSetPane extends AbstractCellAttrPane { if (cellDesensitizationAttr == null) { cellDesensitizationAttr = new CellDesensitizationAttr(); } - cellDesensitizationAttr.setScope(exportButton.isSelected() ? EXPORT_SCOPE : PREVIEW_AND_EXPORT_SCOPE); + int previewAndExportScope = CellDesensitizationAttr.PREVIEW_AND_EXPORT_SCOPE; + cellDesensitizationAttr.setScope(exportButton.isSelected() ? EXPORT_SCOPE : previewAndExportScope); cellDesensitizationAttr.setDesensitizationBeans(new ArrayList<>(groupsPane.update())); cellElement.addCellAttr(cellDesensitizationAttr); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/CellDesensitizationGroupsPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/CellDesensitizationGroupsPane.java index de4e046b8..cf9617f2f 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/CellDesensitizationGroupsPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/CellDesensitizationGroupsPane.java @@ -1,15 +1,14 @@ package com.fr.design.mainframe.cell.settingpane.desensitization; -import com.fr.design.constants.UIConstants; +import com.fine.swing.ui.layout.Layouts; +import com.fine.theme.light.ui.FineRoundBorder; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itableeditorpane.UITableEditAction; import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.mainframe.cell.settingpane.AbstractCellAttrPane; import com.fr.design.mainframe.cell.settingpane.desensitization.model.CellDesensitizationTableModel; import com.fr.report.cell.desensitization.CellDesensitizationBean; @@ -17,11 +16,11 @@ import com.fr.report.cell.desensitization.CellDesensitizationBean; import javax.swing.JPanel; import javax.swing.JTable; import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; import java.util.List; import java.util.Objects; +import static com.fine.swing.ui.layout.Layouts.cell; + /** * 数据脱敏规则设置面板 * @@ -40,18 +39,17 @@ public class CellDesensitizationGroupsPane extends JPanel { public CellDesensitizationGroupsPane(AbstractCellAttrPane pane) { model = new CellDesensitizationTableModel(pane, this); - initComponent(); } private void initComponent() { - this.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 10, true)); - + this.setLayout(new BorderLayout()); addRulePane = initAddPane(model); editorPane = initEditorPane(model); - - this.add(addRulePane); - this.add(editorPane); + this.add(Layouts.column(LayoutConstants.VERTICAL_GAP, + cell(addRulePane), + cell(editorPane) + ).weight(1.0).getComponent()); } /** @@ -63,17 +61,10 @@ public class CellDesensitizationGroupsPane extends JPanel { private JPanel initAddPane(CellDesensitizationTableModel model) { UIButton addButton = new UIButton(model.getAction()); UILabel addLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Desensitization_Setting")); - - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, f}; - double[] rowSize = {p, p}; - - Component[][] components = new Component[][]{ - new Component[]{addLabel, addButton} - }; - - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 20, 0); + return Layouts.row( + cell(addLabel).weight(1.2), + cell(addButton).weight(3.0) + ).getComponent(); } /** @@ -89,14 +80,9 @@ public class CellDesensitizationGroupsPane extends JPanel { this.setLayout(FRGUIPaneFactory.createBorderLayout()); JTable editTable = getTableModel().createTable(); - editTable.getTableHeader().setBackground(UIConstants.DEFAULT_BG_RULER); setEditTable(editTable); - initbuttonPane(action); - getbuttonPane().setBackground(UIConstants.DEFAULT_BG_RULER); - JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - controlPane.setBackground(Color.WHITE); controlPane.add(getbuttonPane(), BorderLayout.WEST); JPanel pane = new JPanel(new BorderLayout(4, 4)); @@ -106,6 +92,7 @@ public class CellDesensitizationGroupsPane extends JPanel { this.add(pane, BorderLayout.CENTER); } }; + tableEditorPane.setBorder(new FineRoundBorder()); return tableEditorPane; } diff --git a/designer-realize/src/main/java/com/fr/design/present/BarCodePane.java b/designer-realize/src/main/java/com/fr/design/present/BarCodePane.java index b0df938db..d5a76a23f 100644 --- a/designer-realize/src/main/java/com/fr/design/present/BarCodePane.java +++ b/designer-realize/src/main/java/com/fr/design/present/BarCodePane.java @@ -1,10 +1,12 @@ package com.fr.design.present; +import com.fine.swing.ui.layout.Layouts; +import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIScale; import com.fr.code.bar.core.BarcodeAttr; import com.fr.code.BarcodeImpl; import com.fr.code.bar.core.BarCodeUtils; import com.fr.design.beans.FurtherBasicBeanPane; -import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; import com.fr.design.gui.icheckbox.UICheckBox; @@ -14,8 +16,6 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.report.cell.cellattr.BarcodePresent; @@ -38,6 +38,12 @@ import java.text.AttributedString; import java.util.HashMap; import java.util.Map; +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; +import static com.fine.swing.ui.layout.Layouts.fix; + /** * @author zhou * @since 2012-6-4下午6:49:59 @@ -65,10 +71,8 @@ public class BarCodePane extends FurtherBasicBeanPane { barCodePreviewPane = new BarCodePreviewPane(); this.barWidthSpinner = new UISpinner(1,100.0,1.0,10.0); this.barHeightSpinner = new UISpinner(1,100.0,1.0,30); - this.barWidthSpinner.setPreferredSize(new Dimension(60, 20)); - this.barHeightSpinner.setPreferredSize(new Dimension(60, 20)); JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - TitledBorder titledBorder = new TitledBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Sample"), 4, 2, this.getFont(), UIConstants.LINE_COLOR); + TitledBorder titledBorder = new TitledBorder(new FineRoundBorder(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Sample"), 4, 2, this.getFont(), UIConstants.LINE_COLOR); borderPane.setBorder(titledBorder); borderPane.add(barCodePreviewPane, BorderLayout.CENTER); setTypeComboBox(); @@ -82,21 +86,9 @@ public class BarCodePane extends FurtherBasicBeanPane { drawingTextCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bar_CodeD_Drawing_Text")); drawingTextCheckBox.setSelected(true); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, f}; - double[] rowSize = {p, p, p, p, p, p, p, p}; - int[][] rowCount = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}}; - barCodePreviewPane.setPreferredSize(new Dimension(0, 125)); - typeComboBox.setPreferredSize(new Dimension(155,20)); + drawingTextCheckBox.setBorder(null); + barCodePreviewPane.setPreferredSize(new Dimension(0, FineUIScale.scale(110))); final JPanel centerPane = new JPanel(new CardLayout()); - - Component[][] components = new Component[][]{ - new Component[]{typeSetLabel, typeComboBox}, - new Component[]{borderPane, null}, - new Component[]{centerPane, null} - }; - JPanel barCode = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_HUGER, LayoutConstants.VGAP_LARGE); centerPane.add(getNormalPane(), "normal"); centerPane.add(getSpecialPane(), "special"); typeComboBox.addItemListener(new ItemListener() { @@ -107,8 +99,15 @@ public class BarCodePane extends FurtherBasicBeanPane { repaintPreviewBarCode(); } }); + this.setLayout(new BorderLayout()); - this.add(barCode, BorderLayout.CENTER); + this.add(column(LayoutConstants.VERTICAL_GAP, + row( + cell(typeSetLabel).weight(1.2), cell(typeComboBox).weight(2.8) + ), + cell(borderPane), + cell(centerPane) + ).getComponent(), BorderLayout.CENTER); } private void setTypeComboBox() { @@ -135,51 +134,43 @@ public class BarCodePane extends FurtherBasicBeanPane { } private JPanel getNormalPane() { - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p, p, p, p, p, p}; - double[] columnSize = {p, f, f}; - int[][] rowCount = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}; - JPanel barWidthContainer = new JPanel(new BorderLayout()); - barWidthContainer.add(barWidthSpinner); - JPanel barHeightContainer = new JPanel(new BorderLayout()); - barHeightContainer.add(barHeightSpinner); - UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tree_Width"), UILabel.RIGHT); - uiLabel.setPreferredSize(typeSetLabel.getPreferredSize()); - JPanel drawingTextCheckBoxPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - drawingTextCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); - drawingTextCheckBoxPane.add(drawingTextCheckBox); - Component[][] components_normal = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Barcode_Size"), UILabel.LEFT), barWidthContainer, barHeightContainer}, - new Component[]{null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tree_Width"), UILabel.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tree_Height"), UILabel.CENTER)}, - new Component[]{drawingTextCheckBoxPane, null, null} - }; - - - JPanel normalPane = TableLayoutHelper.createGapTableLayoutPane(components_normal, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE); - return normalPane; + return Layouts.column( + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Barcode_Size"), UILabel.LEFT)).weight(1.2), + cell(barWidthSpinner).weight(1.4), + fix(4), + cell(barHeightSpinner).weight(1.4) + ), + fix(1), + row( + flex(1.2), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tree_Width"), UILabel.CENTER)).weight(1.4), + fix(4), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tree_Height"), UILabel.CENTER)).weight(1.4) + ), + fix(10), + row( + cell(drawingTextCheckBox) + ) + ).getComponent(); } private JPanel getSpecialPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, f}; - double[] rowSize = {p, p, p}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; - UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCode_Version"), UILabel.LEFT); - uiLabel.setPreferredSize(typeSetLabel.getPreferredSize()); - versionComboBox.setPreferredSize(new Dimension(155,20)); - errorCorrectComboBox.setPreferredSize(new Dimension(155,20)); - sizeSpinner.setPreferredSize(new Dimension(155,20)); - Component[][] components_special = new Component[][]{ - new Component[]{uiLabel, versionComboBox}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCode_Error_Correct"), UILabel.LEFT), errorCorrectComboBox}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCodeDrawPix"), UILabel.LEFT), sizeSpinner} - }; - - JPanel specialPane = TableLayoutHelper.createGapTableLayoutPane(components_special, rowSize, columnSize, rowCount, LayoutConstants.VGAP_HUGER, LayoutConstants.VGAP_LARGE); - return specialPane; + return Layouts.column(LayoutConstants.VERTICAL_GAP, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCode_Version"), UILabel.LEFT)).weight(1.2), + cell(versionComboBox).weight(2.8) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCode_Error_Correct"), UILabel.LEFT)).weight(1.2), + cell(errorCorrectComboBox).weight(2.8) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCodeDrawPix"), UILabel.LEFT)).weight(1.2), + cell(sizeSpinner).weight(2.8) + ) + ).getComponent(); } private void addListener() { diff --git a/designer-realize/src/main/java/com/fr/design/present/CurrencyLinePane.java b/designer-realize/src/main/java/com/fr/design/present/CurrencyLinePane.java index 6a98189d9..138929178 100644 --- a/designer-realize/src/main/java/com/fr/design/present/CurrencyLinePane.java +++ b/designer-realize/src/main/java/com/fr/design/present/CurrencyLinePane.java @@ -1,16 +1,16 @@ package com.fr.design.present; +import com.fine.swing.ui.layout.Layouts; +import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIScale; import com.fr.code.bar.BarcodeException; import com.fr.design.beans.FurtherBasicBeanPane; -import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; 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.utils.gui.GUICoreUtils; import com.fr.report.cell.cellattr.CurrencyLineAttr; @@ -25,27 +25,25 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import java.awt.*; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + /** * @author zhou * @since 2012-6-4下午7:34:52 */ public class CurrencyLinePane extends FurtherBasicBeanPane { - private static final int VS_NUM = 4; - private static final int VG_NUM = 6; - private static final Dimension NORMAL_DIMENSION = new Dimension(155, 20); private UISpinner intPartSpinner; private UISpinner deciPartSpinner; private UITextField textField; - private CurrencyLinePreviewPane CurrencyLinePreviewPane; - private int intPart = 9; - private int deciPart = 3; + private CurrencyLinePreviewPane currencyLinePreviewPane; private static final int POSITION = 8; ChangeListener listener2 = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { - CurrencyLinePreviewPane.setObject(textField.getText(), update()); + currencyLinePreviewPane.setObject(textField.getText(), update()); } }; @@ -53,17 +51,17 @@ public class CurrencyLinePane extends FurtherBasicBeanPane DocumentListener listener = new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { - CurrencyLinePreviewPane.setObject(textField.getText(), update()); + currencyLinePreviewPane.setObject(textField.getText(), update()); } @Override public void removeUpdate(DocumentEvent e) { - CurrencyLinePreviewPane.setObject(textField.getText(), update()); + currencyLinePreviewPane.setObject(textField.getText(), update()); } @Override public void changedUpdate(DocumentEvent e) { - CurrencyLinePreviewPane.setObject(textField.getText(), update()); + currencyLinePreviewPane.setObject(textField.getText(), update()); } }; @@ -74,43 +72,36 @@ public class CurrencyLinePane extends FurtherBasicBeanPane protected void initComponents() { // 整数位选择 intPartSpinner = new UISpinner(1, 20, 1, 9); - intPartSpinner.setPreferredSize(NORMAL_DIMENSION); - // 小数位选择 deciPartSpinner = new UISpinner(1, 10, 1, 2); - deciPartSpinner.setPreferredSize(NORMAL_DIMENSION); // 预览区域 textField = new UITextField(10); - CurrencyLinePreviewPane = new CurrencyLinePreviewPane(); - CurrencyLinePreviewPane.setPreferredSize(new Dimension(0, 145)); + currencyLinePreviewPane = new CurrencyLinePreviewPane(); + currencyLinePreviewPane.setPreferredSize(new Dimension(0, FineUIScale.scale(145))); JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - TitledBorder titledBorder = new TitledBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Sample"), 4, 2, this.getFont(), UIConstants.LINE_COLOR); + TitledBorder titledBorder = new TitledBorder(new FineRoundBorder(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Sample"), 4, 2, this.getFont(), UIConstants.LINE_COLOR); borderPane.setBorder(titledBorder); - borderPane.add(CurrencyLinePreviewPane, BorderLayout.CENTER); + borderPane.add(currencyLinePreviewPane, BorderLayout.CENTER); textField.requestFocus(); - double vs = VS_NUM; - double vg = VG_NUM; - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, f}; - double[] rowSize = {p, p, p, p}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; - - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Data"), UILabel.LEFT), textField}, - new Component[]{borderPane, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_IntPart"), UILabel.LEFT), groupPane(intPartSpinner)}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Deci_Part"), UILabel.LEFT), groupPane(deciPartSpinner)} - - }; - - JPanel linePane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_HUGER, LayoutConstants.VGAP_LARGE); this.setLayout(new BorderLayout()); - this.add(linePane, BorderLayout.CENTER); - + this.add(Layouts.column(LayoutConstants.VERTICAL_GAP, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Data"), UILabel.LEFT)).weight(1.2), + cell(textField).weight(3) + ), + cell(borderPane), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_IntPart"), UILabel.LEFT)).weight(1.2), + cell(intPartSpinner).weight(3) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Deci_Part"), UILabel.LEFT)).weight(1.2), + cell(deciPartSpinner).weight(3) + ) + ).getComponent(), BorderLayout.CENTER); textField.getDocument().addDocumentListener(listener); intPartSpinner.addChangeListener(listener2); @@ -141,14 +132,12 @@ public class CurrencyLinePane extends FurtherBasicBeanPane * */ public void setintPart(int intpart) { - this.intPart = intpart; } /** * */ public void setdeciPart(int decipart) { - this.deciPart = decipart; } private class CurrencyLinePreviewPane extends JPanel { @@ -156,7 +145,6 @@ public class CurrencyLinePane extends FurtherBasicBeanPane CurrencyLineAttr currencyLineAttr; public CurrencyLinePreviewPane() { -// setBackground(Color.WHITE); } public void setObject(String text, CurrencyLineAttr currencyLineAttr) { @@ -185,14 +173,6 @@ public class CurrencyLinePane extends FurtherBasicBeanPane } - protected static JPanel groupPane(JComponent comp) { - JPanel jp = new JPanel(); - jp.setBorder(null); - jp.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); - jp.add(comp); - return jp; - } - @Override /** * 是否为该类型 diff --git a/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortItemPane.java b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortItemPane.java index 0c202fe0e..a717c1640 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortItemPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortItemPane.java @@ -2,7 +2,6 @@ package com.fr.design.sort.celldscolumn; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.sort.common.AbstractSortItemPane; -import com.fr.design.sort.common.AbstractSortPane; import com.fr.report.core.sort.sortexpression.SortExpression; import javax.swing.*; @@ -18,10 +17,9 @@ public class CellDSColumnSortItemPane extends AbstractSortItemPane { } @Override - public void initMainSortAreaPane(JPanel sortAreaPane) { + public Component getSortAreaComponent(JPanel sortAreaPane) { sortAreaUiComboBox = new UIComboBox(new String[0]); - sortAreaUiComboBox.setPreferredSize(new Dimension(sortItemPaneRightWidth, AbstractSortPane.PANE_COMPONENT_HEIGHT)); - sortAreaPane.add(sortAreaUiComboBox); + return sortAreaUiComboBox; } public void populateBean(SortExpression sortExpression) { diff --git a/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java index 4b14dc692..18b080775 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java @@ -1,12 +1,12 @@ package com.fr.design.sort.cellexpand; -import com.fr.design.sort.common.AbstractSortPane; import com.fr.design.sort.common.SortColumnRowPane; import com.fr.design.sort.common.AbstractSortItemPane; import com.fr.report.core.sort.sortexpression.SortExpression; import com.fr.stable.ColumnRow; import javax.swing.*; +import java.awt.Component; public class CellExpandSortItemPane extends AbstractSortItemPane { SortColumnRowPane columnRowPane; @@ -16,9 +16,9 @@ public class CellExpandSortItemPane extends AbstractSortItemPane { } @Override - public void initMainSortAreaPane(JPanel sortAreaPane) { - columnRowPane = new SortColumnRowPane(sortItemPaneRightWidth + 4, AbstractSortPane.PANE_COMPONENT_HEIGHT); - sortAreaPane.add(columnRowPane); + public Component getSortAreaComponent(JPanel sortAreaPane) { + columnRowPane = new SortColumnRowPane(); + return columnRowPane; } public void populateBean(SortExpression sortExpression) { diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java index 8a90b960e..0075d92b6 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java @@ -1,6 +1,7 @@ package com.fr.design.sort.common; -import com.fr.base.svg.IconUtils; +import com.fine.swing.ui.layout.Layouts; +import com.fine.theme.icon.LazyIcon; import com.fr.design.event.ComponentChangeListener; import com.fr.design.event.ComponentChangeObserver; import com.fr.design.gui.ibutton.UIButton; @@ -15,6 +16,8 @@ import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; + public abstract class AbstractSortGroupPane extends JPanel implements ComponentChangeObserver { @@ -34,7 +37,6 @@ public abstract class AbstractSortGroupPane extends JPanel implements ComponentC public AbstractSortGroupPane(int sortGroupPaneWidth, int sortGroupPaneRightWidth) { this.sortGroupPaneRightWidth = sortGroupPaneRightWidth; this.sortGroupPaneWidth = sortGroupPaneWidth; - this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); initComponents(); } @@ -42,8 +44,11 @@ public abstract class AbstractSortGroupPane extends JPanel implements ComponentC addSortItemBar = new AddSortItemBar(this); sortItemListPane = new JPanel(); sortItemListPane.setLayout(new BoxLayout(sortItemListPane, BoxLayout.Y_AXIS)); - this.add(sortItemListPane); - this.add(addSortItemBar); + this.setLayout(new BorderLayout()); + this.add(Layouts.column( + cell(sortItemListPane), + cell(addSortItemBar) + ).getComponent(), BorderLayout.CENTER); } public void populateBean(List sortExpressions, String selfSortArea) { @@ -51,8 +56,8 @@ public abstract class AbstractSortGroupPane extends JPanel implements ComponentC this.selfSortArea = selfSortArea; this.sortExpressions = sortExpressions; this.sortUIExpandablePanes = new ArrayList<>(); - for (int i = 0; i < sortExpressions.size(); i++) { - addSortItem(sortExpressions.get(i)); + for (SortExpression sortExpression : sortExpressions) { + addSortItem(sortExpression); } refresh(); } @@ -153,19 +158,13 @@ public abstract class AbstractSortGroupPane extends JPanel implements ComponentC AddSortItemBar(AbstractSortGroupPane sortGroupPane) { init(); this.sortGroupPane = sortGroupPane; - this.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 5)); } void init() { - uiButton = new UIButton(Toolkit.i18nText("Fine-Design_Sort_Add_Second_Sort"), - IconUtils.readIcon("/com/fr/design/images/sort/add.png")); - uiButton.setPreferredSize(new Dimension(sortGroupPaneWidth - 4, AbstractSortPane.PANE_COMPONENT_HEIGHT)); + uiButton = new UIButton(Toolkit.i18nText("Fine-Design_Sort_Add_Second_Sort"),new LazyIcon("add")); + this.setLayout(new BorderLayout()); this.add(uiButton); - uiButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - sortGroupPane.addSortItem(null); - } - }); + uiButton.addActionListener(e -> sortGroupPane.addSortItem(null)); } } } diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortItemPane.java b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortItemPane.java index a5fec3f47..437f38fa7 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortItemPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortItemPane.java @@ -1,5 +1,9 @@ package com.fr.design.sort.common; +import com.fine.swing.ui.layout.Layouts; +import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.gui.core.ReactiveCardPane; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; @@ -14,11 +18,12 @@ import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; import java.util.ArrayList; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.cell; + public abstract class AbstractSortItemPane extends JPanel { protected int sortItemPaneWidth; protected int sortItemPaneRightWidth; @@ -29,13 +34,40 @@ public abstract class AbstractSortItemPane extends JPanel { UIComboBox sortBasisUiComboBox; JPanel sortAreaPane; JPanel sortRulePane; + SortExpressionPane formulaExpressionPane; + SortExpressionPane customExpressionPane; + ReactiveCardPane cardPane; public AbstractSortItemPane(int sortItemPaneWidth, int sortItemPaneRightWidth) { this.sortItemPaneWidth = sortItemPaneWidth; this.sortItemPaneRightWidth = sortItemPaneRightWidth; - this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); registerSortExpressionPanes(); initComponents(); + initLayouts(); + } + + private void initLayouts() { + cardPane = ReactiveCardPane.create() + .addSupplier("cell", () -> column(LayoutConstants.VERTICAL_GAP, + cell(sortAreaPane), + cell(sortBasisPanel), + cell(sortRulePane) + ).getComponent()) + .addSupplier("formula", () -> column(LayoutConstants.VERTICAL_GAP, + cell(sortBasisPanel), + cell(formulaExpressionPane), + cell(sortRulePane) + ).getComponent()) + .addSupplier("custom", () -> column(LayoutConstants.VERTICAL_GAP, + cell(sortAreaPane), + cell(sortBasisPanel), + cell(currentSortExpressionPane), + cell(sortRulePane) + ).getComponent()); + cardPane.select("cell").populate(); + cardPane.setBorder(new ScaledEmptyBorder(LayoutConstants.VERTICAL_GAP, 0, LayoutConstants.VERTICAL_GAP, 0)); + this.setLayout(new BorderLayout()); + this.add(cardPane, BorderLayout.CENTER); } private void initComponents() { @@ -46,54 +78,43 @@ public abstract class AbstractSortItemPane extends JPanel { private void registerSortExpressionPanes() { sortExpressionPanes.add(new CellSortExpressionPane(sortItemPaneRightWidth)); - sortExpressionPanes.add(new FormulaSortExpressionPane(sortItemPaneRightWidth)); - sortExpressionPanes.add(new CustomSequenceSortExpressionPane(sortItemPaneWidth, sortItemPaneRightWidth)); + sortExpressionPanes.add(formulaExpressionPane = new FormulaSortExpressionPane(sortItemPaneRightWidth)); + sortExpressionPanes.add(customExpressionPane = new CustomSequenceSortExpressionPane(sortItemPaneWidth, sortItemPaneRightWidth)); } void initSortAreaPane() { - sortAreaPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, AbstractSortPane.PANE_COMPONENT_V_GAP)); - sortAreaPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Sort_Sort_Area"), SwingConstants.LEFT)); - sortAreaPane.add(AbstractSortPane.createIntervalUILabel()); - initMainSortAreaPane(sortAreaPane); - this.add(sortAreaPane); + sortAreaPane = new JPanel(new BorderLayout()); + Component component = getSortAreaComponent(sortAreaPane); + sortAreaPane.add(Layouts.row( + cell(new UILabel(Toolkit.i18nText("Fine-Design_Sort_Sort_Area"), SwingConstants.LEFT)).weight(1.2), + cell(component).weight(3) + ).getComponent()); } - public abstract void initMainSortAreaPane(JPanel sortAreaPane); + public abstract Component getSortAreaComponent(JPanel sortAreaPane); void initSortRulePane() { - sortRulePane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, AbstractSortPane.PANE_COMPONENT_V_GAP)); sortRuleUiComboBox = new UIComboBox(new String[]{SortRule.ASC.getDescription(), SortRule.DES.getDescription(), SortRule.NO_SORT.getDescription()}); sortRuleUiComboBox.setPreferredSize(new Dimension(sortItemPaneRightWidth, AbstractSortPane.PANE_COMPONENT_HEIGHT)); - sortRulePane.add(new UILabel(Toolkit.i18nText("Fine-Design_Sort_Sort_Rule"), SwingConstants.LEFT)); - sortRulePane.add(AbstractSortPane.createIntervalUILabel()); - sortRulePane.add(sortRuleUiComboBox); - this.add(sortRulePane); + sortRulePane = Layouts.row( + cell(new UILabel(Toolkit.i18nText("Fine-Design_Sort_Sort_Rule"), SwingConstants.LEFT)).weight(1.2), + cell(sortRuleUiComboBox).weight(3) + ).getComponent(); } void initSortBasisPanel() { - sortBasisPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, AbstractSortPane.PANE_COMPONENT_V_GAP)); sortBasisUiComboBox = new UIComboBox(getSortNames()); sortBasisUiComboBox.setPreferredSize(new Dimension(sortItemPaneRightWidth, AbstractSortPane.PANE_COMPONENT_HEIGHT)); - sortBasisUiComboBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (sortExpressionPanes.get(sortBasisUiComboBox.getSelectedIndex()) != currentSortExpressionPane) { - if (currentSortExpressionPane != null) { - currentSortExpressionPane.setVisible(false); - } - triggerItemChanged(sortBasisUiComboBox.getSelectedIndex()); - } + sortBasisUiComboBox.addItemListener(e -> { + if (sortExpressionPanes.get(sortBasisUiComboBox.getSelectedIndex()) != currentSortExpressionPane) { + triggerItemChanged(sortBasisUiComboBox.getSelectedIndex()); } }); - sortBasisPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Sort_Sort_Basis"), SwingConstants.LEFT)); - sortBasisPanel.add(AbstractSortPane.createIntervalUILabel()); - sortBasisPanel.add(sortBasisUiComboBox); - this.add(sortBasisPanel); - for (SortExpressionPane sortExpressionPane : sortExpressionPanes) { - this.add(sortExpressionPane); - sortExpressionPane.setVisible(false); - } + sortBasisPanel = Layouts.row( + cell(new UILabel(Toolkit.i18nText("Fine-Design_Sort_Sort_Basis"), SwingConstants.LEFT)).weight(1.2), + cell(sortBasisUiComboBox).weight(3) + ).getComponent(); } void triggerItemChanged(Integer index) { @@ -102,9 +123,13 @@ public abstract class AbstractSortItemPane extends JPanel { } private void refreshCurrentSortExpressionPane() { - currentSortExpressionPane.setVisible(true); - sortAreaPane.setVisible(currentSortExpressionPane.needSortArea()); - sortRulePane.setVisible(currentSortExpressionPane.needSortRule()); + if (currentSortExpressionPane instanceof FormulaSortExpressionPane) { + cardPane.select("formula").populate(); + } else if (currentSortExpressionPane instanceof CustomSequenceSortExpressionPane) { + cardPane.select("custom").populate(); + } else { + cardPane.select("cell").populate(); + } } private String[] getSortNames() { diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java b/designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java index 0db7af4a1..eaf2bbdd0 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java @@ -1,5 +1,7 @@ package com.fr.design.sort.common; +import com.fine.swing.ui.layout.Layouts; +import com.fine.theme.icon.LazyIcon; import com.fr.base.Style; import com.fr.base.background.ColorBackground; import com.fr.base.svg.IconUtils; @@ -27,22 +29,21 @@ import com.fr.stable.StringUtils; import javax.swing.Icon; import javax.swing.JPanel; import javax.swing.JTextField; +import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Dimension; -import java.awt.FlowLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; +import static com.fine.swing.ui.layout.Layouts.cell; + public class SortColumnRowPane extends JPanel implements UIObserver { - int paneWidth; - int paneHeight; - int jTextFieldWidth; JTextField colJTextField; JTextField rowJTextField; UIButton selectButton; + UILabel elementLabel; private boolean isAlreadyAddListener = false; private CellSelection oldSelection; private SelectionListener gridSelectionChangeListener; @@ -54,28 +55,30 @@ public class SortColumnRowPane extends JPanel implements UIObserver { HeaderAreaPane.CellSelectionManager cellSelectionManager; - public SortColumnRowPane(int paneWidth, int paneHeight) { - this.paneWidth = paneWidth; - this.paneHeight = paneHeight; + public SortColumnRowPane() { initComponents(); } private void initComponents() { - initSize(); - this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); intUILabel(); initTextField(); initSelectButton(); - this.setSize(new Dimension(paneWidth, paneHeight)); + initLayout(); } - void initSize() { - jTextFieldWidth = (paneWidth - 40) / 2; + private void initLayout() { + this.setLayout(new BorderLayout()); + this.add(Layouts.row(2, + cell(elementLabel).weight(1), + cell(colJTextField).weight(2), + cell(rowJTextField).weight(2), + cell(selectButton).weight(1) + ).getComponent()); } + void intUILabel() { - UILabel uiLabel = new UILabel(IconUtils.readIcon("/com/fr/design/images/buttonicon/propertiestab/cellelement_normal.png")); - this.add(uiLabel); + elementLabel = new UILabel(new LazyIcon("cellelement_small")); } public static boolean isAvailableColumnRow(ColumnRow columnRow) { @@ -87,17 +90,12 @@ public class SortColumnRowPane extends JPanel implements UIObserver { colJTextField.setEditable(false); rowJTextField = new JTextField(); rowJTextField.setEditable(false); - colJTextField.setPreferredSize(new Dimension(jTextFieldWidth, paneHeight)); - rowJTextField.setPreferredSize(new Dimension(jTextFieldWidth, paneHeight)); - this.add(colJTextField); - this.add(rowJTextField); } void initSelectButton() { selectButton = new UIButton(ENABLE_ICON); selectActionListener = new SelectActionListener(this); selectButton.addMouseListener(selectActionListener); - this.add(selectButton); } public void populateBean(ColumnRow columnRow, boolean enabled, HeaderAreaPane.CellSelectionManager cellSelectionManager) { @@ -129,7 +127,9 @@ public class SortColumnRowPane extends JPanel implements UIObserver { public void setColumnRow(ColumnRow columnRow) { populateBean(columnRow); - uiObserverListener.doChange(); + if (uiObserverListener != null) { + uiObserverListener.doChange(); + } } public ColumnRow updateBean() { diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java b/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java index 42a135298..1b3ffd640 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java @@ -1,12 +1,14 @@ package com.fr.design.sort.common; -import com.fr.base.BaseUtils; -import com.fr.base.svg.IconUtils; +import com.fine.swing.ui.layout.Layouts; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fr.design.constants.LayoutConstants; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; -import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.design.i18n.Toolkit; import javax.swing.*; @@ -14,6 +16,9 @@ import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.flex; + public class SortUIExpandablePane extends JPanel { private static final long serialVersionUID = 1L; @@ -31,12 +36,12 @@ public class SortUIExpandablePane extends JPanel { public SortUIExpandablePane(AbstractSortItemPane contentPane, AbstractSortGroupPane sortGroupPane) { super(); + this.setLayout(new BorderLayout()); this.sortGroupPane = sortGroupPane; this.contentPane = contentPane; initComponents(); - wrapPane.setBorder(BorderFactory.createLineBorder(new Color(217, 218, 221), 1)); + wrapPane.setBorder(new FineRoundBorder()); wrapPane.setBackground(Color.WHITE); - this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 5)); } @@ -51,11 +56,12 @@ public class SortUIExpandablePane extends JPanel { } }); headerPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(217, 218, 221))); - contentPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); + contentPane.setBorder(new ScaledEmptyBorder(0, 5, 0, 5)); wrapPane.add(headerPane, BorderLayout.NORTH); wrapPane.add(contentPane, BorderLayout.CENTER); setContentPanelShow(true); this.add(wrapPane); + this.setBorder(new ScaledEmptyBorder(0, 0, LayoutConstants.VERTICAL_GAP, 0)); } @@ -77,20 +83,14 @@ public class SortUIExpandablePane extends JPanel { HeaderPane(AbstractSortGroupPane sortGroupPane) { this.sortGroupPane = sortGroupPane; - this.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 0)); initComponents(); + this.setBorder(new ScaledEmptyBorder(5, 0, 5, 0)); } private void initComponents() { iconUiLabel = new UILabel(); - this.add(iconUiLabel); tipUILabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Second_Sort")); - this.add(tipUILabel); - this.add(AbstractSortPane.createIntervalUILabel( DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.sort.expand.header.pane"))); - - closeButton = new UILabel(IconUtils.readIcon("/com/fr/design/images/control/close.png")); - closeButton.setPreferredSize(new Dimension(16, 20)); - this.add(closeButton); + closeButton = new UILabel(new LazyIcon("close")); closeButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { @@ -100,14 +100,19 @@ public class SortUIExpandablePane extends JPanel { } } }); - this.setPreferredSize(new Dimension(contentPane.sortItemPaneWidth + 7, AbstractSortPane.PANE_COMPONENT_HEIGHT)); + this.setLayout(new BorderLayout()); + this.add(Layouts.row( + cell(iconUiLabel), cell(tipUILabel), flex(), cell(closeButton) + ) + .getComponent(), BorderLayout.CENTER); + this.setPreferredSize(new Dimension(contentPane.sortItemPaneWidth + FineUIScale.scale(7), FineUIScale.scale(24))); } public void setShow(boolean show) { if (show) { - iconUiLabel.setIcon(IconUtils.readIcon("/com/fr/design/images/sort/down_arrow.png")); + iconUiLabel.setIcon(new LazyIcon("triangle_down")); } else { - iconUiLabel.setIcon(IconUtils.readIcon("/com/fr/design/images/sort/left_arrow.png")); + iconUiLabel.setIcon(new LazyIcon("triangle_right")); } } diff --git a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequencePane.java b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequencePane.java index 3a5b9641f..a67cd5aa6 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequencePane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequencePane.java @@ -1,11 +1,12 @@ package com.fr.design.sort.expressionpane; -import com.fr.base.svg.IconUtils; +import com.fine.swing.ui.layout.Layouts; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIScale; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.sort.common.AbstractSortPane; import com.fr.report.core.sort.sortexpression.CustomSequenceSortExpression; import javax.swing.*; @@ -14,27 +15,25 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; + public class CustomSequencePane extends JPanel { protected UITextField textField; protected UIButton button; List customSequence; - public CustomSequencePane(int width) { - this.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); - this.initComponents(width); + public CustomSequencePane() { + this.setLayout(new BorderLayout()); + this.initComponents(); } - protected void initComponents(int width) { + protected void initComponents() { textField = new UITextField(); textField.setEditable(false); - textField.setPreferredSize(new Dimension(width - 20, AbstractSortPane.PANE_COMPONENT_HEIGHT)); - Icon icon = IconUtils.readIcon("/com/fr/design/images/sort/sequence.png"); - button = new UIButton(icon); - button.setBackground(Color.RED); + button = new UIButton(new LazyIcon("nosort")); button.setOpaque(false); button.setCursor(new Cursor(Cursor.HAND_CURSOR)); - button.setPreferredSize(new Dimension(20, AbstractSortPane.PANE_COMPONENT_HEIGHT)); MouseAdapter mouseAdapter = new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { @@ -46,13 +45,14 @@ public class CustomSequencePane extends JPanel { triggerOk(CustomSequenceSortExpression.customSequenceToString(customSequence, ","), CustomSequenceSortExpression.isReferenceCustomSequence(customSequence)); } - }, new Dimension(700, 400)).setVisible(true); + }, FineUIScale.scale(new Dimension(700, 400))).setVisible(true); } }; button.addMouseListener(mouseAdapter); textField.addMouseListener(mouseAdapter); - this.add(textField); - this.add(button); + this.add(Layouts.row( + cell(textField).weight(6), cell(button).weight(1) + ).getComponent()); } private void triggerOk(String customSequence, Boolean referenceCustomSequence) { diff --git a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java index 69dac2a2a..b56b60b90 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java @@ -1,21 +1,25 @@ package com.fr.design.sort.expressionpane; -import com.fr.design.sort.common.AbstractSortPane; +import com.fine.swing.ui.layout.Layouts; import com.fr.locale.InterProviderFactory; import com.fr.report.core.sort.sortexpression.CustomSequenceSortExpression; -import javax.swing.*; import java.awt.*; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.flex; + public class CustomSequenceSortExpressionPane extends SortExpressionPane { CustomSequencePane customSequencePane; public CustomSequenceSortExpressionPane(int width, int rightWidth) { - this.setLayout(new FlowLayout(FlowLayout.RIGHT, 2, 0)); - customSequencePane = new CustomSequencePane(rightWidth + 5); - this.add(customSequencePane); + this.setLayout(new BorderLayout()); + customSequencePane = new CustomSequencePane(); + this.add(Layouts.row( + flex(1.2), cell(customSequencePane).weight(3) + ).getComponent()); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/FormulaSortExpressionPane.java b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/FormulaSortExpressionPane.java index 3785a7e97..dc27f2123 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/FormulaSortExpressionPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/FormulaSortExpressionPane.java @@ -1,21 +1,25 @@ package com.fr.design.sort.expressionpane; +import com.fine.swing.ui.layout.Layouts; import com.fr.design.formula.TinyFormulaPane; -import com.fr.design.sort.common.AbstractSortPane; import com.fr.locale.InterProviderFactory; import com.fr.report.core.sort.sortexpression.FormulaSortExpression; import java.awt.*; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.flex; + public class FormulaSortExpressionPane extends SortExpressionPane { TinyFormulaPane tinyFormulaPane; public FormulaSortExpressionPane(int width) { - this.setLayout(new FlowLayout(FlowLayout.RIGHT, 2, 0)); + this.setLayout(new BorderLayout()); tinyFormulaPane = new TinyFormulaPane(); - tinyFormulaPane.setPreferredSize(new Dimension(width + 5, AbstractSortPane.PANE_COMPONENT_HEIGHT)); - this.add(tinyFormulaPane); + this.add(Layouts.row( + flex(1.2), cell(tinyFormulaPane).weight(3) + ).getComponent()); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java index 831038758..15ce26c67 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java @@ -1,35 +1,28 @@ package com.fr.design.sort.header; -import com.fr.design.designer.TargetComponent; -import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.gui.core.ReactiveCardPane; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.ElementCasePane; -import com.fr.design.sort.common.AbstractSortPane; import com.fr.design.sort.common.SortColumnRowPane; import com.fr.design.sort.common.SortUtils; -import com.fr.log.FineLoggerFactory; 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.core.sort.common.CellSortable; import com.fr.report.core.sort.header.SortHeader; import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.ColumnRow; 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.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; import java.util.ArrayList; -import java.util.HashMap; import java.util.Iterator; -import java.util.Map; + +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 HeaderAreaPane extends JPanel { @@ -37,31 +30,63 @@ public class HeaderAreaPane extends JPanel { protected int headerAreaPaneRightWidth; private CellSelectionManager cellSelectionManager = new CellSelectionManager(); TemplateCellElement cellElement; - - - AreaJLayeredPane areaJLayeredPane; + SortColumnRowPane columnRowPane; + ReactiveCardPane cardPane; + UIComboBox uiComboBox; + UILabel headerLabel; HeaderAreaPane(int headerAreaPaneWidth, int headerAreaPaneRightWidth) { this.headerAreaPaneWidth = headerAreaPaneWidth; this.headerAreaPaneRightWidth = headerAreaPaneRightWidth; - this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); initComponents(); } void initComponents() { - initUILabel(); - initLayeredPane(); + headerLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Header_Area"), SwingConstants.LEFT); + uiComboBox = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_None"), Toolkit.i18nText("Fine-Design_Basic_Custom")}); + columnRowPane = new SortColumnRowPane(); + initCardPane(); + initChangeListener(); + this.setLayout(new BorderLayout()); + this.add(cardPane); } - void initUILabel() { - UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Header_Area"), SwingConstants.LEFT); - this.add(uiLabel); - this.add(AbstractSortPane.createIntervalUILabel()); + private void initChangeListener() { + uiComboBox.addItemListener(e -> { + if (uiComboBox.getSelectedIndex() == 0) { + cardPane.select("none").populate(); + cellSelectionManager.removeNotSelectables(columnRowPane.updateBean()); + columnRowPane.cancelSelectState(); + } else { + cardPane.select("custom").populate(); + ColumnRow columnRow = columnRowPane.updateBean(); + if (cellSelectionManager.isNotSelectables(columnRow)) { + columnRowPane.setColumnRow(ColumnRow.ERROR); + } else { + cellSelectionManager.addNotSelectables(columnRow); + } + } + }); + uiComboBox.setEnabled(false); } - void initLayeredPane() { - areaJLayeredPane = new AreaJLayeredPane(); - this.add(areaJLayeredPane); + private void initCardPane() { + cardPane = ReactiveCardPane.create() + .addSupplier("none", () -> column(LayoutConstants.VERTICAL_GAP, + row( + cell(headerLabel).weight(1.2), cell(uiComboBox).weight(3) + ) + ).getComponent()) + .addSupplier("custom", () -> column(LayoutConstants.VERTICAL_GAP, + row( + cell(headerLabel).weight(1.2), cell(uiComboBox).weight(3) + ), + row( + flex(1.2), cell(columnRowPane).weight(3) + ) + ).getComponent()); + + cardPane.select("none").populate(); } public void populateBean(ColumnRow columnRow, boolean showHeaderArea, TemplateCellElement cellElement) { @@ -71,7 +96,18 @@ public class HeaderAreaPane extends JPanel { if (elementCasePane != null) { enabled = elementCasePane.isSelectedOneCell(); } - areaJLayeredPane.populateBean(columnRow, showHeaderArea, enabled); + populateColumnRowPane(columnRow, showHeaderArea, enabled); + } + + private void populateColumnRowPane(ColumnRow columnRow, boolean showHeaderArea, boolean enabled) { + cellSelectionManager.build(cellElement, columnRow); + if(showHeaderArea){ + columnRow = cellSelectionManager.buildCurrentCell(cellElement, columnRow); + } + columnRowPane.populateBean(columnRow, enabled, cellSelectionManager); + uiComboBox.setSelectedIndex(showHeaderArea ? 1 : 0); + uiComboBox.setEnabled(enabled); + } public ColumnRow updateBean(TemplateCellElement cellElement) { @@ -81,7 +117,15 @@ public class HeaderAreaPane extends JPanel { return getOldColumnRow(cellElement); } } - return areaJLayeredPane.updateBean(); + return updateColumnRowBean(); + } + + private ColumnRow updateColumnRowBean() { + if (uiComboBox.getSelectedIndex() == 0) { + return null; + } else { + return columnRowPane.updateBean(); + } } private ColumnRow getOldColumnRow(TemplateCellElement cellElement) { @@ -99,100 +143,6 @@ public class HeaderAreaPane extends JPanel { } } - class AreaJLayeredPane extends JPanel { - SortColumnRowPane columnRowPane; - JLayeredPane jLayeredPane; - UIComboBox uiComboBox; - boolean showHeaderArea; - - AreaJLayeredPane() { - this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); - initComponents(); - } - - private void initComponents() { - initUIComboBox(); - initJLayeredPane(); - } - - - void initUIComboBox() { - uiComboBox = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_None"), Toolkit.i18nText("Fine-Design_Basic_Custom")}); - uiComboBox.setSize(new Dimension(headerAreaPaneRightWidth, AbstractSortPane.PANE_COMPONENT_HEIGHT)); - uiComboBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if ((showHeaderArea ? 1 : 0) != uiComboBox.getSelectedIndex()) { - triggerItemChanged(uiComboBox.getSelectedIndex()); - } - } - }); - uiComboBox.setEnabled(false); - } - - void triggerItemChanged(Integer index) { - setSortColumnRowPaneShow(index == 1); - if (index == 1) { - ColumnRow columnRow = columnRowPane.updateBean(); - if (cellSelectionManager.isNotSelectables(columnRow)) { - columnRowPane.setColumnRow(ColumnRow.ERROR); - } else { - cellSelectionManager.addNotSelectables(columnRow); - } - } else { - cellSelectionManager.removeNotSelectables(columnRowPane.updateBean()); - columnRowPane.cancelSelectState(); - } - } - - void setSortColumnRowPaneShow(boolean show) { - if (show) { - jLayeredPane.setLayer(columnRowPane, JLayeredPane.POPUP_LAYER); - jLayeredPane.setLayer(uiComboBox, JLayeredPane.MODAL_LAYER); - } else { - jLayeredPane.setLayer(uiComboBox, JLayeredPane.POPUP_LAYER); - jLayeredPane.setLayer(columnRowPane, JLayeredPane.MODAL_LAYER); - } - showHeaderArea = show; - refresh(); - } - - void initJLayeredPane() { - jLayeredPane = new JLayeredPane(); - columnRowPane = new SortColumnRowPane(headerAreaPaneRightWidth - 18, AbstractSortPane.PANE_COMPONENT_HEIGHT); - jLayeredPane.setPreferredSize(new Dimension(headerAreaPaneRightWidth, AbstractSortPane.PANE_COMPONENT_HEIGHT)); - jLayeredPane.add(columnRowPane, JLayeredPane.MODAL_LAYER); - jLayeredPane.add(uiComboBox, JLayeredPane.POPUP_LAYER); - this.add(jLayeredPane); - } - - public void populateBean(ColumnRow columnRow, boolean showHeaderArea, boolean enabled) { - cellSelectionManager.build(cellElement, columnRow); - if(showHeaderArea){ - columnRow = cellSelectionManager.buildCurrentCell(cellElement, columnRow); - } - columnRowPane.populateBean(columnRow, enabled, cellSelectionManager); - setSortColumnRowPaneShow(showHeaderArea); - uiComboBox.setSelectedIndex(showHeaderArea ? 1 : 0); - uiComboBox.setEnabled(enabled); - } - - public ColumnRow updateBean() { - if (uiComboBox.getSelectedIndex() == 0) { - return null; - } else { - return columnRowPane.updateBean(); - } - } - - public void refresh() { - validate(); - repaint(); - revalidate(); - } - - } - public static class CellSelectionManager { ElementCasePane elementCase; java.util.List notSelectables = new ArrayList<>(); diff --git a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSettingPane.java b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSettingPane.java index 114300e66..5cd8ea7ed 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSettingPane.java @@ -1,9 +1,9 @@ package com.fr.design.sort.header; +import com.fine.swing.ui.layout.Column; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; -import com.fr.design.sort.common.AbstractSortPane; import com.fr.general.GeneralContext; import com.fr.report.core.sort.header.SortHeader; @@ -13,6 +13,9 @@ import javax.swing.event.ChangeListener; import java.awt.*; import java.util.Locale; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + public class HeaderSettingPane extends JPanel { protected int headerSettingPaneWidth; protected int headerSettingPaneRightWidth; @@ -22,34 +25,30 @@ public class HeaderSettingPane extends JPanel { HeaderSettingPane(int headerSettingPaneWidth, int headerSettingPaneRightWidth) { this.headerSettingPaneWidth = headerSettingPaneWidth; this.headerSettingPaneRightWidth = headerSettingPaneRightWidth; - this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + this.setLayout(new BorderLayout()); initComponents(); } void initComponents() { - initUILabel(); - initHeaderSortRulePane(); - } - - void initUILabel() { - JPanel jPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 2)); UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Header_Setting")); - UILabel emptyUILabel = new UILabel(); - emptyUILabel.setPreferredSize(new Dimension(10, 10)); - uiCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Sort_Allow_User_Click_Sort_Order")); addToolTipText(); - uiCheckBox.setPreferredSize(new Dimension(headerSettingPaneRightWidth - 10, AbstractSortPane.PANE_COMPONENT_HEIGHT)); uiCheckBox.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { headerSortRulePane.setVisible(uiCheckBox.isSelected()); } }); - jPanel.add(uiLabel); - jPanel.add(emptyUILabel); - jPanel.add(uiCheckBox); - this.add(jPanel); + headerSortRulePane = new HeaderSortRulePane(); + headerSortRulePane.setVisible(false); + + Column corePane = new Column(); + corePane.setSpacing(10); + corePane.add( + row(cell(uiLabel).weight(1.2),cell(uiCheckBox).weight(3.0)), + row(cell(headerSortRulePane).weight(1)) + ); + this.add(corePane, BorderLayout.CENTER); } private void addToolTipText() { @@ -58,12 +57,6 @@ public class HeaderSettingPane extends JPanel { } } - void initHeaderSortRulePane() { - headerSortRulePane = new HeaderSortRulePane(); - this.add(headerSortRulePane); - headerSortRulePane.setVisible(false); - } - protected void refresh() { validate(); repaint(); diff --git a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java index d18a73f5d..425015072 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java @@ -1,15 +1,16 @@ package com.fr.design.sort.header; +import com.fine.swing.ui.layout.Layouts; +import com.fine.theme.light.ui.FineRoundBorder; import com.fr.base.FineColor; import com.fr.base.svg.SVGIcon; +import com.fr.design.constants.LayoutConstants; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ipoppane.PopupHider; -import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.style.color.ColorControlWindow; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.report.core.sort.header.HeaderIconBuilder; @@ -25,6 +26,10 @@ import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.util.ArrayList; +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 HeaderSortRulePane extends JPanel { IconButton ascIconButton; IconButton desIconButton; @@ -38,32 +43,23 @@ public class HeaderSortRulePane extends JPanel { HeaderSortRulePane() { initComponents(); initState(true); - this.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 15)); } void initComponents() { this.setLayout(new BorderLayout()); - initUILabel(); - initSortRuleItem(); - this.setPreferredSize(new Dimension(160, 160)); - } - - void initUILabel() { - UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Header_Sort_Basis"), SwingConstants.LEFT); - this.add(uiLabel, BorderLayout.NORTH); - } + UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Header_Sort_Basis"), SwingConstants.LEFT); + ascUICheckBox = new UICheckBox(SortRule.ASC.getDescription()); + ascIconButton = new IconButton(SortRule.ASC); + desUICheckBox = new UICheckBox(SortRule.DES.getDescription()); + desIconButton = new IconButton(SortRule.DES); + nosortUICheckBox = new UICheckBox(SortRule.NO_SORT.getDescription()); + nosortIconButton = new IconButton(SortRule.NO_SORT); + this.add(Layouts.column(LayoutConstants.VERTICAL_GAP, + row(cell(label).weight(1.5), cell(ascUICheckBox).weight(2), flex(), cell(ascIconButton)), + row(flex(1.5), cell(desUICheckBox).weight(2), flex(), cell(desIconButton)), + row(flex(1.5), cell(nosortUICheckBox).weight(2), flex(), cell(nosortIconButton)) + ).getComponent()); - void initSortRuleItem() { - Component[][] components = new Component[][]{ - new Component[]{ascUICheckBox = new UICheckBox(SortRule.ASC.getDescription()), ascIconButton = new IconButton(SortRule.ASC)}, - new Component[]{desUICheckBox = new UICheckBox(SortRule.DES.getDescription()), desIconButton = new IconButton(SortRule.DES)}, - new Component[]{nosortUICheckBox = new UICheckBox(SortRule.NO_SORT.getDescription()), nosortIconButton = new IconButton(SortRule.NO_SORT)}, - }; - double[] rowSize = {ICON_LENGTH + 10, ICON_LENGTH + 10, ICON_LENGTH + 10}; - double[] columnSize = - {DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.sort.rule.item").getWidth(), ICON_LENGTH + 10}; - JPanel sortRuleItem = TableLayoutHelper.createCommonTableLayoutPane(components, rowSize, columnSize, 0); - this.add(sortRuleItem, BorderLayout.CENTER); initUICheckBoxChange(ascUICheckBox, ascIconButton); initUICheckBoxChange(desUICheckBox, desIconButton); initUICheckBoxChange(nosortUICheckBox, nosortIconButton); @@ -108,7 +104,7 @@ public class HeaderSortRulePane extends JPanel { public void setActiveState(boolean activeState) { if (activeState) { - borderUiLabel.setBorder(BorderFactory.createLineBorder(Color.gray, 1)); + borderUiLabel.setBorder(new FineRoundBorder()); } else { borderUiLabel.setBorder(null); } @@ -145,8 +141,7 @@ public class HeaderSortRulePane extends JPanel { Icon getIcon(FineColor fineColor) { BufferedImage bufferedImage = HeaderIconBuilder.getIcon(sortRule, fineColor); - Icon icon = new SVGIcon(bufferedImage); - return icon; + return new SVGIcon(bufferedImage); } void refreshIconLabel(BufferedImage bufferedImage) { diff --git a/designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java b/designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java index 77802429c..0c6f963aa 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java @@ -1,11 +1,16 @@ package com.fr.design.sort.header; -import com.fr.design.sort.common.SortColumnRowPane; +import com.fine.swing.ui.layout.Layouts; +import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fr.design.constants.LayoutConstants; import com.fr.report.cell.TemplateCellElement; import com.fr.report.core.sort.header.SortHeader; import com.fr.stable.ColumnRow; import javax.swing.*; +import java.awt.BorderLayout; + +import static com.fine.swing.ui.layout.Layouts.cell; public class SortHeaderPane extends JPanel { int sortHeaderPaneWidth; @@ -16,22 +21,16 @@ public class SortHeaderPane extends JPanel { TemplateCellElement cellElement; public SortHeaderPane(int sortHeaderPaneWidth, int sortHeaderPaneRightWidth) { + this.setLayout(new BorderLayout()); this.sortHeaderPaneWidth = sortHeaderPaneWidth; this.sortHeaderPaneRightWidth = sortHeaderPaneRightWidth; - this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - initHeaderArea(); - initHeaderSetting(); - this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - } - - void initHeaderArea() { this.headerAreaPane = new HeaderAreaPane(sortHeaderPaneWidth, sortHeaderPaneRightWidth); - this.add(headerAreaPane); - } - - void initHeaderSetting() { this.headerSettingPane = new HeaderSettingPane(sortHeaderPaneWidth, sortHeaderPaneRightWidth); - this.add(headerSettingPane); + this.add( + Layouts.column(LayoutConstants.VERTICAL_GAP, + cell(headerAreaPane), cell(headerSettingPane) + ).with(it -> it.setBorder(new ScaledEmptyBorder(10, 0, 0, 0))).getComponent(), + BorderLayout.CENTER); } public void populateBean(SortHeader sortHeader, String defaultHeaderArea,TemplateCellElement cellElement) { @@ -59,7 +58,6 @@ public class SortHeaderPane extends JPanel { if (columnRow != null) { headerArea = columnRow.toString(); } - SortHeader sortHeader = new SortHeader(headerArea, null, items); - return sortHeader; + return new SortHeader(headerArea, null, items); } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java index 4419392f9..504dc1e4b 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java @@ -1,9 +1,12 @@ package com.fr.quickeditor; +import com.fine.swing.ui.layout.Layouts; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.GraphHelper; import com.fr.base.Style; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.core.ActionFactory; +import com.fr.design.constants.LayoutConstants; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.icombobox.UIComboBox; @@ -12,8 +15,6 @@ import com.fr.design.gui.iscrollbar.UIScrollBar; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.style.TextFormatPaneContainer; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.CellElementPropertyPane; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.ElementCasePane; @@ -36,7 +37,6 @@ import javax.swing.JPanel; import javax.swing.JScrollBar; import javax.swing.SwingUtilities; import java.awt.BorderLayout; -import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.event.ActionEvent; @@ -50,6 +50,9 @@ import java.util.ArrayList; import java.util.Objects; import java.util.Set; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + /** * @author zhou, yaoh.wu * @version 2017年8月7日16点54分 @@ -116,23 +119,14 @@ public abstract class CellQuickEditor extends QuickEditor { } private void createPanelBody() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {f}; + leftContentPane = Layouts.column(LayoutConstants.VERTICAL_GAP, + cell(multipleLabelTip), + cell(topContentContainer), + cell(formatPane), + cell(centerBodyContainer)).getComponent(); if (isScrollAll()) { - double[] scrollAllRowSize = {p, p, p, p}; prepareScrollBar(); - multipleLabelTip.setBorder(BorderFactory.createMatteBorder(5, 10, 0, 0, this.getBackground())); - topContentContainer.setBorder(BorderFactory.createMatteBorder(0, 10, 0, 0, this.getBackground())); - formatPane.setBorder(BorderFactory.createMatteBorder(0, 10, 0, 0, this.getBackground())); - centerBodyContainer.setBorder(BorderFactory.createMatteBorder(0, 10, 0, 0, this.getBackground())); - Component[][] components = new Component[][]{ - new Component[]{multipleLabelTip}, - new Component[]{topContentContainer}, - new Component[]{formatPane}, - new Component[]{centerBodyContainer} - }; - leftContentPane = TableLayoutHelper.createGapTableLayoutPane(components, scrollAllRowSize, columnSize, HGAP, VGAP); + leftContentPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0)); this.setLayout(new CellElementBarLayout(leftContentPane) { @Override public void layoutContainer(Container parent) { @@ -147,31 +141,17 @@ public abstract class CellQuickEditor extends QuickEditor { } int width = parent.getWidth(); int height = parent.getHeight(); - if (leftContentPane.getPreferredSize().height > maxHeight) { - leftContentPane.setBounds(0, -beginY, width - SCROLLBAR_WIDTH - CONTENT_PANE_WIDTH_GAP, height + beginY); - scrollBar.setBounds(width - SCROLLBAR_WIDTH - CONTENT_PANE_WIDTH_GAP, 0, SCROLLBAR_WIDTH + CONTENT_PANE_WIDTH_GAP, height); - } else { - leftContentPane.setBounds(0, 0, width - SCROLLBAR_WIDTH - CONTENT_PANE_WIDTH_GAP, height); - } + leftContentPane.setBounds(0, -beginY, width - SCROLLBAR_WIDTH, height + beginY); + scrollBar.setBounds(width - SCROLLBAR_WIDTH - CONTENT_PANE_WIDTH_GAP, 0, SCROLLBAR_WIDTH + CONTENT_PANE_WIDTH_GAP, height); leftContentPane.validate(); } }); this.add(scrollBar); this.add(leftContentPane); } else { - double[] scrollContentRowSize = {p, p, p, f}; - multipleLabelTip.setBorder(BorderFactory.createMatteBorder(5, 10, 0, 0, this.getBackground())); - topContentContainer.setBorder(BorderFactory.createMatteBorder(0, 10, 0, 10, this.getBackground())); - formatPane.setBorder(BorderFactory.createMatteBorder(0, 10, 0, 10, this.getBackground())); - centerBodyContainer.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, this.getBackground())); - Component[][] components = new Component[][]{ - new Component[]{multipleLabelTip}, - new Component[]{topContentContainer}, - new Component[]{formatPane}, - new Component[]{centerBodyContainer} - }; + leftContentPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 10)); this.setLayout(new BorderLayout()); - this.add(TableLayoutHelper.createGapTableLayoutPane(components, scrollContentRowSize, columnSize, HGAP, VGAP), BorderLayout.CENTER); + this.add(leftContentPane, BorderLayout.CENTER); } } @@ -303,19 +283,20 @@ public abstract class CellQuickEditor extends QuickEditor { private JPanel initTopContent() { - - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Report_Insert_Cell_Element")), f}; - double[] rowSize = {p, p}; cellLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Basic_Cell")); UILabel insertContentLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Report_Insert_Cell_Element")); + columnRowTextField = initColumnRowTextField(); initCellElementEditComboBox(); - Component[][] components = new Component[][]{ - new Component[]{cellLabel, columnRowTextField = initColumnRowTextField()}, - new Component[]{insertContentLabel, UIComponentUtils.wrapWithBorderLayoutPane(comboBox)}, - }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP); + return Layouts.column(LayoutConstants.VERTICAL_GAP, + row( + cell(cellLabel).weight(1.2), + cell(columnRowTextField).weight(3) + ), + row( + cell(insertContentLabel).weight(1.2), + cell(UIComponentUtils.wrapWithBorderLayoutPane(comboBox)).weight(3) + ) + ).getComponent(); } private void prepareScrollBar() { diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index 9fcdecbe1..c8f813a4e 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -1,9 +1,11 @@ package com.fr.quickeditor.cellquick; +import com.fine.swing.ui.layout.Layouts; import com.fr.base.BaseFormula; import com.fr.design.actions.columnrow.DSColumnConditionAction; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.insert.cell.DSColumnCellAction; +import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.DialogActionAdapter; @@ -60,6 +62,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Set; +import static com.fine.swing.ui.layout.Layouts.cell; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.BOTTOM; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.EVEN; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.ODD; @@ -120,12 +123,10 @@ public class CellDSColumnEditor extends CellQuickEditor { public JComponent createCenterBody() { this.createPanes(); this.createSwitchTab(); - JPanel dsColumnRegion = new JPanel(new BorderLayout()); - dsColumnRegion.add(tabsHeaderIconPane, BorderLayout.NORTH); - dsColumnRegion.add(cardContainer, BorderLayout.CENTER); - JPanel centerPane = new JPanel(new BorderLayout()); - centerPane.add(dsColumnRegion, BorderLayout.CENTER); - return centerPane; + return Layouts.column(10, + cell(tabsHeaderIconPane), + cell(cardContainer) + ).getComponent(); } @Override @@ -261,7 +262,6 @@ public class CellDSColumnEditor extends CellQuickEditor { dataPane.release(); } - /** * 创建有内容的面板显示信息 * @@ -270,24 +270,22 @@ public class CellDSColumnEditor extends CellQuickEditor { @Override protected JPanel createContentPane() { initComponents(); - double[] columnSize = {F}; - double[] rowSize = {P, P, P}; - Component[][] components = new Component[][]{ - //数据集列选择 - new Component[]{this.dataPane}, - //数据分组设置 - new Component[]{this.groupPane}, - //条件过滤 - new Component[]{this.conditionPane} - }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP); + return Layouts.column(LayoutConstants.VERTICAL_GAP, + cell(dataPane), cell(groupPane), cell(conditionPane) + ).getComponent(); + } + + protected void initContentPane() { + leftContentPane = createContentPane(); + if (leftContentPane != null) { + this.add(leftContentPane, BorderLayout.CENTER); + } } private void initComponents(){ dataPane = new SelectedDataColumnPane(true, true); groupPane = new ResultSetGroupDockingPane(); initListener(); - double[] rowSize = {P}, columnSize = {60, F}; UILabel uiLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Report_Filter_Conditions")); condition = new DSColumnConditionAction(); if (tc != null) { @@ -297,11 +295,7 @@ public class CellDSColumnEditor extends CellQuickEditor { condition.setSmallIcon(UIConstants.EMPTY_ICON); condition.setName(Toolkit.i18nText("Fine-Design_Basic_Edit")); conditionUIButton = new UIButton(condition); - Component[][] components = new Component[][]{ - new Component[]{uiLabel, UIComponentUtils.wrapWithBorderLayoutPane(conditionUIButton)} - }; - conditionPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP); - this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + conditionPane = Layouts.row(cell(uiLabel).weight(1.2),cell(conditionUIButton).weight(3)).getComponent(); } private void initListener() { diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java index e57204920..baf372a88 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java @@ -1,7 +1,7 @@ package com.fr.quickeditor.cellquick; +import com.fine.swing.ui.layout.Layouts; import com.fine.theme.icon.LazyIcon; -import com.fine.theme.utils.FineUIScale; import com.fr.base.BaseFormula; import com.fr.base.Style; import com.fr.base.TextFormat; @@ -12,8 +12,6 @@ import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.UIFormula; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase; import com.fr.grid.selection.CellSelection; @@ -23,20 +21,16 @@ import com.fr.report.cell.TemplateCellElement; import com.fr.stable.ColumnRow; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; import javax.swing.JComponent; -import javax.swing.JPanel; -import javax.swing.UIManager; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; -import java.util.Arrays; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.flex; /** * 公式快速编辑面板,同文本数字编辑拆分 @@ -88,7 +82,6 @@ public class CellFormulaQuickEditor extends CellQuickEditor { */ @Override public JComponent createCenterBody() { - JPanel content = new JPanel(new BorderLayout()); formulaTextField = new UITextField(); formulaTextField.addKeyListener(new KeyAdapter() { @Override @@ -98,14 +91,9 @@ public class CellFormulaQuickEditor extends CellQuickEditor { } } }); - JPanel textFieldPane = new JPanel(new BorderLayout()); - textFieldPane.add(formulaTextField, BorderLayout.CENTER); - textFieldPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); UIButton formulaButton = new UIButton(new LazyIcon("formula")); formulaButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula") + "..."); - Dimension dimension = new Dimension(UIManager.getInt("FormulaPane.buttonWidth"), UIManager.getInt("FormulaPane.buttonHeight")); - formulaButton.setPreferredSize(FineUIScale.scale(dimension)); formulaButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); @@ -134,22 +122,9 @@ public class CellFormulaQuickEditor extends CellQuickEditor { } }); - JPanel pane = new JPanel(new BorderLayout()); - pane.add(textFieldPane, BorderLayout.CENTER); - pane.add(formulaButton, BorderLayout.EAST); - - content.add(pane, BorderLayout.NORTH); - - Component[][] componentLines = new Component[][] { - new Component[]{EMPTY_LABEL, content}, - }; - double[] rowSize = new double[componentLines.length]; - Arrays.fill(rowSize, TableLayout.PREFERRED); - double[] columnSize = new double[] {TableLayout.PREFERRED, TableLayout.FILL }; - return TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ - new Component[]{EMPTY_LABEL, content}, - }, - rowSize, columnSize, HGAP, VGAP); + return Layouts.row( + flex(1.2), cell(formulaTextField).weight(2.4), flex(0.1), cell(formulaButton).weight(0.5) + ).getComponent(); } diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellStringQuickEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellStringQuickEditor.java index 29ed7f22c..91a531a11 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellStringQuickEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellStringQuickEditor.java @@ -3,7 +3,6 @@ package com.fr.quickeditor.cellquick; import com.fr.base.BaseFormula; import com.fr.base.Style; import com.fr.base.TextFormat; -import com.fr.design.designer.IntervalConstants; import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase; import com.fr.grid.GridKeyListener; @@ -61,7 +60,7 @@ public class CellStringQuickEditor extends CellQuickEditor { */ @Override public JComponent createCenterBody() { - JPanel content = new JPanel(new BorderLayout(0, IntervalConstants.INTERVAL_L1)); + JPanel content = new JPanel(new BorderLayout()); stringTextArea = new UITextArea(); stringTextArea.addKeyListener(new KeyAdapter() { @@ -89,7 +88,6 @@ public class CellStringQuickEditor extends CellQuickEditor { } }); content.add(stringTextArea, BorderLayout.NORTH); - return content; } From 431cadfd94432554fd7af99ead984330137e63e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Thu, 28 Dec 2023 10:05:36 +0800 Subject: [PATCH 2/3] =?UTF-8?q?REPORT-111995=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?UI=E7=BF=BB=E6=96=B0=20=E6=96=87=E4=BB=B6=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E7=BF=BB=E6=96=B0=EF=BC=8C=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fine/theme/light/ui/FineLightIconSet.java | 25 ++++++++++++++++ .../gui/itree/filetree/FileTreeIcon.java | 30 +++++++++++-------- .../icon/filetree/filetype/add_report.svg | 6 ++++ .../filetree/filetype/add_report_disable.svg | 6 ++++ .../theme/icon/filetree/filetype/add_word.svg | 7 +++++ .../filetree/filetype/add_word_disable.svg | 7 +++++ .../theme/icon/filetree/filetype/bmpFile.svg | 8 +++++ .../filetree/filetype/bmpFile_disable.svg | 8 +++++ .../theme/icon/filetree/filetype/chtFile.svg | 4 +++ .../filetree/filetype/chtFile_disable.svg | 4 +++ .../icon/filetree/filetype/classFile.svg | 6 ++++ .../filetree/filetype/classFile_disable.svg | 6 ++++ .../icon/filetree/filetype/cpt_locked.svg | 6 ++++ .../filetree/filetype/cpt_locked_disable.svg | 6 ++++ .../icon/filetree/filetype/excelFile.svg | 6 ++++ .../filetree/filetype/excelFile_disable.svg | 6 ++++ .../icon/filetree/filetype/excel_import.svg | 7 +++++ .../filetype/excel_import_disable.svg | 7 +++++ .../icon/filetree/filetype/flashFile.svg | 8 +++++ .../filetree/filetype/flashFile_disable.svg | 7 +++++ .../icon/filetree/filetype/frm_locked.svg | 9 ++++++ .../filetree/filetype/frm_locked_disable.svg | 9 ++++++ .../theme/icon/filetree/filetype/gifFile.svg | 8 +++++ .../filetree/filetype/gifFile_disable.svg | 8 +++++ .../theme/icon/filetree/filetype/htmlFile.svg | 11 +++++++ .../filetree/filetype/htmlFile_disable.svg | 10 +++++++ .../theme/icon/filetree/filetype/jarFile.svg | 8 +++++ .../filetree/filetype/jarFile_disable.svg | 8 +++++ .../theme/icon/filetree/filetype/javaFile.svg | 9 ++++++ .../filetree/filetype/javaFile_disable.svg | 9 ++++++ .../theme/icon/filetree/filetype/jpgFile.svg | 8 +++++ .../filetree/filetype/jpgFile_disable.svg | 8 +++++ .../theme/icon/filetree/filetype/jsFile.svg | 7 +++++ .../icon/filetree/filetype/jsFile_disable.svg | 7 +++++ .../theme/icon/filetree/filetype/jspFile.svg | 8 +++++ .../filetree/filetype/jspFile_disable.svg | 8 +++++ .../theme/icon/filetree/filetype/pdfFile.svg | 8 +++++ .../filetree/filetype/pdfFile_disable.svg | 8 +++++ .../theme/icon/filetree/filetype/pngFile.svg | 8 +++++ .../filetree/filetype/pngFile_disable.svg | 8 +++++ .../theme/icon/filetree/filetype/sqlFile.svg | 11 +++++++ .../filetree/filetype/sqlFile_disable.svg | 10 +++++++ .../theme/icon/filetree/filetype/wordFile.svg | 6 ++++ .../filetree/filetype/wordFile_disable.svg | 6 ++++ .../theme/icon/filetree/filetype/xlsFile.svg | 7 +++++ .../filetree/filetype/xlsFile_disable.svg | 7 +++++ .../theme/icon/filetree/filetype/xmlFile.svg | 9 ++++++ .../filetree/filetype/xmlFile_disable.svg | 8 +++++ 48 files changed, 388 insertions(+), 13 deletions(-) create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_report.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_report_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_word.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_word_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/bmpFile.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/bmpFile_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/chtFile.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/chtFile_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/classFile.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/classFile_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/cpt_locked.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/cpt_locked_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excelFile.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excelFile_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excel_import.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excel_import_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/flashFile.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/flashFile_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/frm_locked.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/frm_locked_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/gifFile.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/gifFile_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/htmlFile.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/htmlFile_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jarFile.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jarFile_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/javaFile.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/javaFile_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jpgFile.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jpgFile_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jsFile.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jsFile_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jspFile.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jspFile_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pdfFile.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pdfFile_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pngFile.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pngFile_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/sqlFile.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/sqlFile_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/wordFile.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/wordFile_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xlsFile.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xlsFile_disable.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xmlFile.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xmlFile_disable.svg 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 85c2ed651..ccb9d9ef0 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 @@ -72,6 +72,31 @@ public class FineLightIconSet extends AbstractIconSet { new SvgIconSource("refresh", "com/fine/theme/icon/filetree/refresh.svg", true), new SvgIconSource("new_folder", "com/fine/theme/icon/filetree/new_folder.svg", true), + // 文件类型 + new SvgIconSource("add_report", "com/fine/theme/icon/filetree/filetype/add_report.svg", true), + new SvgIconSource("add_word", "com/fine/theme/icon/filetree/filetype/add_word.svg", true), + new SvgIconSource("bmpFile", "com/fine/theme/icon/filetree/filetype/bmpFile.svg", true), + new SvgIconSource("chtFile", "com/fine/theme/icon/filetree/filetype/chtFile.svg", true), + new SvgIconSource("classFile", "com/fine/theme/icon/filetree/filetype/classFile.svg", true), + new SvgIconSource("cpt_locked", "com/fine/theme/icon/filetree/filetype/cpt_locked.svg", true), + new SvgIconSource("excel_import", "com/fine/theme/icon/filetree/filetype/excel_import.svg", true), + new SvgIconSource("excelFile", "com/fine/theme/icon/filetree/filetype/excelFile.svg", true), + new SvgIconSource("flashFile", "com/fine/theme/icon/filetree/filetype/flashFile.svg", true), + new SvgIconSource("frm_locked", "com/fine/theme/icon/filetree/filetype/frm_locked.svg", true), + new SvgIconSource("gifFile", "com/fine/theme/icon/filetree/filetype/gifFile.svg", true), + new SvgIconSource("htmlFile", "com/fine/theme/icon/filetree/filetype/htmlFile.svg", true), + new SvgIconSource("jarFile", "com/fine/theme/icon/filetree/filetype/jarFile.svg", true), + new SvgIconSource("javaFile", "com/fine/theme/icon/filetree/filetype/javaFile.svg", true), + new SvgIconSource("jpgFile", "com/fine/theme/icon/filetree/filetype/jpgFile.svg", true), + new SvgIconSource("jsFile", "com/fine/theme/icon/filetree/filetype/jsFile.svg", true), + new SvgIconSource("jspFile", "com/fine/theme/icon/filetree/filetype/jspFile.svg", true), + new SvgIconSource("pdfFile", "com/fine/theme/icon/filetree/filetype/pdfFile.svg", true), + new SvgIconSource("pngFile", "com/fine/theme/icon/filetree/filetype/pngFile.svg", true), + new SvgIconSource("sqlFile", "com/fine/theme/icon/filetree/filetype/sqlFile.svg", true), + new SvgIconSource("wordFile", "com/fine/theme/icon/filetree/filetype/wordFile.svg", true), + new SvgIconSource("xlsFile", "com/fine/theme/icon/filetree/filetype/xlsFile.svg", true), + new SvgIconSource("xmlFile", "com/fine/theme/icon/filetree/filetype/xmlFile.svg", true), + // 属性面板Icon new SvgIconSource("cellattr", "com/fine/theme/icon/propertiestab/cellattr.svg", false, 18), new SvgIconSource("cellattr_disabled", "com/fine/theme/icon/propertiestab/cellattr_disabled.svg", false, 18), diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java index 785bca06b..e5e89bf72 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java @@ -31,22 +31,21 @@ public class FileTreeIcon { public static final Icon FILE_IMAGE_ICON = UIManager.getIcon("FileView.fileIcon"); + public static final Icon JAVA_FILE_IMAGE_ICON = new LazyIcon("javaFile"); + public static final Icon CLASS_FILE_IMAGE_ICON = new LazyIcon("classFile"); + public static final Icon JSP_FILE_IMAGE_ICON = new LazyIcon("jspFile"); + public static final Icon JS_FILE_IMAGE_ICON = new LazyIcon("jsFile"); + public static final Icon XML_FILE_IMAGE_ICON = new LazyIcon("xmlFile"); + public static final Icon HTML_FILE_IMAGE_ICON = new LazyIcon("htmlFile"); + public static final Icon JAR_FILE_IMAGE_ICON = new LazyIcon("jarFile"); + public static final Icon GIF_FILE_IMAGE_ICON = new LazyIcon("gifFile"); + public static final Icon JPG_FILE_IMAGE_ICON = new LazyIcon("jpgFile"); + public static final Icon BMP_FILE_IMAGE_ICON = new LazyIcon("bmpFile"); + public static final Icon MODERN_CHT_FILE_IMAGE_ICON = new LazyIcon("chtFile"); + // TODO: 以下Icon视觉暂未提供,需提供后替换 public static final Icon BLANK_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/blank.gif"); public static final Icon FOLDER_HALF_IMAGE_ICON = IconUtils.readIcon("/com/fr/design/standard/fileicon/folder_half_authority.svg"); - public static final Icon JAVA_FILE_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/javaFile.gif"); - public static final Icon CLASS_FILE_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/classFile.gif"); - public static final Icon JSP_FILE_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/jspFile.gif"); - public static final Icon JS_FILE_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/jsFile.gif"); - public static final Icon XML_FILE_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/xmlFile.gif"); - public static final Icon HTML_FILE_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/htmlFile.gif"); - public static final Icon JAR_FILE_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/jarFile.gif"); - public static final Icon GIF_FILE_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/gifFile.gif"); - public static final Icon JPG_FILE_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/jpgFile.gif"); - public static final Icon BMP_FILE_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/bmpFile.gif"); - - public static final Icon MODERN_CHT_FILE_IMAGE_ICON = IconUtils.readIcon("/com/fr/design/standard/fileicon/cht_icon.svg"); - public static final Icon CPTX_ICON = IconUtils.readIcon("/com/fr/design/standard/fileicon/cptx_icon.svg"); public static final Icon CPTX_LOCKED_ICON = IconUtils.readIcon("/com/fr/design/standard/fileicon/cptx_icon_locked.svg"); @@ -188,6 +187,11 @@ public class FileTreeIcon { if (icon != null) { return icon; } + // 优先从本地已注册的文件图标读取;如读取到默认的文件图标(上锁及未上锁),再从本地读取系统文件图标 + icon = FileTreeIcon.getIcon(FileTreeIcon.getFileType(path), isShowLock); + if (icon != FileTreeIcon.FILE_LOCK_ICON && icon != FileTreeIcon.FILE_IMAGE_ICON) { + return icon; + } return new LocalFileIcon(FileSystemView.getFileSystemView().getSystemIcon(new File(path)), isShowLock); } diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_report.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_report.svg new file mode 100755 index 000000000..6cb73b699 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_report.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_report_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_report_disable.svg new file mode 100755 index 000000000..ef5d8748b --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_report_disable.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_word.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_word.svg new file mode 100755 index 000000000..d2aa41ea8 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_word.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_word_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_word_disable.svg new file mode 100755 index 000000000..f8f711c52 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_word_disable.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/bmpFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/bmpFile.svg new file mode 100755 index 000000000..fc346b19d --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/bmpFile.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/bmpFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/bmpFile_disable.svg new file mode 100755 index 000000000..ec09f32ba --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/bmpFile_disable.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/chtFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/chtFile.svg new file mode 100755 index 000000000..cda2a6cb9 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/chtFile.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/chtFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/chtFile_disable.svg new file mode 100755 index 000000000..abc7f1969 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/chtFile_disable.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/classFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/classFile.svg new file mode 100755 index 000000000..e3e9893bb --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/classFile.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/classFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/classFile_disable.svg new file mode 100755 index 000000000..3201b3d58 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/classFile_disable.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/cpt_locked.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/cpt_locked.svg new file mode 100755 index 000000000..9c5f01a36 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/cpt_locked.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/cpt_locked_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/cpt_locked_disable.svg new file mode 100755 index 000000000..86a33a5c3 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/cpt_locked_disable.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excelFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excelFile.svg new file mode 100755 index 000000000..8143080ca --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excelFile.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excelFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excelFile_disable.svg new file mode 100755 index 000000000..fad1fa2a1 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excelFile_disable.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excel_import.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excel_import.svg new file mode 100755 index 000000000..3faf981f2 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excel_import.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excel_import_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excel_import_disable.svg new file mode 100755 index 000000000..04fd0b9b4 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excel_import_disable.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/flashFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/flashFile.svg new file mode 100755 index 000000000..70e75f46c --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/flashFile.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/flashFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/flashFile_disable.svg new file mode 100755 index 000000000..712692d1b --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/flashFile_disable.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/frm_locked.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/frm_locked.svg new file mode 100755 index 000000000..8bd63be48 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/frm_locked.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/frm_locked_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/frm_locked_disable.svg new file mode 100755 index 000000000..b2fb1bc31 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/frm_locked_disable.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/gifFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/gifFile.svg new file mode 100755 index 000000000..6c64fd724 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/gifFile.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/gifFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/gifFile_disable.svg new file mode 100755 index 000000000..709124b0d --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/gifFile_disable.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/htmlFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/htmlFile.svg new file mode 100755 index 000000000..6a65b848b --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/htmlFile.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/htmlFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/htmlFile_disable.svg new file mode 100755 index 000000000..809c5f12e --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/htmlFile_disable.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jarFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jarFile.svg new file mode 100755 index 000000000..cb3bfd892 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jarFile.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jarFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jarFile_disable.svg new file mode 100755 index 000000000..0b1d5f818 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jarFile_disable.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/javaFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/javaFile.svg new file mode 100755 index 000000000..f2e2e3c2f --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/javaFile.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/javaFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/javaFile_disable.svg new file mode 100755 index 000000000..53acf3252 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/javaFile_disable.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jpgFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jpgFile.svg new file mode 100755 index 000000000..32e7d50fd --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jpgFile.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jpgFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jpgFile_disable.svg new file mode 100755 index 000000000..5ddc6a39c --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jpgFile_disable.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jsFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jsFile.svg new file mode 100755 index 000000000..97756c235 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jsFile.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jsFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jsFile_disable.svg new file mode 100755 index 000000000..4c0509723 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jsFile_disable.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jspFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jspFile.svg new file mode 100755 index 000000000..27be0dcb2 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jspFile.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jspFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jspFile_disable.svg new file mode 100755 index 000000000..dc1ad3941 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jspFile_disable.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pdfFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pdfFile.svg new file mode 100755 index 000000000..9146d94cc --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pdfFile.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pdfFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pdfFile_disable.svg new file mode 100755 index 000000000..6f97ecfc0 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pdfFile_disable.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pngFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pngFile.svg new file mode 100755 index 000000000..527e0a204 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pngFile.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pngFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pngFile_disable.svg new file mode 100755 index 000000000..37a41dc9d --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pngFile_disable.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/sqlFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/sqlFile.svg new file mode 100755 index 000000000..f24f8bb64 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/sqlFile.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/sqlFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/sqlFile_disable.svg new file mode 100755 index 000000000..441ed97a7 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/sqlFile_disable.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/wordFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/wordFile.svg new file mode 100755 index 000000000..6dc5bab61 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/wordFile.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/wordFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/wordFile_disable.svg new file mode 100755 index 000000000..80ae82c64 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/wordFile_disable.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xlsFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xlsFile.svg new file mode 100755 index 000000000..ea58c3491 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xlsFile.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xlsFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xlsFile_disable.svg new file mode 100755 index 000000000..ccd9aae91 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xlsFile_disable.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xmlFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xmlFile.svg new file mode 100755 index 000000000..c5b68c24d --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xmlFile.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xmlFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xmlFile_disable.svg new file mode 100755 index 000000000..4aaa3dfc2 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xmlFile_disable.svg @@ -0,0 +1,8 @@ + + + + + + + + From 5afe8a59f33e5a6b8be6fa663edc73c43d4d41af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Thu, 28 Dec 2023 10:05:56 +0800 Subject: [PATCH 3/3] =?UTF-8?q?REPORT-111995=20=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E9=9D=A2=E6=9D=BF=E5=B8=83=E5=B1=80=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/quickeditor/CellQuickEditor.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java index 504dc1e4b..66d3047c4 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java @@ -1,6 +1,7 @@ package com.fr.quickeditor; import com.fine.swing.ui.layout.Layouts; +import com.fine.theme.utils.FineUIScale; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.GraphHelper; import com.fr.base.Style; @@ -69,14 +70,13 @@ public abstract class CellQuickEditor extends QuickEditor { /** * 滚动条相关配置 */ - private static final int MAXVALUE = 100; - private static final int CONTENT_PANE_WIDTH_GAP = 3; + private static final int MAXVALUE = FineUIScale.scale(100); + private static final int SCROLLBAR_WIDTH = FineUIScale.scale(10); private static final int MOUSE_WHEEL_SPEED = 5; - private static final int SCROLLBAR_WIDTH = 7; private UILabel cellLabel; - private int maxHeight = 280; - private static final int TITLE_HEIGHT = 50; + private int maxHeight = FineUIScale.scale(280); + private static final int TITLE_HEIGHT = FineUIScale.scale(50); /** * 面板配置 @@ -142,7 +142,7 @@ public abstract class CellQuickEditor extends QuickEditor { int width = parent.getWidth(); int height = parent.getHeight(); leftContentPane.setBounds(0, -beginY, width - SCROLLBAR_WIDTH, height + beginY); - scrollBar.setBounds(width - SCROLLBAR_WIDTH - CONTENT_PANE_WIDTH_GAP, 0, SCROLLBAR_WIDTH + CONTENT_PANE_WIDTH_GAP, height); + scrollBar.setBounds(width - SCROLLBAR_WIDTH, 0, SCROLLBAR_WIDTH, height); leftContentPane.validate(); } }); @@ -333,9 +333,9 @@ public abstract class CellQuickEditor extends QuickEditor { } }); - scrollBar.setPreferredSize(new Dimension(SCROLLBAR_WIDTH + CONTENT_PANE_WIDTH_GAP, this.getHeight())); - scrollBar.setBlockIncrement(SCROLLBAR_WIDTH + CONTENT_PANE_WIDTH_GAP); - scrollBar.setBorder(BorderFactory.createMatteBorder(0, CONTENT_PANE_WIDTH_GAP, 0, 0, this.getBackground())); + scrollBar.setPreferredSize(new Dimension(SCROLLBAR_WIDTH, this.getHeight())); + scrollBar.setBlockIncrement(SCROLLBAR_WIDTH); + scrollBar.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, this.getBackground())); } /**