From 36e34a37d74308bed655aa9129c07ad8808780cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Fri, 27 Sep 2024 17:08:06 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-136114=20fix:=E8=80=81=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E9=83=A8=E5=88=86=E9=9D=A2=E6=9D=BF=E7=BF=BB=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fine/theme/utils/FineLayoutBuilder.java | 2 + .../fr/design/layout/TableLayoutHelper.java | 2 +- .../java/com/fr/design/style/AlphaPane.java | 21 +--- .../chart/axis/ChartAlertValuePane.java | 114 ++++++++---------- .../design/chart/report/GisMapDataPane.java | 23 ++-- .../report/GisMapReportDataContentPane.java | 47 +++----- .../report/GisMapTableDataContentPane.java | 77 +++++------- .../chart/gui/other/ChartInteractivePane.java | 5 +- .../chart/gui/style/ChartAxisLabelPane.java | 110 ++++++----------- .../chart/gui/style/ChartAxisTitlePane.java | 36 ++---- .../style/ChartDataPointLabel4GisPane.java | 32 ++--- .../gui/style/ChartDatapointLabelPane.java | 9 +- .../chart/gui/style/axis/ChartAxisPane.java | 11 ++ .../chart/gui/style/axis/ChartValuePane.java | 32 ++--- .../gui/style/legend/ChartLegendPane.java | 27 ++--- .../chart/gui/style/title/ChartTitlePane.java | 42 ++----- 16 files changed, 235 insertions(+), 355 deletions(-) diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineLayoutBuilder.java b/designer-base/src/main/java/com/fine/theme/utils/FineLayoutBuilder.java index 7115b3afea..2c46d446ae 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineLayoutBuilder.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineLayoutBuilder.java @@ -6,6 +6,8 @@ import com.fine.swing.ui.layout.Row; import com.fine.swing.ui.layout.Spacer; import com.fr.design.constants.LayoutConstants; import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.log.FineLoggerFactory; import com.fr.stable.collections.combination.Pair; diff --git a/designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java b/designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java index 5e31ba2f7f..e172b9f117 100644 --- a/designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java +++ b/designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java @@ -370,7 +370,7 @@ public class TableLayoutHelper { JPanel secondMenu = createTableLayoutPane(components, rowSize, columnSize); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - double[] column = {LayoutConstants.CHART_ATTR_TOMARGIN, f}; + double[] column = {LayoutConstants.HORIZONTAL_GAP, f}; double[] row = {p, p}; StringBuilder resultText = new StringBuilder(); for (String text : title) { diff --git a/designer-base/src/main/java/com/fr/design/style/AlphaPane.java b/designer-base/src/main/java/com/fr/design/style/AlphaPane.java index 4560f84dfd..329fef1b64 100644 --- a/designer-base/src/main/java/com/fr/design/style/AlphaPane.java +++ b/designer-base/src/main/java/com/fr/design/style/AlphaPane.java @@ -1,9 +1,7 @@ package com.fr.design.style; import java.awt.BorderLayout; -import java.awt.Dimension; -import javax.swing.BorderFactory; import javax.swing.JFormattedTextField; import javax.swing.JPanel; import javax.swing.JSlider; @@ -14,6 +12,7 @@ import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.base.Utils; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.islider.UISlider; @@ -46,18 +45,11 @@ public class AlphaPane extends JPanel { this.setLayout(FRGUIPaneFactory.createBorderLayout()); // 透明选项 - JPanel alphaPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - alphaPane.setBorder(BorderFactory.createEmptyBorder()); - this.add(alphaPane, BorderLayout.CENTER); - - alphaPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha") + ":")); - - alphaPane.add(alphaSlider = new UISlider(UISlider.HORIZONTAL, 0, ALPHA_FLOAT, START_VALUE)); - alphaSlider.setPreferredSize(new Dimension(80, 20)); - + alphaSlider = new UISlider(UISlider.HORIZONTAL, 0, ALPHA_FLOAT, START_VALUE); valueSpinner = new UIBasicSpinner(new SpinnerListModel(values)); - alphaPane.add(valueSpinner); - + JPanel alphaPane = FineLayoutBuilder.createHorizontalLayout(10, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha")), + alphaSlider, valueSpinner); + JFormattedTextField field = GUICoreUtils.getSpinnerTextField(valueSpinner); field.setText(checkFormat(START_VALUE)); if (field != null) { @@ -65,9 +57,8 @@ public class AlphaPane extends JPanel { field.setHorizontalAlignment(UITextField.LEFT); field.getDocument().addDocumentListener(textListener); } - - valueSpinner.setPreferredSize(new Dimension(60, 18)); alphaSlider.addChangeListener(changeListener); + this.add(alphaPane, BorderLayout.CENTER); } DocumentListener textListener = new DocumentListener() { diff --git a/designer-chart/src/main/java/com/fr/design/chart/axis/ChartAlertValuePane.java b/designer-chart/src/main/java/com/fr/design/chart/axis/ChartAlertValuePane.java index 59250c9725..465d146677 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/axis/ChartAlertValuePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/axis/ChartAlertValuePane.java @@ -1,5 +1,6 @@ package com.fr.design.chart.axis; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.base.BaseFormula; import com.fr.base.Utils; import com.fr.chart.chartattr.ChartAlertValue; @@ -13,25 +14,31 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.style.AlphaPane; import com.fr.design.style.FRFontPane; import com.fr.design.style.color.ColorSelectBox; import com.fr.design.utils.DesignUtils; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; import com.fr.stable.Constants; import com.fr.stable.CoreConstants; -import javax.swing.*; -import java.awt.*; +import javax.swing.ButtonGroup; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Font; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; 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.column; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; + /** * 图表 坐标轴 警戒线值 编辑界面. (默认 位置居左居右) * @author kunsnat E-mail:kunsnat@gmail.com @@ -55,30 +62,14 @@ public class ChartAlertValuePane extends BasicBeanPane { public ChartAlertValuePane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - - JPanel pane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); - this.add(pane, BorderLayout.CENTER); - - JPanel alertLinePane =FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); - pane.add(alertLinePane); - - alertLinePane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Line_Setting"))); - - JPanel valuePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - alertLinePane.add(valuePane); - - valuePane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Value") + ":")); - + + // 警戒线 textField = new UITextField(); - textField.setColumns(4); - valuePane.add(textField); - textField.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { showFormulaPane(); } }); - textField.addKeyListener(new KeyAdapter() { public void keyTyped(KeyEvent e) { e.consume(); @@ -86,34 +77,29 @@ public class ChartAlertValuePane extends BasicBeanPane { } }); - JPanel lineStylePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - alertLinePane.add(lineStylePane); - - lineStylePane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style") + ":")); lineCombo = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); - lineStylePane.add(lineCombo); - - JPanel lineColorPane =FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - alertLinePane.add(lineColorPane); - - lineColorPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Line_Color") + ":")); colorBox = new ColorSelectBox(80); - lineColorPane.add(colorBox); - alphaPane = new AlphaPane(); - alertLinePane.add(alphaPane); - - JPanel tipPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); - pane.add(tipPane); - - tipPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Tip") + ":", null)); - - JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - tipPane.add(centerPane); - + + JPanel alertLinePane = column(10, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Value"))).weight(1), + cell(textField).weight(4) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style"))).weight(1), + cell(lineCombo).weight(4) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Line_Color"))).weight(1), + cell(colorBox).weight(4) + ), + cell(alphaPane) + ).getComponent(); + + // 提示文字 fontNameBox = new UIComboBox(); - fontNameBox.setPreferredSize(new Dimension(80,20)); - + fontNameBox.addItem("SimSun"); // TODO 这边字体中没有在列表内 String[] names = DesignUtils.getAvailableFontFamilyNames4Report(); for(int i = 0; i < names.length; i++) { @@ -121,25 +107,31 @@ public class ChartAlertValuePane extends BasicBeanPane { } fontSizeBox = new UIComboBox(); - fontSizeBox.setPreferredSize(new Dimension(80,20)); Integer[] sizes = FRFontPane.Font_Sizes; for(int i = 0; i < sizes.length; i++) { fontSizeBox.addItem(sizes[i]); } - - double t = TableLayout.FILL; - double[] rowSize = {t, t, t, t, t}; - double[] columnSize = {0.1, 0.2, 0.5, 0.2}; - Component[][] components= { - {null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content") + ":"), contentField = new UITextField(3)}, - {null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Font") + ":"), fontNameBox}, - {null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Font_Size") + ":"), fontSizeBox}, - {null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout") + ": "), leftButton = new UIRadioButton(getLeftName())}, - {null, null, rightButton = new UIRadioButton(getRightName())}, - + leftButton = new UIRadioButton(getLeftName()); + rightButton = new UIRadioButton(getRightName()); + Component[][] components = { + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content") ), contentField = new UITextField()}, + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Font")), fontNameBox}, + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Font_Size") ), fontSizeBox}, + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout")), + FineLayoutBuilder.createHorizontalLayout(10, leftButton, rightButton)}, + }; - JPanel tablePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - centerPane.add(tablePane); + + JPanel tipPane = FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1, 4}); + + JPanel pane = column(10, + cell(wrapComponentWithTitle(alertLinePane, + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Line_Setting") + )), + cell(wrapComponentWithTitle(tipPane, + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Tip"))) + ).getComponent(); + this.add(pane, BorderLayout.CENTER); ButtonGroup bg = new ButtonGroup(); bg.add(leftButton); diff --git a/designer-chart/src/main/java/com/fr/design/chart/report/GisMapDataPane.java b/designer-chart/src/main/java/com/fr/design/chart/report/GisMapDataPane.java index ae46f709e6..a503cea781 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/report/GisMapDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/report/GisMapDataPane.java @@ -1,5 +1,7 @@ package com.fr.design.chart.report; +import com.fine.theme.utils.FineLayoutBuilder; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; @@ -7,18 +9,17 @@ import com.fr.chart.chartdata.GisMapReportDefinition; import com.fr.chart.chartdata.GisMapTableDefinition; import com.fr.chart.chartdata.TopDefinition; import com.fr.design.beans.FurtherBasicBeanPane; -import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicScrollPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.ilable.BoldFontTextLabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.chart.gui.data.DataContentsPane; -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; import java.util.ArrayList; import java.util.List; @@ -102,17 +103,13 @@ public class GisMapDataPane extends DataContentsPane{ contentPane.add(dataFromPane = new UIComboBoxPane() { protected void initLayout() { - this.setLayout(new BorderLayout(LayoutConstants.HGAP_LARGE,6)); + this.setLayout(FRGUIPaneFactory.createScaledBorderLayout(0, 10)); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = { p,f }; - double[] rowSize = { p}; Component[][] components = new Component[][]{ - new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Source") + ":"), jcb}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Source")), jcb}, } ; - JPanel northPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); + JPanel northPane = FineLayoutBuilder.commonLeftRightLayout(components); this.add(northPane, BorderLayout.NORTH); this.add(cardPane, BorderLayout.CENTER); @@ -134,7 +131,7 @@ public class GisMapDataPane extends DataContentsPane{ } }, BorderLayout.CENTER); - dataFromPane.setBorder(BorderFactory.createEmptyBorder(10 ,0, 0, 0)); + dataFromPane.setBorder(new ScaledEmptyBorder(10 ,0, 0, 0)); return contentPane; } diff --git a/designer-chart/src/main/java/com/fr/design/chart/report/GisMapReportDataContentPane.java b/designer-chart/src/main/java/com/fr/design/chart/report/GisMapReportDataContentPane.java index 583b0a54fc..7d904136b2 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/report/GisMapReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/report/GisMapReportDataContentPane.java @@ -1,12 +1,12 @@ package com.fr.design.chart.report; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.base.BaseFormula; import com.fr.base.Utils; import com.fr.chart.chartdata.BaseSeriesDefinition; import com.fr.chart.chartdata.GisMapReportDefinition; import com.fr.chart.chartdata.SeriesDefinition; import com.fr.design.beans.FurtherBasicBeanPane; -import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; @@ -17,25 +17,26 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itable.UITableEditor; import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JTable; -import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.Component; -import java.awt.Dimension; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.util.ArrayList; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; + /** * 属性表gis地图单元格数据源设置界面 * @@ -55,37 +56,25 @@ public class GisMapReportDataContentPane extends FurtherBasicBeanPane(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Address"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_LatLng")}); lnglatOrder = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Longitude_First"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Latitude_First")}); addressPane = new DefaultTinyFormulaPane(); addressNamePane = new DefaultTinyFormulaPane(); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = new double[]{p, f}; - double[] rowSize = new double[]{p, p, p}; - - orderPane = new JPanel(new BorderLayout(LayoutConstants.VGAP_MEDIUM, 0)) { - @Override - public Dimension getPreferredSize() { - if (this.isVisible()) { - return super.getPreferredSize(); - } else { - return new Dimension(0, 0); - } - } - }; - orderPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_LatLng_Order")), BorderLayout.WEST); - orderPane.add(lnglatOrder, BorderLayout.CENTER); + orderPane = FineLayoutBuilder.createHorizontalLayout(0, new double[]{1.2, 3}, + new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_LatLng_Order")), lnglatOrder); orderPane.setVisible(false); lnglatOrder.setSelectedIndex(0); addressType.setSelectedIndex(0); - Component[][] components = new Component[][]{ - new Component[]{addressType, addressPane}, - new Component[]{orderPane, null}, - new Component[]{new UILabel(" " +com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Address_Name")+":", SwingConstants.RIGHT), addressNamePane}, - }; - JPanel northPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + JPanel northPane = column(10, + row(10, + cell(addressType).weight(1), cell(addressPane).weight(1) + ), + cell(orderPane), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Address_Name"))).weight(1.2), cell(addressNamePane).weight(3) + ) + ).getComponent(); this.add(northPane, BorderLayout.NORTH); diff --git a/designer-chart/src/main/java/com/fr/design/chart/report/GisMapTableDataContentPane.java b/designer-chart/src/main/java/com/fr/design/chart/report/GisMapTableDataContentPane.java index 723a91f880..532f9e6b5b 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/report/GisMapTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/report/GisMapTableDataContentPane.java @@ -1,10 +1,10 @@ package com.fr.design.chart.report; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.base.Utils; import com.fr.chart.base.ChartConstants; import com.fr.chart.chartdata.GisMapTableDefinition; import com.fr.chart.chartdata.SeriesDefinition; -import com.fr.design.constants.LayoutConstants; import com.fr.data.impl.NameTableData; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.beans.FurtherBasicBeanPane; @@ -16,17 +16,20 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itable.UITableEditor; import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Component; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.awt.event.ItemEvent; @@ -34,6 +37,10 @@ import java.awt.event.ItemListener; import java.util.ArrayList; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; + /** * 属性表gis地图数据集数据源定义面板 * @author eason @@ -54,26 +61,20 @@ public class GisMapTableDataContentPane extends FurtherBasicBeanPane(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_GIS_Address"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_LatLng")}); - lnglatOrder = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Longitude_First"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Latitude_First")}); + addressType = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_GIS_Address"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_LatLng")}); + lnglatOrder = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Longitude_First"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Latitude_First")}); addressType.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { @@ -82,22 +83,8 @@ public class GisMapTableDataContentPane extends FurtherBasicBeanPane implements UIOb Component[][] components = new Component[][]{ new Component[]{isAutoRefresh, null}, - new Component[]{GUICoreUtils.createFlowPane(new Component[]{ + new Component[]{FineLayoutBuilder.createHorizontalLayout(10, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Time_Interval")), autoRefreshTime, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Time_Seconds")) - }, 1)}, + )}, new Component[]{new UILabel("" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Support_Img_And_Cell") + ""), null}, }; autoRefreshPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"Fine-Design_Chart_Data_Check"}, components, rowSize, columnSize); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAxisLabelPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAxisLabelPane.java index 390ff1004c..0beb5a3d50 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAxisLabelPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAxisLabelPane.java @@ -1,12 +1,14 @@ package com.fr.design.mainframe.chart.gui.style; +import com.fine.swing.ui.layout.Row; +import com.fine.theme.utils.FineLayoutBuilder; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseFormula; import com.fr.base.Style; import com.fr.base.Utils; import com.fr.chart.base.ChartBaseUtils; import com.fr.chart.base.TextAttr; import com.fr.chart.chartattr.Axis; -import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; @@ -16,14 +18,16 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.style.NumberDragBar; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import javax.swing.*; +import javax.swing.JPanel; +import javax.swing.SpinnerNumberModel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -155,33 +159,26 @@ public class ChartAxisLabelPane extends BasicPane implements UIObserver{ } private JPanel getWrapShowWayPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, p, f}; - double[] rowSize = {p, p, p, p}; - Component[][] components = new Component[][]{ - new Component[]{null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show")), showWay, null}, - new Component[]{null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")), labelOrientationChoose, null}, - new Component[]{null, orientationSpinner, orientationBar, null}, - new Component[]{null, textAttrPane, null, null}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show")), showWay}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")), labelOrientationChoose}, + new Component[]{null, createorientionRow()}, + new Component[]{textAttrPane, null, null}, }; - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, components,new double[]{1.2, 3}); } - private JPanel getIntervalShowWayPane() { - - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {f}; - double[] rowSize = {p, p, p}; + private Row createorientionRow() { + return FineLayoutBuilder.createHorizontalLayout(10, new double[]{1, 1.5}, orientationSpinner, orientationBar); + } + private JPanel getIntervalShowWayPane() { Component[][] components = new Component[][]{ new Component[]{getCombox()}, new Component[]{getTowChoose()}, new Component[]{getOther()} }; - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1}); } private JPanel getTowChoose() { @@ -192,46 +189,30 @@ public class ChartAxisLabelPane extends BasicPane implements UIObserver{ custom.setSelected(false); customLabelSamleTime.setVisible(true); customLabelSamleTime.setEnabled(false); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, f}; - double[] rowSize = {p, p}; - JPanel customPane = TableLayoutHelper.createTableLayoutPane(new Component[][]{ - new Component[]{custom, customLabelSamleTime, null}, - }, new double[]{p}, new double[]{p, p, f}); + JPanel customPane = FineLayoutBuilder.createHorizontalLayout(10, custom, customLabelSamleTime); Component[][] components = new Component[][]{ - new Component[]{null, auto,}, - new Component[]{null, customPane} + new Component[]{auto,}, + new Component[]{customPane} }; - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1}); } private JPanel getCombox() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, p, f}; - double[] rowSize = {p}; - Component[][] components = new Component[][]{ - new Component[]{null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show")), showWay, null} + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show")), showWay} }; - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + return FineLayoutBuilder.commonLeftRightLayout(components); } private JPanel getOther() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, p, f}; - double[] rowSize = {p, p, p}; - Component[][] components = new Component[][]{ - new Component[]{null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")), labelOrientationChoose, null}, - new Component[]{null, orientationSpinner, orientationBar, null}, - new Component[]{null, textAttrPane, null, null}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")), labelOrientationChoose}, + new Component[]{null, createorientionRow()}, + new Component[]{textAttrPane, null, null}, }; - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3}); } private void checkShowWay() { @@ -246,18 +227,13 @@ public class ChartAxisLabelPane extends BasicPane implements UIObserver{ } else { labelPane = getWrapShowWayPane(); } - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] row = {p, p}; - double[] col = {f}; - showWayPane = TableLayoutHelper.createTableLayoutPane(new Component[][]{ - new Component[]{isLabelShow}, new Component[]{labelPane}}, row, col); + labelPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0)); + showWayPane = FineLayoutBuilder.createVerticalLayout(10, isLabelShow, labelPane); + this.add(showWayPane, BorderLayout.CENTER); this.validate(); } - - private void checkOrientationField() { if (labelOrientationChoose.getSelectedIndex() != 2) { orientationBar.setVisible(false); @@ -283,23 +259,17 @@ public class ChartAxisLabelPane extends BasicPane implements UIObserver{ customLabelSamleTime.registerChangeListener(this.observerListener); orientationSpinner.registerChangeListener(this.observerListener); labelOrientationChoose.registerChangeListener(this.observerListener); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, p, f}; - double[] rowSize = {p, p, p, p}; Component[][] components = new Component[][]{ - new Component[]{null,new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Label_Interval")), labelSampleChoose, customLabelSamleTime}, - new Component[]{null,new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")), labelOrientationChoose, null}, - new Component[]{null,orientationSpinner, orientationBar, null}, - new Component[]{null,textAttrPane, null, null}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Label_Interval")), + FineLayoutBuilder.createHorizontalLayout(10,labelSampleChoose, customLabelSamleTime)}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")), labelOrientationChoose}, + new Component[]{null, createorientionRow()}, + new Component[]{textAttrPane, null}, }; - labelPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - - double[] row = {p,p}; - double[] col = {f}; - return TableLayoutHelper.createTableLayoutPane(new Component[][]{ - new Component[]{isLabelShow}, new Component[]{labelPane}}, row, col); + labelPane = FineLayoutBuilder.commonLeftRightLayout(components); + labelPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0)); + return FineLayoutBuilder.createVerticalLayout(10, isLabelShow, labelPane); } private void checkCustomSampleField() { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAxisTitlePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAxisTitlePane.java index f2d9446297..59ede28610 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAxisTitlePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAxisTitlePane.java @@ -1,25 +1,23 @@ package com.fr.design.mainframe.chart.gui.style; +import com.fine.theme.utils.FineComponentsFactory; +import com.fine.theme.utils.FineLayoutBuilder; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseFormula; -import com.fr.base.BaseUtils; import com.fr.base.Style; import com.fr.base.Utils; import com.fr.chart.chartattr.Axis; import com.fr.chart.chartattr.Title; -import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.formula.DefaultTinyFormulaPane; import com.fr.design.formula.TinyFormulaPane; 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.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.general.FRFont; import com.fr.stable.Constants; import com.fr.stable.StableUtils; -import javax.swing.Icon; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; @@ -46,36 +44,26 @@ public class ChartAxisTitlePane extends BasicPane{ axisTitleContentPane = new DefaultTinyFormulaPane(); axisTitleAttrPane = new ChartTextAttrPane(); axisTitleAttrPane.populate(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 9)); - Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), - BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), - BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}; - Integer[] alignment = new Integer[] { Constants.LEFT, Constants.CENTER, Constants.RIGHT }; - titleAlignmentPane = new UIButtonGroup(alignmentIconArray, alignment); + titleAlignmentPane = FineComponentsFactory.createHorizontalAlignmentButtonGroup(); titleAlignmentPane.setSelectedItem(Constants.CENTER); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = { LayoutConstants.CHART_ATTR_TOMARGIN, f }; - double[] rowSize = { p, p, p, p}; Component[][] components = new Component[][]{ - new Component[]{null,axisTitleContentPane}, - new Component[]{null,axisTitleAttrPane}, - new Component[]{null,new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alignment_Style"))}, - new Component[]{null,titleAlignmentPane,}, + new Component[]{axisTitleContentPane}, + new Component[]{axisTitleAttrPane}, + new Component[]{FineLayoutBuilder.createHorizontalLayout(0, new double[]{1.2, 3}, + new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alignment_Style")), titleAlignmentPane)}, }; - titlePane = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); - + titlePane = FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1}); + titlePane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0)); + isAxisTitleVisable.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { checkTitleUse(); } }); - double[] row = {p,p}; - double[] col = {f}; this.setLayout(new BorderLayout()); - JPanel panel = TableLayoutHelper.createTableLayoutPane(new Component[][]{ - new Component[]{isAxisTitleVisable}, new Component[]{titlePane}}, row, col); + JPanel panel = FineLayoutBuilder.createVerticalLayout(10, isAxisTitleVisable, titlePane); this.add(panel, BorderLayout.CENTER); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDataPointLabel4GisPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDataPointLabel4GisPane.java index 6b22c287f5..83caf2986d 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDataPointLabel4GisPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDataPointLabel4GisPane.java @@ -1,23 +1,24 @@ package com.fr.design.mainframe.chart.gui.style; +import com.fine.theme.utils.FineLayoutBuilder; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.Utils; import com.fr.chart.base.AttrContents; import com.fr.chart.base.ChartConstants; import com.fr.chart.base.DataSeriesCondition; -import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.BoldFontTextLabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.general.FRFont; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -49,31 +50,18 @@ public class ChartDataPointLabel4GisPane extends ChartDatapointLabelPane{ initFormatListener(); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - - double[] columnSize = { p, f }; - double[] rowSize = { p,p,p,p,p,p}; - - JPanel delimiterPane = new JPanel(new BorderLayout(LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM)); - delimiterPane.add(new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Delimiter_Symbol")), BorderLayout.WEST); - delimiterPane.add(divideComoBox, BorderLayout.CENTER); - Component[][] components = new Component[][]{ new Component[]{isAddress, null}, new Component[]{isAddressName, null}, new Component[]{isAddressTittle, null}, new Component[]{isDatapointValue, valueFormatButton}, - new Component[]{delimiterPane, null}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Delimiter_Symbol")), divideComoBox}, new Component[]{textFontPane, null} }; - labelPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - - double[] row = {p,p}; - double[] col = {LayoutConstants.CHART_ATTR_TOMARGIN, f}; - JPanel panel = TableLayoutHelper.createTableLayoutPane(new Component[][]{ - new Component[]{isLabelShow,null},new Component[]{null, labelPane}}, row, col); + labelPane = FineLayoutBuilder.commonLeftRightLayout(components); + labelPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0)); + JPanel panel = FineLayoutBuilder.createVerticalLayout(10, isLabelShow, labelPane); this.setLayout(new BorderLayout()); this.add(panel, BorderLayout.CENTER) ; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java index 8e198ea6c5..65cf34c868 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java @@ -1,5 +1,7 @@ package com.fr.design.mainframe.chart.gui.style; +import com.fine.theme.utils.FineLayoutBuilder; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.CoreDecimalFormat; import com.fr.base.FRContext; import com.fr.base.Style; @@ -180,11 +182,8 @@ public class ChartDatapointLabelPane extends BasicPane{ components[6] = new Component[]{textFontPane,null}; labelPane = TableLayoutHelper.createTableLayoutPane(components,rowSize2,columnSize); } - - double[] row = {p,p}; - double[] col = {LayoutConstants.CHART_ATTR_TOMARGIN, f}; - panel = TableLayoutHelper.createTableLayoutPane(new Component[][]{ - new Component[]{isLabelShow,null},new Component[]{null, labelPane}}, row, col); + labelPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0)); + panel = FineLayoutBuilder.createVerticalLayout(10, isLabelShow, labelPane ); this.setLayout(new BorderLayout()); this.add(panel,BorderLayout.CENTER) ; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartAxisPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartAxisPane.java index af1af8af31..8c83565d17 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartAxisPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartAxisPane.java @@ -6,6 +6,7 @@ import com.fr.design.chart.ChartPlotFactory; import com.fr.design.chart.axis.AxisStyleObject; import com.fr.design.chart.axis.ChartStyleAxisPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.style.ThirdTabPane; @@ -13,6 +14,7 @@ import com.fr.design.mainframe.chart.gui.style.legend.AutoSelectedPane; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; +import java.awt.BorderLayout; import java.util.ArrayList; import java.util.List; @@ -28,6 +30,15 @@ public class ChartAxisPane extends ThirdTabPane implements AutoSelectedPa super(plot, parent); } + @Override + protected void initLayout() { + this.setLayout(FRGUIPaneFactory.createScaledBorderLayout(0, 10)); + if (!paneList.isEmpty()) { + this.add(tabPane, BorderLayout.NORTH); + } + this.add(centerPane, BorderLayout.CENTER); + } + @Override protected List initPaneList(Plot plot, AbstractAttrNoScrollPane parent) { List paneList = new ArrayList(); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java index 35b57d09d7..80e626d661 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.chart.gui.style.axis; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.base.BaseFormula; import com.fr.base.Utils; import com.fr.chart.base.AxisUnitType; @@ -10,13 +11,11 @@ import com.fr.chart.chartattr.NumberAxis; import com.fr.chart.chartattr.Plot; import com.fr.design.chart.ChartSwingUtils; import com.fr.design.chart.axis.MinMaxValuePane; -import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.style.FormatPane; -import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartAxisLabelPane; @@ -34,7 +33,6 @@ import javax.swing.JPanel; import javax.swing.JSeparator; import java.awt.BorderLayout; import java.awt.Component; -import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -153,15 +151,11 @@ public class ChartValuePane extends ChartAxisUsePane{ //构造数据定义界面 private JPanel createDataDefinePane(){ - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = { LayoutConstants.CHART_ATTR_TOMARGIN,p,f}; - double[] rowSize = { p, p}; Component[][] component = new Component[][]{ - new Component[]{null,initMinMaxValue(),null}, - new Component[]{null, addLogarithmicPane2ValuePane(), addLogText()}, + new Component[]{initMinMaxValue(),null}, + new Component[]{addLogarithmicPane2ValuePane(), addLogText()}, }; - return TableLayoutHelper.createTableLayoutPane(component, rowSize, columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, component, new double[]{1, 1}); } // 返回最大最小值界面. 雷达轴 有切换按钮. @@ -175,15 +169,13 @@ public class ChartValuePane extends ChartAxisUsePane{ // 返回对数相关界面. 百分比 没有此界面. protected JPanel addLogarithmicPane2ValuePane() { - JPanel labelLogPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - labelLogPane.add(logBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Logarithmic")+":")); - labelLogPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Log_Base"))); - + logBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Logarithmic")); logBaseField = new UITextField(4); logBaseField.setText("10"); - logBaseField.setPreferredSize(new Dimension(55, 20)); + JPanel labelLogPane = FineLayoutBuilder.createHorizontalLayout(10, logBox, + new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Log_Base"))); - logBox.addActionListener(new ActionListener() { + logBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { checkLogUse(); } @@ -195,13 +187,7 @@ public class ChartValuePane extends ChartAxisUsePane{ } private JPanel addLogText() { - JPanel labelLogPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - - if(logBaseField != null) { - labelLogPane.add(logBaseField); - } - - return labelLogPane; + return FineLayoutBuilder.createHorizontalLayout(10, logBaseField); } protected JPanel getAxisTitlePane(){ diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/legend/ChartLegendPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/legend/ChartLegendPane.java index 4c5a7b6e42..9ec2b0e947 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/legend/ChartLegendPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/legend/ChartLegendPane.java @@ -1,15 +1,14 @@ package com.fr.design.mainframe.chart.gui.style.legend; +import com.fine.theme.utils.FineLayoutBuilder; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseUtils; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Legend; import com.fr.chart.chartattr.Plot; -import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.BoldFontTextLabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.style.ChartBackgroundNoImagePane; import com.fr.design.mainframe.chart.gui.style.ChartBorderPane; @@ -18,8 +17,11 @@ import com.fr.design.dialog.BasicScrollPane; import com.fr.stable.Constants; -import javax.swing.*; -import java.awt.*; +import javax.swing.Icon; +import javax.swing.JPanel; +import javax.swing.JSeparator; +import java.awt.BorderLayout; +import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -70,24 +72,17 @@ public class ChartLegendPane extends BasicScrollPane{ location.setAllToolTips(textArray); backgroundPane = new ChartBackgroundNoImagePane(); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = { LayoutConstants.CHART_ATTR_TOMARGIN, f }; - double[] rowSize = { p,p,p,p,p,p}; - Component[][] components = new Component[][]{ - new Component[]{null,textAttrPane}, + new Component[]{textAttrPane}, new Component[]{new JSeparator(),null}, new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout")),location} , new Component[]{new JSeparator(),null}, new Component[]{borderPane,null}, new Component[]{backgroundPane,null} }; - legendPane = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); - double[] col = {f}; - double[] row = {p, p}; - JPanel panel = TableLayoutHelper.createTableLayoutPane(new Component[][]{ - new Component[]{isLegendVisible},new Component[]{legendPane},},row,col); + legendPane = FineLayoutBuilder.commonLeftRightLayout(components); + legendPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0)); + JPanel panel = FineLayoutBuilder.createVerticalLayout(10, isLegendVisible, legendPane); this.setLayout(new BorderLayout()); this.add(panel,BorderLayout.CENTER); isLegendVisible.addActionListener(new ActionListener() { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/title/ChartTitlePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/title/ChartTitlePane.java index cc3f828098..a76cf5c2f3 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/title/ChartTitlePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/title/ChartTitlePane.java @@ -1,30 +1,27 @@ package com.fr.design.mainframe.chart.gui.style.title; +import com.fine.theme.utils.FineComponentsFactory; +import com.fine.theme.utils.FineLayoutBuilder; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseFormula; -import com.fr.base.BaseUtils; import com.fr.base.Utils; import com.fr.chart.base.TextAttr; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Title; -import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicScrollPane; import com.fr.design.formula.DefaultTinyFormulaPane; import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.BoldFontTextLabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.style.ChartBackgroundNoImagePane; import com.fr.design.mainframe.chart.gui.style.ChartBorderPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; -import com.fr.stable.Constants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; -import javax.swing.Icon; import javax.swing.JPanel; import javax.swing.JSeparator; import java.awt.BorderLayout; @@ -57,16 +54,12 @@ public class ChartTitlePane extends BasicScrollPane { isTitleVisable = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Title_Visible")); titlePane = createTitlePane(); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {f}; - double[] rowSize = {p, p}; Component[][] components = new Component[][]{ new Component[]{isTitleVisable}, new Component[]{titlePane} } ; - JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + JPanel panel = FineLayoutBuilder.compatibleTableLayout(10, components,new double[]{1}); this.setLayout(new BorderLayout()); this.add(panel,BorderLayout.CENTER); @@ -83,10 +76,6 @@ public class ChartTitlePane extends BasicScrollPane { backgroundPane = new ChartBackgroundNoImagePane(); chartDefaultAttrPane = createDefaultAttrPane(); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, f}; - double[] rowSize = {p,p,p,p,p}; Component[][] components = new Component[][]{ new Component[]{chartDefaultAttrPane,null}, new Component[]{new JSeparator(),null}, @@ -94,29 +83,22 @@ public class ChartTitlePane extends BasicScrollPane { new Component[]{backgroundPane,null} } ; - return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1, 0}); } private JPanel createDefaultAttrPane(){ titleContent = new DefaultTinyFormulaPane(); textAttrPane = new ChartTextAttrPane(); - Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), - BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), - BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}; - Integer[] alignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}; - alignmentPane = new UIButtonGroup(alignmentIconArray, alignment); + alignmentPane = FineComponentsFactory.createHorizontalAlignmentButtonGroup(); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, f}; - double[] rowSize = {p, p,p}; Component[][] components = new Component[][]{ - new Component[]{null,titleContent,null}, - new Component[]{null,textAttrPane,null}, - new Component[]{null,new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alignment_Style") + ":"),alignmentPane} , + new Component[]{titleContent,null}, + new Component[]{textAttrPane,null}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alignment_Style")), alignmentPane} , } ; - - return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + JPanel attrPane = FineLayoutBuilder.commonLeftRightLayout(components); + attrPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0)); + return attrPane; } // 检查标题界面是否可用.