Browse Source

REPORT-127437 feat:翻新预览界面 & 纸张背景,渐变色布局调整

newui
lemon 4 months ago
parent
commit
b15b0f4df2
  1. 2
      designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java
  2. 33
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  3. 15
      designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/PreviewTableDesensitizationPane.java
  4. 1
      designer-base/src/main/java/com/fr/design/gui/itable/SortableJTable.java
  5. 2
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java
  6. 11
      designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBackgroundPane.java
  7. 29
      designer-realize/src/main/java/com/fr/design/report/NewReportBackgroundPane.java

2
designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java

@ -72,7 +72,7 @@ public class CopyableJTable extends SortableJTable {
public CopyableJTable(TableSorter tableModel) {
super(tableModel);
initListener();
this.getTableHeader().setDefaultRenderer(new CopyableTableHeaderCellRenderer(this.getTableHeader().getDefaultRenderer()));
setShowGrid(true);
}
private void initListener() {

33
designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java

@ -3,8 +3,9 @@
*/
package com.fr.design.data.datapane.preview;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIUtils;
import com.fr.base.TableData;
import com.fr.base.svg.IconUtils;
import com.fr.data.TableDataSource;
import com.fr.data.desensitize.base.DesensitizationTableData;
import com.fr.data.impl.DBTableData;
@ -67,6 +68,9 @@ import java.util.List;
import java.util.Objects;
import java.util.concurrent.CancellationException;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
/**
* august PreviewTablePane一共提供5个共有的静态方法用来预览
*/
@ -143,9 +147,9 @@ public class PreviewTablePane extends BasicPane {
}
private PreviewTablePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setLayout(new BorderLayout(0, 10));
// northPane
this.add(initNorthPane(), BorderLayout.NORTH);
this.add(FineUIUtils.wrapComponentWithTitle(initNorthPane(), Toolkit.i18nText("Fine-Design_Basic_Data")), BorderLayout.NORTH);
// centerPane
this.add(initCenterPane(), BorderLayout.CENTER);
// dialog
@ -174,20 +178,14 @@ public class PreviewTablePane extends BasicPane {
* @return
*/
private JComponent initPreviewNumberPane() {
JPanel previewNumberPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
JPanel previewNumberPanel = new JPanel(new BorderLayout());
// 当前行数
JPanel currentPreviewPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
currentPreviewPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Current_Preview_Rows") + ":"));
currentRowsField = new UINumberField();
currentPreviewPanel.add(currentRowsField);
currentRowsField.setEditable(false);
currentRowsField.setColumns(4);
currentRowsField.setInteger(true);
// 最大行数
JPanel maxPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
maxPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Datasource_Maximum_Number_of_Preview_Rows") + ":"));
maxPreviewNumberField = new UINumberField();
maxPanel.add(maxPreviewNumberField);
maxPreviewNumberField.setColumns(4);
maxPreviewNumberField.setInteger(true);
maxPreviewNumberField.setValue(DesignerEnvManager.getEnvManager().getMaxNumberOrPreviewRow());
@ -198,14 +196,17 @@ public class PreviewTablePane extends BasicPane {
// 刷新按钮
initRefreshLabel();
previewNumberPanel.add(currentPreviewPanel);
previewNumberPanel.add(maxPanel);
previewNumberPanel.add(refreshLabel);
previewNumberPanel.add(row(20,
row(4, cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Current_Preview_Rows") + ":")), cell(currentRowsField)),
row(4, cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Datasource_Maximum_Number_of_Preview_Rows") + ":")), cell(maxPreviewNumberField)),
cell(refreshLabel)
).getComponent());
return previewNumberPanel;
}
private void initRefreshLabel() {
Icon refreshImage = IconUtils.readIcon("/com/fr/design/images/control/refresh");
Icon refreshImage = new LazyIcon("refresh");
refreshLabel = new UILabel(refreshImage);
refreshLabel.addMouseListener(refreshLabelMouseAdapter);
}
@ -434,7 +435,6 @@ public class PreviewTablePane extends BasicPane {
*/
public static EmbeddedTableData previewTableData(TableData tableData, final int keyIndex, final int valueIndex) {
PreviewTablePane previewTablePane = new PreviewTablePane();
previewTablePane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Basic_Data")));
try {
previewTablePane.populate(tableData);
previewTablePane.resetPreviewTableColumnColor();
@ -646,7 +646,6 @@ public class PreviewTablePane extends BasicPane {
public static void previewDataModel(final DataModel dataModel, final int keyIndex, final int valueIndex) {
final PreviewTablePane previewTablePane = new PreviewTablePane();
previewTablePane.dataModel = dataModel;
previewTablePane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Basic_Data")));
try {
previewTablePane.setRowsLimitTableModel();
@ -675,8 +674,6 @@ public class PreviewTablePane extends BasicPane {
// 单个结果集的展示面板
PreviewTablePane previewTablePane = new PreviewTablePane();
previewTablePane.dataModel = nameDataModel;
// 数据
previewTablePane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Basic_Data")));
try {
// 带行数限制的数据集结果预览对象
previewTablePane.setRowsLimitTableModel();

15
designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/PreviewTableDesensitizationPane.java

@ -1,6 +1,6 @@
package com.fr.design.data.datapane.preview.desensitization.view;
import com.fr.base.svg.IconUtils;
import com.fine.theme.icon.LazyIcon;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.gui.ibutton.UIToggleButton;
@ -12,11 +12,14 @@ import com.fr.design.menu.ToolBarDef;
import javax.swing.Icon;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
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.row;
/**
* 数据集预览-脱敏配置面板主要展示当前脱敏开启状态当前脱敏设定数量等
*
@ -56,10 +59,8 @@ public class PreviewTableDesensitizationPane extends JPanel {
* 初始化面板
*/
private void initComponents() {
this.setLayout(new FlowLayout(FlowLayout.LEFT));
this.add(initDesensitizationLabel());
this.add(initToolBar());
this.add(initPreviewButton());
this.setLayout(new BorderLayout());
this.add(row(cell(initDesensitizationLabel()), cell(initToolBar()), cell(initPreviewButton())).getComponent());
}
/**
@ -100,7 +101,7 @@ public class PreviewTableDesensitizationPane extends JPanel {
* @return
*/
private UIToggleButton initPreviewButton() {
previewToggle = new UIToggleButton(new Icon[]{IconUtils.readIcon("/com/fr/design/images/m_file/preview"), IconUtils.readIcon("/com/fr/design/images/m_file/preview")}, true);
previewToggle = new UIToggleButton(new Icon[]{new LazyIcon("preview"), new LazyIcon("preview")}, true);
previewToggle.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Desensitization_Preview"));
previewToggle.setSelected(false);
previewToggle.addActionListener(e -> {

1
designer-base/src/main/java/com/fr/design/gui/itable/SortableJTable.java

@ -6,5 +6,6 @@ public class SortableJTable extends JTable{
public SortableJTable(TableSorter tableModel){
super(tableModel);
tableModel.setTableHeader(getTableHeader());
setShowGrid(true);
}
}

2
designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.backgroundpane;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.base.background.ColorBackground;
import com.fr.design.event.UIObserverListener;
import com.fr.design.layout.FRGUIPaneFactory;
@ -29,6 +30,7 @@ public class ColorBackgroundQuickPane extends BackgroundQuickPane {
return false;
}
};
colorSelectBox.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE));
this.add(colorSelectBox, BorderLayout.NORTH);
}

11
designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBackgroundPane.java

@ -11,14 +11,11 @@ import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.Background;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -56,20 +53,20 @@ public class GradientBackgroundPane extends BackgroundDetailPane {
toggle.add(top2bottom);
JPanel jpanel = column(
10,
row(
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Drag_To_Select_Gradient"))),
flex()
),
fix(100),
row(
flex(),
cell(gradientBar),
flex()
),
fix(100),
fix(10),
row(
5,
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Gradient_Direction") + ":")),
fix(20),
cell(left2right),
cell(top2bottom),
flex()
@ -77,7 +74,7 @@ public class GradientBackgroundPane extends BackgroundDetailPane {
)
).getComponent();
jpanel.setPreferredSize(FineUIScale.scale(new Dimension(600, 450)));
this.setLayout(new BorderLayout());
this.add(FineUIUtils.wrapComponentWithTitle(jpanel, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Background_Choose_Gradient_Color")));
}

29
designer-realize/src/main/java/com/fr/design/report/NewReportBackgroundPane.java

@ -19,14 +19,12 @@ 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.ui.BorderUtils;
import com.fr.general.Background;
import com.fr.page.ReportSettingsProvider;
import com.fr.report.stable.ReportSettings;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.border.CompoundBorder;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
@ -36,6 +34,9 @@ import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.geom.Rectangle2D;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column;
public class NewReportBackgroundPane extends BasicPane {
private final UICheckBox isPrintBackgroundCheckBox;
private final UICheckBox isExportBackgroundCheckBox;
@ -44,14 +45,12 @@ public class NewReportBackgroundPane extends BasicPane {
public NewReportBackgroundPane() {
setLayout(FRGUIPaneFactory.createBorderLayout());
setBorder(BorderFactory.createEmptyBorder());
setPreferredSize(FineUIScale.scale(new Dimension(600, 570)));
profilePane = new BackgroundProfilePane();
isPrintBackgroundCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Print_Background"));
isExportBackgroundCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Background"));
add(profilePane, BorderLayout.CENTER);
add(createBottomPane(), BorderLayout.SOUTH);
add(column(10, cell(profilePane).weight(1), cell(createBottomPane())).getComponent());
}
private JPanel createBottomPane() {
@ -144,9 +143,9 @@ public class NewReportBackgroundPane extends BasicPane {
}
});
JPanel contentContainer = Layouts.column(
JPanel contentContainer = column(
10,
Layouts.row(10, Layouts.cell(createLeftPane()), Layouts.cell(createRightPane()))
Layouts.row(10, cell(createLeftPane()).weight(1), cell(createRightPane())).weight(1)
).getComponent();
contentContainer.setPreferredSize(FineUIScale.scale(new Dimension(600, 540)));
@ -167,23 +166,19 @@ public class NewReportBackgroundPane extends BasicPane {
}
private JPanel createLeftPane() {
JPanel panel = new JPanel();
panel.add(previewPane, BorderLayout.NORTH);
previewPane.setBorder(new FineRoundBorder());
JPanel titledPane = Layouts.column(
JPanel panel = new JPanel(new BorderLayout());
panel.add(previewPane, BorderLayout.CENTER);
return column(
10,
Layouts.cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Preview"))),
Layouts.cell(previewPane)
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Preview"))),
cell(panel).weight(1).with(it -> it.setBorder(new FineRoundBorder()))
).getComponent();
previewPane.setPreferredSize(FineUIScale.scale(new Dimension(367, 480)));
return titledPane;
}
private JPanel createRightPane() {
JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane();
container.setBorder(BorderFactory.createEmptyBorder());
container.setPreferredSize(FineUIScale.scale(new Dimension(263, 502)));
container.add(themePane, BorderLayout.NORTH);
return container;
}

Loading…
Cancel
Save