Browse Source

Pull request #14517: REPORT-127437:【Newui】

Merge in DESIGN/design from ~ZONGYU.WANG/design:newui to newui

* commit 'f3b3e04363c953b49cfd99443c8fc1eb69c62fd9':
  REPORT-127437 fix:布局,背景颜色问题修复
  REPORT-127437 fix: 调整 jtable 滚动条/UI布局/表身组件 的一些样式
newui
Zongyu.Wang-王宗雨 4 months ago
parent
commit
e3a7c796f1
  1. 98
      designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java
  2. 40
      designer-base/src/main/java/com/fine/theme/light/ui/FineTableScrollBarPaneUI.java
  3. 4
      designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java
  4. 21
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java
  5. 3
      designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java
  6. 28
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  7. 12
      designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/PreviewTableDesensitizationPane.java
  8. 50
      designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java
  9. 23
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  10. 4
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java
  11. 9
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java
  12. 5
      designer-base/src/main/java/com/fr/design/dialog/BasicPane.java
  13. 25
      designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxRenderer.java
  14. 35
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java
  15. 7
      designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java
  16. 3
      designer-base/src/main/java/com/fr/design/gui/itable/SortableJTable.java
  17. 4
      designer-base/src/main/java/com/fr/design/gui/itable/TableSorter.java
  18. 14
      designer-base/src/main/java/com/fr/design/gui/itableeditorpane/ParameterTableModel.java
  19. 113
      designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java
  20. 22
      designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java
  21. 2
      designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java
  22. 2
      designer-base/src/main/java/com/fr/design/mainframe/DottedLine.java
  23. 5
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/AbstractSupportSelectTablePane.java
  24. 3
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java
  25. 4
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/ToolTipTableCellRenderer.java
  26. 1
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java
  27. 2
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsOperatorPane.java
  28. 1
      designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java
  29. 19
      designer-base/src/main/java/com/fr/design/style/FormatPane.java
  30. 3
      designer-base/src/main/java/com/fr/design/style/background/impl/ImageBackgroundPane.java
  31. 3
      designer-base/src/main/java/com/fr/design/style/color/DetailColorSelectPane.java
  32. 44
      designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java
  33. 29
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties
  34. 111
      designer-base/src/test/java/com/fr/design/gui/storybook/components/TableStoryBoard.java
  35. 2
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java
  36. 1
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java
  37. 13
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java
  38. 1
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java
  39. 30
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java
  40. 7
      designer-realize/src/main/java/com/fr/design/cell/smartaction/SmartJTablePane.java
  41. 3
      designer-realize/src/main/java/com/fr/design/condition/ForeGroundPane.java
  42. 3
      designer-realize/src/main/java/com/fr/design/condition/PaddingPane.java
  43. 3
      designer-realize/src/main/java/com/fr/design/condition/PagePane.java
  44. 25
      designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterEditPane.java
  45. 11
      designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterPane.java
  46. 23
      designer-realize/src/main/java/com/fr/design/report/NewReportBackgroundPane.java
  47. 23
      designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java
  48. 42
      designer-realize/src/main/java/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java
  49. 8
      designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java

98
designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java

@ -0,0 +1,98 @@
package com.fine.theme.light.ui;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.ui.FlatTableHeaderUI;
import com.fr.stable.StringUtils;
import sun.swing.DefaultLookup;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.UIResource;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.JTableHeader;
import java.awt.Component;
import java.awt.Graphics;
/**
* 应用于 JTable 的UI
*
* @author lemon
* @since
* Created on
*/
public class FineTableHeaderUI extends FlatTableHeaderUI {
@Override
public void installUI(JComponent c) {
super.installUI(c);
JTableHeader header = (JTableHeader) c;
header.setDefaultRenderer(new TableHeaderRenderer());
JTable table = header.getTable();
FineUIStyle.setStyle(table, FineUIStyle.DEFAULT_TABLE);
table.getTableHeader().getTable().setDefaultRenderer(Object.class, new TableRenderer());
}
@Override
public void paint(Graphics g, JComponent c) {
super.paint(g, c);
}
/**
* 表头 render
*/
public static class TableHeaderRenderer extends DefaultTableCellRenderer implements UIResource {
public TableHeaderRenderer() {
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
Border border = DefaultLookup.getBorder(this, this.ui, "TableHeader.cellBorder");
this.setText(value == null ? "" : value.toString());
this.setHorizontalAlignment(SwingConstants.LEFT);
this.setBorder(border);
return this;
}
}
/**
* UI
* @param c
* @return
*/
public static ComponentUI createUI(JComponent c) {
return new FineTableHeaderUI();
}
/**
* 表身 render
*/
public static class TableRenderer extends DefaultTableCellRenderer {
public TableRenderer() {
setHorizontalAlignment(SwingConstants.LEFT);
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
Border border;
if (column == table.getColumnCount() - 1) {
border = BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor")),
UIManager.getBorder("Table.cellNoFocusBorder"));
} else {
border = BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor")),
UIManager.getBorder("Table.cellNoFocusBorder"));
}
setBackground(UIManager.getColor("Table.background"));
setText(value == null ? StringUtils.BLANK : String.valueOf(value));
setBorder(border);
return this;
}
}
}

40
designer-base/src/main/java/com/fine/theme/light/ui/FineTableScrollBarPaneUI.java

@ -0,0 +1,40 @@
package com.fine.theme.light.ui;
import com.formdev.flatlaf.ui.FlatScrollBarUI;
import javax.swing.JComponent;
import javax.swing.JTable;
import java.awt.Graphics;
import java.awt.Rectangle;
/**
* 应用于 JTable 的垂直滚动条UI
*
* @author lemon
* @since
* Created on 2024/08/11
*/
public class FineTableScrollBarPaneUI extends FlatScrollBarUI {
private final JTable table;
public FineTableScrollBarPaneUI(JTable table) {
this.table = table;
}
@Override
protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) {
super.paintTrack(g, c, trackBounds);
}
@Override
protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) {
// 确保滚动条滑块不会超过表头区域
Rectangle headerRect = table.getTableHeader().getBounds();
int headerHeight = headerRect.height;
thumbBounds.y = Math.max(thumbBounds.y, headerHeight);
super.paintThumb(g, c, thumbBounds);
}
}

4
designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java

@ -44,6 +44,10 @@ public interface FineUIStyle {
String PASTEL_BUTTON = "pastelButton";
String BREADCRUMB_BUTTON = "breadcrumbButton";
String DEFAULT_TABLE = "defaultTable";
String WHITE_BUTTON = "whiteButton";
String ORIGINAL_BUTTON = "originalButton";
/**
* 添加组件的样式类类似css该方法会接在原样式后方

21
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java

@ -5,8 +5,6 @@ import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIScale;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.data.core.db.TableProcedure;
import com.fr.data.impl.AbstractDatabaseConnection;
import com.fr.data.impl.Connection;
@ -72,7 +70,7 @@ public class ConnectionTableProcedurePane extends BasicPane {
}
private void init(SwitchableTableDataPane parent) {
this.setLayout(new BorderLayout(4, 10));
this.setLayout(FRGUIPaneFactory.createScaledBorderLayout(4, 10));
// 初始化数据连接下拉框
initConnectionComboBox(parent);
// 初始化中间的面板
@ -84,8 +82,7 @@ public class ConnectionTableProcedurePane extends BasicPane {
}
private JPanel initCenterPane() {
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
centerPane.setLayout(new BorderLayout(0, 5));
JPanel centerPane = FRGUIPaneFactory.createScaledBorderLayout_S_Pane(0, 6);
// 搜索面板
centerPane.add(createSearchPane(), BorderLayout.NORTH);
// 数据库表视图面板
@ -156,8 +153,7 @@ public class ConnectionTableProcedurePane extends BasicPane {
});
UIScrollPane tableViewListPane = new UIScrollPane(tableViewList);
tableViewListPane.setBorder(new UIRoundedBorder(UIManager.getColor("defaultBorderColor"), 1, UIConstants.ARC));
JPanel tableViewBorderPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
tableViewBorderPane.setLayout(new BorderLayout(0, 5));
JPanel tableViewBorderPane = FRGUIPaneFactory.createScaledBorderLayout_S_Pane(0, 10);
tableViewBorderPane.add(tableViewListPane, BorderLayout.CENTER);
JPanel checkBoxgroupPane = createCheckBoxgroupPane();
if (checkBoxgroupPane != null) {
@ -193,19 +189,18 @@ public class ConnectionTableProcedurePane extends BasicPane {
}
protected JPanel createCheckBoxgroupPane() {
JPanel checkBoxgroupPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2);
checkBoxgroupPane.setLayout(new BorderLayout(20, 0));
JPanel first = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
JPanel checkBoxgroupPane = FRGUIPaneFactory.createScaledBorderLayout_S_Pane(30, 2);
JPanel first = FRGUIPaneFactory.createScaledBorderLayout_S_Pane(2, 0);
tableCheckBox = new UICheckBox();
tableCheckBox.setSelected(true);
tableCheckBox.addActionListener(filter);
first.add(tableCheckBox);
first.add(tableCheckBox, BorderLayout.WEST);
JPanel second = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
JPanel second = FRGUIPaneFactory.createScaledBorderLayout_S_Pane(4, 0);
viewCheckBox = new UICheckBox();
viewCheckBox.setSelected(true);
viewCheckBox.addActionListener(filter);
second.add(viewCheckBox);
second.add(viewCheckBox, BorderLayout.WEST);
// 根据环境是否为中文设置不同的显示
if (GeneralContext.isChineseEnv()) {

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

@ -7,7 +7,6 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.os.OperatingSystem;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumnModel;
@ -211,8 +210,6 @@ public class CopyableJTable extends SortableJTable {
Component comp = super.prepareRenderer(renderer, row, column);
if (isChoose(row, column)) {
comp.setBackground(selectBackGround);
} else {
comp.setBackground(this.getBackground());
}
return comp;
}

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

@ -4,7 +4,10 @@
package com.fr.design.data.datapane.preview;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineTableHeaderUI;
import com.fine.theme.light.ui.FineTableScrollBarPaneUI;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils;
import com.fr.base.TableData;
import com.fr.data.TableDataSource;
@ -25,6 +28,7 @@ import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.iprogressbar.AutoProgressBar;
import com.fr.design.gui.itable.SortableJTable;
@ -88,7 +92,7 @@ public class PreviewTablePane extends BasicPane {
private BasicDialog dialog;
private SwingWorker worker;
private UILabel refreshLabel;
private UIButton refreshLabel;
private static PreviewTablePane THIS;
private EmbeddedTableData previewTableData;
@ -104,31 +108,22 @@ public class PreviewTablePane extends BasicPane {
@Override
public void mouseEntered(MouseEvent e) { // 当鼠标进入时候调用.
mouseEntered = true;
if (!buttonPressed) {
refreshLabel.setBackground(java.awt.Color.WHITE);
refreshLabel.setOpaque(true);
refreshLabel.setBorder(BorderFactory.createLineBorder(java.awt.Color.GRAY));
}
}
@Override
public void mouseExited(MouseEvent e) {
mouseEntered = false;
refreshLabel.setOpaque(false);
refreshLabel.setBorder(BorderFactory.createEmptyBorder());
}
@Override
public void mousePressed(MouseEvent e) {
buttonPressed = true;
refreshLabel.setBackground(java.awt.Color.lightGray);
}
@Override
public void mouseReleased(MouseEvent e) {
buttonPressed = false;
if (mouseEntered) {
refreshLabel.setBackground(java.awt.Color.WHITE);
try {
populate(tableData);
if (dataModel != null) {
@ -208,7 +203,8 @@ public class PreviewTablePane extends BasicPane {
private void initRefreshLabel() {
Icon refreshImage = new LazyIcon("refresh");
refreshLabel = new UILabel(refreshImage);
refreshLabel = new UIButton(refreshImage);
FineUIStyle.setStyle(refreshLabel, FineUIStyle.ORIGINAL_BUTTON);
refreshLabel.addMouseListener(refreshLabelMouseAdapter);
}
@ -308,8 +304,10 @@ public class PreviewTablePane extends BasicPane {
private JComponent initCenterPane() {
preveiwTable = new CopyableJTable(new TableSorter());
preveiwTable.setRowSelectionAllowed(false);
preveiwTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
return new JScrollPane(preveiwTable);
preveiwTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
JScrollPane scrollPane = new JScrollPane(preveiwTable);
scrollPane.getVerticalScrollBar().setUI(new FineTableScrollBarPaneUI(preveiwTable));
return scrollPane;
}
private void initDialog() {
@ -403,7 +401,7 @@ public class PreviewTablePane extends BasicPane {
public static void resetPreviewTable() {
getInstance().preveiwTable = new SortableJTable(new TableSorter());
getInstance().preveiwTable.setRowSelectionAllowed(false);
getInstance().preveiwTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
getInstance().preveiwTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
PreviewTablePane.progressBar.close();
getInstance().repaint();
}
@ -511,7 +509,7 @@ public class PreviewTablePane extends BasicPane {
* @return
*/
private DefaultTableCellRenderer getDefaultTableCellRenderer() {
return new DefaultTableCellRenderer() {
return new FineTableHeaderUI.TableRenderer() {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
JComponent comp = (JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);

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

@ -1,16 +1,16 @@
package com.fr.design.data.datapane.preview.desensitization.view;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIStyle;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.i18n.Toolkit;
import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ToolBarDef;
import javax.swing.Icon;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
@ -47,7 +47,7 @@ public class PreviewTableDesensitizationPane extends JPanel {
/**
* 脱敏效果预览按钮
*/
private UIToggleButton previewToggle;
private UIButton previewToggle;
public PreviewTableDesensitizationPane(PreviewTablePane previewTablePane) {
@ -100,10 +100,12 @@ public class PreviewTableDesensitizationPane extends JPanel {
*
* @return
*/
private UIToggleButton initPreviewButton() {
previewToggle = new UIToggleButton(new Icon[]{new LazyIcon("preview"), new LazyIcon("preview")}, true);
private UIButton initPreviewButton() {
previewToggle = new UIButton();
previewToggle.setIcon(new LazyIcon("preview"));
previewToggle.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Desensitization_Preview"));
previewToggle.setSelected(false);
FineUIStyle.setStyle(previewToggle, FineUIStyle.ORIGINAL_BUTTON);
previewToggle.addActionListener(e -> {
// 切换TableModel的脱敏状态
previewTablePane.togglePreviewTableModelDesensitizeStatus();

50
designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java

@ -1,6 +1,8 @@
package com.fr.design.data.datapane.preview.desensitization.view.setting;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.data.desensitize.base.DesensitizationTableData;
import com.fr.data.desensitize.base.TableDataDesensitizationItem;
@ -346,26 +348,10 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
*/
private class EffectedRolesChooser extends AbstractCellEditor implements TableCellEditor {
private UIComboCheckBox rolesCheckBox;
private EffectedRolesComboBox rolesCheckBox;
EffectedRolesChooser() {
this.rolesCheckBox = new UIComboCheckBox(roleMap.values().toArray(), true) {
@Override
protected void setLayoutAndAddComponents() {
// 使用BorderLayout,否则默认使用的FlowLayout会让整个下拉选框使用最小Size,然后TableCell这边会出现空白
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(getEditor(), BorderLayout.CENTER);
this.add(getArrowButton(), BorderLayout.EAST);
}
@Override
protected void setEditorToolTipText(JComponent editor, String text) {
// 选项过多时,已选中的值会做省略显示处理,此处添加一个Tooltips,显示完整值
if (text != null) {
editor.setToolTipText(text);
}
}
};
rolesCheckBox = new EffectedRolesComboBox();
this.addCellEditorListener(new CellEditorListener() {
@Override
public void editingStopped(ChangeEvent e) {
@ -385,10 +371,8 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
}
private void setBoxStyle() {
this.rolesCheckBox.getEditor().setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE));
this.rolesCheckBox.getEditor().setOpaque(true);
this.rolesCheckBox.getArrowButton().setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE));
this.rolesCheckBox.getArrowButton().setOpaque(true);
this.rolesCheckBox.setBorder(new FineRoundBorder());
FineUIStyle.setStyle(this.rolesCheckBox.getEditor(), FineUIStyle.TRANSPARENT_TEXT_FIELD);
}
@Override
@ -439,6 +423,28 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
public Object getCellEditorValue() {
return rolesCheckBox.getSelectedValues();
}
private class EffectedRolesComboBox extends UIComboCheckBox {
public EffectedRolesComboBox() {
super(roleMap.values().toArray(), true);
}
@Override
protected void setLayoutAndAddComponents() {
// 使用BorderLayout,否则默认使用的FlowLayout会让整个下拉选框使用最小Size,然后TableCell这边会出现空白
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(getEditor(), BorderLayout.CENTER);
this.add(getLabel(), BorderLayout.EAST);
}
@Override
protected void setEditorToolTipText(JComponent editor, String text) {
// 选项过多时,已选中的值会做省略显示处理,此处添加一个Tooltips,显示完整值
if (text != null) {
editor.setToolTipText(text);
}
}
}
}
/**

23
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java

@ -2,6 +2,7 @@ package com.fr.design.data.tabledata.tabledatapane;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.Parameter;
import com.fr.base.ParameterHelper;
@ -100,7 +101,7 @@ import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX;
*/
public class DBTableDataPane extends AbstractTableDataPane<DBTableData> implements SwitchableTableDataPane {
private static final int BOTTOM = 9;
private static final int BOTTOM = 10;
private static final String PREVIEW_BUTTON = Toolkit.i18nText("Fine-Design_Basic_Preview");
private static final String REFRESH_BUTTON = Toolkit.i18nText("Fine-Design_Basic_Refresh");
private ConnectionTableProcedurePane connectionTableProcedurePane;
@ -156,7 +157,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> implemen
}
private void init() {
contentPane.setLayout(new BorderLayout(4, 4));
contentPane.setLayout(FRGUIPaneFactory.createScaledBorderLayout(4, 4));
this.sqlTextPane = new SQLEditPane();
this.sqlTextPane.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL);
@ -243,11 +244,11 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> implemen
private void initMainSplitPane() {
Box box = new Box(BoxLayout.Y_AXIS);
JPanel northPane = new JPanel(new BorderLayout(4, 4));
JPanel northPane = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(4, 4));
JToolBar editToolBar = createToolBar();
editToolBar.setBorder(null);
northPane.add(editToolBar, BorderLayout.CENTER);
northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, BOTTOM, 0));
northPane.setBorder(new ScaledEmptyBorder(0, 0, BOTTOM, 0));
RTextScrollPane sqlTextScrollPane = new RTextScrollPane(this.sqlTextPane);
sqlTextScrollPane.setLineNumbersEnabled(true);
@ -255,8 +256,9 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> implemen
sqlTextScrollPane.setPreferredSize(FineUIScale.scale(new Dimension(680, 600)));
JPanel paraMeanPane = new JPanel(new BorderLayout());
paraMeanPane.setPreferredSize(FineUIScale.scale(new Dimension(680, 90)));
paraMeanPane.setBorder(new ScaledEmptyBorder(10, 0, BOTTOM, 0));
UILabel paraMean = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Datasource_Param_DES"));
FineUIStyle.setStyle(paraMean, FineUIStyle.LABEL_TIP);
paraMeanPane.add(paraMean, BorderLayout.CENTER);
@ -265,7 +267,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> implemen
box.add(paraMeanPane);
box.add(this.editorPane);
JPanel sqlSplitPane = new JPanel(new BorderLayout(4, 4));
JPanel sqlSplitPane = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(4, 4));
sqlSplitPane.add(box, BorderLayout.CENTER);
@ -275,7 +277,6 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> implemen
this.connectionTableProcedurePane.setMaximumSize(FineUIScale.scale(new Dimension(500, 400)));
JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, this.connectionTableProcedurePane, sqlSplitPane);
mainSplitPane.setBorder(new ScaledEmptyBorder(10, 10, 10, 10));
mainSplitPane.setOneTouchExpandable(true);
contentPane.add(mainSplitPane, BorderLayout.CENTER);
}
@ -339,15 +340,19 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> implemen
private void createToolbarEsdComponents(final UIToolbar editToolBar) {
this.esdSettingsLabel = new UILabel(Toolkit.i18nText("Fine-Design_ESD_Cache_Settings"));
esdSettingsLabel.setBorder(new ScaledEmptyBorder(0, 6, 0,6));
this.esdConfigOption = new UIComboBox(StrategyConfigFrom.values());
this.esdConfigOption.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX);
this.esdEnabled = new UICheckBox(Toolkit.i18nText("Fine-Design_ESD_Enable_Cache"));
esdEnabled.setBorder(new ScaledEmptyBorder(0, 6, 0,6));
this.barErrorTips = new UILabel();
this.barErrorTips.setForeground(Color.RED);
barErrorTips.setBorder(new ScaledEmptyBorder(0, 6, 0,6));
FineUIStyle.setStyle(barErrorTips, FineUIStyle.LABEL_WARNING_TIP);
this.barErrorTips.setVisible(false);
esdSettingsBtn = new UIButton(Toolkit.i18nText("Fine-Design_ESD_Strategy_Config"));
esdSettingsBtn.setPreferredSize(FineUIScale.scale(new Dimension(72, 24)));
esdSettingsBtn.setPreferredSize(new Dimension((int) esdSettingsBtn.getPreferredSize().getWidth(), FineUIScale.scale(24)));
FineUIStyle.setStyle(esdSettingsBtn, FineUIStyle.WHITE_BUTTON);
esdSettingsBtn.addActionListener(new ActionListener() {
@Override

4
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java

@ -15,6 +15,9 @@ import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.StringUtils;
import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX;
import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE;
public class MaxMemRowCountPanel extends UIToolbar {
private static final int ALL_IN_MEMORY = 0;
@ -71,6 +74,7 @@ public class MaxMemRowCountPanel extends UIToolbar {
this.setRollover(true);
this.setBackground(UIConstants.NORMAL_BACKGROUND);
switchCache = new UIComboBox(CACHE_LIST);
switchCache.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX);
switchCache.addActionListener(switchStateL);
numberSpinner = new UISpinner(0, Integer.MAX_VALUE, 1);
numberSpinner.setNumberFieldColumns(3);

9
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java

@ -92,11 +92,11 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
super();
queryText = new UILabel(StringUtils.EMPTY);
Box box = new Box(BoxLayout.Y_AXIS);
JPanel northpane = new JPanel(new BorderLayout(4, 4));
JPanel northpane = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(4, 0));
JToolBar editToolBar = creatToolBar();
editToolBar.setBorder(null);
northpane.add(editToolBar, BorderLayout.NORTH);
northpane.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0));
northpane.setBorder(new ScaledEmptyBorder(0, 0, 10, 0));
storeProcedureContext = new SQLEditPane(SQLEditPane.UNREQUEST_DROPTARGET);
storeProcedureContext.setEditable(false);
@ -107,6 +107,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
JPanel namePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
namePane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Stored_Procedure") + ":"));
namePane.add(queryText);
namePane.setBorder(new ScaledEmptyBorder(10, 0, 0, 0));
inAutoeditorPane = new UITableEditorPane<StoreProcedureParameter>(new StoreProcedureTableModel());
autoEditorPane = new UITableEditorPane<StoreProcedureParameter>(new AutoStoreProcedureTableModel());
autoEditorPane.getbuttonPane().setVisible(false);
@ -127,13 +128,12 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
// 左边的Panel,上面是选择DatabaseConnection的ComboBox,下面DatabaseConnection对应的Table
initconnectionTableProcedurePane();
this.setLayout(new BorderLayout(4, 4));
this.setLayout(FRGUIPaneFactory.createScaledBorderLayout(4, 4));
this.connectionTableProcedurePane.setMinimumSize(FineUIScale.scale(new Dimension(230, 400)));
this.connectionTableProcedurePane.setMaximumSize(FineUIScale.scale(new Dimension(500, 400)));
box.setMinimumSize(FineUIScale.scale(new Dimension(300, 400)));
// 使用SplitPane
JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, connectionTableProcedurePane, sqlSplitPane);
mainSplitPane.setBorder(new ScaledEmptyBorder(10, 10, 10, 10));
mainSplitPane.setOneTouchExpandable(true);
this.add(mainSplitPane, BorderLayout.CENTER);
}
@ -172,6 +172,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
toolBarDef.addShortCut(new RefreshAction());
toolBarDef.addShortCut(SeparatorDef.DEFAULT);
isShareCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Is_Share_DBTableData"));
isShareCheckBox.setBorder(new ScaledEmptyBorder(0, 6, 0,6));
maxPanel = new MaxMemRowCountPanel();
maxPanel.setBorder(null);
maxPanel.setBackground(null);

5
designer-base/src/main/java/com/fr/design/dialog/BasicPane.java

@ -1,6 +1,7 @@
package com.fr.design.dialog;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.common.annotations.Open;
import com.fr.design.constants.LayoutConstants;
@ -315,14 +316,14 @@ public abstract class BasicPane extends JPanel {
nameTextField = new UITextField();
Name = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Name"));
JPanel northPane = new JPanel(new BorderLayout());
northPane.setBorder(new ScaledEmptyBorder(0,10,0,10));
northPane.setBorder(new ScaledEmptyBorder(0,0,10,0));
northPane.add(row(
LayoutConstants.HGAP_LARGE,
cell(Name).weight(titleRatio),
cell(nameTextField).weight(0.7 - titleRatio),
cell(showfield = new UILabel(" ")).weight(0.3)
).getComponent());
showfield.setForeground(new Color(204, 0, 1));
FineUIStyle.setStyle(showfield, FineUIStyle.LABEL_WARNING_TIP);
showfield.setPreferredSize(new Dimension(FineUIScale.scale(220), showfield.getPreferredSize().height));
this.add(northPane, BorderLayout.NORTH);
this.centerPane = bPane;

25
designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxRenderer.java

@ -1,14 +1,10 @@
package com.fr.design.gui.icombobox;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import javax.swing.DefaultListCellRenderer;
import com.fr.design.constants.UIConstants;
import javax.swing.JList;
import javax.swing.JLabel;
import com.fine.theme.utils.FineUIScale;
/**
*
@ -23,19 +19,8 @@ public class UIComboBoxRenderer extends DefaultListCellRenderer {
super();
}
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
cellHasFocus = cellHasFocus && !this.isEnabled();
JLabel renderer =(JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
renderer.setOpaque(true);
list.setSelectionBackground(UIConstants.NORMAL_BLUE);
list.setSelectionForeground(Color.WHITE);
if (isSelected) {
renderer.setForeground(list.getSelectionForeground());
renderer.setBackground(list.getSelectionBackground());
} else {
renderer.setForeground(list.getForeground());
renderer.setBackground(list.getBackground());
}
return renderer;
@Override
public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, FineUIScale.scale(24));
}
}

35
designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java

@ -1,24 +1,23 @@
package com.fr.design.gui.icombocheckbox;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIScale;
import com.fr.base.BaseUtils;
import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.HoverAware;
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.gui.itextfield.UITextField;
import com.fr.design.icon.IconPathConstants;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.awt.BorderLayout;
@ -42,8 +41,12 @@ import java.util.Map;
* 支持全选半选
* 可以设置悬停颜色一页最多显示单选框个数
* 可以省略显示
*
* @author
* @since
* Created on
*/
public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNameObserver {
public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNameObserver, HoverAware {
//下拉框的值
private Object[] values;
//已经选中的值
@ -53,6 +56,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
private UICheckListPopup popup;
private UITextField editor;
private UIButton arrowButton;
private UILabel label;
//选中的值之间显示的分隔符
private String valueSperator;
private static final String DEFAULT_VALUE_SPERATOR = ",";
@ -121,8 +125,13 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
this.popup.addActionListener(new PopupAction());
this.editor = createEditor();
this.arrowButton = createArrowButton();
this.label = new UILabel(getIcon());
label.setPreferredSize(FineUIScale.scale(new Dimension(24, 24)));
setLayoutAndAddComponents();
setText();
addPopupListener(this);
}
/**
@ -155,12 +164,14 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
return arrowButton;
}
public UILabel getLabel() {
return label;
}
private UIButton createArrowButton() {
final UIButton arrowBtn = new UIButton();
arrowBtn.setNormalPainted(false);
arrowBtn.setPreferredSize(FineUIScale.scale(new Dimension(20, 5)));
arrowBtn.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, UIManager.getColor("defaultBorderColor")));
arrowBtn.setOpaque(true);
arrowBtn.setIcon(getIcon());
arrowBtn.setExtraPainted(false);
addPopupListener(arrowBtn);
@ -171,8 +182,6 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
private UITextField createEditor() {
UITextField editor = new TextField();
editor.setEditable(false);
editor.setPreferredSize(FineUIScale.scale(new Dimension(110, 20)));
editor.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 0, UIManager.getColor("defaultBorderColor")));
addPopupListener(editor);
return editor;
@ -213,6 +222,11 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
return popup.getSelectedValues();
}
@Override
public boolean isHovered() {
return true;
}
private class PopupAction implements ActionListener {
@Override
@ -229,7 +243,6 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
private void togglePopup() {
if (this.arrowButton.isEnabled()) {
popup.setBorder(new FineRoundBorder());
popup.setPreferredSize(new Dimension(FineUIScale.scale(this.getWidth()), (int) popup.getPreferredSize().getHeight()));
popup.show(this, 0, getHeight());
}
}
@ -352,7 +365,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
}
private Icon getIcon() {
return BaseUtils.readIcon(IconPathConstants.ARROW_ICON_PATH);
return new LazyIcon("down_arrow");
}
/**

7
designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java

@ -1,6 +1,7 @@
package com.fr.design.gui.ilist;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIScale;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.base.BaseUtils;
import com.fr.data.core.DataCoreUtils;
@ -26,6 +27,7 @@ import javax.swing.ListSelectionModel;
import javax.swing.SwingWorker;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.dnd.DnDConstants;
import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.DragGestureListener;
@ -261,6 +263,11 @@ public class TableViewList extends UIList {
return this;
}
@Override
public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, FineUIScale.scale(24));
}
}
/**

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

@ -1,5 +1,7 @@
package com.fr.design.gui.itable;
import com.fine.theme.light.ui.FineTableHeaderUI;
import javax.swing.JTable;
public class SortableJTable extends JTable{
@ -7,5 +9,6 @@ public class SortableJTable extends JTable{
super(tableModel);
tableModel.setTableHeader(getTableHeader());
setShowGrid(true);
getTableHeader().setUI(new FineTableHeaderUI());
}
}

4
designer-base/src/main/java/com/fr/design/gui/itable/TableSorter.java

@ -14,10 +14,10 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.swing.Icon;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.Icon;
import javax.swing.JTable;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;

14
designer-base/src/main/java/com/fr/design/gui/itableeditorpane/ParameterTableModel.java

@ -1,7 +1,7 @@
package com.fr.design.gui.itableeditorpane;
import com.fine.theme.light.ui.FineTableHeaderUI;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.base.Parameter;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
@ -14,7 +14,6 @@ import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor;
import java.awt.*;
import java.awt.event.ActionEvent;
@ -231,11 +230,10 @@ public class ParameterTableModel extends UITableModelAdapter<ParameterProvider>
}
private class ParameterValueRenderer extends DefaultTableCellRenderer {
private class ParameterValueRenderer extends FineTableHeaderUI.TableRenderer {
private static final long serialVersionUID = 1L;
private ValueEditorPane editor;
private UILabel disableLable;
public ParameterValueRenderer(int paraUseType) {
this(ValueEditorPaneFactory.createVallueEditorPaneWithUseType(paraUseType));
}
@ -243,15 +241,13 @@ public class ParameterTableModel extends UITableModelAdapter<ParameterProvider>
public ParameterValueRenderer(ValueEditorPane valueEditorPane) {
disableLable = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Paramete_Name"));
FineUIStyle.setStyle(disableLable, FineUIStyle.LABEL_WARNING_TIP);
disableLable.setHorizontalAlignment(SwingConstants.LEFT);
disableLable.setOpaque(true);
disableLable.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE));
disableLable.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor")));
disableLable.setHorizontalAlignment(SwingConstants.LEFT);
editor = valueEditorPane;
}
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
JComponent component = ((JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column));
if (table.isCellEditable(row, column)) {
if (value == null) {
editor.populate("");
@ -260,6 +256,8 @@ public class ParameterTableModel extends UITableModelAdapter<ParameterProvider>
}
return editor;
} else {
disableLable.setBorder(component.getBorder());
disableLable.setBackground(component.getBackground());
return disableLable;
}
}

113
designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java

@ -1,41 +1,27 @@
package com.fr.design.gui.itableeditorpane;
import com.fine.swing.ui.layout.Layouts;
import com.fine.swing.ui.layout.Row;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.light.ui.FineTableHeaderUI;
import com.fine.theme.light.ui.FineTableScrollBarPaneUI;
import com.fine.theme.utils.FineUIScale;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableCellRenderer;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;
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;
/**
* 表格编辑面板,一般是两列.- 用泛型实现用的时候请定义T.model里面的T要一样
*
@ -47,7 +33,7 @@ public class UITableEditorPane<T> extends BasicPane {
*
*/
private static final long serialVersionUID = 6855793816972735815L;
protected static JTable editTable;
protected JTable editTable;
// 放置action 的按钮.
protected UITableModelAdapter<T> tableModel;
private String leftLabelName;
@ -91,39 +77,12 @@ public class UITableEditorPane<T> extends BasicPane {
controlPane.add(buttonPane, BorderLayout.EAST);
controlPane.add(content == null ? l : content, BorderLayout.WEST);
pane.add(column(cell(controlPane), cell(buildScrollTablePane(scrollPane)).weight(1)).getComponent());
this.editTable.getTableHeader().setDefaultRenderer(new TableHeaderRenderer());
this.editTable.setDefaultRenderer(Object.class, new TableRenderer());
scrollPane.getVerticalScrollBar().setUI(new FineTableScrollBarPaneUI(editTable));
pane.add(Layouts.column(10, Layouts.cell(controlPane), Layouts.cell(scrollPane).weight(1)).getComponent());
this.editTable.getTableHeader().setUI(new FineTableHeaderUI());
this.editTable.setRowHeight(FineUIScale.scale(24));
}
/**
* 组合 jtable 和垂直滚动条
* @param scrollPane
* @return
*/
protected JPanel buildScrollTablePane(JScrollPane scrollPane) {
verticalScrollBar = column(
cell(new UILabel()).with(it -> {
it.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 1, UIManager.getColor("defaultBorderColor")));
it.setPreferredSize(new Dimension(scrollPane.getVerticalScrollBar().getWidth(), (int) editTable.getTableHeader().getPreferredSize().getHeight()));
}),
cell(scrollPane.getVerticalScrollBar()).weight(1).with(it -> {
it.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, UIManager.getColor("defaultBorderColor")));
})
).getComponent();
scrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() {
@Override
public void adjustmentValueChanged(AdjustmentEvent e) {
verticalScrollBar.setVisible(editTable.getHeight() > scrollPane.getViewport().getHeight());
verticalScrollBar.repaint();
}
});
return row(cell(scrollPane).weight(1), cell(verticalScrollBar)).getComponent();
}
public UITableModelAdapter<T> getTableModel() {
return tableModel;
}
@ -132,7 +91,7 @@ public class UITableEditorPane<T> extends BasicPane {
buttonPane = new JPanel();
if (action != null) {
buttonPane.setLayout(new GridLayout(1, action.length, 3, 3));
buttonPane.setLayout(new GridLayout(1, action.length, FineUIScale.scale(2), 0));
for (int i = 0; i < action.length; i++) {
final UIButton newButton = new UIButton(action[i]);
newButton.set4ToolbarButton();
@ -140,9 +99,9 @@ public class UITableEditorPane<T> extends BasicPane {
newButton.setText("");
newButton.setName(action[i].getName());
newButton.setToolTipText(action[i].getName());
newButton.setBorder(null);
newButton.setMargin(null);
newButton.setOpaque(false);
newButton.setPreferredSize(FineUIScale.scale(new Dimension(24, 24)));
buttonPane.add(newButton);
}
}
@ -211,7 +170,7 @@ public class UITableEditorPane<T> extends BasicPane {
/**
* @return jTable
*/
public static JTable getEditTable() {
public JTable getEditTable() {
return editTable;
}
@ -234,54 +193,4 @@ public class UITableEditorPane<T> extends BasicPane {
editTable.getTableHeader().setResizingAllowed(resizingAllowed);
}
/**
* 设置 TableHeader 文字左对齐
*/
public static class TableHeaderRenderer extends DefaultTableCellRenderer {
public TableHeaderRenderer() {
setHorizontalAlignment(SwingConstants.LEFT);
setPreferredSize(new Dimension(this.getWidth(), FineUIScale.scale(24)));
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if (column == table.getColumnCount() - 1) {
((JComponent) component).setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor")));
} else {
((JComponent) component).setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor")));
}
return component;
}
}
/**
* 设置 Table 表身格式
*/
public static class TableRenderer extends DefaultTableCellRenderer {
public TableRenderer() {
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if(component instanceof JLabel) {
String toolTipText = GeneralUtils.objectToString(value);
if (StringUtils.isNotEmpty(toolTipText)) {
((JLabel) component).setToolTipText(toolTipText);
}
}
if (column == table.getColumnCount() - 1) {
((JComponent) component).setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor")),
new ScaledEmptyBorder(0,4,0,0)));
} else {
((JComponent) component).setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor")),
new ScaledEmptyBorder(0,4,0,0)));
}
component.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE));
return component;
}
}
}

22
designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java

@ -1,5 +1,6 @@
package com.fr.design.layout;
import com.fine.theme.utils.FineUIScale;
import com.fr.design.border.UITitledBorder;
import com.fr.design.gui.ilable.UILabel;
import com.fr.stable.AssistUtils;
@ -114,6 +115,16 @@ public class FRGUIPaneFactory {
return new BorderLayout();
}
/**
* 创建一个适应 DPI 缩放的边框布局
* @param hgap 水平间距
* @param vgap 竖直间距
* @return JPanel对象
*/
public static LayoutManager createScaledBorderLayout(int hgap, int vgap) {
return new BorderLayout(FineUIScale.scale(hgap), FineUIScale.scale(vgap));
}
/**
* 创建一个边框布局间距4,4
*
@ -660,6 +671,17 @@ public class FRGUIPaneFactory {
return jp;
}
/**
* 创建包含水平垂直间距的边框面板S
*
* @return JPanel对象
*/
public static JPanel createScaledBorderLayout_S_Pane(int hgap, int vgap) {
JPanel jp = new JPanel();
jp.setLayout(FRGUIPaneFactory.createScaledBorderLayout(hgap, vgap));
return jp;
}
public static JPanel createBorderLayout_NO_Opaque_Pane() {
JPanel jp = new JPanel();
jp.setOpaque(false);

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

@ -72,7 +72,7 @@ public class CenterRegionContainerPane extends JPanel {
public CenterRegionContainerPane() {
toolbarPane = new JPanel();
toolbarPane.setBorder(new ScaledEmptyBorder(6, 0, 0, 0));
toolbarPane.setBorder(new ScaledEmptyBorder(10, 0, 0, 0));
toolbarPane.setLayout(FRGUIPaneFactory.createBorderLayout());
eastPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
largeToolbar = getToolBarMenuDock().createLargeToolbar();

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

@ -1 +1 @@
package com.fr.design.mainframe; import com.fr.design.constants.UIConstants; import com.fr.design.gui.iscrollbar.UIScrollBar; import javax.swing.*; import java.awt.*; import java.awt.geom.GeneralPath; import java.awt.geom.Path2D; /** * Author : daisy * Date: 13-9-11 * Time: 上午10:14 */ public class DottedLine extends JPanel { public static final int HEIGHT = 3; private static final int BLUE_WIDTH = 12;//蓝色线长度,白色线长度是其半 private int direction = UIScrollBar.HORIZONTAL; public DottedLine(int direction, int width) { //水平方向的虚线框 if (direction == UIScrollBar.HORIZONTAL) { this.setPreferredSize(new Dimension(width, HEIGHT)); } else { this.setPreferredSize(new Dimension(HEIGHT, width)); } this.direction = direction; this.setBackground(new Color(255, 255, 255));//设置白色背景 } public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; //如果是水平方向的 if (direction == UIScrollBar.HORIZONTAL) { paintHorizontal(g2d); } else { paintVertical(g2d); } } private void paintHorizontal(Graphics2D g2d) { int totalWidth = getWidth(); int paintX = 0; while (paintX < totalWidth) { int endX = paintX + BLUE_WIDTH; if (endX > totalWidth) { endX = totalWidth; } int[] x = new int[]{paintX, endX, endX, paintX, paintX}; int[] y = new int[]{0, 0, HEIGHT, HEIGHT, 0}; paintBlueArea(g2d, x, y); paintX += BLUE_WIDTH + BLUE_WIDTH / 2; } } private void paintVertical(Graphics2D g2d) { int totalHeight = getHeight(); int paintY = 0; while (paintY < totalHeight) { int endY = paintY + BLUE_WIDTH; if (endY > totalHeight) { endY = totalHeight; } int[] x = new int[]{0, HEIGHT, HEIGHT, 0, 0}; int[] y = new int[]{paintY, paintY, endY, endY, paintY}; paintBlueArea(g2d, x, y); paintY += BLUE_WIDTH + BLUE_WIDTH / 2; } } private void paintBlueArea(Graphics2D g2d, int[] x, int[] y) { g2d.setPaint(UIConstants.DOTTED_LINE_COLOR); GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length); generalPath.moveTo(x[0], y[0]); for (int index = 1; index < x.length; index++) { generalPath.lineTo(x[index], y[index]); } generalPath.closePath(); g2d.fill(generalPath); } }
package com.fr.design.mainframe; import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.design.constants.UIConstants; import com.fr.design.gui.iscrollbar.UIScrollBar; import javax.swing.*; import java.awt.*; import java.awt.geom.GeneralPath; import java.awt.geom.Path2D; /** * Author : daisy * Date: 13-9-11 * Time: 上午10:14 */ public class DottedLine extends JPanel { public static final int HEIGHT = 3; private static final int BLUE_WIDTH = 12;//蓝色线长度,白色线长度是其半 private int direction = UIScrollBar.HORIZONTAL; public DottedLine(int direction, int width) { //水平方向的虚线框 if (direction == UIScrollBar.HORIZONTAL) { this.setPreferredSize(new Dimension(width, HEIGHT)); } else { this.setPreferredSize(new Dimension(HEIGHT, width)); } this.direction = direction; this.setBackground(new Color(255, 255, 255));//设置白色背景 } public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; //如果是水平方向的 if (direction == UIScrollBar.HORIZONTAL) { paintHorizontal(g2d); } else { paintVertical(g2d); } } private void paintHorizontal(Graphics2D g2d) { int totalWidth = getWidth(); int paintX = 0; while (paintX < totalWidth) { int endX = paintX + BLUE_WIDTH; if (endX > totalWidth) { endX = totalWidth; } int[] x = new int[]{paintX, endX, endX, paintX, paintX}; int[] y = new int[]{0, 0, HEIGHT, HEIGHT, 0}; paintBlueArea(g2d, x, y); paintX += BLUE_WIDTH + BLUE_WIDTH / 2; } } private void paintVertical(Graphics2D g2d) { int totalHeight = getHeight(); int paintY = 0; while (paintY < totalHeight) { int endY = paintY + BLUE_WIDTH; if (endY > totalHeight) { endY = totalHeight; } int[] x = new int[]{0, HEIGHT, HEIGHT, 0, 0}; int[] y = new int[]{paintY, paintY, endY, endY, paintY}; paintBlueArea(g2d, x, y); paintY += BLUE_WIDTH + BLUE_WIDTH / 2; } } private void paintBlueArea(Graphics2D g2d, int[] x, int[] y) { g2d.setPaint(FlatUIUtils.getUIColor("DottedLine.defaultColor", new Color(37,118,239,1))); GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length); generalPath.moveTo(x[0], y[0]); for (int index = 1; index < x.length; index++) { generalPath.lineTo(x[index], y[index]); } generalPath.closePath(); g2d.fill(generalPath); } }

5
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/AbstractSupportSelectTablePane.java

@ -334,7 +334,11 @@ public abstract class AbstractSupportSelectTablePane<T extends TableEntity> exte
component.setForeground(tableHeader.getForeground());
component.setBackground(tableHeader.getBackground());
component.setFont(tableHeader.getFont());
if (column != 0) {
component.setBorder(UIManager.getBorder("TableHeader.cellBorder"));
} else {
component.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor")));
}
return component;
}
@ -366,6 +370,7 @@ public abstract class AbstractSupportSelectTablePane<T extends TableEntity> exte
setColumnClass(classes);
this.setDefaultEditor(Boolean.class, new BooleanEditor());
this.setDefaultRenderer(Boolean.class, new BooleanRenderer());
this.setDefaultRenderer(UILabel.class, new ToolTipTableCellRenderer());
this.createTable().getColumnModel().getColumn(0).setCellRenderer(new BooleanRenderer());
}

3
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java

@ -123,7 +123,7 @@ public class RecyclePane extends AbstractSupportSelectTablePane<VcsTableEntity>
searchTextField.setPlaceholder(Toolkit.i18nText("Fine-Design_Vcs_Start_Search"));
searchTextField.setColumns(COLUMNS_COUNT);
UILabel searchLabel = new UILabel(ICON_SEARCH);
searchLabel.setBorder(new ScaledEmptyBorder(0, 3, 0, 3));
searchLabel.setBorder(new ScaledEmptyBorder(0, 4, 0, 4));
searchTextField.setBorder(null);
leftPane = row(cell(searchLabel), cell(searchTextField).weight(1)).with(it -> {
it.setBorder(new FineRoundBorder());
@ -148,7 +148,6 @@ public class RecyclePane extends AbstractSupportSelectTablePane<VcsTableEntity>
}
tableTopPane.add(leftPane, BorderLayout.EAST);
tableTopPane.add(rightPane, BorderLayout.WEST);
tableTopPane.setBorder(new ScaledEmptyBorder(0, 0, 10, 0));
}

4
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/ToolTipTableCellRenderer.java

@ -1,11 +1,11 @@
package com.fr.design.mainframe.vcs.ui;
import com.fine.theme.light.ui.FineTableHeaderUI;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
import javax.swing.JTable;
import javax.swing.JLabel;
import javax.swing.table.DefaultTableCellRenderer;
import java.awt.*;
@ -16,7 +16,7 @@ import java.awt.*;
* @since 11.0
* Created on 2023/7/21
*/
public class ToolTipTableCellRenderer extends DefaultTableCellRenderer {
public class ToolTipTableCellRenderer extends FineTableHeaderUI.TableRenderer {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {

1
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java

@ -127,6 +127,7 @@ public class VcsNewPane extends RecyclePane {
this.operatorPane = createOperatorPane();
this.model.setDefaultEditor(VcsOperatorPane.class, new VcsCellEditor(createOperatorPane()));
this.model.setDefaultRenderer(VcsOperatorPane.class, new VcsCellRender(createOperatorPane()));
this.model.setDefaultRenderer(UILabel.class, new ToolTipTableCellRenderer());
}

2
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsOperatorPane.java

@ -46,7 +46,7 @@ public class VcsOperatorPane extends JPanel {
panel.add(value);
}
panel.setOpaque(false);
add(column(flex(), row(fix(4), cell(panel)), flex())
add(column(flex(), row(fix(6), cell(panel)), flex())
.with(it -> {
it.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor")));
it.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE));

1
designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java

@ -45,6 +45,7 @@ public abstract class AbstractSelectBox<T> extends AbstractPopBox implements Mou
// 初始化组件布局
JPanel displayPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
displayPane.setBorder(null);
displayPane.setOpaque(false);
displayPane.add(displayComponent, BorderLayout.CENTER);
displayComponent.setSize(new Dimension(preWidth, displayPane.getPreferredSize().height));
// 添加事件监听

19
designer-base/src/main/java/com/fr/design/style/FormatPane.java

@ -22,10 +22,10 @@ import com.fr.general.ComparatorUtils;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
@ -139,21 +139,24 @@ public class FormatPane extends BasicPane {
patternList.setCellRenderer(new DefaultListCellRenderer(){
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
setOpaque(false);
return this;
JLabel renderer = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
list.setSelectionBackground(UIManager.getColor("List.selectBackgroundColor"));
setOpaque(true);
if (isSelected) {
renderer.setBackground(list.getSelectionBackground());
} else {
renderer.setBackground(list.getBackground());
}
return renderer;
}
});
patternList.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE));
patternList.addListSelectionListener(patternListSelectionListener);
}
private JScrollPane initPatternScrollPanel() {
JScrollPane scrollPane = new JScrollPane(patternList);
patternList.setOpaque(false);
scrollPane.getViewport().setOpaque(false);
scrollPane.getVerticalScrollBar().setOpaque(false);
scrollPane.setBorder(new FineRoundBorder());
scrollPane.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE));
return scrollPane;
}

3
designer-base/src/main/java/com/fr/design/style/background/impl/ImageBackgroundPane.java

@ -1,6 +1,7 @@
package com.fr.design.style.background.impl;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.base.Style;
import com.fr.base.background.ImageBackground;
@ -66,7 +67,7 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
this.add(column(
5,
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))),
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))).with(it -> FineUIStyle.setStyle(it, FineUIStyle.LABEL_TIP)),
row(
10,
cell(new JScrollPane(previewPane)).with(it -> {

3
designer-base/src/main/java/com/fr/design/style/color/DetailColorSelectPane.java

@ -12,6 +12,7 @@ import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils;
import com.fr.design.gui.ilable.UILabel;
@ -79,7 +80,7 @@ public class DetailColorSelectPane extends BasicPane {
row(
20,
cell(colorSelectPane.transparentButton).weight(0.3),
cell(new UILabel("<html><font color=gray>" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview") + "</font></html>")).weight(0.53)
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))).weight(0.53).with(it -> FineUIStyle.setStyle(it, FineUIStyle.LABEL_TIP))
),
row(
20,

44
designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java

@ -3,6 +3,7 @@ package com.fr.design.write.submit;
import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.icon.LazyIcon;
import com.fine.swing.ui.layout.Spacer;
import com.fine.theme.light.ui.FineTableHeaderUI;
import com.fine.theme.utils.FineClientProperties;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIUtils;
@ -55,12 +56,15 @@ import com.fr.write.config.InsertConfig;
import com.fr.write.config.IntelliDMLConfig;
import com.fr.write.config.UpdateConfig;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.AbstractCellEditor;
import javax.swing.BorderFactory;
import javax.swing.DefaultCellEditor;
import javax.swing.DefaultComboBoxModel;
import javax.swing.Icon;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
@ -70,17 +74,14 @@ import javax.swing.JTree;
import javax.swing.ListSelectionModel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.plaf.UIResource;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
@ -172,9 +173,7 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
keyColumnValuesTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
keyColumnValuesTable.setPreferredScrollableViewportSize(FineUIScale.scale(new Dimension(280, 150)));
keyColumnValuesTable.setShowHorizontalLines(true);
DefaultTableCellRenderer headerRenderer = new DefaultTableCellRenderer();
headerRenderer.setHorizontalAlignment(SwingConstants.LEFT);
keyColumnValuesTable.getTableHeader().setDefaultRenderer(headerRenderer);
keyColumnValuesTable.getTableHeader().setUI(new FineTableHeaderUI());
northPane.add(column(10,
cell(FineUIUtils.wrapComponentWithTitle(typePane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Write_Submit_Type"))),
@ -700,7 +699,7 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
private void initJTableColumn() {
TableColumn column0 = this.keyColumnValuesTable.getColumnModel().getColumn(0);
column0.setMaxWidth(50);
column0.setCellRenderer(new ColumnNameTableCellRenderer());
column0.setCellRenderer(new BooleanRenderer());
TableColumn column1 = this.keyColumnValuesTable.getColumnModel().getColumn(1);
column1.setCellRenderer(new ColumnNameTableCellRenderer());
@ -1187,7 +1186,7 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
/*
* ColumnNameTableCellRenderer
*/
public static class ColumnNameTableCellRenderer extends DefaultTableCellRenderer {
public static class ColumnNameTableCellRenderer extends FineTableHeaderUI.TableRenderer {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
@ -1203,7 +1202,7 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
/*
* ColumnValueTableCellRenderer
*/
private static class ColumnValueTableCellRenderer extends DefaultTableCellRenderer {
private static class ColumnValueTableCellRenderer extends FineTableHeaderUI.TableRenderer {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
@ -1224,4 +1223,25 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
return this;
}
}
/**
* checkBox cellRender
*/
public static class BooleanRenderer extends UICheckBox implements TableCellRenderer, UIResource {
public BooleanRenderer() {
super();
setHorizontalAlignment(JLabel.CENTER);
setBorderPainted(true);
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
setSelected((value != null && ((Boolean) value).booleanValue()));
setUI(getUICheckBoxUI());
setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor")));
setBackground(Color.WHITE);
return this;
}
}
}

29
designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties

@ -427,9 +427,10 @@ HelpButton.innerFocusWidth = $?Button.innerFocusWidth
List.border = 0,0,0,0
List.cellMargins = 1,12,1,12
List.selectionInsets = 0,0,0,0
List.selectionArc = 0
List.selectionInsets = 0,4,0,4
List.selectionArc = 2
List.cellFocusColor = @cellFocusColor
List.selectionBackground = fade(#2576EF,12%)
List.cellNoFocusBorder = com.formdev.flatlaf.ui.FlatListCellBorder$Default
List.focusCellHighlightBorder = com.formdev.flatlaf.ui.FlatListCellBorder$Focused
List.focusSelectedCellHighlightBorder = com.formdev.flatlaf.ui.FlatListCellBorder$Selected
@ -742,8 +743,8 @@ GradientBar.recHeight=30
#---- Spinner ----
Spinner.border = com.formdev.flatlaf.ui.FlatRoundBorder
Spinner.background = @componentBackground
Spinner.buttonBackground = darken($Spinner.background,2%)
Spinner.background = $fill.normal
Spinner.buttonBackground = $fill.normal
Spinner.buttonSeparatorColor = $Component.borderColor
Spinner.buttonDisabledSeparatorColor = $Component.disabledBorderColor
Spinner.buttonArrowColor = @buttonArrowColor
@ -898,7 +899,7 @@ Table.scrollPaneBorder = com.formdev.flatlaf.ui.FlatBorder
Table.ascendingSortIcon = com.formdev.flatlaf.icons.FlatAscendingSortIcon
Table.descendingSortIcon = com.formdev.flatlaf.icons.FlatDescendingSortIcon
Table.sortIconColor = @icon
Table.cellMargins = 2,3,2,3
Table.cellMargins = 2,6,2,3
Table.cellFocusColor = @cellFocusColor
Table.cellNoFocusBorder = com.formdev.flatlaf.ui.FlatTableCellBorder$Default
Table.focusCellHighlightBorder = com.formdev.flatlaf.ui.FlatTableCellBorder$Focused
@ -913,13 +914,14 @@ Table.dropCellForeground = @dropCellForeground
Table.dropLineColor = @dropLineColor
Table.dropLineShortColor = @dropLineShortColor
Table.gridColor = darken($Table.background,8%)
Table.default.background = $default.background
#---- TableHeader ----
TableHeader.height = 25
TableHeader.cellBorder = com.formdev.flatlaf.ui.FlatTableHeaderBorder
TableHeader.cellMargins = 2,3,2,3
TableHeader.cellMargins = 2,6,2,3
TableHeader.focusCellBackground = $TableHeader.background
TableHeader.background = @componentBackground
TableHeader.showTrailingVerticalLine = false
@ -1148,6 +1150,10 @@ Tree.icon.closedColor = @icon
Tree.icon.openColor = @icon
Tree.hash = darken($Tree.background,10%)
# ---- DottedLine ----
DottedLine.defaultColor=@BrandColor
#---- West ----
West.border = $defaultBorderColor
#---- ExpandablePane ----
@ -1362,3 +1368,14 @@ chart.selectedBorderColor = #2576EF
hoverBackground: #E6E9EF; \
pressedBackground: #DADEE7; \
selectedBackground: null
[style]Table.defaultTable = \
background: $Table.default.background
[style]Button.whiteButton = \
border: com.fine.theme.light.ui.FineRoundBorder; \
background: $fill.normal
[style]Button.originalButton = \
border: 4,4,4,4; \
background: null;

111
designer-base/src/test/java/com/fr/design/gui/storybook/components/TableStoryBoard.java

@ -0,0 +1,111 @@
package com.fr.design.gui.storybook.components;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.light.ui.FineTableHeaderUI;
import com.fine.theme.light.ui.FineTableScrollBarPaneUI;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.storybook.StoryBoard;
import javax.swing.BorderFactory;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.UIManager;
import javax.swing.plaf.UIResource;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column;
public class TableStoryBoard extends StoryBoard {
public TableStoryBoard() {
super("表格");
DefaultTableModel model1 = new DefaultTableModel(new Object[][] {
{"1", "Alice", "Female", "Engineering"},
{"2", "Bob", "Male", "Marketing"},
{"3", "Carol", "Female", "Design"},
{"4", "Dave", "Male", "Finance"},
{"4", "Dave", "Male", "Finance"},
{"4", "Dave", "Male", "Finance"},
{"4", "Dave", "Male", "Finance"},
{"4", "Dave", "Male", "Finance"},
{"4", "Dave", "Male", "Finance"},
{"4", "Dave", "Male", "Finance"},
{"4", "Dave", "Male", "Finance"},
{"4", "Dave", "Male", "Finance"},
{"4", "Dave", "Male", "Finance"},
{"4", "Dave", "Male", "Finance"},
{"4", "Dave", "Male", "Finance"},
{"4", "Dave", "Male", "Finance"},
{"4", "Dave", "Male", "Finance"},
{"4", "Dave", "Male", "Finance"},
{"4", "Dave", "Male", "Finance"},
{"4", "Dave", "Male", "Finance"},
{"4", "Dave", "Male", "Finance"},
{"4", "Dave", "Male", "Finance"}
}, new String[] {"ID", "Name", "Gender", "Department"});
JTable table1 = new JTable(model1);
table1.getTableHeader().setUI(new FineTableHeaderUI());
DefaultTableModel model2 = new DefaultTableModel(new Object[][] {
{"1", "Alice", "Female", "Engineering"},
{"2", "Bob", "Male", "Marketing"},
{"3", "Carol", "Female", "Design"},
{"4", "Dave", "Male", "Finance"}
}, new String[] {"ID", "Name", "Gender", "Department"});
JTable table2 = new JTable(model2);
table2.getTableHeader().setUI(new FineTableHeaderUI());
DefaultTableModel model3 = new DefaultTableModel(new Object[][] {
{false, "1", "Alice", "Female", "Engineering"},
{false, "2", "Bob", "Male", "Marketing"},
{false, "3", "Carol", "Female", "Design"},
{false, "4", "Dave", "Male", "Finance"}
}, new String[] {"选中", "ID", "Name", "Gender", "Department"}) {
private static final long serialVersionUID = 1L;
Class<?>[] types = new Class<?>[]{Boolean.class, UILabel.class, UILabel.class, UILabel.class, UILabel.class};
public Class<?> getColumnClass(int columnIndex) {
return types[columnIndex];
}
};
JTable table3 = new JTable(model3);
table3.getTableHeader().setUI(new FineTableHeaderUI());
table3.getTableHeader().getColumnModel().getColumn(0).setCellRenderer(new BooleanRenderer());
add(column(20, cell(new UIScrollPane(table1)).with(this::setFixSize).with(it -> it.getVerticalScrollBar().setUI(new FineTableScrollBarPaneUI(table1))),
cell(new UIScrollPane(table2)).with(this::setFixSize),
cell(new UIScrollPane(table3)).with(this::setFixSize)).getComponent());
}
private void setFixSize(JComponent component) {
component.setPreferredSize(new Dimension(component.getWidth(), 150));
component.setBorder(new FineRoundBorder());
}
public static class BooleanRenderer extends JCheckBox implements TableCellRenderer, UIResource {
public BooleanRenderer() {
super();
setHorizontalAlignment(JLabel.CENTER);
setOpaque(false);
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
setSelected((value != null && ((Boolean) value).booleanValue()));
setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor")));
setBackground(Color.WHITE);
return this;
}
}
}

2
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java

@ -159,7 +159,7 @@ public class ITReplaceNorthPanel {
public ITReplaceNorthPanel() {
cardLayout = new CardLayout();
cardPanel = new JPanel(cardLayout);
cardPanel.setBorder(new ScaledEmptyBorder(20, 20, 20, 20));
cardPanel.setBorder(new ScaledEmptyBorder(20, 20, 10, 20));
upContentPanel = new JPanel(null);
upSettingPanel = new JPanel(null);

1
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java

@ -3,7 +3,6 @@ package com.fr.design.actions.replace.ui;
import javax.swing.BorderFactory;
import javax.swing.RowSorter;
import javax.swing.table.TableRowSorter;
import java.awt.Color;
/**
* 下面板

13
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java

@ -1,17 +1,8 @@
package com.fr.design.actions.replace.ui;
import com.fine.theme.icon.LazyIcon;
import com.fr.base.TRL;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.file.FILE;
import com.fr.file.FILEFactory;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
import javax.swing.AbstractCellEditor;
@ -21,10 +12,6 @@ import javax.swing.UIManager;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import static com.fr.design.actions.replace.ui.ITTableEditorPane.getEditTable;
/**
* 放进表格中的定位按钮

1
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java

@ -60,7 +60,6 @@ public class ITTableEditor extends UITableModelAdapter {
});
this.setDefaultRenderer(UILabel.class, new UITableEditorPane.TableRenderer());
this.setDefaultEditor(ITTableButton.class, new ITTableButton());
this.setDefaultRenderer(ITTableButton.class, new ITTableButton());
this.setDefaultEditor(Boolean.class, new ITBooleanEditor());

30
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java

@ -1,21 +1,25 @@
package com.fr.design.actions.replace.ui;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineTableHeaderUI;
import com.fine.theme.light.ui.FineTableScrollBarPaneUI;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.base.TRL;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.dialog.BasicPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itableeditorpane.UITableEditAction;
import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.gui.itableeditorpane.UITableModelAdapter;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.share.ui.base.MouseClickListener;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
import sun.swing.DefaultLookup;
import javax.swing.BorderFactory;
@ -28,10 +32,8 @@ import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellRenderer;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.List;
@ -47,13 +49,15 @@ import static com.fine.swing.ui.layout.Layouts.cell;
* @since
* Created On
*/
public class ITTableEditorPane<T> extends UITableEditorPane<T> {
public class ITTableEditorPane<T> extends BasicPane {
public static JTable editTable;
private UITableModelAdapter<T> tableModel;
private String leftLabelName;
private JPanel buttonPane;
public ITTableEditorPane(UITableModelAdapter<T> model) {
super(model);
this.tableModel = model;
this.initComponent(model.createAction());
}
@ -65,6 +69,7 @@ public class ITTableEditorPane<T> extends UITableEditorPane<T> {
public void initComponent(UITableEditAction[] action) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
editTable = tableModel.createTable();
FineUIStyle.setStyle(editTable, FineUIStyle.DEFAULT_TABLE);
editTable.addMouseListener(new MouseClickListener() {
@Override
public void mouseClicked(MouseEvent e) {
@ -88,9 +93,10 @@ public class ITTableEditorPane<T> extends UITableEditorPane<T> {
}
});
UIScrollPane scrollPane = new UIScrollPane(editTable);
add(cell(buildScrollTablePane(scrollPane)).weight(1).getComponent());
UIScrollPane scrollPane = new UIScrollPane(editTable);
scrollPane.getVerticalScrollBar().setUI(new FineTableScrollBarPaneUI(editTable));
add(cell(scrollPane).weight(1).getComponent());
}
/**
@ -136,7 +142,7 @@ public class ITTableEditorPane<T> extends UITableEditorPane<T> {
/**
* 表头渲染
*/
public static class ITHeaderRenderer implements TableCellRenderer {
public static class ITHeaderRenderer extends FineTableHeaderUI.TableHeaderRenderer {
JTableHeader tableHeader;
final UICheckBox selectBox;
private boolean ascSort = true;
@ -221,8 +227,8 @@ public class ITTableEditorPane<T> extends UITableEditorPane<T> {
component.setForeground(tableHeader.getForeground());
component.setBackground(tableHeader.getBackground());
component.setFont(tableHeader.getFont());
if (column == table.getColumnCount() - 1) {
component.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor")));
if (column != ITReplaceSouthPanel.CHECKBOX_INDEX) {
component.setBorder(DefaultLookup.getBorder(this, this.ui, "TableHeader.cellBorder"));
} else {
component.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor")));
}
@ -239,7 +245,7 @@ public class ITTableEditorPane<T> extends UITableEditorPane<T> {
* @param table
*/
public static void makeFace(JTable table) {
table.getTableHeader().setBackground(FlatUIUtils.getUIColor("TableHeader.background", Color.WHITE));
table.getTableHeader().setUI(new FineTableHeaderUI());
table.getTableHeader().setDefaultRenderer(new ITHeaderRenderer(table));
}

7
designer-realize/src/main/java/com/fr/design/cell/smartaction/SmartJTablePane.java

@ -3,6 +3,8 @@ package com.fr.design.cell.smartaction;
import java.awt.BorderLayout;
import java.awt.Window;
import com.fine.theme.light.ui.FineTableHeaderUI;
import com.fine.theme.light.ui.FineTableScrollBarPaneUI;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JScrollPane;
@ -60,6 +62,7 @@ public abstract class SmartJTablePane extends BasicPane {
// BasicPane的center放JTable
table = new JTable(model);
this.add(scrollPane = new JScrollPane(table), BorderLayout.CENTER);
scrollPane.getVerticalScrollBar().setUI(new FineTableScrollBarPaneUI(table));
// 鼠标切换选中项时,editingRowIndex也要跟着变
table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@ -73,9 +76,7 @@ public abstract class SmartJTablePane extends BasicPane {
}
}
});
DefaultTableCellRenderer headerRenderer = new DefaultTableCellRenderer();
headerRenderer.setHorizontalAlignment(SwingConstants.LEFT);
table.getTableHeader().setDefaultRenderer(headerRenderer);
table.getTableHeader().setUI(new FineTableHeaderUI());
setCellRenderer();
actionReportPane.addSelectionChangeListener(gridSelectionChangeL);

3
designer-realize/src/main/java/com/fr/design/condition/ForeGroundPane.java

@ -13,6 +13,8 @@ import java.awt.*;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX;
import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE;
/**
* @author richie
@ -34,6 +36,7 @@ public class ForeGroundPane extends ConditionAttrSingleConditionPane<HighlightAc
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Current_Cell"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Current_Row"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Current_Column") });
this.foreScopeComboBox.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX);
this.foregroundColorPane.setSelectObject(Color.black);
this.setLayout(new BorderLayout());

3
designer-realize/src/main/java/com/fr/design/condition/PaddingPane.java

@ -23,6 +23,8 @@ import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.flex;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX;
import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE;
/**
* @author richie
@ -49,6 +51,7 @@ public class PaddingPane extends ConditionAttrSingleConditionPane<HighlightActio
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Current_Cell"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Current_Row"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Current_Column") });
this.paddingScopeComboBox.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX);
this.paddingLeftSpinner.setValue(new Integer(0));
this.paddingRightSpinner.setValue(new Integer(0));
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {

3
designer-realize/src/main/java/com/fr/design/condition/PagePane.java

@ -11,6 +11,8 @@ import java.awt.BorderLayout;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX;
import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE;
/**
* @author richie
@ -30,6 +32,7 @@ public class PagePane extends ConditionAttrSingleConditionPane<HighlightAction>
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cell_Write_Page_Before_Row"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cell_Write_Page_After_Column"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cell_Write_Page_Before_Column") });
this.pageComboBox.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX);
this.pageComboBox.setSelectedIndex(0);
this.setLayout(new BorderLayout());

25
designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterEditPane.java

@ -5,9 +5,9 @@ package com.fr.design.headerfooter;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper;
import com.fr.base.PaperSize;
import com.fr.base.ScreenResolution;
@ -29,7 +29,6 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.BackgroundPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Background;
import com.fr.page.ReportSettingsProvider;
import com.fr.report.core.ReportHF;
@ -40,10 +39,8 @@ import com.fr.stable.unit.INCH;
import com.fr.stable.unit.MM;
import com.fr.stable.unit.UNIT;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JToolBar;
import javax.swing.JViewport;
import javax.swing.Scrollable;
import javax.swing.SwingConstants;
@ -67,6 +64,7 @@ import java.awt.geom.Rectangle2D;
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.fix;
import static com.fine.swing.ui.layout.Layouts.row;
/**
@ -133,36 +131,33 @@ public class HeaderFooterEditPane extends JPanel {
private void addCenterPanel() {
JPanel controlContentPane = row(
2,
4,
cell(createContainerSection(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_HF_Left_Section") + ":", leftHFContainer)).weight(0.1),
cell(createContainerSection(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_HF_Center_Section") + ":", centerHFContainer)).weight(0.1),
cell(createContainerSection(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_HF_Right_Section") + ":", rightHFContainer)).weight(0.1)
).getComponent();
initToolbar();
JPanel centerPane =
column(
10,
cell(createToolbar()),
cell(iconToolPanel),
cell(controlContentPane).weight(0.3),
column(
2,
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))).weight(0.1),
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))).weight(0.1).with(it -> FineUIStyle.setStyle(it, FineUIStyle.LABEL_TIP)),
cell(scrollPreviewPane).weight(1.2).with(it -> it.setBorder(new FineRoundBorder()))
).weight(0.75)
).with(it -> it.setBorder(new ScaledEmptyBorder(0,10,0,0))).getComponent();
this.add(centerPane, BorderLayout.CENTER);
}
private JToolBar createToolbar() {
private void initToolbar() {
//toolbar.
JToolBar toolbar = new JToolBar();
toolbar.setFloatable(false);
printBackgroundCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportGUI_Print_Background"));
headerUnitFieldPane = new AdjustHeightPane();
footerUnitFieldPane = new AdjustHeightPane();
headFootUnitFieldPane = new AdjustHeightPane();
initIconToolPanel();
toolbar.add(iconToolPanel);
return toolbar;
}
private UIButton initCustomBackgroundButton() {
@ -191,7 +186,7 @@ public class HeaderFooterEditPane extends JPanel {
private void initIconToolPanel() {
iconToolPanel = row(
6,
2,
cell(this.createHFInsertButton(new TextHFElement())),
cell(this.createHFInsertButton(new FormulaHFElement())),
cell(this.createHFInsertButton(new PageNumberHFElement())),
@ -201,11 +196,13 @@ public class HeaderFooterEditPane extends JPanel {
cell(this.createHFInsertButton(new ImageHFElement())),
cell(this.createHFInsertButton(new NewLineHFElement())),
cell(initCustomBackgroundButton()),
fix(6),
cell(printBackgroundCheckBox),
fix(6),
row(
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Height") + ":")),
cell(headFootUnitFieldPane)
).with(it -> it.setBorder(new ScaledEmptyBorder(2,0,2,0)))
)
).getComponent();
}

11
designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterPane.java

@ -59,7 +59,7 @@ public abstract class HeaderFooterPane extends BasicPane {
reportHFYypeList
.addListSelectionListener(reportHFTypeSelectionListener);
reportHFYypeList.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE));
reportHFYypeList.setBorder(BorderFactory.createCompoundBorder(new FineRoundBorder(), new ScaledEmptyBorder(4, 4, 4, 4)));
reportHFYypeList.setBorder(BorderFactory.createCompoundBorder(new FineRoundBorder(), new ScaledEmptyBorder(6, 2, 6, 2)));
JScrollPane hfTypeListScrollPane = new JScrollPane(reportHFYypeList);
leftPane.add(hfTypeListScrollPane, BorderLayout.CENTER);
@ -75,10 +75,10 @@ public abstract class HeaderFooterPane extends BasicPane {
.addElement(new Integer(ReportConstants.REPORTPAGE_EVEN));
// CenterPane.
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel centerPane = FRGUIPaneFactory.createScaledBorderLayout_S_Pane(0, 10);
this.add(centerPane, BorderLayout.CENTER);
JPanel definePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
JPanel definePane = new JPanel(new BorderLayout());
centerPane.add(definePane, BorderLayout.NORTH);
defineCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_HF_Whether_To_Define_The_Selected_Type"), true); //是否定义选中的类型
@ -229,11 +229,6 @@ public abstract class HeaderFooterPane extends BasicPane {
return this;
}
@Override
public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, FineUIScale.scale(24));
}
};

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

@ -3,6 +3,7 @@ package com.fr.design.report;
import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.theme.ReportTheme;
import com.fr.base.theme.TemplateTheme;
@ -34,9 +35,6 @@ 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;
@ -50,16 +48,9 @@ public class NewReportBackgroundPane extends BasicPane {
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(column(10, cell(profilePane).weight(1), cell(createBottomPane())).getComponent());
add(Layouts.column(10, Layouts.cell(profilePane).weight(1), Layouts.row(10, Layouts.cell(isPrintBackgroundCheckBox), Layouts.cell(isExportBackgroundCheckBox))).getComponent());
}
private JPanel createBottomPane() {
JPanel container = new JPanel();
container.setPreferredSize(new Dimension(container.getPreferredSize().width, FineUIScale.scale(30)));
container.add(isExportBackgroundCheckBox);
container.add(isPrintBackgroundCheckBox);
return container;
}
@Override
protected String title4PopupWindow() {
@ -143,9 +134,9 @@ public class NewReportBackgroundPane extends BasicPane {
}
});
JPanel contentContainer = column(
JPanel contentContainer = Layouts.column(
10,
Layouts.row(10, cell(createLeftPane()).weight(1), cell(createRightPane())).weight(1)
Layouts.row(10, Layouts.cell(createLeftPane()).weight(1), Layouts.cell(createRightPane())).weight(1)
).getComponent();
contentContainer.setPreferredSize(FineUIScale.scale(new Dimension(600, 540)));
@ -169,10 +160,10 @@ public class NewReportBackgroundPane extends BasicPane {
JPanel panel = new JPanel(new BorderLayout());
panel.add(previewPane, BorderLayout.CENTER);
return column(
return Layouts.column(
10,
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Preview"))),
cell(panel).weight(1).with(it -> it.setBorder(new FineRoundBorder()))
Layouts.cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Preview"))).with(it -> FineUIStyle.setStyle(it, FineUIStyle.LABEL_TIP)),
Layouts.cell(panel).weight(1).with(it -> it.setBorder(new FineRoundBorder()))
).getComponent();
}

23
designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java

@ -1,10 +1,10 @@
package com.fr.design.report;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.GraphHelper;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.border.UITitledBorder;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIRadioButton;
@ -25,7 +25,6 @@ import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SpinnerNumberModel;
import javax.swing.SwingConstants;
@ -36,7 +35,6 @@ import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -127,7 +125,6 @@ public class ReportColumnsPane extends BasicPane{
buttonGroupPane.add(onOffButtonGroup);
north.add(buttonGroupPane, BorderLayout.EAST);
this.setBorder(new ScaledEmptyBorder(10, 10, 10, 10));
JPanel northV2 = column(
20,
row(
@ -229,12 +226,12 @@ public class ReportColumnsPane extends BasicPane{
colButton.addActionListener(colChangeListener);
return row(
row(
3,
4,
column(cell(rowButton)),
cell(new UILabel(IOUtils.readIcon("/com/fr/design/images/reportcolumns/" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Row_Icon_File_Name"))))
).weight(0.2),
row(
3,
4,
column(cell(colButton)),
cell(new UILabel(IOUtils.readIcon("/com/fr/design/images/reportcolumns/" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Col_Icon_File_Name"))))
).weight(0.3)
@ -288,14 +285,14 @@ public class ReportColumnsPane extends BasicPane{
toUILabel = new UILabel(COLUMN_ROW_TEXTS[1 - rowOrColumn]);
return row(
row(
3,
4,
cell(maxRadioButton),
cell(maxNumberSpinner),
cell(maxUILabel),
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Report_Columns_Columns_Optional")))
).weight(0.2),
row(
3,
4,
cell(toXRadioButton),
cell(toXSpinner),
cell(toUILabel)
@ -334,23 +331,25 @@ public class ReportColumnsPane extends BasicPane{
*/
private JPanel createRowPane() {
repeatColDataTextField = new UITextField();
copyLabel = new UILabel(REPORT_COLUMN_RAPEAT[rowOrColumn] + ":");
copyLabel = new UILabel(REPORT_COLUMN_RAPEAT[rowOrColumn]);
copyTitleTextField = new UITextField();
JPanel colPane = column(
10,
row(
10,
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Column_Data") + ":")).weight(0.12),
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Column_Data"))).weight(0.12),
cell(repeatColDataTextField).weight(0.33),
cell(new UILabel("<html><font color=gray>" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format") + ": A2:D5 " + "</font></html>")).weight(0.2),
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format") + ": A2:D5 ")).weight(0.2)
.with(it -> FineUIStyle.setStyle(it, FineUIStyle.LABEL_TIP)),
flex(0.35)
),
row(
10,
cell(copyLabel).weight(0.12),
cell(copyTitleTextField).weight(0.33),
cell(new UILabel("<html><font color=gray>" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format") + ": 1,2-3,5,18" + "</font></html>")).weight(0.2),
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format") + ": 1,2-3,5,18")).weight(0.2)
.with(it -> FineUIStyle.setStyle(it, FineUIStyle.LABEL_TIP)),
flex(0.35)
)
).getComponent();

42
designer-realize/src/main/java/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java

@ -1,11 +1,11 @@
package com.fr.design.report.freeze;
import com.fine.theme.utils.FineUIStyle;
import com.fr.base.FRContext;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.extra.WebViewDlgHelper;
import com.fr.design.gui.frpane.FineTabbedPane;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.UILabel;
@ -27,7 +27,6 @@ import java.awt.event.ActionListener;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.fix;
import static com.fine.swing.ui.layout.Layouts.flex;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle;
@ -94,7 +93,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
repeatTitleRowPane = new RepeatRowPane();
return row(
2,
4,
cell(useRepeatTitleRCheckBox),
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Title_Start_Row_Form"))),
cell(repeatTitleRowPane),
@ -111,7 +110,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
repeatTitleColPane = new RepeatColPane();
return row(
2,
4,
cell(useRepeatTitleCCheckBox),
cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Title_Start_Column_Form"))),
cell(repeatTitleColPane),
@ -121,7 +120,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
private JPanel initPageRepeatPane() {
return row(
10,
20,
column(
10,
cell(new UILabel(REPEAT_AND_FROZEN_HEAD)).weight(0.5),
@ -138,7 +137,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
private JPanel initPageRepeatFootPane() {
return row(
10,
20,
column(
10,
cell(new UILabel(REPEAT_AND_FROZEN_FOOT)).weight(0.5),
@ -161,7 +160,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
repeatFinisRowPane = new RepeatRowPane();
return row(
2,
4,
cell(useRepeatFinisRCheckBox),
cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Finis_Start_Row_Form"))),
cell(repeatFinisRowPane),
@ -178,7 +177,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
repeatFinisColPane = new RepeatColPane();
return row(
2,
4,
cell(useRepeatFinisCCheckBox),
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Finis_Start_Column_Form"))),
cell(repeatFinisColPane),
@ -208,7 +207,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
usePageHeadFrozenCCheckBox = new UICheckBox();
return row(
10,
20,
column(
10,
cell(new UILabel(REPEAT_AND_FROZEN_HEAD)).weight(0.5),
@ -217,12 +216,12 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
column(
10,
row(
2,
4,
cell(usePageHeadFrozenRCheckBox),
cell(freezePageRowPane)
).weight(0.5),
row(
2,
4,
cell(usePageHeadFrozenCCheckBox),
cell(freezePageColPane)
).weight(0.5)
@ -239,7 +238,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
freezeFootColPane = new FreezePagePane(false, true);
return row(
10,
20,
column(
10,
cell(new UILabel(REPEAT_AND_FROZEN_FOOT)).weight(0.5),
@ -248,12 +247,12 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
column(
10,
row(
2,
4,
cell(usePageFootFrozenRCheckBox),
cell(freezeFootRowPane)
).weight(0.5),
row(
2,
4,
cell(usePageFootFrozenCCheckBox),
cell(freezeFootColPane)
).weight(0.5)
@ -287,7 +286,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
freezeWriteColPane = new FreezeWriteColPane();
return row(
10,
20,
column(
10,
cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Face_Write_Frozen"))).weight(0.5),
@ -296,12 +295,12 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
column(
10,
row(
2,
4,
cell(useWriteFrozenRCheckBox),
cell(freezeWriteRowPane)
).weight(0.5),
row(
2,
4,
cell(useWriteFrozenCCheckBox),
cell(freezeWriteColPane)
).weight(0.5)
@ -325,15 +324,12 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
).getComponent();
JPanel pagePanel = column(
10,
fix(10),
20,
cell(wrapComponentWithTitle(outrepeatPanel, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Repeat"))),
cell(wrapComponentWithTitle(outfreezePanel, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Frozen"))),
cell(new UILabel("<html><font color=gray>"+ Toolkit.i18nText("Fine-Design_Report_Engine_Freeze_Tip") + "</font></html>"))
cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Engine_Freeze_Tip"))).with(it -> FineUIStyle.setStyle(it, FineUIStyle.LABEL_TIP))
).getComponent();
// 重复打印部分
// 重复打印标题的起始行
JPanel labelPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
labelPanel.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Select_the_repeated_row_and_column") + ":"));
UILabel warning = new UILabel("(" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_FreezeWarning") + ")");
@ -342,8 +338,6 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
JPanel writeOutrepeatPanel = initWriteFrozenPane();
JPanel writePanel = column(
10,
fix(10),
cell(wrapComponentWithTitle(writeOutrepeatPanel, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Frozen")))
).getComponent();
addWriteFrozen(writePanel, pagePanel);

8
designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java

@ -1,6 +1,7 @@
package com.fr.design.write.submit;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineTableHeaderUI;
import com.fr.cache.list.IntList;
import com.fr.data.ClassSubmitJob;
import com.fr.design.actions.UpdateAction;
@ -40,7 +41,6 @@ import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableColumn;
import java.awt.BorderLayout;
import java.awt.Component;
@ -355,7 +355,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane {
column0.setMaxWidth(LEFT_COLUMN_MAX_WIDTH);
ColumnNameTableCellRenderer cellRenderer = new ColumnNameTableCellRenderer();
cellRenderer.setHorizontalAlignment(SwingConstants.LEFT);
column0.setCellRenderer(cellRenderer);
column0.setCellRenderer(new BooleanRenderer());
/*
* 设置Column 1的Renderer
*/
@ -554,7 +554,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane {
/*
* ColumnValueTableCellRenderer
*/
private class SelectedColumnValueTableCellRenderer extends DefaultTableCellRenderer {
private class SelectedColumnValueTableCellRenderer extends FineTableHeaderUI.TableRenderer {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
@ -577,7 +577,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane {
}
}
private class ColumnRowGroupCellRenderer2 extends DefaultTableCellRenderer {
private class ColumnRowGroupCellRenderer2 extends FineTableHeaderUI.TableRenderer {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);

Loading…
Cancel
Save