Browse Source

Pull request #13506: REPORT-111995 【UI翻新】翻新数据集面板;补充图标

Merge in DESIGN/design from ~LEVY.XIE/design:newui to newui

* commit 'fbc5dc08da163f289e3e6abe8b47eafeb2d8ae77':
  REPORT-111995 【UI翻新】翻新数据集面板;补充图标
newui
Levy.Xie-解安森 11 months ago
parent
commit
74b6f6611c
  1. 3
      designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java
  2. 1
      designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java
  3. 12
      designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java
  4. 37
      designer-base/src/main/java/com/fr/design/border/FineBorderFactory.java
  5. 70
      designer-base/src/main/java/com/fr/design/data/datapane/connect/AdvancePane.java
  6. 2
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionManagerPane.java
  7. 104
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java
  8. 111
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java
  9. 280
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  10. 185
      designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java
  11. 120
      designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java
  12. 5
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  13. 9
      designer-base/src/main/java/com/fr/design/gui/controlpane/JControlPane.java
  14. 29
      designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java
  15. 6
      designer-base/src/main/java/com/fr/design/gui/ilable/ActionLabel.java
  16. 2
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java
  17. 5
      designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java
  18. 3
      designer-base/src/main/resources/com/fine/theme/icon/expand/forbid.svg
  19. 3
      designer-base/src/main/resources/com/fine/theme/icon/expand/forbid_disable.svg
  20. 6
      designer-base/src/main/resources/com/fine/theme/icon/expand/horizontal.svg
  21. 6
      designer-base/src/main/resources/com/fine/theme/icon/expand/horizontal_disable.svg
  22. 6
      designer-base/src/main/resources/com/fine/theme/icon/expand/vertical.svg
  23. 6
      designer-base/src/main/resources/com/fine/theme/icon/expand/vertical_disable.svg
  24. 16
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties
  25. 7
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java

3
designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java

@ -194,6 +194,9 @@ public class FineLightIconSet extends AbstractIconSet {
//东区面板
new SvgIconSource("cellelement_small", "com/fine/theme/icon/cellelement.svg"),
new SvgIconSource("forbid", "com/fine/theme/icon/expand/forbid.svg"),
new SvgIconSource("horizontal_expand", "com/fine/theme/icon/expand/horizontal.svg"),
new SvgIconSource("vertical_expand", "com/fine/theme/icon/expand/vertical.svg"),
// 三角
new SvgIconSource("triangle_down", "com/fine/theme/icon/triangle/triangle_down.svg"),

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

@ -27,6 +27,7 @@ public interface FineUIStyle {
String TOP_TOOLS = "topTools";
String BRAND_COLOR_LABEL = "brandColorLabel";
String BUTTON_TAB_ACTION = "tabAction";
String LABEL_BOLD = "boldLabel";
String MENU_TOOL_BAR = "menuToolBar";
String MENU_ITEM_TOOL_BAR = "menuItemToolBar";

12
designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java

@ -1,10 +1,12 @@
package com.fine.theme.utils;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.design.border.FineBorderFactory;
import com.fr.stable.os.OperatingSystem;
import com.fr.value.AtomicClearableLazyValue;
import javax.swing.UIManager;
import javax.swing.JLabel;
import java.awt.Color;
import java.awt.Component;
import java.awt.Composite;
@ -364,4 +366,14 @@ public class FineUIUtils {
return createPartRoundRectangle(x, y, width, height, 0, 0, arc, 0);
}
/**
* 标签加粗显示并设置下划线适用于小标题
*
* @param label 标签
*/
public static void wrapBoldLabelWithUnderline(JLabel label) {
label.setBorder(FineBorderFactory.createDefaultUnderlineBorder());
FineUIStyle.setStyle(label, FineUIStyle.LABEL_BOLD);
}
}

37
designer-base/src/main/java/com/fr/design/border/FineBorderFactory.java

@ -0,0 +1,37 @@
package com.fr.design.border;
import com.fine.theme.utils.FineUIUtils;
import javax.swing.BorderFactory;
import javax.swing.border.Border;
import java.awt.Color;
/**
* 创建Border的工厂
*
* @author Levy.Xie
* @since 11.0
* Created on 2024/01/08
*/
public class FineBorderFactory {
/**
* 创建一个下划线边框
*
* @param color 下划线颜色
* @return 边框
*/
public static Border createUnderlineBorder(Color color) {
return BorderFactory.createMatteBorder(0, 0, 1, 0, color);
}
/**
* 创建默认的下划线边框
*
* @return 边框
*/
public static Border createDefaultUnderlineBorder() {
return createUnderlineBorder(FineUIUtils.getUIColor("Label.borderColor", "defaultBorderColor"));
}
}

70
designer-base/src/main/java/com/fr/design/data/datapane/connect/AdvancePane.java

@ -1,55 +1,69 @@
package com.fr.design.data.datapane.connect;
import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.utils.FineUIUtils;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.pool.DBCPConnectionPoolAttr;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.editor.IntegerEditor;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.stable.StringUtils;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.flex;
/**
* @author xiqiu
* @date 2021/11/22
* @description
*/
public class AdvancePane extends BasicPane {
private IntegerEditor DBCP_MAX_ACTIVE = new IntegerEditor();
private UIComboBox DBCP_TESTONBORROW = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_No"), Toolkit.i18nText("Fine-Design_Basic_Yes")});
private IntegerEditor DBCP_MAX_WAIT = new IntegerEditor();
private SpecialUITextField DBCP_VALIDATION_QUERY = new SpecialUITextField();
private final IntegerEditor DBCP_MAX_ACTIVE = new IntegerEditor();
private final UIComboBox DBCP_TEST_ON_BORROW = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_No"),
Toolkit.i18nText("Fine-Design_Basic_Yes")});
private final IntegerEditor DBCP_MAX_WAIT = new IntegerEditor();
private final SpecialUITextField DBCP_VALIDATION_QUERY = new SpecialUITextField();
public AdvancePane() {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
DBCP_VALIDATION_QUERY.addFocusListener(new JTextFieldHintListener(DBCP_VALIDATION_QUERY));
double p = TableLayout.PREFERRED;
DBCP_VALIDATION_QUERY.setColumns(20);
double[] rowSizeDbcp = {p, p, p, p};
double[] columnDbcp = {190, p};
Component[][] comps = {
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Active") + ":", SwingConstants.RIGHT), DBCP_MAX_ACTIVE},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Validation_Query") + ":", SwingConstants.RIGHT), DBCP_VALIDATION_QUERY},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Borrow") + ":", SwingConstants.RIGHT), DBCP_TESTONBORROW},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Max_Wait_Time") + ":", SwingConstants.RIGHT), DBCP_MAX_WAIT}
};
JPanel contextPane = TableLayoutHelper.createGapTableLayoutPane(comps, rowSizeDbcp, columnDbcp, 11, 11);
jPanel.add(contextPane, BorderLayout.CENTER);
this.add(jPanel);
this.setLayout(new BorderLayout());
this.add(Layouts.column(LayoutConstants.VERTICAL_GAP,
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Advanced"))).with(FineUIUtils::wrapBoldLabelWithUnderline),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Active"), SwingConstants.LEFT)).weight(1),
cell(DBCP_MAX_ACTIVE).weight(1.5),
flex(2)
),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Validation_Query"), SwingConstants.LEFT)).weight(1),
cell(DBCP_VALIDATION_QUERY).weight(1.5),
flex(2)
),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Borrow"), SwingConstants.LEFT)).weight(1),
cell(DBCP_TEST_ON_BORROW).weight(1.5),
flex(2)
),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Max_Wait_Time"), SwingConstants.LEFT)).weight(1),
cell(DBCP_MAX_WAIT).weight(1.5),
flex(2)
)
).getComponent(), BorderLayout.CENTER);
}
@ -62,7 +76,7 @@ public class AdvancePane extends BasicPane {
this.DBCP_MAX_ACTIVE.setValue(dbcpAttr.getMaxActive());
this.DBCP_MAX_WAIT.setValue(dbcpAttr.getMaxWait());
this.DBCP_VALIDATION_QUERY.setText(dbcpAttr.getValidationQuery());
this.DBCP_TESTONBORROW.setSelectedIndex(dbcpAttr.isTestOnBorrow() ? 1 : 0);
this.DBCP_TEST_ON_BORROW.setSelectedIndex(dbcpAttr.isTestOnBorrow() ? 1 : 0);
}
@ -75,7 +89,7 @@ public class AdvancePane extends BasicPane {
dbcpAttr.setMaxActive(this.DBCP_MAX_ACTIVE.getValue().intValue());
dbcpAttr.setMaxWait(this.DBCP_MAX_WAIT.getValue().intValue());
dbcpAttr.setValidationQuery(this.DBCP_VALIDATION_QUERY.getText());
dbcpAttr.setTestOnBorrow(this.DBCP_TESTONBORROW.getSelectedIndex() == 0 ? false : true);
dbcpAttr.setTestOnBorrow(this.DBCP_TEST_ON_BORROW.getSelectedIndex() != 0);
}
@Override
@ -84,8 +98,8 @@ public class AdvancePane extends BasicPane {
}
private class JTextFieldHintListener implements FocusListener {
private SpecialUITextField textField;
private static class JTextFieldHintListener implements FocusListener {
private final SpecialUITextField textField;
public JTextFieldHintListener(SpecialUITextField jTextField) {
this.textField = jTextField;
@ -108,7 +122,7 @@ public class AdvancePane extends BasicPane {
}
}
private class SpecialUITextField extends UITextField {
private static class SpecialUITextField extends UITextField {
@Override
public String getText() {

2
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionManagerPane.java

@ -33,8 +33,6 @@ public class ConnectionManagerPane extends LoadingBasicPane implements Connectio
}
public void populate(ConnectionConfig datasourceManager) {
// this.connectionTextField.setText(WorkContext.getCurrent().getPath() + File.separator + ProjectConstants.RESOURCES_NAME
// + File.separator + datasourceManager.fileName());
this.connectionListPane.populate(datasourceManager);
}

104
designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java

@ -1,9 +1,13 @@
package com.fr.design.data.datapane.connect;
import com.fr.base.GraphHelper;
import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.data.core.db.dialect.DialectFactory;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.pool.DBCPConnectionPoolAttr;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.editor.IntegerEditor;
@ -11,19 +15,13 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Window;
import java.awt.event.InputMethodEvent;
import java.awt.event.InputMethodListener;
@ -36,6 +34,10 @@ import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.flex;
public class DBCPAttrPane extends BasicPane {
public static final int TIME_MULTIPLE = 1000;
private static final Pattern FETCHSIZE_PATTERN = Pattern.compile("^0$|^[1-9][\\d]*[\\d]*$");;
@ -70,37 +72,44 @@ public class DBCPAttrPane extends BasicPane {
}
public DBCPAttrPane() {
defaultPane = this;
this.setLayout(new BorderLayout());
defaultPane = Layouts.column(20)
.with(it -> it.setBorder(new ScaledEmptyBorder(10, 10, 10, 10))).getComponent();
// JPanel northFlowPane
northFlowPane = FRGUIPaneFactory.createTopVerticalTitledBorderPane(Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr"));
northFlowPane.setPreferredSize(new Dimension(630, 330));
defaultPane.add(northFlowPane, BorderLayout.NORTH);
// ContextPane
double f = TableLayout.FILL;
// double p = TableLayout.PREFERRED;
double[] rowSize = {f, f, f, f, f, f, f};
double[] columnSize = {f, f};
Component[][] comps = {
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Initial_Size") + ":", SwingConstants.RIGHT), DBCP_INITIAL_SIZE},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Min_Idle") + ":", SwingConstants.RIGHT), DBCP_MIN_IDLE},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Return") + ":", SwingConstants.RIGHT), DBCP_TESTONRETURN},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_While_Idle") + ":", SwingConstants.RIGHT), DBCP_TESTWHILEIDLE},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Evictionruns_millis") + ":", SwingConstants.RIGHT),
DBCP_TIMEBETWEENEVICTIONRUNSMILLS},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Num_Test_Per_Evction_Run") + ":", SwingConstants.RIGHT), DBCP_NUMTESTSPEREVICTIONRUN},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Mix_Evictable_Idle_Time_Millis") + ":", SwingConstants.RIGHT),
DBCP_MINEVICTABLEIDLETIMEMILLIS}};
JPanel contextPane = TableLayoutHelper.createGapTableLayoutPane(comps, rowSize, columnSize, 10, 10);
northFlowPane.add(contextPane);
JPanel boxFlowInnerContainer = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(0, 5, 5);
UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Dbcp_Warning"));
uiLabel.setForeground(Color.RED);
boxFlowInnerContainer.add(uiLabel);
northFlowPane.add(boxFlowInnerContainer);
northFlowPane = Layouts.column(LayoutConstants.VERTICAL_GAP,
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr"))).with(FineUIUtils::wrapBoldLabelWithUnderline),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Initial_Size"))).weight(1),
cell(DBCP_INITIAL_SIZE).weight(1), flex(1.2)
),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Min_Idle"))).weight(1),
cell(DBCP_MIN_IDLE).weight(1), flex(1.2)
),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Return"))).weight(1),
cell(DBCP_TESTONRETURN).weight(1), flex(1.2)
),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_While_Idle"))).weight(1),
cell(DBCP_TESTWHILEIDLE).weight(1), flex(1.2)
),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Evictionruns_millis"))).weight(1),
cell(DBCP_TIMEBETWEENEVICTIONRUNSMILLS).weight(1), flex(1.2)
),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Num_Test_Per_Evction_Run"))).weight(1),
cell(DBCP_NUMTESTSPEREVICTIONRUN).weight(1), flex(1.2)
),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Mix_Evictable_Idle_Time_Millis"))).weight(1),
cell(DBCP_MINEVICTABLEIDLETIMEMILLIS).weight(1), flex(1.2)
),
cell(new UILabel(Toolkit.i18nText("Fine-Design_Dbcp_Warning"))).with(it -> it.setForeground(FlatUIUtils.getUIColor("Label.strongHintColor", Color.RED)))
).getComponent();
defaultPane.add(northFlowPane);
this.add(defaultPane);
}
public void populate(JDBCDatabaseConnection jdbcDatabase) {
@ -188,24 +197,19 @@ public class DBCPAttrPane extends BasicPane {
public BasicDialog showWindow(Window window) {
String databaseName = JDBCConnectionDef.getInstance().getDatabaseName();
if (showOtherConfig(databaseName)) {
southFlowPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Other"));
southFlowPane.setPreferredSize(new Dimension(630, 200));
double f = TableLayout.FILL;
double[] rowSize = {f};
double otherColumnSize = GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Evictionruns_millis")) + 6;
double[] columnSize = {otherColumnSize, otherColumnSize};
FETCHSIZE.addKeyListener(fetchSizeKeyListener);
FETCHSIZE.addInputMethodListener(fetchSizeInputMethodListener);
FETCHSIZE.setHorizontalAlignment(JTextField.RIGHT);
Component[][] comps = {
{new UILabel("Fetchsize:", SwingConstants.RIGHT), FETCHSIZE}
};
JPanel otherConfigPane = TableLayoutHelper.createGapTableLayoutPane(comps, rowSize, columnSize, 10, 4);
southFlowPane.add(otherConfigPane);
southFlowPane = Layouts.column(LayoutConstants.VERTICAL_GAP,
cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Other"))).with(FineUIUtils::wrapBoldLabelWithUnderline),
row(
cell(new UILabel("Fetchsize")).weight(1), cell(FETCHSIZE).weight(1), flex(1.2)
)
).getComponent();
defaultPane.removeAll();
defaultPane.add(northFlowPane, BorderLayout.NORTH);
defaultPane.add(southFlowPane, BorderLayout.SOUTH);
defaultPane.add(northFlowPane);
defaultPane.add(southFlowPane);
} else {
if (southFlowPane != null) {
defaultPane.remove(southFlowPane);

111
designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java

@ -3,6 +3,10 @@
*/
package com.fr.design.data.datapane.connect;
import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.data.driver.util.JarFileParseUtil;
import com.fr.data.impl.Connection;
import com.fr.data.impl.JDBCDatabaseConnection;
@ -14,6 +18,7 @@ import com.fr.data.solution.entity.DriverPage;
import com.fr.data.solution.processor.ClassNotFoundExceptionSolutionProcessor;
import com.fr.data.solution.processor.SolutionProcessor;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane;
@ -29,6 +34,7 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import org.jetbrains.annotations.NotNull;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
@ -62,6 +68,10 @@ import java.io.File;
import java.net.URI;
import java.util.concurrent.ExecutionException;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.flex;
/**
* Database Connection pane.
*/
@ -124,11 +134,11 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
public void mouseClicked(MouseEvent e) {
if (hiddenPanel.isVisible()) {
hiddenPanel.setVisible(false);
dialog.setSize(new Dimension(380, 142));
dialog.setSize(FineUIScale.scale(new Dimension(380, 142)));
detailLabel.setText(Toolkit.i18nText("Fine_Designer_Look_Detail"));
directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.right"));
} else {
dialog.setSize(new Dimension(380, 270));
dialog.setSize(FineUIScale.scale(new Dimension(380, 270)));
hiddenPanel.setVisible(true);
detailLabel.setText(Toolkit.i18nText("Fine_Designer_Hide_Detail"));
directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.down"));
@ -222,58 +232,51 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
midPane = new JPanel();
midPane.add(directUiLabel);
midPane.add(detailLabel);
okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK"));
cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel"));
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
UIScrollPane uiScrollPane = new UIScrollPane(northPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
FineUIStyle.setStyle(okButton, FineUIStyle.STYLE_PRIMARY);
initCorePaneLayout();
}
private void initCorePaneLayout() {
this.setLayout(new BorderLayout());
JPanel corePane = Layouts.column(20)
.with(it -> it.setBorder(new ScaledEmptyBorder(0, 10, 0, 10)))
.getComponent();
JPanel columnContainer = new JPanel(new BorderLayout());
columnContainer.add(corePane);
UIScrollPane uiScrollPane = new UIScrollPane(columnContainer,
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
this.add(uiScrollPane, BorderLayout.CENTER);
// 按钮.
JPanel testPane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
northPane.add(testPane, BorderLayout.NORTH);
UIButton testButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Datasource_Test_Connection"));
testPane.add(testButton);
testButton.addActionListener(testConnectionActionListener);
testPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 3, 4));
// 按钮
JPanel testButtonPane = initTestButtonPane();
corePane.add(testButtonPane);
// Center
mainPanel = mainPanel();
JPanel advancedPanel = FRGUIPaneFactory.createTopVerticalTitledBorderPane(Toolkit.i18nText("Fine-Design_Basic_Advanced"));
JPanel advancedPanel = Layouts.column(LayoutConstants.VERTICAL_GAP).getComponent();
if (mainPanel instanceof JDBCDefPane) {
northPane.add(mainPanel, BorderLayout.CENTER);
ActionLabel actionLabel = new ActionLabel(Toolkit.i18nText("Fine-Design_Advanced_More_Settings"));
actionLabel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
JDialog wDialog = createJDialog();
if (wDialog != null) {
wDialog.setVisible(true);
initJDBCLayout(corePane, advancedPanel);
} else {
initJNDILayout(corePane, advancedPanel);
}
corePane.add(advancedPanel);
}
});
JPanel actionLabelPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
actionLabelPanel.setBorder(BorderFactory.createEmptyBorder(2, 4, 4, 20));
actionLabelPanel.add(actionLabel, BorderLayout.WEST);
JPanel advancePane = getAdvancePane();
if (advancePane != null) {
advancedPanel.add(advancePane);
}
advancedPanel.add(actionLabelPanel);
northPane.add(getSshPane());
northPane.add(getSslPane());
} else {
//非jdbc配置布局保持不变
advancedPanel.setPreferredSize(new Dimension(MAX_MAIN_PANEL_WIDTH, 60));
if (mainPanel.getPreferredSize().height > MAX_MAIN_PANEL_HEIGHT || mainPanel.getPreferredSize().width > MAX_MAIN_PANEL_WIDTH) {
UIScrollPane jp = new
UIScrollPane(mainPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
jp.setPreferredSize(new Dimension(MAX_MAIN_PANEL_WIDTH, MAX_MAIN_PANEL_HEIGHT));
northPane.add(jp, BorderLayout.CENTER);
} else {
mainPanel.setPreferredSize(new Dimension(MAX_MAIN_PANEL_WIDTH, MAX_MAIN_PANEL_HEIGHT));
northPane.add(mainPanel, BorderLayout.CENTER);
@NotNull
private JPanel initTestButtonPane() {
JPanel testPane = new JPanel(new BorderLayout());
UIButton testButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Datasource_Test_Connection"));
testButton.addActionListener(testConnectionActionListener);
testPane.add(testButton, BorderLayout.WEST);
return testPane;
}
private void initJNDILayout(JPanel corePane, JPanel advancedPanel) {
corePane.add(mainPanel);
// ChartSet
String[] defaultEncode = new String[]{Toolkit.i18nText("Fine-Design_Encode_Auto")};
charSetComboBox = new UIComboBox(ArrayUtils.addAll(defaultEncode, EncodeConstants.ENCODING_ARRAY));
@ -281,11 +284,29 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
chartSetPane.add(GUICoreUtils.createNamedPane(charSetComboBox, Toolkit.i18nText("Fine-Design_Basic_Datasource_Charset") + ":"));
advancedPanel.add(chartSetPane);
}
northPane.add(advancedPanel);
private void initJDBCLayout(JPanel corePane, JPanel advancedPanel) {
corePane.add(mainPanel);
ActionLabel actionLabel = new ActionLabel(Toolkit.i18nText("Fine-Design_Advanced_More_Settings"));
actionLabel.addActionListener(evt -> {
JDialog wDialog = createJDialog();
if (wDialog != null) {
wDialog.setVisible(true);
}
});
JPanel advancePane = getAdvancePane();
if (advancePane != null) {
advancedPanel.add(advancePane);
}
advancedPanel.add(
row(cell(actionLabel),flex()).getComponent());
corePane.add(getSshPane());
corePane.add(getSslPane());
}
private JDialog createJDialog() {
return JDBC.getAdvancedAttrPane() != null ? JDBC.getAdvancedAttrPane().showWindow(SwingUtilities.getWindowAncestor(mainPanel)) : null;
return JDBC.getAdvancedAttrPane() != null ?
JDBC.getAdvancedAttrPane().showWindow(SwingUtilities.getWindowAncestor(mainPanel)) : null;
}
private void initDialogPane() {

280
designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java

@ -1,12 +1,14 @@
package com.fr.design.data.datapane.connect;
import com.fr.base.GraphHelper;
import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIUtils;
import com.fr.data.driver.DriverLoader;
import com.fr.data.driver.config.DriverLoaderConfig;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.solution.entity.DriverClasses;
import com.fr.design.border.UITitledBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.core.ReactiveCardPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxUI;
@ -15,9 +17,6 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.BrowseUtils;
import com.fr.file.filter.ChooseFileFilter;
@ -29,8 +28,6 @@ import com.fr.stable.StringUtils;
import com.fr.third.guava.collect.HashBiMap;
import com.fr.workspace.WorkContext;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
@ -39,10 +36,6 @@ import javax.swing.event.DocumentListener;
import javax.swing.plaf.ComboBoxUI;
import javax.swing.plaf.basic.ComboPopup;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputMethodEvent;
@ -59,6 +52,10 @@ import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.flex;
public class JDBCDefPane extends JPanel {
public static final String DRIVER_TYPE = "driver_type";
public static final String USER_NAME = "user_name";
@ -104,9 +101,8 @@ public class JDBCDefPane extends JPanel {
private JPasswordField passwordTextField;
private UIComboBox charSetComboBox;
private ActionLabel odbcTipsLink;
private JPanel centerPanel;
private Component[][] allComponents;
private Component[][] partComponents;
private ReactiveCardPane centerPanel;
private ReactiveCardPane driverSelectRow;
// 请不要改动dbtype,只应该最后添加
private final String[] dbtype = {"Oracle", "DB2", "SQL Server", "MySQL", "Sybase", "Access", "Derby", "Postgre", "SQLite", "Inceptor", OTHER_DB};
@ -116,16 +112,18 @@ public class JDBCDefPane extends JPanel {
private UIComboBox driverManageBox;
private ActionLabel driverManageLabel;
private UIComboBox driverLoaderBox;
ActionListener driverManageListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
boolean selectSelfDefine = isSelfDefine();
driverManageLabel.setVisible(selectSelfDefine);
driverLoaderBox.setVisible(selectSelfDefine);
driverComboBox.setVisible(!selectSelfDefine);
odbcTipsLink.setVisible(driverComboBox.isVisible() && ComparatorUtils.equals("sun.jdbc.odbc.JdbcOdbcDriver", driverComboBox.getSelectedItem()));
ActionListener driverManageListener = e -> changeDriverRow();
private void changeDriverRow() {
if (isSelfDefine()) {
driverSelectRow.select("define").populate();
} else if (ComparatorUtils.equals("sun.jdbc.odbc.JdbcOdbcDriver", driverComboBox.getSelectedItem())) {
driverSelectRow.select("odbc").populate();
} else {
driverSelectRow.select("normal").populate();
}
};
}
ActionListener dbtypeActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
@ -162,27 +160,24 @@ public class JDBCDefPane extends JPanel {
public JDBCDefPane() {
initMap();
this.setBorder(UITitledBorder.createBorderWithTitle("JDBC" + ":"));
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
JPanel innerthis = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
innerthis.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.add(innerthis);
this.setLayout(new BorderLayout());
dbtypeComboBox = new UIComboBox();
dbtypeComboBox.setName(DRIVER_TYPE);
for (int i = 0; i < dbtype.length; i++) {
dbtypeComboBox.addItem(dbtype[i]);
for (String s : dbtype) {
dbtypeComboBox.addItem(s);
}
dbtypeComboBox.addActionListener(dbtypeActionListener);
dbtypeComboBox.setMaximumRowCount(10);
driverLoaderBox = new SpecialUIComboBox();
refreshDriverLoader();
driverLoaderBox.setPreferredSize(new Dimension(200, driverLoaderBox.getPreferredSize().height));
driverLoaderBox.setEditable(false);
driverManageBox = new UIComboBox();
refreshDriverManage(true);
driverManageBox.setEditable(false);
driverManageBox.addActionListener(driverManageListener);
driverLoaderBox.setVisible(isSelfDefine());
driverComboBox = new UIComboBox();
driverComboBox.setEditable(true);
driverComboBox.addActionListener(driverListener);
@ -198,124 +193,117 @@ public class JDBCDefPane extends JPanel {
userNameTextField.setName(USER_NAME);
passwordTextField = new UIPasswordFieldWithFixedLength(15);
dbtypeButton = new UIButton();
dbtypeButton.setIcon(new ImageIcon(UIConstants.ACCESSIBLE_EDITOR_DOT));
dbtypeButton.setPreferredSize(new Dimension(20, 20));
dbtypeButton.setIcon(new LazyIcon("dot"));
dbtypeButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Click_Get_Default_URL"));
dbtypeButton.addActionListener(dbtypeButtonActionListener);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
JPanel dbtypePane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
dbtypePane.add(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Database") + ":")));
Component[][] dbtypeComComponents = {{dbtypeComboBox}};
double[] dbtypeRowSize = {p};
double[] dbtypeColumnSize = {p};
JPanel dbtypeComPane = TableLayoutHelper.createTableLayoutPane(dbtypeComComponents, dbtypeRowSize, dbtypeColumnSize);
JPanel driverPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
driverPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Driver") + ":"));
JPanel dbTypeRow = row(
cell(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Database")))).weight(1.2),
cell(dbtypeComboBox).weight(2),
flex(5.8)
).getComponent();
// 选择ODBC数据源的时候的提示链接
JPanel odbcTipsPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
odbcTipsLink = new ActionLabel(Toolkit.i18nText("Fine-Design_Basic_Odbc_Tips")) {
@Override
public void paintComponent(Graphics _gfx) {
super.paintComponent(_gfx);
_gfx.setColor(Color.blue);
_gfx.drawLine(0, this.getHeight() - 1, GraphHelper.getWidth(this.getText()), this.getHeight() - 1);
}
};
odbcTipsPane.add(odbcTipsLink);
odbcTipsLink.setPreferredSize(new Dimension(GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Basic_Odbc_Tips")), odbcTipsLink.getPreferredSize().height));
odbcTipsLink.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
odbcTipsLink = new ActionLabel(Toolkit.i18nText("Fine-Design_Basic_Odbc_Tips"));
odbcTipsLink.addActionListener(evt -> {
String url = CloudCenter.getInstance().acquireUrlByKind("odbc.help");
BrowseUtils.browser(url);
}
});
driverManageLabel = new ActionLabel(Toolkit.i18nText("Fine-Design_Driver_Manage_Add_Driver")) {
@Override
public void paintComponent(Graphics _gfx) {
super.paintComponent(_gfx);
_gfx.setColor(Color.blue);
_gfx.drawLine(0, this.getHeight() - 1, GraphHelper.getWidth(this.getText()), this.getHeight() - 1);
}
};
driverManageLabel.setPreferredSize(new Dimension(GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Driver_Manage_Add_Driver")), driverManageLabel.getPreferredSize().height));
driverManageLabel.setVisible(isSelfDefine());
driverManageLabel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
driverManageLabel = new ActionLabel(Toolkit.i18nText("Fine-Design_Driver_Manage_Add_Driver"));
driverManageLabel.addActionListener(evt -> {
String url = CloudCenter.getInstance().acquireUrlByKind("driver.add.help");
BrowseUtils.browser(url);
}
});
odbcTipsPane.add(driverManageLabel);
odbcTipsPane.add(odbcTipsLink);
JPanel driverComboBoxAndTips = new JPanel(new BorderLayout());
JPanel normalFlowInnerContainer_s_pane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(0, 5, 0);
normalFlowInnerContainer_s_pane.add(driverManageBox);
normalFlowInnerContainer_s_pane.add(driverComboBox);
normalFlowInnerContainer_s_pane.add(driverLoaderBox);
driverComboBoxAndTips.add(normalFlowInnerContainer_s_pane, BorderLayout.WEST);
driverComboBoxAndTips.add(odbcTipsPane, BorderLayout.CENTER);
JPanel hostPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
hostPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Host") + ":"));
Component[][] hostComComponents = {{hostTextField}};
double[] hostRowSize = {p};
double[] hostColumnSize = {p};
JPanel hostComPane = TableLayoutHelper.createTableLayoutPane(hostComComponents, hostRowSize, hostColumnSize);
JPanel portPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
portPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Port") + ":"));
Component[][] portComComponents = {{portTextField}};
double[] portRowSize = {p};
double[] portColumnSize = {p};
JPanel portComPane = TableLayoutHelper.createTableLayoutPane(portComComponents, portRowSize, portColumnSize);
JPanel dbNamePane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
dbNamePane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_DatabaseName") + ":"));
Component[][] dbNameComComponents = {{dbNameTextField}};
double[] dbNameRowSize = {p};
double[] dbNameColumnSize = {p};
JPanel dbNameComPane = TableLayoutHelper.createTableLayoutPane(dbNameComComponents, dbNameRowSize, dbNameColumnSize);
JPanel urlPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
urlPane.add(new UILabel("URL:"));
Component[][] urlComComponents = {{urlTextField, dbtypeButton}};
double[] urlRowSize = {p};
double[] urlColumnSize = {f, 21};
JPanel urlComPane = TableLayoutHelper.createCommonTableLayoutPane(urlComComponents, urlRowSize, urlColumnSize, 4);
JPanel userPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
userPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_UserName") + ":"));
Component[][] userComComponents = {{userNameTextField, new UILabel(Toolkit.i18nText("Fine-Design_Basic_Password") + ":"), passwordTextField}};
double[] userRowSize = {p};
double[] userColumnSize = {f, p, f};
JPanel userComPane = TableLayoutHelper.createCommonTableLayoutPane(userComComponents, userRowSize, userColumnSize, 4);
driverSelectRow = ReactiveCardPane.create()
.addSupplier("normal", () -> row(
cell(driverComboBox).weight(3), flex(2)
).getComponent())
.addSupplier("odbc", () -> row(
cell(driverComboBox).weight(3), flex(0.2), cell(odbcTipsLink).weight(1.8)
).getComponent())
.addSupplier("define", () -> row(
cell(driverLoaderBox).weight(3), cell(driverManageLabel).weight(2)
).getComponent());
changeDriverRow();
JPanel driverRow = row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Driver"))).weight(1.2),
cell(driverManageBox).weight(1.2),
flex(0.2),
cell(driverSelectRow).weight(4.6),
flex(1.8)
).getComponent();
// 以下布局比例为对齐计算而出
JPanel hostRow = row(
cell(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Host")))).weight(1.2),
cell(hostTextField).weight(4.16),
flex(3.64)
).getComponent();
JPanel portRow = row(
cell(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Port")))).weight(1.2),
cell(portTextField).weight(4.16),
flex(3.64)
).getComponent();
JPanel dbNameRow = row(
cell(new UILabel((Toolkit.i18nText("Fine-Design_Basic_DatabaseName")))).weight(1.2),
cell(dbNameTextField).weight(4.16),
flex(3.64)
).getComponent();
JPanel urlRow = row(
cell(new UILabel("URL")).weight(1.2),
cell(urlTextField).weight(5.6),
flex(0.1),
cell(dbtypeButton).weight(0.3),
flex(1.8)
).getComponent();
JPanel userRow = row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_UserName"))).weight(1.2),
cell(userNameTextField).weight(2.3),
flex(0.2),
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Password"))).weight(1.2),
cell(passwordTextField).weight(2.3),
flex(1.8)
).getComponent();
String[] defaultEncode = new String[]{Toolkit.i18nText("Fine-Design_Encode_Auto")};
charSetComboBox = new UIComboBox(ArrayUtils.addAll(defaultEncode, EncodeConstants.ENCODING_ARRAY));
JPanel chartSetPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
chartSetPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Datasource_Charset") + ":"));
Component[][] charSetComComponents = {{charSetComboBox}};
double[] charSetRowSize = {p};
double[] charSetColumnSize = {f};
JPanel charSetComPane = TableLayoutHelper.createTableLayoutPane(charSetComComponents, charSetRowSize, charSetColumnSize);
JPanel charSetRow = row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Datasource_Charset"))).weight(1.2),
cell(charSetComboBox).weight(6),
flex(1.8)
).getComponent();
//这边调整的话注意下面的changePane
allComponents = new Component[][]{{dbtypePane, dbtypeComPane}, {driverPane, driverComboBoxAndTips}, {hostPane, hostComPane},
{portPane, portComPane}, {dbNamePane, dbNameComPane}, {userPane, userComPane},
{chartSetPane, charSetComPane}, {urlPane, urlComPane}};
partComponents = new Component[][]{{dbtypePane, dbtypeComPane}, {driverPane, driverComboBoxAndTips}, {urlPane, urlComPane},
{userPane, userComPane}, {chartSetPane, charSetComPane}};
double[] rowSize = {p, p, p, p, p, p, p, p};
double[] columnSize = {p, f, 22};
// REPORT-41450 Windows环境的jdk11下dpi为125%时会因为缩放导致显示问题,因此加个水平gap值
centerPanel = TableLayoutHelper.createGapTableLayoutPane(allComponents, rowSize, columnSize, 6, 6);
innerthis.add(centerPanel);
centerPanel = ReactiveCardPane.create()
.addSupplier("all", () -> Layouts.column(LayoutConstants.VERTICAL_GAP,
cell(dbTypeRow),
cell(driverRow),
cell(hostRow),
cell(portRow),
cell(dbNameRow),
cell(userRow),
cell(charSetRow),
cell(urlRow)
).getComponent())
.addSupplier("part", () -> Layouts.column(LayoutConstants.VERTICAL_GAP,
cell(dbTypeRow),
cell(driverRow),
cell(urlRow),
cell(userRow),
cell(charSetRow)
).getComponent());
centerPanel.select("all").populate();
this.add(Layouts.column(LayoutConstants.VERTICAL_GAP,
cell(new UILabel("JDBC")).with(FineUIUtils::wrapBoldLabelWithUnderline),
cell(centerPanel)
).getComponent());
}
private void refreshDriverLoader() {
@ -365,17 +353,10 @@ public class JDBCDefPane extends JPanel {
}
private void changePane(Object dbType) {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f, 22};
if (ComparatorUtils.equals(dbType, OTHER_DB) || ComparatorUtils.equals(dbType, "Access") || ComparatorUtils.equals(dbType, "SQLite")) {
if (this.centerPanel.getComponentCount() != partComponents.length * 2) {
centerPanel.removeAll();
TableLayoutHelper.addComponent2ResultPane(partComponents, new double[]{p, p, p, p, p}, columnSize, centerPanel);
}
} else if (this.centerPanel.getComponentCount() != allComponents.length * 2) {
centerPanel.removeAll();
TableLayoutHelper.addComponent2ResultPane(allComponents, new double[]{p, p, p, p, p, p, p, p}, columnSize, centerPanel);
centerPanel.select("part").populate();
} else {
centerPanel.select("all").populate();
}
}
@ -488,8 +469,13 @@ public class JDBCDefPane extends JPanel {
linkPanel.setVisible(DriverClasses.MYSQL.toString().equalsIgnoreCase((String) dbtypeComboBox.getSelectedItem())
&& driverComboBox.getSelectedItem() != null
&& ComparatorUtils.equals(DriverClasses.MYSQL.getDriverClass(), driverComboBox.getSelectedItem().toString().trim()));
odbcTipsLink.setVisible(driverComboBox.getSelectedItem() != null
&& ComparatorUtils.equals("sun.jdbc.odbc.JdbcOdbcDriver", driverComboBox.getSelectedItem().toString().trim())); // 选择的如果是ODBC就显示提示
if (driverComboBox.getSelectedItem() != null
&& ComparatorUtils.equals("sun.jdbc.odbc.JdbcOdbcDriver", driverComboBox.getSelectedItem().toString().trim())) {
driverSelectRow.select("odbc").populate();
} else {
driverSelectRow.select("normal").populate();
}
if (driverComboBox.getSelectedItem() == null || ComparatorUtils.equals(driverComboBox.getSelectedItem(), StringUtils.EMPTY)) {
return;
}

185
designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java

@ -1,5 +1,8 @@
package com.fr.design.data.datapane.connect;
import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIUtils;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.security.ssh.BaseSsh;
import com.fr.data.security.ssh.Ssh;
@ -8,10 +11,10 @@ import com.fr.data.security.ssh.SshType;
import com.fr.data.security.ssh.impl.KeyVerifySsh;
import com.fr.data.security.ssh.impl.NormalSsh;
import com.fr.data.security.ssl.SslUtils;
import com.fr.design.border.UITitledBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.editor.NotNegativeIntegerEditor;
import com.fr.design.gui.core.ReactiveCardPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox;
@ -19,29 +22,22 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.file.FILE;
import com.fr.file.FILEChooserPane;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.stable.StringUtils;
import com.fr.third.guava.collect.HashBiMap;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.flex;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fr.design.i18n.Toolkit.i18nText;
/**
@ -58,79 +54,49 @@ public class SshPane extends BasicPane {
typeMap.put(Toolkit.i18nText("Fine-Design_Basic_Ssh_Public_Key"), SshType.KEY);
}
private UICheckBox usingSsh = new UICheckBox(i18nText("Fine-Design_Basic_Ssh_Using"));
private NotNegativeIntegerEditor port = new NotNegativeIntegerEditor(20);
private UITextField ip = new UITextField(20);
private UIComboBox type = new UIComboBox();
private UITextField user = new UITextField(20);
private JPasswordField password = new UIPasswordFieldWithFixedLength(20);
private JPasswordField secret = new UIPasswordFieldWithFixedLength(20);
private KeyFileUITextField keyPath = new KeyFileUITextField(18);
private JPanel contextPane;
private Component[][] passwordComps;
private Component[][] keyComps;
private double p = TableLayout.PREFERRED;
private double f = TableLayout.FILL;
private JPanel jPanel;
private UIButton fileChooserButton = new UIButton();
private double[] columnSize = new double[]{195, p};
private final UICheckBox usingSsh = new UICheckBox(i18nText("Fine-Design_Basic_Ssh_Using"));
private final NotNegativeIntegerEditor port = new NotNegativeIntegerEditor(20);
private final UITextField ip = new UITextField(20);
private final UIComboBox type = new UIComboBox();
private final UITextField user = new UITextField(20);
private final JPasswordField password = new UIPasswordFieldWithFixedLength(20);
private final JPasswordField secret = new UIPasswordFieldWithFixedLength(20);
private final KeyFileUITextField keyPath = new KeyFileUITextField(18);
private ReactiveCardPane coreCardPane;
private ReactiveCardPane verifyCardPane;
private final UIButton fileChooserButton = new UIButton();
private static final String USE_SSH = "useSSH";
private static final String NOT_USE_SSH = "notUseSSH";
private static final String USE_PASSWORD = "usePassword";
private static final String USE_KEY = "useKey";
public SshPane() {
fileChooserButton.setIcon(new ImageIcon(UIConstants.ACCESSIBLE_EDITOR_DOT));
this.setBorder(UITitledBorder.createBorderWithTitle(Toolkit.i18nText("Fine-Design_Basic_Ssh_Settings")));
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
this.setLayout(new BorderLayout());
fileChooserButton.setIcon(new LazyIcon("dot"));
typeMap.keySet().forEach(key -> type.addItem(key));
type.setSelectedItem(typeMap.inverse().get(SshType.KEY));
jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
fileChooserButton.setPreferredSize(new Dimension(20, 20));
type.setEditable(false);
type.setSelectedItem(Toolkit.i18nText("Fine-Design_Basic_Ssh_Private_Key"));
JPanel filePanel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{{keyPath, fileChooserButton}}, new double[]{p}, new double[]{f, 20}, 0);
Component[] compIp = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Host") + ":", SwingConstants.RIGHT), ip};
Component[] compPort = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Port") + ":", SwingConstants.RIGHT), port};
Component[] compUserName = {new UILabel(Toolkit.i18nText("Fine-Design_Report_UserName") + ":", SwingConstants.RIGHT), user};
Component[] compMethod = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssh_Verify_Method") + ":", SwingConstants.RIGHT), type};
Component[] compPassword = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Password") + ":", SwingConstants.RIGHT), password};
Component[] compKey = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssh_Private_Key") + ":", SwingConstants.RIGHT), filePanel};
Component[] comSecret = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssh_Secret") + ":", SwingConstants.RIGHT), secret};
passwordComps = new Component[][]{
compIp,
compPort,
compUserName,
compMethod,
compPassword
};
keyComps = new Component[][]{
compIp,
compPort,
compUserName,
compMethod,
compKey,
comSecret
};
usingSsh.setSelected(true);
contextPane = TableLayoutHelper.createGapTableLayoutPane(keyComps, new double[]{p, p, p, p, p, p}, columnSize, 11, 11);
jPanel.add(usingSsh, BorderLayout.NORTH);
jPanel.add(contextPane, BorderLayout.CENTER);
this.add(jPanel);
usingSsh.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
changePane();
}
});
type.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
changePaneForType();
initVerifyCardPane();
initCoreCardPane();
initListeners();
this.add(Layouts.column(LayoutConstants.VERTICAL_GAP,
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssh_Settings"))).with(FineUIUtils::wrapBoldLabelWithUnderline),
cell(coreCardPane)
).getComponent());
}
});
fileChooserButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
private void initListeners() {
usingSsh.addActionListener(e -> changePane());
type.addActionListener(e -> changePaneForType());
fileChooserButton.addActionListener(e -> {
FILEChooserPane fileChooser = FILEChooserPane.getInstanceWithDesignatePath(SslUtils.PREFIX, new ChooseFileFilter(true), SslUtils.CERTIFICATES);
int type = fileChooser.showOpenDialog(SshPane.this, StringUtils.EMPTY);
if (type == FILEChooserPane.OK_OPTION) {
@ -143,29 +109,80 @@ public class SshPane extends BasicPane {
}
fileChooser.removeAllFilter();
fileChooser.removeTopPath();
}
});
}
private void initCoreCardPane() {
coreCardPane = ReactiveCardPane.create()
.addSupplier(NOT_USE_SSH, () -> cell(usingSsh).getComponent())
.addSupplier(USE_SSH, () -> Layouts.column(LayoutConstants.VERTICAL_GAP,
cell(usingSsh),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Host"))).weight(1),
cell(ip).weight(5),
flex(6)
),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Port"))).weight(1),
cell(port).weight(5),
flex(6)
),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_UserName"))).weight(1),
cell(user).weight(5),
flex(6)
),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssh_Verify_Method"))).weight(1),
cell(type).weight(5),
flex(6)
),
cell(verifyCardPane)
).getComponent());
coreCardPane.select(USE_SSH).populate();
}
private void initVerifyCardPane() {
verifyCardPane = ReactiveCardPane.create()
.addSupplier(USE_PASSWORD, () -> Layouts.row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Password"))).weight(1),
cell(password).weight(5),
flex(6)
).getComponent())
.addSupplier(USE_KEY, () -> Layouts.column(LayoutConstants.VERTICAL_GAP,
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssh_Private_Key"))).weight(1),
cell(keyPath).weight(4.5),
flex(0.1),
cell(fileChooserButton).weight(0.4),
flex(6)
),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssh_Secret"))).weight(1),
cell(secret).weight(5),
flex(6)
)
).getComponent());
verifyCardPane.select(USE_KEY).populate();
}
private void changePane() {
contextPane.setVisible(usingSsh.isSelected());
coreCardPane.select(usingSsh.isSelected() ? USE_SSH: NOT_USE_SSH).populate();
}
private void changePaneForType() {
contextPane.removeAll();
switch (typeMap.get(type.getSelectedItem())) {
case NORMAL:
TableLayoutHelper.addComponent2ResultPane(passwordComps, new double[]{p, p, p, p, p}, columnSize, contextPane);
verifyCardPane.select(USE_PASSWORD).populate();
break;
case KEY:
TableLayoutHelper.addComponent2ResultPane(keyComps, new double[]{p, p, p, p, p, p}, columnSize, contextPane);
verifyCardPane.select(USE_KEY).populate();
break;
default:
throw new SshException("un support ssh type");
}
jPanel.revalidate();
jPanel.repaint();
}

120
designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java

@ -1,37 +1,36 @@
package com.fr.design.data.datapane.connect;
import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIUtils;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.security.ssl.Ssl;
import com.fr.data.security.ssl.SslException;
import com.fr.data.security.ssl.SslType;
import com.fr.data.security.ssl.SslUtils;
import com.fr.data.security.ssl.impl.NormalSsl;
import com.fr.design.border.UITitledBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.data.datapane.connect.SshPane.KeyFileUITextField;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.core.ReactiveCardPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.file.FILE;
import com.fr.file.FILEChooserPane;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.stable.StringUtils;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.flex;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fr.design.i18n.Toolkit.i18nText;
/**
@ -41,65 +40,66 @@ import static com.fr.design.i18n.Toolkit.i18nText;
*/
public class SslPane extends BasicPane {
UICheckBox usingSsl = new UICheckBox(i18nText("Fine-Design_Basic_Ssl_Using"));
private KeyFileUITextField keyPathCa = new KeyFileUITextField(18);
private UIButton fileChooserButtonCa = new UIButton();
private KeyFileUITextField keyPathClientCert = new KeyFileUITextField(18);
private UIButton fileChooserButtonClientCert = new UIButton();
private KeyFileUITextField keyPathClientKey = new KeyFileUITextField(18);
private UIButton fileChooserButtonClientKey = new UIButton();
private UICheckBox verifyCa = new UICheckBox(i18nText("Fine-Design_Basic_Ssl_Verify_Ca"));
// private UITextField cipher = new UITextField(20);
private JPanel jPanel;
private Component[][] usingComps;
private double p = TableLayout.PREFERRED;
private double f = TableLayout.FILL;
private JPanel contextPane;
private double[] columnSize = new double[]{195, p};
private final KeyFileUITextField keyPathCa = new KeyFileUITextField(18);
private final UIButton fileChooserButtonCa = new UIButton();
private final KeyFileUITextField keyPathClientCert = new KeyFileUITextField(18);
private final UIButton fileChooserButtonClientCert = new UIButton();
private final KeyFileUITextField keyPathClientKey = new KeyFileUITextField(18);
private final UIButton fileChooserButtonClientKey = new UIButton();
private final UICheckBox verifyCa = new UICheckBox(i18nText("Fine-Design_Basic_Ssl_Verify_Ca"));
private final ReactiveCardPane cardPane;
public SslPane() {
fileChooserButtonCa.setIcon(new ImageIcon(UIConstants.ACCESSIBLE_EDITOR_DOT));
fileChooserButtonClientCert.setIcon(new ImageIcon(UIConstants.ACCESSIBLE_EDITOR_DOT));
fileChooserButtonClientKey.setIcon(new ImageIcon(UIConstants.ACCESSIBLE_EDITOR_DOT));
this.setBorder(UITitledBorder.createBorderWithTitle(Toolkit.i18nText("Fine-Design_Basic_Ssl_Settings")));
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
Dimension dimension = new Dimension(20, 20);
fileChooserButtonCa.setPreferredSize(dimension);
fileChooserButtonClientCert.setPreferredSize(dimension);
fileChooserButtonClientKey.setPreferredSize(dimension);
JPanel filePanelCa = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{{keyPathCa, fileChooserButtonCa}}, new double[]{p}, new double[]{f, 20}, 0);
Component[] compCa = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Ca") + ":", SwingConstants.RIGHT), filePanelCa};
Component[] compVerifyCa = {null, verifyCa};
JPanel filePanelClientKey = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{{keyPathClientKey, fileChooserButtonClientKey}}, new double[]{p}, new double[]{f, 20}, 0);
Component[] compClientKey = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Client_Key") + ":", SwingConstants.RIGHT), filePanelClientKey};
JPanel filePanelClientCert = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{{keyPathClientCert, fileChooserButtonClientCert}}, new double[]{p}, new double[]{f, 20}, 0);
Component[] compClientCert = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Client_Cert") + ":", SwingConstants.RIGHT), filePanelClientCert};
// Component[] comCipher = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Cipher") + ":", SwingConstants.RIGHT), cipher};
usingComps = new Component[][]{
compCa,
compVerifyCa,
compClientKey,
compClientCert
// comCipher
};
initDotButtons();
this.setLayout(new BorderLayout());
usingSsl.setSelected(true);
contextPane = TableLayoutHelper.createGapTableLayoutPane(usingComps, new double[]{p, p, p, p}, columnSize, 11, 11);
jPanel.add(usingSsl, BorderLayout.NORTH);
jPanel.add(contextPane, BorderLayout.CENTER);
this.add(jPanel);
usingSsl.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
changePane();
cardPane = ReactiveCardPane.create()
.addSupplier("notUseSSL", () -> cell(usingSsl).getComponent())
.addSupplier("useSSL", () -> Layouts.column(LayoutConstants.VERTICAL_GAP,
cell(usingSsl),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Ca"), SwingConstants.LEFT)).weight(1),
cell(keyPathCa).weight(1.3),
flex(0.05),
cell(fileChooserButtonCa).weight(0.15),
flex(2)
),
cell(verifyCa),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Client_Key"), SwingConstants.LEFT)).weight(1),
cell(keyPathClientKey).weight(1.3),
flex(0.05),
cell(fileChooserButtonClientKey).weight(0.15),
flex(2)
),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Client_Cert"), SwingConstants.LEFT)).weight(1),
cell(keyPathClientCert).weight(1.3),
flex(0.05),
cell(fileChooserButtonClientCert).weight(0.15),
flex(2)
)
).getComponent()
);
cardPane.select("useSSL").populate();
this.add(Layouts.column(LayoutConstants.VERTICAL_GAP,
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Settings"))).with(FineUIUtils::wrapBoldLabelWithUnderline),
cell(cardPane)
).getComponent());
usingSsl.addActionListener(e -> changePane());
}
});
private void initDotButtons() {
fileChooserButtonCa.setIcon(new LazyIcon("dot"));
fileChooserButtonClientCert.setIcon(new LazyIcon("dot"));
fileChooserButtonClientKey.setIcon(new LazyIcon("dot"));
fileChooserButtonCa.addActionListener(new TextFieldActionListener(keyPathCa));
fileChooserButtonClientCert.addActionListener(new TextFieldActionListener(keyPathClientCert));
fileChooserButtonClientKey.addActionListener(new TextFieldActionListener(keyPathClientKey));
}
private void changePane() {
contextPane.setVisible(usingSsl.isSelected());
cardPane.select(usingSsl.isSelected() ? "useSSL" : "notUseSSL").populate();
}
@ -120,7 +120,6 @@ public class SslPane extends BasicPane {
keyPathClientCert.setText(normalSsl.getClientCertificate());
keyPathClientKey.setText(normalSsl.getClientPrivateKey());
verifyCa.setSelected(normalSsl.isVerifyCa());
// cipher.setText(normalSsl.getCipher());
} else {
throw new SslException("un support ssl type");
}
@ -130,7 +129,6 @@ public class SslPane extends BasicPane {
public void update(JDBCDatabaseConnection jdbcDatabase) {
NormalSsl normalSsl = new NormalSsl();
// normalSsl.setCipher(cipher.getText().trim());
normalSsl.setVerifyCa(verifyCa.isSelected());
normalSsl.setCaCertificate(keyPathCa.getText().trim());
normalSsl.setClientCertificate(keyPathClientCert.getText().trim());
@ -140,7 +138,7 @@ public class SslPane extends BasicPane {
}
private class TextFieldActionListener implements ActionListener {
private UITextField textField;
private final UITextField textField;
public TextFieldActionListener(UITextField textField) {
this.textField = textField;

5
designer-base/src/main/java/com/fr/design/formula/FormulaPane.java

@ -4,6 +4,7 @@ import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils;
@ -1361,7 +1362,9 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
private JPanel createNamePane(String name, JComponent comp) {
JPanel namePane = new JPanel(new BorderLayout(0, 4));
namePane.add(new UILabel(name), BorderLayout.NORTH);
UILabel label = new UILabel(name);
FineUIStyle.setStyle(label, FineUIStyle.LABEL_BOLD);
namePane.add(label, BorderLayout.NORTH);
namePane.add(comp, BorderLayout.CENTER);
return namePane;
}

9
designer-base/src/main/java/com/fr/design/gui/controlpane/JControlPane.java

@ -1,5 +1,7 @@
package com.fr.design.gui.controlpane;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.design.border.FineBorderFactory;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.controlpane.shortcutfactory.AbstractShortCutFactory;
import com.fr.design.gui.controlpane.shortcutfactory.OldShortCutFactory;
@ -7,16 +9,15 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Filter;
import com.fr.stable.Nameable;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.util.Arrays;
import java.util.stream.Stream;
@ -107,7 +108,6 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S
initCardPane();
// SplitPane
JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, getLeftPane(), cardPane);
mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor()));
mainSplitPane.setOneTouchExpandable(true);
this.add(mainSplitPane, BorderLayout.CENTER);
@ -163,7 +163,8 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S
}
initToolBar();
toolBar.setBorder(FineBorderFactory.createUnderlineBorder(FlatUIUtils.getUIColor("defaultBorderColor", Color.GRAY)));
toolBar.setBorderPainted(true);
leftPane.add(toolBar, BorderLayout.NORTH);
return leftPane;
}

29
designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java

@ -1,6 +1,10 @@
package com.fr.design.gui.controlpane;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.FineBorderFactory;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilist.JNameEdList;
@ -10,14 +14,12 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.event.Listener;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.invoke.Reflect;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.BorderFactory;
import javax.swing.DefaultListModel;
import javax.swing.Icon;
import javax.swing.JLabel;
@ -87,8 +89,9 @@ public abstract class JListControlPane extends JControlPane implements ListContr
protected void initLeftPane(JPanel leftPane) {
nameableList = createJNameList();
nameableList.setName(LIST_NAME);
nameableList.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE));
leftPane.add(new UIScrollPane(nameableList), BorderLayout.CENTER);
leftPane.setBorder(new FineRoundBorder());
nameableList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
nameableList.addMouseListener(listMouseListener);
nameableList.addListSelectionListener(new ListSelectionListener() {
@ -107,6 +110,12 @@ public abstract class JListControlPane extends JControlPane implements ListContr
});
}
@Override
protected void initToolBar() {
super.initToolBar();
toolBar.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE));
}
protected JNameEdList createJNameList() {
JNameEdList nameEdList = new JNameEdList(new DefaultListModel()) {
@Override
@ -355,19 +364,17 @@ public abstract class JListControlPane extends JControlPane implements ListContr
/**
* JList默认单元格渲染器的选中背景色
*/
private final Color selectedBgColor = new Color(65, 155, 249);
protected NameableListCellRenderer() {
setLayout(new BorderLayout());
this.textLabel = new JLabel();
this.iconLabel = new JLabel();
this.textLabel.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 1));
this.iconLabel.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 0));
add(this.textLabel, BorderLayout.CENTER);
add(this.iconLabel, BorderLayout.WEST);
this.iconLabel.setBackground(Color.WHITE);
this.iconLabel.setBackground(FlatUIUtils.getUIColor("List.cellRender.background", Color.WHITE));
//iconLabel和textLabel的背景颜色不会被JList背景颜色覆盖,开发者自定义
this.textLabel.setOpaque(true);
this.iconLabel.setOpaque(true);
this.setBorder(FineBorderFactory.createUnderlineBorder(FlatUIUtils.getUIColor("defaultBorderColor", Color.GRAY)));
}
@Override
@ -380,11 +387,9 @@ public abstract class JListControlPane extends JControlPane implements ListContr
this.textLabel.setText(nameable.getName());
boolean iconSet = false;
if(isSelected) {
this.textLabel.setBackground(selectedBgColor);
this.textLabel.setForeground(Color.WHITE);
this.textLabel.setBackground(FlatUIUtils.getUIColor("List.selectionInactiveBackground", Color.GRAY));
} else {
this.textLabel.setBackground(Color.WHITE);
this.textLabel.setForeground(Color.BLACK);
this.textLabel.setBackground(FlatUIUtils.getUIColor("List.cellRender.background", Color.WHITE));
}
for (NameableCreator creator : JListControlPane.this.creators()) {
if (creator.menuIcon() != null && creator.acceptObject2Populate(nameable) != null) {
@ -395,7 +400,7 @@ public abstract class JListControlPane extends JControlPane implements ListContr
}
}
if (!iconSet) {
this.setIcon(IOUtils.readIcon("/com/fr/base/images/oem/cpt.png"));
this.setIcon(new LazyIcon("cpt_icon"));
}
}
return this;

6
designer-base/src/main/java/com/fr/design/gui/ilable/ActionLabel.java

@ -1,5 +1,7 @@
package com.fr.design.gui.ilable;
import com.formdev.flatlaf.ui.FlatUIUtils;
import javax.swing.event.MouseInputAdapter;
import java.awt.Color;
import java.awt.Cursor;
@ -13,12 +15,12 @@ import java.awt.event.MouseEvent;
*/
public class ActionLabel extends UILabel {
private ActionListener actionListener;
private Color color;
private final Color color;
// 文字是否有下划线
private boolean drawUnderLine = true;
public ActionLabel(String text) {
this(text, Color.blue);
this(text, FlatUIUtils.getUIColor("Label.hyperLinkColor", Color.BLUE));
}
public ActionLabel(String text, boolean drawUnderLine) {

2
designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java

@ -42,11 +42,11 @@ public class FileTreeIcon {
public static final Icon JPG_FILE_IMAGE_ICON = new LazyIcon("jpgFile");
public static final Icon BMP_FILE_IMAGE_ICON = new LazyIcon("bmpFile");
public static final Icon MODERN_CHT_FILE_IMAGE_ICON = new LazyIcon("chtFile");
public static final Icon CPTX_ICON = new LazyIcon("cpt_icon");
// TODO: 以下Icon视觉暂未提供,需提供后替换
public static final Icon BLANK_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/blank.gif");
public static final Icon FOLDER_HALF_IMAGE_ICON = IconUtils.readIcon("/com/fr/design/standard/fileicon/folder_half_authority.svg");
public static final Icon CPTX_ICON = IconUtils.readIcon("/com/fr/design/standard/fileicon/cptx_icon.svg");
public static final Icon CPTX_LOCKED_ICON = IconUtils.readIcon("/com/fr/design/standard/fileicon/cptx_icon_locked.svg");
public static final LockIcon FOLDER_LOCK_ICON =

5
designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe;
import com.fine.theme.utils.FineUIScale;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager;
import com.fr.design.data.datapane.TableDataTreePane;
@ -16,6 +17,7 @@ import com.fr.stable.Constants;
public class WestRegionContainerPane extends UIResizableContainer {
private static WestRegionContainerPane THIS;
private static final int WEST_CONTAINER_WIDTH = 165;
/**
* 得到实例
@ -56,7 +58,6 @@ public class WestRegionContainerPane extends UIResizableContainer {
}
});
setContainerWidth(165);
// setBackground(UIConstants.TREE_BACKGROUND);
setContainerWidth(FineUIScale.scale(WEST_CONTAINER_WIDTH));
}
}

3
designer-base/src/main/resources/com/fine/theme/icon/expand/forbid.svg

@ -0,0 +1,3 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M28 16C28 22.6274 22.6274 28 16 28C13.0706 28 10.3864 26.9503 8.30292 25.2066L25.2066 8.30292C26.9503 10.3864 28 13.0706 28 16ZM6.88079 23.8003L23.8003 6.88079C21.7027 5.0848 18.978 4 16 4C9.37258 4 4 9.37258 4 16C4 18.978 5.0848 21.7027 6.88079 23.8003ZM30 16C30 23.732 23.732 30 16 30C8.26801 30 2 23.732 2 16C2 8.26801 8.26801 2 16 2C23.732 2 30 8.26801 30 16Z" fill="#0A1C38" fill-opacity="0.9"/>
</svg>

After

Width:  |  Height:  |  Size: 553 B

3
designer-base/src/main/resources/com/fine/theme/icon/expand/forbid_disable.svg

@ -0,0 +1,3 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M28 16C28 22.6274 22.6274 28 16 28C13.0706 28 10.3864 26.9503 8.30292 25.2066L25.2066 8.30292C26.9503 10.3864 28 13.0706 28 16ZM6.88079 23.8003L23.8003 6.88079C21.7027 5.0848 18.978 4 16 4C9.37258 4 4 9.37258 4 16C4 18.978 5.0848 21.7027 6.88079 23.8003ZM30 16C30 23.732 23.732 30 16 30C8.26801 30 2 23.732 2 16C2 8.26801 8.26801 2 16 2C23.732 2 30 8.26801 30 16Z" fill="#0A1C38" fill-opacity="0.29"/>
</svg>

After

Width:  |  Height:  |  Size: 554 B

6
designer-base/src/main/resources/com/fine/theme/icon/expand/horizontal.svg

@ -0,0 +1,6 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5 13C4.44772 13 4 13.4477 4 14L4 30C4 30.5523 4.44772 31 5 31L9 31C9.55229 31 10 30.5523 10 30L10 14C10 13.4477 9.55229 13 9 13L5 13Z" fill="#5493F2"/>
<path d="M14 13C13.4477 13 13 13.4477 13 14L13 30C13 30.5523 13.4477 31 14 31L18 31C18.5523 31 19 30.5523 19 30L19 14C19 13.4477 18.5523 13 18 13L14 13Z" fill="#105DD1"/>
<path d="M23 13C22.4477 13 22 13.4477 22 14L22 30C22 30.5523 22.4477 31 23 31L27 31C27.5523 31 28 30.5523 28 30L28 14C28 13.4477 27.5523 13 27 13L23 13Z" fill="#5493F2"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M29.4657 9.88517C29.5689 9.83801 29.6657 9.77457 29.7516 9.69479C30.167 9.30909 30.1728 8.68543 29.7646 8.29312L22.6408 1.44538C22.2226 1.04335 21.5306 1.0378 21.105 1.43305C20.6896 1.81875 20.6838 2.44241 21.0919 2.83472L26.4655 8.00004L2.99999 8.00005C2.44771 8.00005 2 8.44776 2 9.00004C2 9.55232 2.44771 10 2.99999 10L29 10C29.1682 10 29.3267 9.95851 29.4657 9.88517Z" fill="#105DD1"/>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

6
designer-base/src/main/resources/com/fine/theme/icon/expand/horizontal_disable.svg

@ -0,0 +1,6 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5 13C4.44772 13 4 13.4477 4 14L4 30C4 30.5523 4.44772 31 5 31L9 31C9.55229 31 10 30.5523 10 30L10 14C10 13.4477 9.55229 13 9 13L5 13Z" fill="#0A1C38" fill-opacity="0.29"/>
<path d="M14 13C13.4477 13 13 13.4477 13 14L13 30C13 30.5523 13.4477 31 14 31L18 31C18.5523 31 19 30.5523 19 30L19 14C19 13.4477 18.5523 13 18 13L14 13Z" fill="#0A1C38" fill-opacity="0.29"/>
<path d="M23 13C22.4477 13 22 13.4477 22 14L22 30C22 30.5523 22.4477 31 23 31L27 31C27.5523 31 28 30.5523 28 30L28 14C28 13.4477 27.5523 13 27 13L23 13Z" fill="#0A1C38" fill-opacity="0.29"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M29.4657 9.88517C29.5689 9.83801 29.6657 9.77457 29.7516 9.69479C30.167 9.30909 30.1728 8.68543 29.7646 8.29312L22.6408 1.44538C22.2226 1.04335 21.5306 1.0378 21.105 1.43305C20.6896 1.81875 20.6838 2.44241 21.0919 2.83472L26.4655 8.00004L2.99999 8.00005C2.44771 8.00005 2 8.44776 2 9.00004C2 9.55232 2.44771 10 2.99999 10L29 10C29.1682 10 29.3267 9.95851 29.4657 9.88517Z" fill="#0A1C38" fill-opacity="0.29"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

6
designer-base/src/main/resources/com/fine/theme/icon/expand/vertical.svg

@ -0,0 +1,6 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12.9995 5.00003C12.9995 4.44775 13.4472 4.00003 13.9995 4.00003L29.9995 4.00003C30.5518 4.00003 30.9995 4.44775 30.9995 5.00003L30.9995 9.00003C30.9995 9.55231 30.5518 10 29.9995 10L13.9995 10C13.4472 10 12.9995 9.55231 12.9995 9.00003L12.9995 5.00003Z" fill="#5493F2"/>
<path d="M13 14C13 13.4477 13.4477 13 14 13L30 13C30.5523 13 31 13.4477 31 14L31 18C31 18.5523 30.5523 19 30 19L14 19C13.4477 19 13 18.5523 13 18L13 14Z" fill="#105DD1"/>
<path d="M13 23C13 22.4477 13.4477 22 14 22L30 22C30.5523 22 31 22.4477 31 23L31 27C31 27.5523 30.5523 28 30 28L14 28C13.4477 28 13 27.5523 13 27L13 23Z" fill="#5493F2"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.88514 29.4657C9.83799 29.5689 9.77454 29.6657 9.69476 29.7516C9.30906 30.167 8.6854 30.1728 8.29309 29.7646L1.44535 22.6408C1.04333 22.2226 1.03777 21.5306 1.43302 21.105C1.81872 20.6896 2.44238 20.6838 2.83469 21.0919L8.00001 26.4655L8.00002 2.99999C8.00002 2.44771 8.44773 2 9.00001 2C9.55229 2 10 2.44771 10 2.99999L9.99999 29C9.99999 29.1682 9.95848 29.3267 9.88514 29.4657Z" fill="#105DD1"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

6
designer-base/src/main/resources/com/fine/theme/icon/expand/vertical_disable.svg

@ -0,0 +1,6 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12.9995 5.00003C12.9995 4.44775 13.4472 4.00003 13.9995 4.00003L29.9995 4.00003C30.5518 4.00003 30.9995 4.44775 30.9995 5.00003L30.9995 9.00003C30.9995 9.55231 30.5518 10 29.9995 10L13.9995 10C13.4472 10 12.9995 9.55231 12.9995 9.00003L12.9995 5.00003Z" fill="#0A1C38" fill-opacity="0.29"/>
<path d="M13 14C13 13.4477 13.4477 13 14 13L30 13C30.5523 13 31 13.4477 31 14L31 18C31 18.5523 30.5523 19 30 19L14 19C13.4477 19 13 18.5523 13 18L13 14Z" fill="#0A1C38" fill-opacity="0.29"/>
<path d="M13 23C13 22.4477 13.4477 22 14 22L30 22C30.5523 22 31 22.4477 31 23L31 27C31 27.5523 30.5523 28 30 28L14 28C13.4477 28 13 27.5523 13 27L13 23Z" fill="#0A1C38" fill-opacity="0.29"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.88514 29.4657C9.83799 29.5689 9.77454 29.6657 9.69476 29.7516C9.30906 30.167 8.6854 30.1728 8.29309 29.7646L1.44535 22.6408C1.04333 22.2226 1.03777 21.5306 1.43302 21.105C1.81872 20.6896 2.44238 20.6838 2.83469 21.0919L8.00001 26.4655L8.00002 2.99999C8.00002 2.44771 8.44773 2 9.00001 2C9.55229 2 10 2.44771 10 2.99999L9.99999 29C9.99999 29.1682 9.95848 29.3267 9.88514 29.4657Z" fill="#0A1C38" fill-opacity="0.29"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

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

@ -399,6 +399,9 @@ FormattedTextField.iconTextGap = 4
# ---- Label ----
Label.tipColor = @BrandTipColor
Label.borderColor = $defaultBorderColor
Label.hyperLinkColor = #2576EF
Label.strongHintColor = #FF0000
#---- HelpButton ----
@ -421,8 +424,8 @@ HelpButton.innerFocusWidth = $?Button.innerFocusWidth
#---- List ----
List.border = 2,2,2,2
List.cellMargins = 1,6,1,6
List.border = 0,0,0,0
List.cellMargins = 1,12,1,12
List.selectionInsets = 0,0,0,0
List.selectionArc = 0
List.cellFocusColor = @cellFocusColor
@ -540,7 +543,7 @@ PasswordField.capsLockIconColor = #00000064
PasswordField.revealIconColor = tint(@foreground,40%)
PasswordField.border = com.formdev.flatlaf.ui.FlatTextBorder
PasswordField.margin = @componentMargin
PasswordField.background = @componentBackground
PasswordField.background = $fill.normal
PasswordField.placeholderForeground = @disabledForeground
PasswordField.iconTextGap = 4
PasswordField.echoChar = \u2022
@ -669,7 +672,7 @@ ScrollBar.largeBar.buttonBackground = $ScrollBar.track
#---- ScrollPane ----
ScrollPane.border = com.formdev.flatlaf.ui.FlatBorder
ScrollPane.border = null
ScrollPane.background = $ScrollBar.track
ScrollPane.fillUpperCorner = true
ScrollPane.smoothScrolling = true
@ -765,6 +768,8 @@ FormulaPane.buttonHeight=$Component.defaultHeight
SplitPane.dividerSize = 5
SplitPane.continuousLayout = true
SplitPane.border = null
# \u5F71\u54CD\u89C6\u89C9\u6548\u679C\uFF0C\u4E34\u65F6\u5148\u5173\u6389
SplitPane.supportsOneTouchButtons = false
SplitPane.centerOneTouchButtons = true
SplitPane.oneTouchButtonSize = {scaledInteger}6
SplitPane.oneTouchButtonOffset = {scaledInteger}2
@ -1294,3 +1299,6 @@ CellOtherSetPane.height=$Component.defaultHeight
toolbar.spacingInsets: 1,1,1,1; \
toolbar.hoverBackground: null; \
toolbar.pressedBackground: null
[style]Label.boldLabel = \
font: bold $defaultFont

7
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.cell.settingpane;
import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.icon.LazyIcon;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.expand.ExpandLeftFatherPane;
@ -53,9 +54,9 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
public JPanel createContentPane() {
String[] nameArray = {Toolkit.i18nText("Fine-Design_Report_ExpandD_Not_Expand"), Toolkit.i18nText("Fine-Design_Report_Utils_Top_To_Bottom"), Toolkit.i18nText("FIne-Design_Report_Utils_Left_To_Right")};
Icon[][] iconArray = {
{IOUtils.readIcon("/com/fr/design/images/expand/none16x16.png"), IOUtils.readIcon("/com/fr/design/images/expand/none16x16_selected@1x.png")},
{IOUtils.readIcon("/com/fr/design/images/expand/vertical.png"), IOUtils.readIcon("/com/fr/design/images/expand/vertical_selected@1x.png")},
{IOUtils.readIcon("/com/fr/design/images/expand/landspace.png"), IOUtils.readIcon("/com/fr/design/images/expand/landspace_selected@1x.png")}
{new LazyIcon("forbid"), new LazyIcon("forbid").white()},
{new LazyIcon("vertical_expand"), new LazyIcon("vertical_expand").white()},
{new LazyIcon("horizontal_expand"), new LazyIcon("horizontal_expand").white()}
};
Byte[] valueArray = {Constants.NONE, Constants.TOP_TO_BOTTOM, Constants.LEFT_TO_RIGHT};
expandDirectionButton = new UIButtonGroup<Byte>(iconArray, valueArray);

Loading…
Cancel
Save