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. 125
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java
  9. 288
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  10. 207
      designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java
  11. 122
      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. 18
      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("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"), 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 TOP_TOOLS = "topTools";
String BRAND_COLOR_LABEL = "brandColorLabel"; String BRAND_COLOR_LABEL = "brandColorLabel";
String BUTTON_TAB_ACTION = "tabAction"; String BUTTON_TAB_ACTION = "tabAction";
String LABEL_BOLD = "boldLabel";
String MENU_TOOL_BAR = "menuToolBar"; String MENU_TOOL_BAR = "menuToolBar";
String MENU_ITEM_TOOL_BAR = "menuItemToolBar"; 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; package com.fine.theme.utils;
import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.design.border.FineBorderFactory;
import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.OperatingSystem;
import com.fr.value.AtomicClearableLazyValue; import com.fr.value.AtomicClearableLazyValue;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.JLabel;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Composite; import java.awt.Composite;
@ -364,4 +366,14 @@ public class FineUIUtils {
return createPartRoundRectangle(x, y, width, height, 0, 0, arc, 0); 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; 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.impl.JDBCDatabaseConnection;
import com.fr.data.pool.DBCPConnectionPoolAttr; import com.fr.data.pool.DBCPConnectionPoolAttr;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.editor.IntegerEditor; import com.fr.design.editor.editor.IntegerEditor;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit; 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 com.fr.stable.StringUtils;
import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.FocusListener; 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 * @author xiqiu
* @date 2021/11/22 * @date 2021/11/22
* @description * @description
*/ */
public class AdvancePane extends BasicPane { public class AdvancePane extends BasicPane {
private IntegerEditor DBCP_MAX_ACTIVE = new IntegerEditor(); private final 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 final UIComboBox DBCP_TEST_ON_BORROW = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_No"),
private IntegerEditor DBCP_MAX_WAIT = new IntegerEditor(); Toolkit.i18nText("Fine-Design_Basic_Yes")});
private SpecialUITextField DBCP_VALIDATION_QUERY = new SpecialUITextField(); private final IntegerEditor DBCP_MAX_WAIT = new IntegerEditor();
private final SpecialUITextField DBCP_VALIDATION_QUERY = new SpecialUITextField();
public AdvancePane() { public AdvancePane() {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
DBCP_VALIDATION_QUERY.addFocusListener(new JTextFieldHintListener(DBCP_VALIDATION_QUERY)); DBCP_VALIDATION_QUERY.addFocusListener(new JTextFieldHintListener(DBCP_VALIDATION_QUERY));
double p = TableLayout.PREFERRED;
DBCP_VALIDATION_QUERY.setColumns(20); DBCP_VALIDATION_QUERY.setColumns(20);
double[] rowSizeDbcp = {p, p, p, p}; this.setLayout(new BorderLayout());
double[] columnDbcp = {190, p}; this.add(Layouts.column(LayoutConstants.VERTICAL_GAP,
Component[][] comps = { cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Advanced"))).with(FineUIUtils::wrapBoldLabelWithUnderline),
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Active") + ":", SwingConstants.RIGHT), DBCP_MAX_ACTIVE}, row(
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Validation_Query") + ":", SwingConstants.RIGHT), DBCP_VALIDATION_QUERY}, cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Active"), SwingConstants.LEFT)).weight(1),
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Borrow") + ":", SwingConstants.RIGHT), DBCP_TESTONBORROW}, cell(DBCP_MAX_ACTIVE).weight(1.5),
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Max_Wait_Time") + ":", SwingConstants.RIGHT), DBCP_MAX_WAIT} flex(2)
}; ),
row(
JPanel contextPane = TableLayoutHelper.createGapTableLayoutPane(comps, rowSizeDbcp, columnDbcp, 11, 11); cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Validation_Query"), SwingConstants.LEFT)).weight(1),
jPanel.add(contextPane, BorderLayout.CENTER); cell(DBCP_VALIDATION_QUERY).weight(1.5),
this.add(jPanel); 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_ACTIVE.setValue(dbcpAttr.getMaxActive());
this.DBCP_MAX_WAIT.setValue(dbcpAttr.getMaxWait()); this.DBCP_MAX_WAIT.setValue(dbcpAttr.getMaxWait());
this.DBCP_VALIDATION_QUERY.setText(dbcpAttr.getValidationQuery()); 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.setMaxActive(this.DBCP_MAX_ACTIVE.getValue().intValue());
dbcpAttr.setMaxWait(this.DBCP_MAX_WAIT.getValue().intValue()); dbcpAttr.setMaxWait(this.DBCP_MAX_WAIT.getValue().intValue());
dbcpAttr.setValidationQuery(this.DBCP_VALIDATION_QUERY.getText()); 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 @Override
@ -84,8 +98,8 @@ public class AdvancePane extends BasicPane {
} }
private class JTextFieldHintListener implements FocusListener { private static class JTextFieldHintListener implements FocusListener {
private SpecialUITextField textField; private final SpecialUITextField textField;
public JTextFieldHintListener(SpecialUITextField jTextField) { public JTextFieldHintListener(SpecialUITextField jTextField) {
this.textField = 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 @Override
public String getText() { 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) { public void populate(ConnectionConfig datasourceManager) {
// this.connectionTextField.setText(WorkContext.getCurrent().getPath() + File.separator + ProjectConstants.RESOURCES_NAME
// + File.separator + datasourceManager.fileName());
this.connectionListPane.populate(datasourceManager); 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; 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.core.db.dialect.DialectFactory;
import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.pool.DBCPConnectionPoolAttr; import com.fr.data.pool.DBCPConnectionPoolAttr;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.editor.IntegerEditor; 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.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit; 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.general.ComparatorUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.SwingConstants;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Window; import java.awt.Window;
import java.awt.event.InputMethodEvent; import java.awt.event.InputMethodEvent;
import java.awt.event.InputMethodListener; import java.awt.event.InputMethodListener;
@ -36,6 +34,10 @@ import java.util.Optional;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; 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 class DBCPAttrPane extends BasicPane {
public static final int TIME_MULTIPLE = 1000; public static final int TIME_MULTIPLE = 1000;
private static final Pattern FETCHSIZE_PATTERN = Pattern.compile("^0$|^[1-9][\\d]*[\\d]*$");; private static final Pattern FETCHSIZE_PATTERN = Pattern.compile("^0$|^[1-9][\\d]*[\\d]*$");;
@ -70,37 +72,44 @@ public class DBCPAttrPane extends BasicPane {
} }
public DBCPAttrPane() { 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 // JPanel northFlowPane
northFlowPane = FRGUIPaneFactory.createTopVerticalTitledBorderPane(Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr")); northFlowPane = Layouts.column(LayoutConstants.VERTICAL_GAP,
northFlowPane.setPreferredSize(new Dimension(630, 330)); cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr"))).with(FineUIUtils::wrapBoldLabelWithUnderline),
defaultPane.add(northFlowPane, BorderLayout.NORTH); row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Initial_Size"))).weight(1),
// ContextPane cell(DBCP_INITIAL_SIZE).weight(1), flex(1.2)
),
double f = TableLayout.FILL; row(
// double p = TableLayout.PREFERRED; cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Min_Idle"))).weight(1),
double[] rowSize = {f, f, f, f, f, f, f}; cell(DBCP_MIN_IDLE).weight(1), flex(1.2)
double[] columnSize = {f, f}; ),
Component[][] comps = { row(
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Initial_Size") + ":", SwingConstants.RIGHT), DBCP_INITIAL_SIZE}, cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Return"))).weight(1),
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Min_Idle") + ":", SwingConstants.RIGHT), DBCP_MIN_IDLE}, cell(DBCP_TESTONRETURN).weight(1), flex(1.2)
{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}, row(
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Evictionruns_millis") + ":", SwingConstants.RIGHT), cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_While_Idle"))).weight(1),
DBCP_TIMEBETWEENEVICTIONRUNSMILLS}, cell(DBCP_TESTWHILEIDLE).weight(1), flex(1.2)
{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), row(
DBCP_MINEVICTABLEIDLETIMEMILLIS}}; cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Evictionruns_millis"))).weight(1),
cell(DBCP_TIMEBETWEENEVICTIONRUNSMILLS).weight(1), flex(1.2)
JPanel contextPane = TableLayoutHelper.createGapTableLayoutPane(comps, rowSize, columnSize, 10, 10); ),
northFlowPane.add(contextPane); row(
JPanel boxFlowInnerContainer = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(0, 5, 5); cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Num_Test_Per_Evction_Run"))).weight(1),
UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Dbcp_Warning")); cell(DBCP_NUMTESTSPEREVICTIONRUN).weight(1), flex(1.2)
uiLabel.setForeground(Color.RED); ),
boxFlowInnerContainer.add(uiLabel); row(
northFlowPane.add(boxFlowInnerContainer); 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) { public void populate(JDBCDatabaseConnection jdbcDatabase) {
@ -188,24 +197,19 @@ public class DBCPAttrPane extends BasicPane {
public BasicDialog showWindow(Window window) { public BasicDialog showWindow(Window window) {
String databaseName = JDBCConnectionDef.getInstance().getDatabaseName(); String databaseName = JDBCConnectionDef.getInstance().getDatabaseName();
if (showOtherConfig(databaseName)) { 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.addKeyListener(fetchSizeKeyListener);
FETCHSIZE.addInputMethodListener(fetchSizeInputMethodListener); FETCHSIZE.addInputMethodListener(fetchSizeInputMethodListener);
FETCHSIZE.setHorizontalAlignment(JTextField.RIGHT); 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.removeAll();
defaultPane.add(northFlowPane, BorderLayout.NORTH); defaultPane.add(northFlowPane);
defaultPane.add(southFlowPane, BorderLayout.SOUTH); defaultPane.add(southFlowPane);
} else { } else {
if (southFlowPane != null) { if (southFlowPane != null) {
defaultPane.remove(southFlowPane); defaultPane.remove(southFlowPane);

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

@ -3,6 +3,10 @@
*/ */
package com.fr.design.data.datapane.connect; 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.driver.util.JarFileParseUtil;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.data.impl.JDBCDatabaseConnection; 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.ClassNotFoundExceptionSolutionProcessor;
import com.fr.data.solution.processor.SolutionProcessor; import com.fr.data.solution.processor.SolutionProcessor;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane; 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.EncodeConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import org.jetbrains.annotations.NotNull;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
@ -62,6 +68,10 @@ import java.io.File;
import java.net.URI; import java.net.URI;
import java.util.concurrent.ExecutionException; 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. * Database Connection pane.
*/ */
@ -124,11 +134,11 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (hiddenPanel.isVisible()) { if (hiddenPanel.isVisible()) {
hiddenPanel.setVisible(false); 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")); detailLabel.setText(Toolkit.i18nText("Fine_Designer_Look_Detail"));
directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.right")); directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.right"));
} else { } else {
dialog.setSize(new Dimension(380, 270)); dialog.setSize(FineUIScale.scale(new Dimension(380, 270)));
hiddenPanel.setVisible(true); hiddenPanel.setVisible(true);
detailLabel.setText(Toolkit.i18nText("Fine_Designer_Hide_Detail")); detailLabel.setText(Toolkit.i18nText("Fine_Designer_Hide_Detail"));
directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.down")); directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.down"));
@ -222,70 +232,81 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
midPane = new JPanel(); midPane = new JPanel();
midPane.add(directUiLabel); midPane.add(directUiLabel);
midPane.add(detailLabel); midPane.add(detailLabel);
okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK")); okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK"));
cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel")); cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel"));
this.setLayout(FRGUIPaneFactory.createBorderLayout()); FineUIStyle.setStyle(okButton, FineUIStyle.STYLE_PRIMARY);
JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
UIScrollPane uiScrollPane = new UIScrollPane(northPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); 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); this.add(uiScrollPane, BorderLayout.CENTER);
// 按钮. // 按钮
JPanel testPane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); JPanel testButtonPane = initTestButtonPane();
northPane.add(testPane, BorderLayout.NORTH); corePane.add(testButtonPane);
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));
// Center // Center
mainPanel = mainPanel(); mainPanel = mainPanel();
JPanel advancedPanel = FRGUIPaneFactory.createTopVerticalTitledBorderPane(Toolkit.i18nText("Fine-Design_Basic_Advanced")); JPanel advancedPanel = Layouts.column(LayoutConstants.VERTICAL_GAP).getComponent();
if (mainPanel instanceof JDBCDefPane) { if (mainPanel instanceof JDBCDefPane) {
northPane.add(mainPanel, BorderLayout.CENTER); initJDBCLayout(corePane, advancedPanel);
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);
}
}
});
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 { } else {
//非jdbc配置布局保持不变 initJNDILayout(corePane, advancedPanel);
advancedPanel.setPreferredSize(new Dimension(MAX_MAIN_PANEL_WIDTH, 60)); }
if (mainPanel.getPreferredSize().height > MAX_MAIN_PANEL_HEIGHT || mainPanel.getPreferredSize().width > MAX_MAIN_PANEL_WIDTH) { corePane.add(advancedPanel);
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)); @NotNull
northPane.add(jp, BorderLayout.CENTER); private JPanel initTestButtonPane() {
} else { JPanel testPane = new JPanel(new BorderLayout());
mainPanel.setPreferredSize(new Dimension(MAX_MAIN_PANEL_WIDTH, MAX_MAIN_PANEL_HEIGHT)); UIButton testButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Datasource_Test_Connection"));
northPane.add(mainPanel, BorderLayout.CENTER); 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));
JPanel chartSetPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2);
chartSetPane.add(GUICoreUtils.createNamedPane(charSetComboBox, Toolkit.i18nText("Fine-Design_Basic_Datasource_Charset") + ":"));
advancedPanel.add(chartSetPane);
}
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);
} }
// ChartSet });
String[] defaultEncode = new String[]{Toolkit.i18nText("Fine-Design_Encode_Auto")}; JPanel advancePane = getAdvancePane();
charSetComboBox = new UIComboBox(ArrayUtils.addAll(defaultEncode, EncodeConstants.ENCODING_ARRAY)); if (advancePane != null) {
JPanel chartSetPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2); advancedPanel.add(advancePane);
chartSetPane.add(GUICoreUtils.createNamedPane(charSetComboBox, Toolkit.i18nText("Fine-Design_Basic_Datasource_Charset") + ":"));
advancedPanel.add(chartSetPane);
} }
northPane.add(advancedPanel); advancedPanel.add(
row(cell(actionLabel),flex()).getComponent());
corePane.add(getSshPane());
corePane.add(getSslPane());
} }
private JDialog createJDialog() { 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() { private void initDialogPane() {

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

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

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

@ -1,5 +1,8 @@
package com.fr.design.data.datapane.connect; 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.impl.JDBCDatabaseConnection;
import com.fr.data.security.ssh.BaseSsh; import com.fr.data.security.ssh.BaseSsh;
import com.fr.data.security.ssh.Ssh; 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.KeyVerifySsh;
import com.fr.data.security.ssh.impl.NormalSsh; import com.fr.data.security.ssh.impl.NormalSsh;
import com.fr.data.security.ssl.SslUtils; import com.fr.data.security.ssl.SslUtils;
import com.fr.design.border.UITitledBorder; import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.editor.NotNegativeIntegerEditor; 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.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; 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.ipasswordfield.UIPasswordFieldWithFixedLength;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit; 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.FILE;
import com.fr.file.FILEChooserPane; import com.fr.file.FILEChooserPane;
import com.fr.file.filter.ChooseFileFilter; import com.fr.file.filter.ChooseFileFilter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.guava.collect.HashBiMap; import com.fr.third.guava.collect.HashBiMap;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.JPasswordField; import javax.swing.JPasswordField;
import javax.swing.SwingConstants;
import java.awt.BorderLayout; 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.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; 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; import static com.fr.design.i18n.Toolkit.i18nText;
/** /**
@ -58,114 +54,135 @@ public class SshPane extends BasicPane {
typeMap.put(Toolkit.i18nText("Fine-Design_Basic_Ssh_Public_Key"), SshType.KEY); typeMap.put(Toolkit.i18nText("Fine-Design_Basic_Ssh_Public_Key"), SshType.KEY);
} }
private UICheckBox usingSsh = new UICheckBox(i18nText("Fine-Design_Basic_Ssh_Using")); private final UICheckBox usingSsh = new UICheckBox(i18nText("Fine-Design_Basic_Ssh_Using"));
private NotNegativeIntegerEditor port = new NotNegativeIntegerEditor(20); private final NotNegativeIntegerEditor port = new NotNegativeIntegerEditor(20);
private UITextField ip = new UITextField(20); private final UITextField ip = new UITextField(20);
private UIComboBox type = new UIComboBox(); private final UIComboBox type = new UIComboBox();
private UITextField user = new UITextField(20); private final UITextField user = new UITextField(20);
private JPasswordField password = new UIPasswordFieldWithFixedLength(20); private final JPasswordField password = new UIPasswordFieldWithFixedLength(20);
private JPasswordField secret = new UIPasswordFieldWithFixedLength(20); private final JPasswordField secret = new UIPasswordFieldWithFixedLength(20);
private KeyFileUITextField keyPath = new KeyFileUITextField(18); private final KeyFileUITextField keyPath = new KeyFileUITextField(18);
private JPanel contextPane; private ReactiveCardPane coreCardPane;
private Component[][] passwordComps; private ReactiveCardPane verifyCardPane;
private Component[][] keyComps; private final UIButton fileChooserButton = new UIButton();
private double p = TableLayout.PREFERRED;
private double f = TableLayout.FILL; private static final String USE_SSH = "useSSH";
private JPanel jPanel; private static final String NOT_USE_SSH = "notUseSSH";
private UIButton fileChooserButton = new UIButton(); private static final String USE_PASSWORD = "usePassword";
private double[] columnSize = new double[]{195, p}; private static final String USE_KEY = "useKey";
public SshPane() { public SshPane() {
fileChooserButton.setIcon(new ImageIcon(UIConstants.ACCESSIBLE_EDITOR_DOT)); this.setLayout(new BorderLayout());
this.setBorder(UITitledBorder.createBorderWithTitle(Toolkit.i18nText("Fine-Design_Basic_Ssh_Settings")));
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); fileChooserButton.setIcon(new LazyIcon("dot"));
typeMap.keySet().forEach(key -> type.addItem(key)); typeMap.keySet().forEach(key -> type.addItem(key));
type.setSelectedItem(typeMap.inverse().get(SshType.KEY)); type.setSelectedItem(typeMap.inverse().get(SshType.KEY));
jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
fileChooserButton.setPreferredSize(new Dimension(20, 20));
type.setEditable(false); type.setEditable(false);
type.setSelectedItem(Toolkit.i18nText("Fine-Design_Basic_Ssh_Private_Key")); 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() { initVerifyCardPane();
@Override initCoreCardPane();
public void actionPerformed(ActionEvent e) {
changePaneForType(); initListeners();
}
}); this.add(Layouts.column(LayoutConstants.VERTICAL_GAP,
fileChooserButton.addActionListener(new ActionListener() { cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssh_Settings"))).with(FineUIUtils::wrapBoldLabelWithUnderline),
@Override cell(coreCardPane)
public void actionPerformed(ActionEvent e) { ).getComponent());
FILEChooserPane fileChooser = FILEChooserPane.getInstanceWithDesignatePath(SslUtils.PREFIX, new ChooseFileFilter(true), SslUtils.CERTIFICATES); }
int type = fileChooser.showOpenDialog(SshPane.this, StringUtils.EMPTY);
if (type == FILEChooserPane.OK_OPTION) { private void initListeners() {
final FILE file = fileChooser.getSelectedFILE(); usingSsh.addActionListener(e -> changePane());
if (file == null) {
keyPath.setText(StringUtils.EMPTY); type.addActionListener(e -> changePaneForType());
} else { fileChooserButton.addActionListener(e -> {
keyPath.setText(file.getPath()); FILEChooserPane fileChooser = FILEChooserPane.getInstanceWithDesignatePath(SslUtils.PREFIX, new ChooseFileFilter(true), SslUtils.CERTIFICATES);
} int type = fileChooser.showOpenDialog(SshPane.this, StringUtils.EMPTY);
if (type == FILEChooserPane.OK_OPTION) {
final FILE file = fileChooser.getSelectedFILE();
if (file == null) {
keyPath.setText(StringUtils.EMPTY);
} else {
keyPath.setText(file.getPath());
} }
fileChooser.removeAllFilter();
fileChooser.removeTopPath();
} }
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() { private void changePane() {
contextPane.setVisible(usingSsh.isSelected()); coreCardPane.select(usingSsh.isSelected() ? USE_SSH: NOT_USE_SSH).populate();
} }
private void changePaneForType() { private void changePaneForType() {
contextPane.removeAll();
switch (typeMap.get(type.getSelectedItem())) { switch (typeMap.get(type.getSelectedItem())) {
case NORMAL: case NORMAL:
TableLayoutHelper.addComponent2ResultPane(passwordComps, new double[]{p, p, p, p, p}, columnSize, contextPane); verifyCardPane.select(USE_PASSWORD).populate();
break; break;
case KEY: case KEY:
TableLayoutHelper.addComponent2ResultPane(keyComps, new double[]{p, p, p, p, p, p}, columnSize, contextPane); verifyCardPane.select(USE_KEY).populate();
break; break;
default: default:
throw new SshException("un support ssh type"); throw new SshException("un support ssh type");
} }
jPanel.revalidate();
jPanel.repaint();
} }

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

@ -1,37 +1,36 @@
package com.fr.design.data.datapane.connect; 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.impl.JDBCDatabaseConnection;
import com.fr.data.security.ssl.Ssl; import com.fr.data.security.ssl.Ssl;
import com.fr.data.security.ssl.SslException; import com.fr.data.security.ssl.SslException;
import com.fr.data.security.ssl.SslType; import com.fr.data.security.ssl.SslType;
import com.fr.data.security.ssl.SslUtils; import com.fr.data.security.ssl.SslUtils;
import com.fr.data.security.ssl.impl.NormalSsl; import com.fr.data.security.ssl.impl.NormalSsl;
import com.fr.design.border.UITitledBorder; import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.datapane.connect.SshPane.KeyFileUITextField; import com.fr.design.data.datapane.connect.SshPane.KeyFileUITextField;
import com.fr.design.dialog.BasicPane; 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.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit; 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.FILE;
import com.fr.file.FILEChooserPane; import com.fr.file.FILEChooserPane;
import com.fr.file.filter.ChooseFileFilter; import com.fr.file.filter.ChooseFileFilter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; 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; 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 { public class SslPane extends BasicPane {
UICheckBox usingSsl = new UICheckBox(i18nText("Fine-Design_Basic_Ssl_Using")); UICheckBox usingSsl = new UICheckBox(i18nText("Fine-Design_Basic_Ssl_Using"));
private KeyFileUITextField keyPathCa = new KeyFileUITextField(18); private final KeyFileUITextField keyPathCa = new KeyFileUITextField(18);
private UIButton fileChooserButtonCa = new UIButton(); private final UIButton fileChooserButtonCa = new UIButton();
private KeyFileUITextField keyPathClientCert = new KeyFileUITextField(18); private final KeyFileUITextField keyPathClientCert = new KeyFileUITextField(18);
private UIButton fileChooserButtonClientCert = new UIButton(); private final UIButton fileChooserButtonClientCert = new UIButton();
private KeyFileUITextField keyPathClientKey = new KeyFileUITextField(18); private final KeyFileUITextField keyPathClientKey = new KeyFileUITextField(18);
private UIButton fileChooserButtonClientKey = new UIButton(); private final UIButton fileChooserButtonClientKey = new UIButton();
private UICheckBox verifyCa = new UICheckBox(i18nText("Fine-Design_Basic_Ssl_Verify_Ca")); private final UICheckBox verifyCa = new UICheckBox(i18nText("Fine-Design_Basic_Ssl_Verify_Ca"));
// private UITextField cipher = new UITextField(20); private final ReactiveCardPane cardPane;
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};
public SslPane() { public SslPane() {
fileChooserButtonCa.setIcon(new ImageIcon(UIConstants.ACCESSIBLE_EDITOR_DOT)); initDotButtons();
fileChooserButtonClientCert.setIcon(new ImageIcon(UIConstants.ACCESSIBLE_EDITOR_DOT)); this.setLayout(new BorderLayout());
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
};
usingSsl.setSelected(true); usingSsl.setSelected(true);
contextPane = TableLayoutHelper.createGapTableLayoutPane(usingComps, new double[]{p, p, p, p}, columnSize, 11, 11); cardPane = ReactiveCardPane.create()
jPanel.add(usingSsl, BorderLayout.NORTH); .addSupplier("notUseSSL", () -> cell(usingSsl).getComponent())
jPanel.add(contextPane, BorderLayout.CENTER); .addSupplier("useSSL", () -> Layouts.column(LayoutConstants.VERTICAL_GAP,
this.add(jPanel); cell(usingSsl),
usingSsl.addActionListener(new ActionListener() { row(
@Override cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Ca"), SwingConstants.LEFT)).weight(1),
public void actionPerformed(ActionEvent e) { cell(keyPathCa).weight(1.3),
changePane(); 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)); fileChooserButtonCa.addActionListener(new TextFieldActionListener(keyPathCa));
fileChooserButtonClientCert.addActionListener(new TextFieldActionListener(keyPathClientCert)); fileChooserButtonClientCert.addActionListener(new TextFieldActionListener(keyPathClientCert));
fileChooserButtonClientKey.addActionListener(new TextFieldActionListener(keyPathClientKey)); fileChooserButtonClientKey.addActionListener(new TextFieldActionListener(keyPathClientKey));
} }
private void changePane() { 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()); keyPathClientCert.setText(normalSsl.getClientCertificate());
keyPathClientKey.setText(normalSsl.getClientPrivateKey()); keyPathClientKey.setText(normalSsl.getClientPrivateKey());
verifyCa.setSelected(normalSsl.isVerifyCa()); verifyCa.setSelected(normalSsl.isVerifyCa());
// cipher.setText(normalSsl.getCipher());
} else { } else {
throw new SslException("un support ssl type"); throw new SslException("un support ssl type");
} }
@ -130,7 +129,6 @@ public class SslPane extends BasicPane {
public void update(JDBCDatabaseConnection jdbcDatabase) { public void update(JDBCDatabaseConnection jdbcDatabase) {
NormalSsl normalSsl = new NormalSsl(); NormalSsl normalSsl = new NormalSsl();
// normalSsl.setCipher(cipher.getText().trim());
normalSsl.setVerifyCa(verifyCa.isSelected()); normalSsl.setVerifyCa(verifyCa.isSelected());
normalSsl.setCaCertificate(keyPathCa.getText().trim()); normalSsl.setCaCertificate(keyPathCa.getText().trim());
normalSsl.setClientCertificate(keyPathClientCert.getText().trim()); normalSsl.setClientCertificate(keyPathClientCert.getText().trim());
@ -140,7 +138,7 @@ public class SslPane extends BasicPane {
} }
private class TextFieldActionListener implements ActionListener { private class TextFieldActionListener implements ActionListener {
private UITextField textField; private final UITextField textField;
public TextFieldActionListener(UITextField textField) { public TextFieldActionListener(UITextField textField) {
this.textField = 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.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder; import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
@ -1361,7 +1362,9 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
private JPanel createNamePane(String name, JComponent comp) { private JPanel createNamePane(String name, JComponent comp) {
JPanel namePane = new JPanel(new BorderLayout(0, 4)); 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); namePane.add(comp, BorderLayout.CENTER);
return namePane; 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; 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.dialog.BasicPane;
import com.fr.design.gui.controlpane.shortcutfactory.AbstractShortCutFactory; import com.fr.design.gui.controlpane.shortcutfactory.AbstractShortCutFactory;
import com.fr.design.gui.controlpane.shortcutfactory.OldShortCutFactory; 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.gui.itoolbar.UIToolbar;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Filter; import com.fr.stable.Filter;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JSplitPane; import javax.swing.JSplitPane;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Color;
import java.util.Arrays; import java.util.Arrays;
import java.util.stream.Stream; import java.util.stream.Stream;
@ -107,7 +108,6 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S
initCardPane(); initCardPane();
// SplitPane // SplitPane
JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, getLeftPane(), cardPane); JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, getLeftPane(), cardPane);
mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor()));
mainSplitPane.setOneTouchExpandable(true); mainSplitPane.setOneTouchExpandable(true);
this.add(mainSplitPane, BorderLayout.CENTER); this.add(mainSplitPane, BorderLayout.CENTER);
@ -163,7 +163,8 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S
} }
initToolBar(); initToolBar();
toolBar.setBorder(FineBorderFactory.createUnderlineBorder(FlatUIUtils.getUIColor("defaultBorderColor", Color.GRAY)));
toolBar.setBorderPainted(true);
leftPane.add(toolBar, BorderLayout.NORTH); leftPane.add(toolBar, BorderLayout.NORTH);
return leftPane; 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; 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.beans.BasicBeanPane;
import com.fr.design.border.FineBorderFactory;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilist.JNameEdList; 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.design.utils.gui.GUICoreUtils;
import com.fr.form.event.Listener; import com.fr.form.event.Listener;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.invoke.Reflect; import com.fr.invoke.Reflect;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.BorderFactory;
import javax.swing.DefaultListModel; import javax.swing.DefaultListModel;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JLabel; import javax.swing.JLabel;
@ -87,8 +89,9 @@ public abstract class JListControlPane extends JControlPane implements ListContr
protected void initLeftPane(JPanel leftPane) { protected void initLeftPane(JPanel leftPane) {
nameableList = createJNameList(); nameableList = createJNameList();
nameableList.setName(LIST_NAME); nameableList.setName(LIST_NAME);
nameableList.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE));
leftPane.add(new UIScrollPane(nameableList), BorderLayout.CENTER); leftPane.add(new UIScrollPane(nameableList), BorderLayout.CENTER);
leftPane.setBorder(new FineRoundBorder());
nameableList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); nameableList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
nameableList.addMouseListener(listMouseListener); nameableList.addMouseListener(listMouseListener);
nameableList.addListSelectionListener(new ListSelectionListener() { 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() { protected JNameEdList createJNameList() {
JNameEdList nameEdList = new JNameEdList(new DefaultListModel()) { JNameEdList nameEdList = new JNameEdList(new DefaultListModel()) {
@Override @Override
@ -355,19 +364,17 @@ public abstract class JListControlPane extends JControlPane implements ListContr
/** /**
* JList默认单元格渲染器的选中背景色 * JList默认单元格渲染器的选中背景色
*/ */
private final Color selectedBgColor = new Color(65, 155, 249);
protected NameableListCellRenderer() { protected NameableListCellRenderer() {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
this.textLabel = new JLabel(); this.textLabel = new JLabel();
this.iconLabel = 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.textLabel, BorderLayout.CENTER);
add(this.iconLabel, BorderLayout.WEST); add(this.iconLabel, BorderLayout.WEST);
this.iconLabel.setBackground(Color.WHITE); this.iconLabel.setBackground(FlatUIUtils.getUIColor("List.cellRender.background", Color.WHITE));
//iconLabel和textLabel的背景颜色不会被JList背景颜色覆盖,开发者自定义 //iconLabel和textLabel的背景颜色不会被JList背景颜色覆盖,开发者自定义
this.textLabel.setOpaque(true); this.textLabel.setOpaque(true);
this.iconLabel.setOpaque(true); this.iconLabel.setOpaque(true);
this.setBorder(FineBorderFactory.createUnderlineBorder(FlatUIUtils.getUIColor("defaultBorderColor", Color.GRAY)));
} }
@Override @Override
@ -380,11 +387,9 @@ public abstract class JListControlPane extends JControlPane implements ListContr
this.textLabel.setText(nameable.getName()); this.textLabel.setText(nameable.getName());
boolean iconSet = false; boolean iconSet = false;
if(isSelected) { if(isSelected) {
this.textLabel.setBackground(selectedBgColor); this.textLabel.setBackground(FlatUIUtils.getUIColor("List.selectionInactiveBackground", Color.GRAY));
this.textLabel.setForeground(Color.WHITE);
} else { } else {
this.textLabel.setBackground(Color.WHITE); this.textLabel.setBackground(FlatUIUtils.getUIColor("List.cellRender.background", Color.WHITE));
this.textLabel.setForeground(Color.BLACK);
} }
for (NameableCreator creator : JListControlPane.this.creators()) { for (NameableCreator creator : JListControlPane.this.creators()) {
if (creator.menuIcon() != null && creator.acceptObject2Populate(nameable) != null) { if (creator.menuIcon() != null && creator.acceptObject2Populate(nameable) != null) {
@ -395,7 +400,7 @@ public abstract class JListControlPane extends JControlPane implements ListContr
} }
} }
if (!iconSet) { if (!iconSet) {
this.setIcon(IOUtils.readIcon("/com/fr/base/images/oem/cpt.png")); this.setIcon(new LazyIcon("cpt_icon"));
} }
} }
return this; 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; package com.fr.design.gui.ilable;
import com.formdev.flatlaf.ui.FlatUIUtils;
import javax.swing.event.MouseInputAdapter; import javax.swing.event.MouseInputAdapter;
import java.awt.Color; import java.awt.Color;
import java.awt.Cursor; import java.awt.Cursor;
@ -13,12 +15,12 @@ import java.awt.event.MouseEvent;
*/ */
public class ActionLabel extends UILabel { public class ActionLabel extends UILabel {
private ActionListener actionListener; private ActionListener actionListener;
private Color color; private final Color color;
// 文字是否有下划线 // 文字是否有下划线
private boolean drawUnderLine = true; private boolean drawUnderLine = true;
public ActionLabel(String text) { public ActionLabel(String text) {
this(text, Color.blue); this(text, FlatUIUtils.getUIColor("Label.hyperLinkColor", Color.BLUE));
} }
public ActionLabel(String text, boolean drawUnderLine) { 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 JPG_FILE_IMAGE_ICON = new LazyIcon("jpgFile");
public static final Icon BMP_FILE_IMAGE_ICON = new LazyIcon("bmpFile"); 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 MODERN_CHT_FILE_IMAGE_ICON = new LazyIcon("chtFile");
public static final Icon CPTX_ICON = new LazyIcon("cpt_icon");
// TODO: 以下Icon视觉暂未提供,需提供后替换 // TODO: 以下Icon视觉暂未提供,需提供后替换
public static final Icon BLANK_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/blank.gif"); 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 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 Icon CPTX_LOCKED_ICON = IconUtils.readIcon("/com/fr/design/standard/fileicon/cptx_icon_locked.svg");
public static final LockIcon FOLDER_LOCK_ICON = 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; package com.fr.design.mainframe;
import com.fine.theme.utils.FineUIScale;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
@ -16,6 +17,7 @@ import com.fr.stable.Constants;
public class WestRegionContainerPane extends UIResizableContainer { public class WestRegionContainerPane extends UIResizableContainer {
private static WestRegionContainerPane THIS; private static WestRegionContainerPane THIS;
private static final int WEST_CONTAINER_WIDTH = 165;
/** /**
* 得到实例 * 得到实例
@ -56,7 +58,6 @@ public class WestRegionContainerPane extends UIResizableContainer {
} }
}); });
setContainerWidth(165); setContainerWidth(FineUIScale.scale(WEST_CONTAINER_WIDTH));
// setBackground(UIConstants.TREE_BACKGROUND);
} }
} }

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

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

@ -399,6 +399,9 @@ FormattedTextField.iconTextGap = 4
# ---- Label ---- # ---- Label ----
Label.tipColor = @BrandTipColor Label.tipColor = @BrandTipColor
Label.borderColor = $defaultBorderColor
Label.hyperLinkColor = #2576EF
Label.strongHintColor = #FF0000
#---- HelpButton ---- #---- HelpButton ----
@ -421,8 +424,8 @@ HelpButton.innerFocusWidth = $?Button.innerFocusWidth
#---- List ---- #---- List ----
List.border = 2,2,2,2 List.border = 0,0,0,0
List.cellMargins = 1,6,1,6 List.cellMargins = 1,12,1,12
List.selectionInsets = 0,0,0,0 List.selectionInsets = 0,0,0,0
List.selectionArc = 0 List.selectionArc = 0
List.cellFocusColor = @cellFocusColor List.cellFocusColor = @cellFocusColor
@ -540,7 +543,7 @@ PasswordField.capsLockIconColor = #00000064
PasswordField.revealIconColor = tint(@foreground,40%) PasswordField.revealIconColor = tint(@foreground,40%)
PasswordField.border = com.formdev.flatlaf.ui.FlatTextBorder PasswordField.border = com.formdev.flatlaf.ui.FlatTextBorder
PasswordField.margin = @componentMargin PasswordField.margin = @componentMargin
PasswordField.background = @componentBackground PasswordField.background = $fill.normal
PasswordField.placeholderForeground = @disabledForeground PasswordField.placeholderForeground = @disabledForeground
PasswordField.iconTextGap = 4 PasswordField.iconTextGap = 4
PasswordField.echoChar = \u2022 PasswordField.echoChar = \u2022
@ -669,7 +672,7 @@ ScrollBar.largeBar.buttonBackground = $ScrollBar.track
#---- ScrollPane ---- #---- ScrollPane ----
ScrollPane.border = com.formdev.flatlaf.ui.FlatBorder ScrollPane.border = null
ScrollPane.background = $ScrollBar.track ScrollPane.background = $ScrollBar.track
ScrollPane.fillUpperCorner = true ScrollPane.fillUpperCorner = true
ScrollPane.smoothScrolling = true ScrollPane.smoothScrolling = true
@ -765,6 +768,8 @@ FormulaPane.buttonHeight=$Component.defaultHeight
SplitPane.dividerSize = 5 SplitPane.dividerSize = 5
SplitPane.continuousLayout = true SplitPane.continuousLayout = true
SplitPane.border = null SplitPane.border = null
# \u5F71\u54CD\u89C6\u89C9\u6548\u679C\uFF0C\u4E34\u65F6\u5148\u5173\u6389
SplitPane.supportsOneTouchButtons = false
SplitPane.centerOneTouchButtons = true SplitPane.centerOneTouchButtons = true
SplitPane.oneTouchButtonSize = {scaledInteger}6 SplitPane.oneTouchButtonSize = {scaledInteger}6
SplitPane.oneTouchButtonOffset = {scaledInteger}2 SplitPane.oneTouchButtonOffset = {scaledInteger}2
@ -1293,4 +1298,7 @@ CellOtherSetPane.height=$Component.defaultHeight
toolbar.margin: 1,1,1,1; \ toolbar.margin: 1,1,1,1; \
toolbar.spacingInsets: 1,1,1,1; \ toolbar.spacingInsets: 1,1,1,1; \
toolbar.hoverBackground: null; \ toolbar.hoverBackground: null; \
toolbar.pressedBackground: 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; package com.fr.design.mainframe.cell.settingpane;
import com.fine.swing.ui.layout.Layouts; import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.icon.LazyIcon;
import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.expand.ExpandLeftFatherPane; import com.fr.design.expand.ExpandLeftFatherPane;
@ -53,9 +54,9 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
public JPanel createContentPane() { 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")}; 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 = { Icon[][] iconArray = {
{IOUtils.readIcon("/com/fr/design/images/expand/none16x16.png"), IOUtils.readIcon("/com/fr/design/images/expand/none16x16_selected@1x.png")}, {new LazyIcon("forbid"), new LazyIcon("forbid").white()},
{IOUtils.readIcon("/com/fr/design/images/expand/vertical.png"), IOUtils.readIcon("/com/fr/design/images/expand/vertical_selected@1x.png")}, {new LazyIcon("vertical_expand"), new LazyIcon("vertical_expand").white()},
{IOUtils.readIcon("/com/fr/design/images/expand/landspace.png"), IOUtils.readIcon("/com/fr/design/images/expand/landspace_selected@1x.png")} {new LazyIcon("horizontal_expand"), new LazyIcon("horizontal_expand").white()}
}; };
Byte[] valueArray = {Constants.NONE, Constants.TOP_TO_BOTTOM, Constants.LEFT_TO_RIGHT}; Byte[] valueArray = {Constants.NONE, Constants.TOP_TO_BOTTOM, Constants.LEFT_TO_RIGHT};
expandDirectionButton = new UIButtonGroup<Byte>(iconArray, valueArray); expandDirectionButton = new UIButtonGroup<Byte>(iconArray, valueArray);

Loading…
Cancel
Save