Browse Source

Merge remote-tracking branch 'origin/fbp/feature' into fbp/feature

fbp/research
Destiny.Lin 4 months ago
parent
commit
9f831ae9f4
  1. 107
      designer-base/src/main/java/com/fine/theme/light/ui/FineOptionPaneUI.java
  2. 11
      designer-base/src/main/java/com/fine/theme/light/ui/FineToggleButtonUI.java
  3. 1
      designer-base/src/main/java/com/fine/theme/utils/FineClientProperties.java
  4. 12
      designer-base/src/main/java/com/fine/theme/utils/FineUIScale.java
  5. 2
      designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java
  6. 23
      designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java
  7. 3
      designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java
  8. 9
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  9. 20
      designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java
  10. 5
      designer-base/src/main/java/com/fr/design/backup/DesignContext.java
  11. 28
      designer-base/src/main/java/com/fr/design/components/notification/NotificationDialog.java
  12. 4
      designer-base/src/main/java/com/fr/design/condition/DSColumnLiteConditionPane.java
  13. 7
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  14. 8
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  15. 4
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataCreatorProducer.java
  16. 16
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  17. 3
      designer-base/src/main/java/com/fr/design/data/datapane/connect/AdvancePane.java
  18. 21
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  19. 2
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java
  20. 42
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java
  21. 9
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java
  22. 38
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  23. 8
      designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java
  24. 1
      designer-base/src/main/java/com/fr/design/data/datapane/management/search/pane/FineSearchPane.java
  25. 2
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  26. 1
      designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java
  27. 12
      designer-base/src/main/java/com/fr/design/data/tabledata/LocalTableDataSource.java
  28. 17
      designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataJSBridge.java
  29. 40
      designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataPane.java
  30. 1
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java
  31. 1
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  32. 12
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java
  33. 24
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java
  34. 10
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java
  35. 4
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java
  36. 14
      designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java
  37. 115
      designer-base/src/main/java/com/fr/design/dialog/FineJOptionPane.java
  38. 2
      designer-base/src/main/java/com/fr/design/dialog/TipDialog.java
  39. 35
      designer-base/src/main/java/com/fr/design/dialog/UIDetailErrorLinkDialog.java
  40. 2
      designer-base/src/main/java/com/fr/design/editor/ValueEditorPane.java
  41. 36
      designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java
  42. 2
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java
  43. 44
      designer-base/src/main/java/com/fr/design/formula/DefaultTinyFormulaPane.java
  44. 5
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  45. 12
      designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java
  46. 12
      designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java
  47. 4
      designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneHelper.java
  48. 3
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java
  49. 18
      designer-base/src/main/java/com/fr/design/gui/controlpane/UISimpleListControlPane.java
  50. 2
      designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java
  51. 4
      designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java
  52. 6
      designer-base/src/main/java/com/fr/design/gui/frpane/ClosableBubbleFloatPane.java
  53. 48
      designer-base/src/main/java/com/fr/design/gui/frpane/FineTabbedPane.java
  54. 3
      designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPane.java
  55. 53
      designer-base/src/main/java/com/fr/design/gui/ibutton/FitUIButtonGroup.java
  56. 9
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java
  57. 16
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java
  58. 2
      designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java
  59. 15
      designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java
  60. 2
      designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java
  61. 127
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java
  62. 2
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java
  63. 11
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java
  64. 3
      designer-base/src/main/java/com/fr/design/gui/itooltip/MultiLineToolTip.java
  65. 14
      designer-base/src/main/java/com/fr/design/gui/style/FollowingThemePane.java
  66. 3
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java
  67. 6
      designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperNorthPane.java
  68. 7
      designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java
  69. 4
      designer-base/src/main/java/com/fr/design/hyperlink/WebHyperNorthPane.java
  70. 5
      designer-base/src/main/java/com/fr/design/javascript/EmailPane.java
  71. 13
      designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java
  72. 1
      designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java
  73. 27
      designer-base/src/main/java/com/fr/design/lock/LockInfoDialog.java
  74. 26
      designer-base/src/main/java/com/fr/design/mainframe/DecodeDialog.java
  75. 1
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  76. 3
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  77. 13
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  78. 3
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java
  79. 13
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeDialog.java
  80. 6
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java
  81. 3
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartFontPane.java
  82. 1
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartSeriesStylePane.java
  83. 3
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecycleSettingPane.java
  84. 5
      designer-base/src/main/java/com/fr/design/parameter/ParameterInputPane.java
  85. 18
      designer-base/src/main/java/com/fr/design/parameter/ParameterPane.java
  86. 3
      designer-base/src/main/java/com/fr/design/remote/button/IconButton.java
  87. 21
      designer-base/src/main/java/com/fr/design/remote/ui/AbstractListControlPane.java
  88. 36
      designer-base/src/main/java/com/fr/design/remote/ui/AbstractManagerPane.java
  89. 13
      designer-base/src/main/java/com/fr/design/remote/ui/AuthorityEditorPane.java
  90. 3
      designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListCustomRolePane.java
  91. 3
      designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListUserPane.java
  92. 9
      designer-base/src/main/java/com/fr/design/remote/ui/AuthorityManagerPane.java
  93. 37
      designer-base/src/main/java/com/fr/design/remote/ui/CustomRoleManagerPane.java
  94. 36
      designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java
  95. 15
      designer-base/src/main/java/com/fr/design/remote/ui/list/AddedMemberListCellRender.java
  96. 21
      designer-base/src/main/java/com/fr/design/remote/ui/list/AddingMemberListCellRender.java
  97. 5
      designer-base/src/main/java/com/fr/design/remote/ui/list/AuthorityListCellRenderer.java
  98. 3
      designer-base/src/main/java/com/fr/design/remote/ui/list/cell/AddedCustomRoleListCellRender.java
  99. 3
      designer-base/src/main/java/com/fr/design/remote/ui/list/cell/AddedUserListCellRender.java
  100. 3
      designer-base/src/main/java/com/fr/design/remote/ui/list/cell/AddingCustomRoleListCellRender.java
  101. Some files were not shown because too many files have changed in this diff Show More

107
designer-base/src/main/java/com/fine/theme/light/ui/FineOptionPaneUI.java

@ -1,14 +1,33 @@
package com.fine.theme.light.ui;
import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.ui.FlatOptionPaneUI;
import com.fr.design.gui.ilable.UILabel;
import sun.swing.DefaultLookup;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.plaf.ComponentUI;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.flex;
import static com.fine.swing.ui.layout.Layouts.row;
/**
* @author Renekton
@ -35,4 +54,92 @@ public class FineOptionPaneUI extends FlatOptionPaneUI {
}
}
}
protected void installComponents() {
optionPane.setLayout(new BorderLayout());
optionPane.add(createMessageArea());
optionPane.add(createButtonArea(), BorderLayout.SOUTH);
optionPane.applyComponentOrientation(optionPane.getComponentOrientation());
}
protected Container createMessageArea() {
JPanel top = new JPanel();
Border topBorder = (Border) DefaultLookup.get(optionPane, this,
"OptionPane.messageAreaBorder");
if (topBorder != null) {
top.setBorder(topBorder);
}
top.setLayout(new BorderLayout());
/* Fill the body. */
Container body = new JPanel(new GridBagLayout());
Container realBody = new JPanel(new BorderLayout());
body.setName("OptionPane.body");
realBody.setName("OptionPane.realBody");
realBody.add(body, BorderLayout.NORTH);
GridBagConstraints cons = new GridBagConstraints();
cons.gridx = cons.gridy = 0;
cons.gridwidth = GridBagConstraints.REMAINDER;
cons.gridheight = 1;
cons.anchor = DefaultLookup.getInt(optionPane, this,
"OptionPane.messageAnchor", GridBagConstraints.CENTER);
cons.insets = new Insets(0,0,3,0);
addMessageComponents(body, cons, getMessage(),
getMaxCharactersPerLineCount(), false);
top.add(realBody, BorderLayout.CENTER);
addIcon(top);
top.setAlignmentX(Component.CENTER_ALIGNMENT);
return row(flex(), column(flex(), cell(top), flex()), flex()).getComponent();
}
@Override
protected void addIcon(Container top) {
Icon sideIcon = getIcon();
if (sideIcon != null) {
UILabel iconLabel = new UILabel(sideIcon);
iconLabel.setName("OptionPane.iconLabel");
iconLabel.setVerticalAlignment(SwingConstants.TOP);
top.add(row(cell(iconLabel), Layouts.fix(10)).getComponent(), BorderLayout.BEFORE_LINE_BEGINS);
}
}
@Override
protected Icon getIconForType(int messageType) {
String iconId = null;
switch (messageType) {
case 0:
iconId = "error";
break;
case 1:
iconId = "information";
break;
case 2:
iconId = "warning";
break;
case 3:
iconId = "question";
break;
default:
break;
}
if (iconId != null) {
return new LazyIcon(iconId, 20);
}
return null;
}
public Dimension getPreferredSize(JComponent c) {
if (c == optionPane) {
Dimension size = super.getPreferredSize(c);
size.width = Math.max(FineUIScale.scale(360), size.width);
size.height = Math.max(FineUIScale.scale(130), size.height);
return size;
}
return null;
}
}

11
designer-base/src/main/java/com/fine/theme/light/ui/FineToggleButtonUI.java

@ -22,6 +22,7 @@ import java.awt.Shape;
import java.awt.Rectangle;
import static com.fine.theme.utils.FineClientProperties.BUTTON_TYPE_GROUP;
import static com.fine.theme.utils.FineClientProperties.BUTTON_TYPE_GROUP_FIT;
import static com.fine.theme.utils.FineClientProperties.BUTTON_TYPE;
import static com.fine.theme.utils.FineClientProperties.BUTTON_TYPE_TAB;
import static com.fine.theme.utils.FineClientProperties.BUTTON_GROUP_POSITION;
@ -96,12 +97,20 @@ public class FineToggleButtonUI extends FlatToggleButtonUI {
}
static boolean isGroupButton(Component c) {
if (!(c instanceof UIButton)) {
return false;
}
String buttonType = getButtonTypeStr((UIButton) c);
return BUTTON_TYPE_GROUP.equals(buttonType) || BUTTON_TYPE_GROUP_FIT.equals(buttonType);
}
static boolean isGroupButtonNotFit(Component c) {
return c instanceof UIButton && BUTTON_TYPE_GROUP.equals(getButtonTypeStr((UIButton) c));
}
@Override
public void paint(Graphics g, JComponent c) {
if (isGroupButton(c) || isTabButton(c)) {
if (isGroupButtonNotFit(c) || isTabButton(c)) {
((AbstractButton)c).setMargin(FineUIUtils.getUIInsets("ToggleButton.compact.margin", "ToggleButton.margin"));
}
super.paint(g, c);

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

@ -13,6 +13,7 @@ public interface FineClientProperties extends FlatClientProperties {
//--------------------------- ButtonGroup -----------------------
String BUTTON_TYPE_GROUP = "group";
String BUTTON_TYPE_GROUP_FIT = "groupFit";
String BUTTON_BORDER = "buttonBorder";
String BUTTON_BORDER_LEFT_ROUND_RECT = "leftRoundRect";

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

@ -83,4 +83,16 @@ public class FineUIScale {
public static Insets scale(Insets insets) {
return UIScale.scale(insets);
}
/**
* Creates a scaled {@link Dimension} object based on the specified width and height.
* <p>
* This method uses the current user scale factor to adjust the provided width and height values:
* - If the user scale factor is 1 (no scaling), the original width and height values are returned unchanged.
* - If the user scale factor is different from 1, a new {@link Dimension} instance is created and returned,
* with the width and height values scaled according to the user scale factor.
*/
public static Dimension createScaleDimension(int width, int height) {
return scale(new Dimension(width, height));
}
}

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

@ -28,6 +28,7 @@ public interface FineUIStyle {
String BRAND_COLOR_LABEL = "brandColorLabel";
String BUTTON_TAB_ACTION = "tabAction";
String LABEL_BOLD = "boldLabel";
String LABEL_TIP_WINDOW_TITLE = "tipWindowTitleLabel";
String LABEL_SECONDARY = "secondaryLabel";
String LABEL_TIP = "tipLabel";
String LABEL_WARNING_TIP = "warningTipLabel";
@ -51,6 +52,7 @@ public interface FineUIStyle {
String WHITE_BUTTON = "whiteButton";
String ORIGINAL_BUTTON = "originalButton";
String DETAIL_LABEL = "detailLabel";
String WIDGET_EVENT_LABEL = "widgetEventLabel";
/**

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

@ -6,6 +6,8 @@ import com.fr.design.border.FineBorderFactory;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.theme.edit.ui.LabelUtils;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.stable.os.OperatingSystem;
import com.fr.value.AtomicClearableLazyValue;
@ -13,9 +15,11 @@ import javax.swing.JLabel;
import javax.swing.JLayer;
import javax.swing.ScrollPaneConstants;
import javax.swing.UIManager;
import javax.swing.JTextArea;
import java.awt.Color;
import java.awt.Component;
import java.awt.Composite;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
@ -435,4 +439,23 @@ public class FineUIUtils {
Font newSizeFont = font.deriveFont(font.getStyle(), scale(size));
c.setFont(newSizeFont);
}
/**
* 获取缩放后的国际化尺寸
*
* @param i18nDimensionKey 国际化key值
* @return 缩放后的国际化尺寸
*/
public static Dimension getScaledI18nDimension(String i18nDimensionKey) {
return FineUIScale.scale(DesignSizeI18nManager.getInstance().i18nDimension(i18nDimensionKey));
}
/**
* 创建一个支持自动换行的提示文本
* @param text 显示的文本内容
* @return 自动换行提示文本
*/
public static JTextArea createAutoWrapTipLabel(String text) {
return LabelUtils.createAutoWrapLabel(text, FineUIUtils.getUIColor("Label.tipColor", "inactiveCaption"));
}
}

3
designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java

@ -13,6 +13,7 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.KeySetUtils;
import javax.swing.SwingUtilities;
import java.awt.Dimension;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@ -42,7 +43,7 @@ public class TableDataSourceAction extends TemplateComponentAction<JTemplate<?,
populate(tds);
}
};
final BasicDialog reportTableDataDialog = tableDataPane.showLargeWindow(SwingUtilities.getWindowAncestor(this.getEditingComponent()), null);
final BasicDialog reportTableDataDialog = tableDataPane.showWindowWithCustomSize(SwingUtilities.getWindowAncestor(this.getEditingComponent()), null, new Dimension(1200, 600));
reportTableDataDialog.addDialogActionListener(new DialogActionAdapter() {
@Override

9
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -1,6 +1,7 @@
package com.fr.design.actions.file;
import com.fine.swing.ui.layout.Row;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineLayoutBuilder;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
@ -47,7 +48,6 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.general.log.Log4jConfig;
import com.fr.io.attr.ImageExportAttr;
@ -346,6 +346,7 @@ public class PreferencePane extends BasicPane {
.addTab(i18nText("Fine-Design_Basic_General"), generalScrollPane)
.addTab(i18nText("Fine-Design_Basic_Advanced"), adviceScrollPane)
.addTab(i18nText("Fine-Design_Vcs_Title"), vcsParentPane)
.withAdaptiveFit()
.build();
contentPane.add(tabbedPane, BorderLayout.CENTER);
@ -731,10 +732,10 @@ public class PreferencePane extends BasicPane {
private Component createColorSettingPane() {
// Color Setting Pane
gridLineColorTBButton = new UINoThemeColorButton(IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png"));
gridLineColorTBButton = new UINoThemeColorButton(new LazyIcon("foreground"));
gridLineColorTBButton.setEnabled(this.isEnabled());
paginationLineColorTBButton = new UINoThemeColorButton(IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png"));
paginationLineColorTBButton = new UINoThemeColorButton(new LazyIcon("foreground"));
paginationLineColorTBButton.setEnabled(this.isEnabled());
JPanel colorPanel = row(10,
@ -1251,7 +1252,7 @@ public class PreferencePane extends BasicPane {
@Override
public BasicDialog showWindow(Window window, DialogActionListener l) {
return showWindowWithCustomSize(window, l, new Dimension(BasicDialog.DEFAULT.width, BasicDialog.DEFAULT.height + OFFSET_HEIGHT));
return showWindowWithCustomSize(window, l, new Dimension(BasicDialog.DEFAULT.width + OFFSET_HEIGHT, BasicDialog.DEFAULT.height + OFFSET_HEIGHT));
}
private void tryGc() {

20
designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java

@ -15,8 +15,8 @@ import com.fr.file.filter.ChooseFileFilter;
import com.fr.io.exporter.DesignExportType;
import com.fr.io.exporter.ExporterKey;
import com.fr.log.FineLoggerFactory;
import com.fanruan.product.ProductConstants;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.third.jodd.io.FileNameUtil;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.exporter.TemplateExportOperator;
@ -211,19 +211,15 @@ public abstract class AbstractExportAction<E extends JTemplate<?, ?>> extends JT
}
private void dealExporter(OutputStream outputStream, String path, final Map<String, Object> para) throws Exception {
if (path.startsWith(ProjectConstants.REPORTLETS_NAME)) {
path = path.substring(ProjectConstants.REPORTLETS_NAME.length());
}
// 没有办法处理这个 isLocal 判断,因为一个是修改参数传递结果,一个是返回值做结果
// todo 后续想想办法
if (WorkContext.getCurrent().isLocal()) {
WorkContext.getCurrent().get(TemplateExportOperator.class)
.export(exportKey(), exportType(), outputStream, path, para);
} else {
byte[] contents =
WorkContext.getCurrent().get(TemplateExportOperator.class)
.export(exportKey(), exportType(), null, path, para);
byte[] contents =
WorkContext.getCurrent().get(TemplateExportOperator.class)
.export(exportKey(), exportType(), null, path, para);
outputStream.write(contents);
}
outputStream.write(contents);
}
@Override

5
designer-base/src/main/java/com/fr/design/backup/DesignContext.java

@ -7,6 +7,7 @@ import com.fr.stable.StringUtils;
import javax.servlet.ServletContext;
import java.io.File;
import java.util.Properties;
/**
@ -17,7 +18,7 @@ import java.util.Properties;
* Created on 2024/5/14
*/
public class DesignContext extends CarinaApplicationContext {
public static final String WEB_INF = "\\WEB-INF";
public static final String WEB_INF = "WEB-INF";
private String designWebInfPath;
private String designDataPath;
@ -39,7 +40,7 @@ public class DesignContext extends CarinaApplicationContext {
public void setDesignWebInfPath(String designWebInfPath) {
this.designWebInfPath = designWebInfPath;
if (StringUtils.isNotEmpty(this.designWebInfPath)) {
this.designDataPath = this.designWebInfPath.replace(WEB_INF, StringUtils.EMPTY);
this.designDataPath = this.designWebInfPath.replace(File.separatorChar + WEB_INF, StringUtils.EMPTY);
}
FineLoggerFactory.getLogger().info("[DesignContext] designWebInfPath:{}, designDataPath:{}", this.designWebInfPath, this.designDataPath);
}

28
designer-base/src/main/java/com/fr/design/components/notification/NotificationDialog.java

@ -1,5 +1,8 @@
package com.fr.design.components.notification;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIScale;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.function.ThrowableRunnable;
import com.fr.base.svg.IconUtils;
import com.fr.design.components.page.PageControlModel;
@ -53,7 +56,7 @@ public class NotificationDialog extends JDialog {
*/
private static final int CONTENT_SCROLL_WIDTH = 280;
private static final int CONTENT_WIDTH = 300;
private static final int CONTENT_WIDTH = 360;
private static final int CONTENT_HEIGHT = 100;
/**
* 通知框的外部宽高
@ -148,21 +151,20 @@ public class NotificationDialog extends JDialog {
protected JPanel createContentPanel() {
JPanel contentPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
contentPanel.setBorder(BorderFactory.createEmptyBorder(8, 10, 8, 10));
contentPanel.setBorder(new ScaledEmptyBorder(8, 10, 8, 10));
contentPanel.setName("contentPanel");
NotificationModel model = getCurrentModel();
UILabel icon = new UILabel(getIconForType(model.getType()));
icon.setPreferredSize(new Dimension(16, 16));
JPanel iconPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
iconPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 10, 8));
iconPanel.setBorder(new ScaledEmptyBorder(0, 5, 10, 8));
iconPanel.add(icon, BorderLayout.NORTH);
contentPanel.add(iconPanel, BorderLayout.WEST);
JPanel centerPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
centerPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 5));
centerPanel.setBorder(new ScaledEmptyBorder(0, 0, 5, 5));
NotificationMessage[] messages = model.getMessages();
List<? extends JComponent> messageComponents = Arrays.stream(messages)
@ -213,7 +215,7 @@ public class NotificationDialog extends JDialog {
jScrollPane.setBorder(BorderFactory.createEmptyBorder());
centerPanel.add(jScrollPane, BorderLayout.CENTER);
centerPanel.setPreferredSize(CONTENT_SIZE);
centerPanel.setPreferredSize(FineUIScale.scale(CONTENT_SIZE));
contentPanel.add(centerPanel, BorderLayout.CENTER);
@ -282,7 +284,7 @@ public class NotificationDialog extends JDialog {
NotificationAction action = currentModel.getAction();
if (action != null) {
UIButton actionButton = new UIButton(action.name());
actionButton.setPreferredSize(BUTTON_DIMENSION);
actionButton.setPreferredSize(FineUIScale.scale(BUTTON_DIMENSION));
actionButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@ -293,7 +295,7 @@ public class NotificationDialog extends JDialog {
}
UIButton knowButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Know"));
knowButton.setPreferredSize(BUTTON_DIMENSION);
knowButton.setPreferredSize(FineUIScale.scale(BUTTON_DIMENSION));
knowButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@ -359,21 +361,21 @@ public class NotificationDialog extends JDialog {
protected Icon getIconForType(NotificationType type) {
String iconPath;
String iconId;
switch (type) {
case ERROR:
iconPath = "/com/fr/design/standard/reminder/reminder_error.svg";
iconId = "error";
break;
case INFO:
iconPath = "/com/fr/design/standard/reminder/reminder_success.svg";
iconId = "success";
break;
case WARNING:
iconPath = "/com/fr/design/standard/reminder/reminder_warning.svg";
iconId = "warning";
break;
default:
return null;
}
return IconUtils.readIcon(iconPath);
return new LazyIcon(iconId, 20);
}
private void destroy() {

4
designer-base/src/main/java/com/fr/design/condition/DSColumnLiteConditionPane.java

@ -123,8 +123,8 @@ public class DSColumnLiteConditionPane extends LiteConditionPane<CommonCondition
UILabel operatorLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ConditionB_Operator") + ":");
operatorLabel.setPreferredSize(FineUIScale.scale(new Dimension(68, 24)));
Component[][] components = {
{ columLabel, keyColumnPane, null},
{operatorLabel, conditionOPComboBox, conditionValuePane}};
{ columLabel, operatorLabel, null},
{ keyColumnPane,conditionOPComboBox, conditionValuePane}};
double p = TableLayout.PREFERRED;
double rowSize[] = { p, p };

7
designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java

@ -352,6 +352,13 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
});
}
}
/**
* 重置
*/
public void resetAddMenuDef() {
this.addMenuDef.clearShortCuts();
this.createAddMenuDef();
}
private abstract class TDAction extends UpdateAction {

8
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -586,13 +586,17 @@ public abstract class DesignTableDataManager {
TableDataSource source = TableDataSourceTailor.extractTableData(tableDataSource);
bean.setDataSource(source);
bean.setDataName(DataOperator.getTableDataName(source, tabledata));
bean.setParameterMap(parameterMap);
bean.setStart(rowCount);
bean.setEnd(-1);
bean.updateConvertMap(parameterMap);
if (checkBean(bean)) {
return (EmbeddedTableData) TableDataRepository.getInstance().previewTableData(bean).getTableData();
} else {
PreviewDataBean dataBean = new PreviewDataBean();
dataBean.setDataSource(tabledata);
dataBean.setParameterMap(parameterMap);
dataBean.updateConvertMap(parameterMap);
dataBean.setStart(rowCount);
dataBean.setEnd(-1);
return (EmbeddedTableData) TableDataRepository.getInstance().previewTableData(dataBean).getTableData();
}

4
designer-base/src/main/java/com/fr/design/data/datapane/TableDataCreatorProducer.java

@ -14,7 +14,7 @@ import com.fine.theme.icon.LazyIcon;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.datacenters.tabledata.DCTableData;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.data.tabledata.datacenter.DatacentersPane;
import com.fr.design.data.tabledata.datacenter.DCTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.ClassTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.DBTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.EmbeddedTableDataPane;
@ -95,7 +95,7 @@ public class TableDataCreatorProducer {
return new TableDataNameObjectCreator[]{
new TableDataNameObjectCreator(i18nText("Fine-Design_Basic_DS_Datacenters"),
new LazyIcon("datacenter"),
DCTableData.class, DatacentersPane.class) {
DCTableData.class, DCTableDataPane.class) {
@Override
public boolean shouldInsertSeparator() {
return true;

16
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

@ -1,6 +1,7 @@
package com.fr.design.data.datapane;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.TableData;
import com.fr.data.MultiResultTableData;
@ -11,6 +12,7 @@ import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction;
import com.fr.design.cache.DesignCacheManager;
import com.fr.design.data.BasicTableDataTreePane;
import com.fr.design.data.BasicTableDataUtils;
import com.fr.design.data.DesignTableDataManager;
@ -646,10 +648,6 @@ public class TableDataTreePane extends BasicTableDataTreePane {
}
private void resetAddMenuDef() {
this.addMenuDef.clearShortCuts();
this.createAddMenuDef();
}
/**
* 感觉这里把一堆Action和Op之类的送到抽象类里去检查很奇怪抽象类本身定义的Action只有add和connection
@ -1120,10 +1118,15 @@ public class TableDataTreePane extends BasicTableDataTreePane {
};
basicPane.setLayout(new BorderLayout());
basicPane.add(tips, BorderLayout.NORTH);
scrollPane.setBorder(new FineRoundBorder());
basicPane.add(scrollPane, BorderLayout.CENTER);
BasicDialog basicDialog = basicPane.showSmallWindow(SwingUtilities.getWindowAncestor(TableDataTreePane.this), new DialogActionAdapter() {
@Override
public void doOk() {
DesignCacheManager.processByCacheTableData(this::processRemove);
}
private void processRemove() {
List selectedValues = tableDataCheckBoxPane.getSelectedObjects();
// 删除时如果正在搜索,跳回原树
if (TableDataTreeSearchManager.getInstance().isInSearchMode()) {
@ -1137,7 +1140,6 @@ public class TableDataTreePane extends BasicTableDataTreePane {
}
}
}
@Override
public void doCancel() {
super.doCancel();
@ -1195,6 +1197,10 @@ public class TableDataTreePane extends BasicTableDataTreePane {
@Override
public void actionPerformed(ActionEvent e) {
DesignCacheManager.processByCacheTableData(this::doPaste);
}
private void doPaste() {
// 粘贴时如果正在搜索,跳回原树
if (TableDataTreeSearchManager.getInstance().isInSearchMode()) {
TableDataTreeSearchManager.getInstance().outOfSearchMode();

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

@ -53,7 +53,8 @@ public class AdvancePane extends BasicPane {
flex(2)
),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Borrow"), SwingConstants.LEFT)).weight(1),
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Borrow"), SwingConstants.LEFT))
.with(it -> it.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Borrow"))).weight(1),
cell(DBCP_TEST_ON_BORROW).weight(1.5),
flex(2)
),

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

@ -222,12 +222,22 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
removedConnNames.add(s);
break;
case ADDED:
addConnections.add(ConnectionInfoBeanHelper.createConnectionInfoBean(s, connection, true));
validConnection.add(connection);
ConnectionInfoBean add = ConnectionInfoBeanHelper.createConnectionInfoBean(s, connection, true);
if (StringUtils.isNotEmpty(add.getConnectionData())) {
addConnections.add(add);
validConnection.add(connection);
} else {
FineLoggerFactory.getLogger().error("Unable to find the corresponding processor : {}", connection.getClass());
}
break;
case UPDATED:
updateConnection.add(ConnectionInfoBeanHelper.createConnectionInfoBean(s, connection, true));
validConnection.add(connection);
ConnectionInfoBean update = ConnectionInfoBeanHelper.createConnectionInfoBean(s, connection, true);
if (StringUtils.isNotEmpty(update.getConnectionData())) {
updateConnection.add(update);
validConnection.add(connection);
} else {
FineLoggerFactory.getLogger().error("Unable to find the corresponding processor : {}", connection.getClass());
}
break;
default:
break;
@ -251,7 +261,8 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
* @return
*/
private boolean needUpdate0(Connection origin, Connection connection) {
return !connection.equals(origin) || !isEmbedConnection(connection);
// 先不考虑插件
return !connection.equals(origin);
}
/**

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

@ -22,7 +22,6 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.GeneralContext;
import com.fr.stable.ArrayUtils;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JPanel;
import javax.swing.ToolTipManager;
@ -171,6 +170,7 @@ public class ConnectionTableProcedurePane extends BasicPane {
searchField = new UITextField();
searchField.setPlaceholder(Toolkit.i18nText("Fine-Design_Basic_Table_Search"));
searchField.getDocument().addDocumentListener(searchListener);
searchField.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Table_Search"));
// 搜索图标
UILabel searchLabel = new UILabel(new LazyIcon("search"));
searchLabel.setBorder(new ScaledEmptyBorder(0, 3, 0, 3));

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

@ -1,8 +1,8 @@
package com.fr.design.data.datapane.connect;
import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.data.core.db.dialect.DialectFactory;
import com.fr.data.impl.JDBCDatabaseConnection;
@ -15,13 +15,12 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.theme.edit.ui.LabelUtils;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import javax.swing.JPanel;
import javax.swing.JTextField;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Window;
import java.awt.event.InputMethodEvent;
import java.awt.event.InputMethodListener;
@ -78,35 +77,14 @@ public class DBCPAttrPane extends BasicPane {
// JPanel northFlowPane
northFlowPane = Layouts.column(LayoutConstants.VERTICAL_GAP,
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr"))).with(FineUIUtils::wrapBoldLabelWithUnderline),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Initial_Size"))).weight(1),
cell(DBCP_INITIAL_SIZE).weight(1), flex(1.2)
),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Min_Idle"))).weight(1),
cell(DBCP_MIN_IDLE).weight(1), flex(1.2)
),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Return"))).weight(1),
cell(DBCP_TESTONRETURN).weight(1), flex(1.2)
),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_While_Idle"))).weight(1),
cell(DBCP_TESTWHILEIDLE).weight(1), flex(1.2)
),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Evictionruns_millis"))).weight(1),
cell(DBCP_TIMEBETWEENEVICTIONRUNSMILLS).weight(1), flex(1.2)
),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Num_Test_Per_Evction_Run"))).weight(1),
cell(DBCP_NUMTESTSPEREVICTIONRUN).weight(1), flex(1.2)
),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Mix_Evictable_Idle_Time_Millis"))).weight(1),
cell(DBCP_MINEVICTABLEIDLETIMEMILLIS).weight(1), flex(1.2)
),
cell(new UILabel(Toolkit.i18nText("Fine-Design_Dbcp_Warning"))).with(it -> it.setForeground(FlatUIUtils.getUIColor("Label.strongHintColor", Color.RED)))
row(cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Initial_Size"))).weight(1), cell(DBCP_INITIAL_SIZE).weight(1)),
row(cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Min_Idle"))).weight(1), cell(DBCP_MIN_IDLE).weight(1)),
row(cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Return"))).weight(1), cell(DBCP_TESTONRETURN).weight(1)),
row(cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_While_Idle"))).weight(1), cell(DBCP_TESTWHILEIDLE).weight(1)),
row(cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Evictionruns_millis"))).weight(1), cell(DBCP_TIMEBETWEENEVICTIONRUNSMILLS).weight(1)),
row(cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Num_Test_Per_Evction_Run"))).weight(1), cell(DBCP_NUMTESTSPEREVICTIONRUN).weight(1)),
row(cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Mix_Evictable_Idle_Time_Millis"))).weight(1), cell(DBCP_MINEVICTABLEIDLETIMEMILLIS).weight(1)),
cell(LabelUtils.createAutoWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Dbcp_Warning"), FineUIUtils.getUIColor("Label.warningColor", "Label.warningColor")))
).getComponent();
defaultPane.add(northFlowPane);
this.add(defaultPane);

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

@ -5,7 +5,6 @@ package com.fr.design.data.datapane.connect;
import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
@ -13,7 +12,6 @@ import com.fr.data.driver.util.JarFileParseUtil;
import com.fr.data.impl.Connection;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.impl.JNDIDatabaseConnection;
import com.fr.data.operator.DataOperatorProvider;
import com.fr.data.security.ssl.impl.NormalSsl;
import com.fr.data.solution.ExceptionSolutionSelector;
import com.fr.data.solution.entity.DriverPage;
@ -31,14 +29,12 @@ import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.rpc.ExceptionHandler;
import com.fr.rpc.RPCInvokerExceptionInfo;
import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.engine.exception.DriverUnExistException;
import org.jetbrains.annotations.NotNull;
import com.fr.workspace.server.entity.connection.ConnectionBean;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
import javax.swing.JDialog;
@ -479,6 +475,9 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
uiLabel.setIcon(new LazyIcon("error", 20));
message.setText(Toolkit.i18nText("Fine-Design_Basic_Connection_Failed"));
Connection database = DatabaseConnectionPane.this.updateBean();
if (e.getCause() instanceof DriverUnExistException) {
((DriverUnExistException) e.getCause()).setThrowable(new ClassNotFoundException(database.getDriver()));
}
SolutionProcessor select = ExceptionSolutionSelector.get().select(e, database);
String detail = select.getResultException().getDetailMessage();
String solution = select.getResultException().getSolution();

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

@ -7,6 +7,7 @@ import com.fr.data.driver.DriverLoader;
import com.fr.data.driver.config.DriverLoaderConfig;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.solution.entity.DriverClasses;
import com.fr.datasource.connection.impl.DefaultDatabaseType;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.core.ReactiveCardPane;
import com.fr.design.gui.ibutton.UIButton;
@ -22,11 +23,14 @@ import com.fr.design.utils.BrowseUtils;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils;
import com.fr.third.guava.collect.HashBiMap;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
@ -60,6 +64,16 @@ public class JDBCDefPane extends JPanel {
public static final String DRIVER_TYPE = "driver_type";
public static final String USER_NAME = "user_name";
private static final String OTHER_DB = "Others";
public static final String ORACLE = "Oracle";
public static final String DB2 = "DB2";
public static final String SQL_SERVER = "SQL Server";
public static final String MYSQL = "MySQL";
public static final String SYBASE = "Sybase";
public static final String ACCESS = "Access";
public static final String DERBY = "Derby";
public static final String POSTGRE = "Postgre";
public static final String SQLITE = "SQLite";
public static final String INCEPTOR = "Inceptor";
private static final Pattern ORACLE_URL = Pattern.compile("^jdbc:oracle:thin:@[/]*([-0-9a-zA-Z_\\.\\\\]+)(:([0-9]+|port))?([:/](.*))?.*", Pattern.CASE_INSENSITIVE);
private static final Pattern GENERAL_URL = Pattern.compile("^jdbc:(mysql|sqlserver|db2|derby|postgresql|inceptor|inceptor2|hive2)://([-0-9a-zA-Z_\\.\\\\]+)(:([0-9]+|port))?((/|;DatabaseName=)(.*))?.*", Pattern.CASE_INSENSITIVE);
private static final Pattern PORT = Pattern.compile("^0$|^[1-9][\\d]*[\\d]*$");
@ -67,9 +81,22 @@ public class JDBCDefPane extends JPanel {
// 编码转换.
private String originalCharSet = null;
private static Map<String, DriverURLName[]> jdbcMap = new HashMap<String, DriverURLName[]>();
// 用于映射connection的database字段
private static Map<String, String> dbTypeMap = new HashMap<>();
private JPanel linkPanel;
static {
dbTypeMap.put(ORACLE, DefaultDatabaseType.ORACLE.getType());
dbTypeMap.put(DB2, DefaultDatabaseType.IBM_DB2.getType());
dbTypeMap.put(SQL_SERVER, DefaultDatabaseType.MICROSOFT_SQL_SERVER.getType());
dbTypeMap.put(MYSQL, DefaultDatabaseType.MYSQL.getType());
dbTypeMap.put(SYBASE, DefaultDatabaseType.SAP_ASE.getType());
dbTypeMap.put(ACCESS, DefaultDatabaseType.OTHER.getType());
dbTypeMap.put(DERBY, DefaultDatabaseType.DERBY.getType());
dbTypeMap.put(POSTGRE, DefaultDatabaseType.POSTGRESQL.getType());
dbTypeMap.put(SQLITE, DefaultDatabaseType.SQLITE.getType());
dbTypeMap.put(INCEPTOR, DefaultDatabaseType.TRANSWARP_INCEPTOR.getType());
jdbcMap.put(OTHER_DB, new DriverURLName[]{new DriverURLName("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:"),
new DriverURLName("org.hsqldb.jdbcDriver", "jdbc:hsqldb:file:[PATH_TO_DB_FILES]"), new DriverURLName("com.inet.tds.TdsDriver", "jdbc:inetdae7:localhost:1433/"),
new DriverURLName("COM.cloudscape.JDBCDriver", "jdbc:cloudscape:/cloudscape/"),
@ -104,7 +131,7 @@ public class JDBCDefPane extends JPanel {
private ReactiveCardPane centerPanel;
private ReactiveCardPane driverSelectRow;
// 请不要改动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};
private JDBCDatabaseConnection jdbcDatabase;
@ -151,6 +178,7 @@ public class JDBCDefPane extends JPanel {
if (needRefresh) {
jdbcDatabase.setDatabase(StringUtils.EMPTY);
}
jdbcDatabase.setDatabase(dbTypeMap.getOrDefault(GeneralUtils.objectToString(dbtypeComboBox.getSelectedItem()), DefaultDatabaseType.OTHER.getType()));
changePane(dbtypeComboBox.getSelectedItem());
JDBCConnectionDef.getInstance().setConnection((String) dbtypeComboBox.getSelectedItem(), jdbcDatabase);
DatabaseConnectionPane.JDBC.getAdvancedAttrPane().populate(jdbcDatabase);
@ -331,7 +359,13 @@ public class JDBCDefPane extends JPanel {
}
private void initMap() {
Map<String, DriverLoader> driverLoaders = DriverLoaderConfig.getInstance().getDriverLoaders();
Map<String, DriverLoader> driverLoaders = null;
try {
driverLoaders = ConnectionRepository.getInstance().getDriverLoaders();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
driverLoaders = new HashMap<>();
}
nameAndRepresent = getDriverLoaderAndRepresent(driverLoaders);
}

8
designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java

@ -3,10 +3,12 @@ package com.fr.design.data.datapane.connect;
import com.fr.data.driver.DriverClassNotFoundException;
import com.fr.data.impl.Connection;
import com.fr.decision.webservice.bean.datasource.ConnectionInfoBean;
import com.fr.decision.webservice.exception.general.DriverNotFoundException;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.ConnectionProcessorFactory;
import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory;
import com.fr.security.encryption.transmission.TransmissionEncryptionManager;
import com.fr.workspace.engine.exception.DriverUnExistException;
import com.fr.workspace.server.repository.connection.BaseConnectionSource;
import java.sql.SQLException;
@ -25,6 +27,8 @@ public class LocalConnectionSource extends BaseConnectionSource {
// 暂时这么处理,后续最好拉到外层包装一下
TransmissionEncryptionManager.setTransEncryptionLevel(1);
ConnectionProcessorFactory.testConnectionWithSchemaReturn(database);
} catch (DriverNotFoundException e) {
throw new DriverUnExistException();
} finally {
TransmissionEncryptionManager.removeTransEncryptionLevel();
}
@ -36,6 +40,8 @@ public class LocalConnectionSource extends BaseConnectionSource {
Connection connection = ConnectionProcessorFactory.createConnection(bean);
validate(bean.getConnectionName(), connection);
ConnectionProcessorFactory.addConnection(bean);
} catch (DriverNotFoundException e) {
throw new DriverUnExistException();
} finally {
TransmissionEncryptionManager.removeTransEncryptionLevel();
}
@ -54,6 +60,8 @@ public class LocalConnectionSource extends BaseConnectionSource {
Connection connection = ConnectionProcessorFactory.createConnection(bean);
validate(bean.getConnectionName(), connection);
ConnectionProcessorFactory.updateConnection(bean.getConnectionName(), bean);
} catch (DriverNotFoundException e) {
throw new DriverUnExistException();
} finally {
TransmissionEncryptionManager.removeTransEncryptionLevel();
}

1
designer-base/src/main/java/com/fr/design/data/datapane/management/search/pane/FineSearchPane.java

@ -159,7 +159,6 @@ public class FineSearchPane extends JPanel implements HoverAware {
@Override
public void requestFocus() {
super.requestFocus();
searchTextField.requestFocus();
}
}

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

@ -102,7 +102,7 @@ public class PreviewTablePane extends BasicPane {
private PreviewTableDesensitizationPane desensitizationPane;
private static final int PREVIEW_TABLE_MIN_COLUMN_WIDTH = FineUIScale.scale(75);
private static final int PREVIEW_TABLE_WIDTH = FineUIScale.scale(600);
private static final int PREVIEW_TABLE_WIDTH = FineUIScale.scale(610);
/**
* 用于refreshLabel的鼠标监听

1
designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java

@ -57,6 +57,7 @@ public class SQLEditPane extends RSyntaxTextArea {
if (requestDroptarget) {
new SQLPaneDropTarget(this);
}
setBorder(null);
}

12
designer-base/src/main/java/com/fr/design/data/tabledata/LocalTableDataSource.java

@ -1,8 +1,10 @@
package com.fr.design.data.tabledata;
import com.fanruan.config.impl.data.TableDataConfigProviderFactory;
import com.fr.decision.webservice.bean.dataset.FileDataSetBean;
import com.fr.decision.webservice.bean.entry.FileNodeBean;
import com.fr.decision.webservice.v10.datasource.dataset.processor.impl.FileProcessor;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.workspace.server.repository.tabledata.BaseTableDataSource;
@ -49,4 +51,14 @@ public class LocalTableDataSource extends BaseTableDataSource {
public List<FileNodeBean> getFileList(String fileType) {
return FileProcessor.KEY.getFileList(fileType, StringUtils.EMPTY);
}
@Override
public boolean testFilePath(FileDataSetBean fileDataSetBean) {
try {
return FileProcessor.KEY.testFilePath(fileDataSetBean);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false;
}
}
}

17
designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DatacentersJSBridge.java → designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataJSBridge.java

@ -4,6 +4,7 @@ import com.fr.base.BaseFormula;
import com.fr.datacenters.tabledata.bean.DCFilterQueryBean;
import com.fr.datacenters.tabledata.bean.DCTableDataBean;
import com.fr.datacenters.tabledata.filter.DCFilter;
import com.fr.datacenters.tabledata.parameter.DCParameter;
import com.fr.design.bridge.exec.JSBridge;
import com.fr.design.dialog.DialogActionListener;
import com.fr.design.dialog.UIDialog;
@ -37,7 +38,7 @@ import java.util.stream.Collectors;
* Created on 2024/6/17
*/
@JsAccessible
public class DatacentersJSBridge {
public class DCTableDataJSBridge {
private static final String EVENT_FORMULA_UPDATE = "OK";
private static final String EVENT_FORMULA_CANCEL = "CANCEL";
@ -47,25 +48,25 @@ public class DatacentersJSBridge {
* @param window js环境的window对象
* @return 桥接实例
*/
public static DatacentersJSBridge getBridge(JsObject window) {
return new DatacentersJSBridge(window);
public static DCTableDataJSBridge getBridge(JsObject window) {
return new DCTableDataJSBridge(window);
}
private final JsObject window;
private DatacentersJSBridge(JsObject window) {
private DCTableDataJSBridge(JsObject window) {
this.window = window;
}
private static DatacentersPane relationPanel;
private static DCTableDataPane relationPanel;
/**
* 设置窗口用于打开对话框的层级
*
* @param panel 面板
*/
public static void relationPanel(DatacentersPane panel) {
public static void relationPanel(DCTableDataPane panel) {
relationPanel = panel;
}
@ -161,7 +162,9 @@ public class DatacentersJSBridge {
JxUIPane.DEFAULT_EXECUTOR.submit(() -> {
try {
DCTableDataBean decoded = EmbedJson.decodeValue(tableData, DCTableDataBean.class);
DCFilter dcFilter = decoded.getFilter().evalValue(decoded.getParameters(), Calculator.createCalculator());
DCParameter[] dcParameters = Arrays.stream(decoded.getParameters())
.map(DCParameter::fromBean).toArray(DCParameter[]::new);
DCFilter dcFilter = decoded.getFilter().evalValue(dcParameters, Calculator.createCalculator());
DCFilterQueryBean queryBean = dcFilter.toQueryBean();
String encode = EmbedJson.encode(queryBean);
callback.invoke(window, encode);

40
designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DatacentersPane.java → designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataPane.java

@ -4,6 +4,7 @@ import com.fanruan.workplace.http.ServiceType;
import com.fr.datacenters.tabledata.DCTableData;
import com.fr.datacenters.tabledata.bean.DCNameBean;
import com.fr.datacenters.tabledata.bean.DCTableDataBean;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane;
import com.fr.design.dialog.DialogActionListener;
import com.fr.design.dialog.UIDialog;
@ -14,10 +15,15 @@ import com.fr.json.revise.EmbedJson;
import com.fr.stable.StringUtils;
import com.fr.third.guava.collect.ImmutableMap;
import com.fr.workspace.WorkContext;
import com.teamdev.jxbrowser.browser.callback.InjectJsCallback;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Window;
import java.util.Arrays;
import static com.fr.design.ui.ModernUIConstants.DOT;
import static com.fr.design.ui.ModernUIConstants.WINDOW;
/**
* 数据中心数据集面板
@ -26,7 +32,7 @@ import java.awt.Window;
* @since 11.0
* Created on 2024/6/17
*/
public class DatacentersPane extends AbstractTableDataPane<DCTableData> {
public class DCTableDataPane extends AbstractTableDataPane<DCTableData> {
private static final JxEngine JX_ENGINE = JxEngine.newInstance(false);
@ -37,31 +43,7 @@ public class DatacentersPane extends AbstractTableDataPane<DCTableData> {
// 用于复制粘贴场景
private DCTableData dcTableData;
/**
* 借用只运行一次
*/
private void addDialogActionListener() {
// 保证在窗口加载完成后执行
SwingUtilities.invokeLater(() -> {
Window ancestor = SwingUtilities.getWindowAncestor(DatacentersPane.this);
if (ancestor instanceof UIDialog) {
((UIDialog) ancestor).addDialogActionListener(new DialogActionListener() {
@Override
public void doOk() {
dataCenterJxUIPane.disposeBrowser();
}
@Override
public void doCancel() {
dataCenterJxUIPane.disposeBrowser();
}
});
}
});
}
public DatacentersPane() {
public DCTableDataPane() {
setLayout(new BorderLayout());
dataCenterJxUIPane = getJxUIPane();
add(dataCenterJxUIPane, BorderLayout.CENTER);
@ -73,7 +55,7 @@ public class DatacentersPane extends AbstractTableDataPane<DCTableData> {
return new JxUIPane.Builder<String>()
.engine(JX_ENGINE)
.namespace(DATA_CENTER)
.bindWindow(DATA_CENTER_HELPER, DatacentersJSBridge::getBridge)
.bindWindow(DATA_CENTER_HELPER, DCTableDataJSBridge::getBridge)
.withEMB("com/fr/design/data/tabledata/datacenter/web/data-choose.prod.html",
ImmutableMap.of("fineServletURL", getDatacentersUrl()))
.build();
@ -96,9 +78,11 @@ public class DatacentersPane extends AbstractTableDataPane<DCTableData> {
@Override
public void populateBean(DCTableData ob) {
DatacentersJSBridge.relationPanel(this);
DCTableDataJSBridge.relationPanel(this);
dcTableData = ob;
dataCenterJxUIPane.populate(EmbedJson.encode(ob.toBean()));
String[] allDSNames = DesignTableDataManager.getAllDSNames(DesignTableDataManager.getEditingTableDataSource());
dataCenterJxUIPane.executeJS(DATA_CENTER + DOT + "datasetNames=" + EmbedJson.encode(allDSNames));
}

1
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java

@ -55,7 +55,6 @@ public class ClassTableDataPane extends AbstractTableDataPane<ClassTableData> {
//类名
classNameTextField = new UITextField();
UIButton browserButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select"));
browserButton.setPreferredSize(new Dimension(browserButton.getPreferredSize().width, classNameTextField.getPreferredSize().height));
browserButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
final ClassNameSelectPane bPane = new ClassNameSelectPane();

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

@ -208,6 +208,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> implemen
@Override
public void keyPressed(KeyEvent e) {
searchField.setToolTipText(searchField.getText());
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
e.setKeyCode(KeyEvent.VK_UP);
DBTableDataPane.this.connectionTableProcedurePane.requestFocus();

12
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java

@ -1,5 +1,6 @@
package com.fr.design.data.tabledata.tabledatapane;
import com.fine.theme.light.ui.FineTableHeaderUI;
import com.fine.theme.utils.FineUIScale;
import com.fr.data.impl.EmbeddedTableData;
import com.fr.design.constants.LayoutConstants;
@ -21,6 +22,7 @@ import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import java.awt.BorderLayout;
import java.awt.Color;
@ -40,9 +42,9 @@ import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.flex;
public class EmbeddedTableDataPane extends AbstractTableDataPane<EmbeddedTableData> {
private static final int MIN_CELL_WIDTH = 30;
private static final int MIN_CELL_WIDTH = FineUIScale.scale(30);
private static final int PREVIEW_TABLE_MIN_COLUMN_WIDTH = FineUIScale.scale(75);
private static final int PREVIEW_TABLE_WIDTH = FineUIScale.scale(600);
private static final int PREVIEW_TABLE_WIDTH = FineUIScale.scale(860);
private JTable dataJTable ;
private UITableScrollPane scrollPane;
private UILabel coordinatelabel;
@ -69,6 +71,8 @@ public class EmbeddedTableDataPane extends AbstractTableDataPane<EmbeddedTableDa
// 显示double,date类;渲染date类
dataJTable.setDefaultRenderer(Double.class, new DoubleRenderer());
dataJTable.setDefaultRenderer(Date.class, new DateRenderer());
dataJTable.setDefaultRenderer(Integer.class, new DoubleRenderer());
dataJTable.setDefaultRenderer(Number.class, new DoubleRenderer());
dataJTable.setDefaultEditor(Date.class, new DateEditor(new UIDatePicker(UIDatePicker.STYLE_CN_DATE1)));
tableStructureChanged();
@ -249,14 +253,14 @@ public class EmbeddedTableDataPane extends AbstractTableDataPane<EmbeddedTableDa
tableColumn.setMaxWidth(Math.max(dataJTable.getColumnCount(), MIN_CELL_WIDTH));
}
private class DoubleRenderer extends DefaultTableCellRenderer {
private class DoubleRenderer extends FineTableHeaderUI.TableRenderer {
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
setHorizontalAlignment(RIGHT);
return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
}
}
private class DateRenderer extends DefaultTableCellRenderer {
private class DateRenderer extends FineTableHeaderUI.TableRenderer {
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
Date date2Format = DateUtils.object2Date(value, true);
return super.getTableCellRendererComponent(table, date2Format == null ? StringUtils.EMPTY : DateUtils.DATEFORMAT1.format(date2Format), isSelected, hasFocus, row,

24
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java

@ -14,6 +14,7 @@ import com.fr.data.impl.ExcelTableData;
import com.fr.data.impl.FileTableData;
import com.fr.data.impl.TextTableData;
import com.fr.data.impl.XMLTableData;
import com.fr.decision.webservice.bean.dataset.FileDataSetBean;
import com.fr.design.actions.UpdateAction;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.data.datapane.preview.PreviewTablePane;
@ -47,6 +48,7 @@ import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLableReader;
import com.fr.workspace.server.repository.tabledata.TableDataRepository;
import javax.swing.ButtonGroup;
import javax.swing.JOptionPane;
@ -194,16 +196,18 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
urlText.setEditable(false);
// 选择按钮
chooseFile = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Selection"));
chooseFile.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Selection"));
chooseFile.addActionListener(chooseFileListener);
// 测试连接按钮
testConnection = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Test_Connection"));
testConnection.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Test_Connection"));
testConnection.setEnabled(false);
testConnection.addActionListener(testConnectionListener);
// 提示信息
tipPanel = column(
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Type_Parameter_Desc"), FineUIStyle.LABEL_TIP)),
cell(new UILabel("reportlets/excel/FineReport${abc}." + "txt", FineUIStyle.LABEL_TIP)),
cell(new UILabel("http://192.168.100.120:8080/XXServer/Report/excel${abc}.jsp", FineUIStyle.LABEL_TIP))
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Type_Parameter"), FineUIStyle.LABEL_TIP)),
cell(new UILabel("assets/file_dataset/FineReport${abc}." + "txt", FineUIStyle.LABEL_TIP)),
cell(new UILabel("http://192.168.100.120:8080/webroot/help/excel${abc}.jsp", FineUIStyle.LABEL_TIP))
).getComponent();
return column(
LayoutConstants.VERTICAL_GAP,
@ -233,22 +237,20 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
}
params = getEditorPaneParameter();
URLDataSource url = new URLDataSource(urlText.getText().trim(), params);
InputStream in = null;
boolean result = false;
try {
in = url.getSourceStream(params);
String urlText = ParameterHelper.analyze4Templatee(url.getUrl(), params);
FileDataSetBean bean = new FileDataSetBean();
bean.setFilePath(urlText);
result = TableDataRepository.getInstance().testFilePath(bean);
} catch (Throwable e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (in == null) {
if (!result) {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
} else {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Connection_Successfully"));
try {
in.close();
} catch (IOException e) {
in = null;
}
}
}
};

10
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java

@ -102,8 +102,12 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
// 10个正好不会出现滚动条
centerPanel.setLayout(new GridLayout(len < MIN_BAR_NUMBER ? MIN_BAR_NUMBER : len + 1, 1));
centerPanel.add(row(LayoutConstants.HORIZONTAL_GAP,
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Multi_Dataset_Name"))).weight(0.2),
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Multi_Dataset_Conditions"))).weight(0.2),
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Multi_Dataset_Name")))
.with(it -> it.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Multi_Dataset_Name")))
.weight(0.2),
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Multi_Dataset_Conditions")))
.with(it -> it.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Multi_Dataset_Conditions")))
.weight(0.2),
flex(0.6)
).getComponent());
@ -329,7 +333,7 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
).weight(0.2),
//条件公式
row(
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Conditions_Formula") + "=")).weight(0.15),
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Conditions_Formula") + "=")).with(it -> it.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Conditions_Formula") + "=")).weight(0.15),
row(5, cell(formulaContentTextField).weight(0.95), cell(formulaButton).weight(0.05)).weight(0.85)
).weight(0.77),
flex(0.03)

4
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java

@ -15,7 +15,7 @@ import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.datacenters.tabledata.DCTableData;
import com.fr.decision.webservice.bean.dataset.ServerDataSetBean;
import com.fr.design.data.datapane.TableDataNameObjectCreator;
import com.fr.design.data.tabledata.datacenter.DatacentersPane;
import com.fr.design.data.tabledata.datacenter.DCTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.ClassTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.DBTableDataPane;
@ -79,7 +79,7 @@ public abstract class TableDataFactory {
i18nText("Fine-Design_Basic_DS_Datacenters"),
new LazyIcon("datacenter"),
DCTableData.class,
DatacentersPane.class));
DCTableDataPane.class));
map.putAll(defaultMap);
}

14
designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java

@ -5,6 +5,7 @@ import com.fr.design.gui.iscrollbar.UIScrollBar;
import javax.swing.JPanel;
import javax.swing.JScrollBar;
import javax.swing.SwingUtilities;
import java.awt.AWTEvent;
import java.awt.Color;
import java.awt.Component;
@ -111,6 +112,15 @@ public abstract class BasicScrollPane<T> extends BasicBeanPane<T>{
doLayout();
}
/**
* 插入图表后单元格元素使用cardLayout布局,需要滚动效果获取高度在子类中重新计算
*
* @return height
*/
protected int getMaxHeight(){
return getHeight();
}
protected class BarLayout implements LayoutManager {
@Override
@ -135,7 +145,7 @@ public abstract class BasicScrollPane<T> extends BasicBeanPane<T>{
@Override
public void layoutContainer(Container parent) {
if(getHeight() >= leftcontentPane.getPreferredSize().height) {
if(getMaxHeight() >= leftcontentPane.getPreferredSize().height) {
scrollBar.setEnabled(false);
scrollBar.setVisible(false);
} else {
@ -143,7 +153,7 @@ public abstract class BasicScrollPane<T> extends BasicBeanPane<T>{
scrollBar.setEnabled(show);
scrollBar.setVisible(show);
}
maxheight = getHeight() - DET_HEIGHT;
maxheight = getMaxHeight() - DET_HEIGHT;
if ((MAXVALUE - scrollBar.getVisibleAmount()) == 0) {
beginY = 0;
} else {

115
designer-base/src/main/java/com/fr/design/dialog/FineJOptionPane.java

@ -1,5 +1,6 @@
package com.fr.design.dialog;
import com.fine.theme.icon.LazyIcon;
import com.fr.invoke.Reflect;
import com.fr.stable.StringUtils;
@ -31,6 +32,8 @@ public class FineJOptionPane extends JOptionPane {
//选项类型optionType 和 选项字符串数组 一一对应
private final static Map<Integer, String[]> OPTION_MAP = new HashMap<>();
public Icon successMessageIcon;
static {
OPTION_MAP.put(DEFAULT_OPTION, OPTION_DEFAULT);
OPTION_MAP.put(YES_NO_OPTION, OPTION_YES_NO);
@ -42,6 +45,17 @@ public class FineJOptionPane extends JOptionPane {
private final static String CONFIRM_DIALOG_TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dialog_Prompt");
private final static String INPUT_DIALOG_TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips");
public FineJOptionPane(Object message, int messageType, int optionType,
Icon icon, Object[] options, Object initialValue,
boolean successMessage) {
super(message, messageType, optionType, icon, options, initialValue);
if (successMessage) {
successMessageIcon = new LazyIcon("success", 20);
}
}
/**
* 使用默认 标题 消息类型 的消息提示弹出框
* @param parentComponent 父容器
@ -54,6 +68,34 @@ public class FineJOptionPane extends JOptionPane {
INFORMATION_MESSAGE);
}
/**
* 使用 success 图标 默认 标题 消息类型 的消息提示弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @throws HeadlessException
*/
public static void showSuccessMessageDialog(Component parentComponent, Object message)
throws HeadlessException {
showMessageDialog(parentComponent, message, MESSAGE_DIALOG_TITLE, INFORMATION_MESSAGE, true);
}
/**
* 使用默认 标题 消息类型 的消息提示弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param messageType 消息类型
* @param isSuccessMessage 是否使用 success 图标如果不是则根据消息类型生成图标
* @throws HeadlessException
*/
public static void showMessageDialog(Component parentComponent, Object message,
String title, int messageType, boolean isSuccessMessage)
throws HeadlessException {
showOptionDialog(parentComponent, message, title, DEFAULT_OPTION,
messageType, null, OPTION_DEFAULT, null, isSuccessMessage);
}
/**
* 使用默认 Icon 的消息提示弹出框
* @param parentComponent 父容器
@ -101,7 +143,7 @@ public class FineJOptionPane extends JOptionPane {
Icon icon, Object[] options, Object initialValue)
throws HeadlessException {
showOptionDialog(parentComponent, message, title, optionType,
messageType, icon, options, initialValue);
messageType, icon, options, initialValue, false);
}
/**
@ -182,7 +224,7 @@ public class FineJOptionPane extends JOptionPane {
Object[] options, Object initialValue)
throws HeadlessException {
return showOptionDialog(parentComponent, message, title, optionType,
messageType, icon, options, initialValue);
messageType, icon, options, initialValue, false);
}
/**
@ -199,7 +241,7 @@ public class FineJOptionPane extends JOptionPane {
String title, Icon icon, Object initialValue, ActionListener listener)
throws HeadlessException {
int val = showOptionDialog(parentComponent, message, title, JOptionPane.DEFAULT_OPTION,
FineJOptionPane.WARNING_MESSAGE, icon, OPTION_OK_CANCEL, initialValue);
FineJOptionPane.WARNING_MESSAGE, icon, OPTION_OK_CANCEL, initialValue, false);
if (val == JOptionPane.OK_OPTION && listener!=null) {
listener.actionPerformed(null);
}
@ -315,4 +357,71 @@ public class FineJOptionPane extends JOptionPane {
return value;
}
/**
* 根据 message type 生成 icon
* @return
*/
public Icon getIcon() {
if (successMessageIcon != null) {
return successMessageIcon;
}
switch (messageType) {
case ERROR_MESSAGE:
return new LazyIcon("error", 20);
case WARNING_MESSAGE:
return new LazyIcon("warning", 20);
case INFORMATION_MESSAGE:
return new LazyIcon("information", 20);
case QUESTION_MESSAGE:
return new LazyIcon("question", 20);
default:
return icon;
}
}
/**
* 自定义的确认弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param optionType 选项类型
* @param messageType 消息类型
* @param icon 图标
* @param options 选项
* @param initialValue 初始选项
* @param isSuccessMessage 是否使用 success 图标
*/
public static int showOptionDialog(Component parentComponent, Object message,
String title, int optionType, int messageType,
Icon icon, Object[] options, Object initialValue,
boolean isSuccessMessage) {
FineJOptionPane pane = new FineJOptionPane(message, messageType, optionType, icon, options, initialValue, isSuccessMessage);
pane.setInitialValue(initialValue);
pane.setComponentOrientation(((parentComponent == null) ? getRootFrame() : parentComponent).getComponentOrientation());
JDialog dialog = pane.createDialog(parentComponent, title);
pane.selectInitialValue();
dialog.show();
dialog.dispose();
Object selectedValue = pane.getValue();
if (selectedValue == null){
return CLOSED_OPTION;
}
if (options == null) {
if (selectedValue instanceof Integer) {
return ((Integer) selectedValue).intValue();
}
return CLOSED_OPTION;
}
for(int counter = 0, maxCounter = options.length;
counter < maxCounter; counter++) {
if (options[counter].equals(selectedValue)) {
return counter;
}
}
return CLOSED_OPTION;
}
}

2
designer-base/src/main/java/com/fr/design/dialog/TipDialog.java

@ -5,6 +5,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.general.IOUtils;
import com.fr.stable.StringUtils;
@ -36,6 +37,7 @@ public abstract class TipDialog extends JDialog implements ActionListener {
iconPane.setPreferredSize(new Dimension(50, 50));
JPanel tipPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
UILabel tipLabel = new UILabel(tip);
UIComponentUtils.setLineWrap(tipLabel);
tipPane.add(tipLabel);
northPane.add(iconPane, BorderLayout.WEST);
northPane.add(tipPane, BorderLayout.CENTER);

35
designer-base/src/main/java/com/fr/design/dialog/UIDetailErrorLinkDialog.java

@ -1,5 +1,9 @@
package com.fr.design.dialog;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.GraphHelper;
import com.fr.design.dialog.link.MessageWithLink;
import com.fr.design.gui.ibutton.UIButton;
@ -7,6 +11,7 @@ import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
@ -30,6 +35,11 @@ import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.fix;
import static com.fine.swing.ui.layout.Layouts.row;
/**
* 带链接的错误详情弹窗
*
@ -40,13 +50,13 @@ import javax.swing.SwingUtilities;
public class UIDetailErrorLinkDialog extends UIDialog {
private static final Color LINK_COLOR = new Color(51, 152, 253);
private static final int GAP_5 = 5;
private static final int GAP_8 = 8;
private static final int GAP_10 = 10;
private static final String TAG_A_START = "<a>";
private static final String TAG_A_END = "</a>";
private static final double SCALE = 1.2;
private final Dimension dimension = new Dimension(300, 180);
private final Dimension dimension = new Dimension(360, 180);
public static Builder newBuilder() {
return new Builder();
@ -65,15 +75,12 @@ public class UIDetailErrorLinkDialog extends UIDialog {
private void init(Builder builder) {
this.setTitle(builder.title);
// 顶部 图标和提示
UILabel errorIcon = new UILabel(IOUtils.readIcon("com/fr/design/images/lookandfeel/Information_Icon_Error_32x32.png"));
UILabel errorIcon = new UILabel(new LazyIcon("error", 20));
UILabel errorInfo= new UILabel(builder.reason);
JPanel topPane = new JPanel(new FlowLayout(FlowLayout.LEFT, GAP_10, GAP_5));
topPane.add(errorIcon);
topPane.add(errorInfo);
FineUIStyle.setStyle(errorInfo, FineUIStyle.LABEL_TIP_WINDOW_TITLE);
// 中部 详细内容
JPanel contentPane = new JPanel(new BorderLayout());
contentPane.setBorder(BorderFactory.createEmptyBorder(0, GAP_5,0,0));
JPanel contentPane = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(GAP_10, GAP_10));
UILabel errorCodeLabel = new UILabel(Toolkit.i18nText("Fine_Design_Basic_Error_Code", builder.errorCode));
UILabel link = new UILabel(Toolkit.i18nText("Fine_Design_Basic_Show_Error_Stack"));
link.setForeground(LINK_COLOR);
@ -92,13 +99,17 @@ public class UIDetailErrorLinkDialog extends UIDialog {
contentPane.add(link, BorderLayout.SOUTH);
// 确定 + 取消
JPanel actionPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, GAP_10, GAP_5));
JPanel actionPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, GAP_10, GAP_8));
actionPane.add(createButton(Toolkit.i18nText("Fine-Design_Report_OK")));
actionPane.add(createButton(Toolkit.i18nText("Fine-Design_Basic_Cancel")));
this.getContentPane().add(topPane, BorderLayout.NORTH);
this.getContentPane().add(contentPane, BorderLayout.CENTER);
this.getContentPane().add(column(10,
row(10, cell(errorIcon), cell(errorInfo)),
row(10, fix(20), cell(contentPane))
).with(it -> it.setBorder(new ScaledEmptyBorder(GAP_10, GAP_10, GAP_10, GAP_10))).getComponent());
this.getContentPane().add(actionPane, BorderLayout.SOUTH);
this.setSize(dimension);
this.setSize(FineUIScale.scale(dimension));
this.setResizable(false);
this.setModal(true);
GUICoreUtils.centerWindow(this);

2
designer-base/src/main/java/com/fr/design/editor/ValueEditorPane.java

@ -58,7 +58,7 @@ public class ValueEditorPane extends BasicPane implements UIObserver, GlobalName
}
public ValueEditorPane(Editor[] cards, String popupName, String textEditorValue) {
initComponents(cards, popupName, textEditorValue, 200);
initComponents(cards, popupName, textEditorValue, FineUIScale.scale(200));
}
public ValueEditorPane(Editor[] cards, String popupName, String textEditorValue, int centerPaneWidth) {

36
designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java vendored

@ -6,6 +6,8 @@ import com.fanruan.workplace.http.RepositoryManager;
import com.fanruan.workplace.http.info.Stub;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.workspace.engine.exception.RemoteDesignConnectionException;
import com.fr.workspace.engine.exception.RemoteDesignNoAuthException;
import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import com.fr.workspace.server.repository.compatible.register.CompatibleRegister;
import com.fr.workspace.server.repository.connect.FineWorkspaceHttpClient;
@ -43,7 +45,8 @@ public class HttpWorkspaceConnector implements WorkspaceConnector {
FineWorkspaceHttpClient client = FineWorkspaceHttpClient.create("Http-Client", connectionInfo);
LoginResponseInfoBean bean;
try {
bean = RemoteAuthorityRepository.getInstance().login(createLoginBean(connectionInfo));
bean = RemoteAuthorityRepository.getInstance().login(createLoginBean(connectionInfo));
checkValidAndUpdateInfo(client, connectionInfo, bean);
} finally {
client.closePool();
}
@ -65,12 +68,7 @@ public class HttpWorkspaceConnector implements WorkspaceConnector {
throw new RuntimeException("Empty token, try connect again and check server");
}
FineLoggerFactory.getLogger().info("[connector] infos:{}", bean.getAccessToken());
WorkspaceConnection connection = new WorkspaceConnection(
UUID.randomUUID().toString(),
connectionInfo.getUserName(),
HttpConstants.AUTHORIZATION_PREFIX + bean.getAccessToken(),
InetAddress.getLocalHost().getHostAddress());
client.updateConnection(connection);
checkValidAndUpdateInfo(client, connectionInfo, bean);
client.startHeartBeat();
} catch (Exception e) {
client.closePool();
@ -81,6 +79,30 @@ public class HttpWorkspaceConnector implements WorkspaceConnector {
return client;
}
private void checkValidAndUpdateInfo(FineWorkspaceHttpClient client, WorkspaceConnectionInfo connectionInfo, LoginResponseInfoBean bean) throws Exception {
WorkspaceConnection connection = new WorkspaceConnection(
UUID.randomUUID().toString(),
connectionInfo.getUserName(),
HttpConstants.AUTHORIZATION_PREFIX + bean.getAccessToken(),
InetAddress.getLocalHost().getHostAddress());
client.updateConnection(connection);
// 检查远程权限
if (!checkRemoteAuthority(connection)) {
// 无权限则抛出无权限的错
throw new RemoteDesignNoAuthException();
}
}
private boolean checkRemoteAuthority(WorkspaceConnection connection) {
try {
return RemoteAuthorityRepository.getInstance().isRoot(connection.getUserName()) || RemoteAuthorityRepository.getInstance().hasAuthority(connection.getUserName());
} catch (Exception e) {
// 如果这里出现异常,就认为fr服务没启动
throw new RemoteDesignConnectionException(e, StringUtils.EMPTY);
}
}
private LoginRequestInfoBean createLoginBean(WorkspaceConnectionInfo connectionInfo) {
LoginRequestInfoBean bean = new LoginRequestInfoBean();
bean.setUsername(connectionInfo.getUserName());

2
designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java

@ -847,7 +847,7 @@ public class MultiTemplateTabPane extends Row {
setIsCloseCurrent(true);
}
closeFormat(template);
closeSpecifiedTemplate(template);
DesignCacheManager.processByCacheTableData(() -> closeSpecifiedTemplate(template));
DesignerContext.getDesignerFrame().getContentFrame().repaint();
isShowList = false;
} else {

44
designer-base/src/main/java/com/fr/design/formula/DefaultTinyFormulaPane.java

@ -1,6 +1,14 @@
package com.fr.design.formula;
import com.fine.theme.utils.FineUIScale;
import com.fr.base.BaseFormula;
import com.fr.design.gui.ilable.UILabel;
import java.awt.Component;
import java.awt.BorderLayout;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.flex;
/**
* @author Carlson
@ -10,8 +18,44 @@ import com.fr.base.BaseFormula;
**/
public class DefaultTinyFormulaPane extends TinyFormulaPane{
/**
* 默认构造方法
* 一个输入框和一个F(x)按钮
*/
public DefaultTinyFormulaPane() {
this.initComponents();
this.initLayout();
}
/**
* 带标题的构造方法
* 当需要显示标题时使用此构造方法
*
* @param title 要在布局中显示的标题
*/
public DefaultTinyFormulaPane(String title) {
this.initComponents();
this.initLayout(title);
}
private void initLayout(String title) {
this.setLayout(new BorderLayout());
this.add(row(cell(new UILabel(title)).weight(1.2), cell(createDefaultTinyFormulaPane()).weight(3)).getComponent());
}
@Override
protected void populateTextField(BaseFormula fm) {
formulaTextField.setText(fm.getContent());
}
@Override
protected void initLayout() {
this.setLayout(new BorderLayout());
formulaTextFieldButton.setPreferredSize(FineUIScale.createScaleDimension(24, 24));
this.add(createDefaultTinyFormulaPane());
}
private Component createDefaultTinyFormulaPane() {
return row(cell(formulaTextField).weight(2), flex(0.1), cell(formulaTextFieldButton).weight(0.4)).getComponent();
}
}

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

@ -41,6 +41,7 @@ import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
@ -743,7 +744,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
}
public BasicDialog showLargeWindow(Window window, DialogActionListener l) {
Dimension dimension = new Dimension(900, 640);
Dimension dimension = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.formula.FormulaPane");
BasicDialog basicDialog = super.showWindowWithCustomSize(window, l, dimension);
basicDialog.setResizable(true);
return basicDialog;
@ -915,7 +916,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
private void showMessageDialog(String message, boolean formulaValid, boolean calException) {
if (formulaValid && !calException) {
FineJOptionPane.showMessageDialog(
FineJOptionPane.showSuccessMessageDialog(
FormulaPane.this,
message);
} else {

12
designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java

@ -32,6 +32,9 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.concurrent.ExecutionException;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
public class JavaEditorPane extends BasicPane {
private RSyntaxTextArea javaText;
@ -83,13 +86,12 @@ public class JavaEditorPane extends BasicPane {
}
UIScrollPane jt = new UIScrollPane(javaText);
JPanel toolbarPane = new JPanel(new FlowLayout(FlowLayout.LEFT));
JPanel toolbarPane = new JPanel(new BorderLayout());
UIButton saveButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Save"));
saveButton.setAction(new SaveAction());
UIButton compileButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Compile"));
compileButton.setAction(new CompilerAction());
toolbarPane.add(saveButton);
toolbarPane.add(compileButton);
toolbarPane.add(row(8, cell(saveButton), cell(compileButton)).getComponent());
this.add(toolbarPane, BorderLayout.NORTH);
this.add(jt, BorderLayout.CENTER);
@ -155,7 +157,7 @@ public class JavaEditorPane extends BasicPane {
private void saveTextToFile(String text) {
if (StringUtils.isEmpty(text)) {
return;
return;
}
if (StringUtils.isEmpty(className)) {
return;
@ -180,7 +182,7 @@ public class JavaEditorPane extends BasicPane {
@Override
protected JavaCompileInfo doInBackground() throws Exception {
return FRContext.getCommonOperator().compile(javaText.getText());
}

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

@ -374,25 +374,23 @@ public abstract class JListControlPane extends JControlPane implements ListContr
this.iconLabel.setBorder(new ScaledEmptyBorder(0, 4, 0, 0));
add(this.textLabel, BorderLayout.CENTER);
add(this.iconLabel, BorderLayout.WEST);
this.iconLabel.setBackground(FlatUIUtils.getUIColor("List.cellRender.background", Color.WHITE));
//iconLabel和textLabel的背景颜色不会被JList背景颜色覆盖,开发者自定义
this.textLabel.setOpaque(true);
this.iconLabel.setOpaque(true);
this.textLabel.setOpaque(false);
this.iconLabel.setOpaque(false);
}
@Override
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
setPreferredSize(FineUIScale.scale(new Dimension(list.getWidth(), 24)));
setPreferredSize(new Dimension(list.getWidth(), FineUIScale.scale(24)));
if (value instanceof ListModelElement) {
ListModelElement element = ((ListModelElement) value);
Nameable nameable = element.wrapper;
this.textLabel.setText(nameable.getName());
boolean iconSet = false;
if(isSelected) {
this.textLabel.setBackground(FlatUIUtils.getUIColor("List.selectionInactiveBackground", Color.GRAY));
setBackground(FlatUIUtils.getUIColor("List.selectionInactiveBackground", Color.GRAY));
} else {
this.textLabel.setBackground(FlatUIUtils.getUIColor("List.cellRender.background", Color.WHITE));
setBackground(FlatUIUtils.getUIColor("List.cellRender.background", Color.WHITE));
}
for (NameableCreator creator : JListControlPane.this.creators()) {
if (creator.menuIcon() != null && creator.acceptObject2Populate(nameable) != null) {

4
designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneHelper.java

@ -1,5 +1,6 @@
package com.fr.design.gui.controlpane;
import com.fine.theme.utils.FineUIScale;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ilist.JNameEdList;
@ -38,6 +39,7 @@ import java.util.Map;
*/
class ListControlPaneHelper {
private static final int EDIT_RANGE = 25; // 编辑按钮的x坐标范围
private static final int DIALOG_GAP = 25; // 编辑按钮的x坐标范围
private ListControlPaneProvider listControlPane;
@ -160,7 +162,7 @@ class ListControlPaneHelper {
// 不能太低
int maxY = frame.getLocationOnScreen().y + frame.getHeight() - popupEditDialog.getHeight();
if (resultPos.y > maxY) {
resultPos.y = maxY;
resultPos.y = maxY - FineUIScale.scale(DIALOG_GAP);
}
// 也不能太高
int minY = frame.getLocationOnScreen().y + EDIT_RANGE;

3
designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java

@ -2,6 +2,7 @@ package com.fr.design.gui.controlpane;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.UIConstants;
@ -567,7 +568,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li
};
label.setBorder(BorderFactory.createMatteBorder(scale(1), 0, scale(1), 0, FineUIUtils.getUIColor("fill.hover", "fill.hover")));
label.setForeground(UIManager.getColor("List.wrapper.text.fontColor"));
FineUIStyle.setStyle(label, FineUIStyle.WIDGET_EVENT_LABEL);
label.setFont(label.getFont().deriveFont(scale(11F)));
label.setPreferredSize(new Dimension(this.getPreferredSize().width, scale(24)));
this.nameEdList = nameEdList;

18
designer-base/src/main/java/com/fr/design/gui/controlpane/UISimpleListControlPane.java

@ -2,13 +2,13 @@ package com.fr.design.gui.controlpane;
import com.fine.theme.icon.LazyIcon;
import com.fr.design.actions.UpdateAction;
import com.fr.design.border.FineBorderFactory;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.gui.ilist.UIList;
import com.fr.design.gui.itoolbar.UIToolBarUI;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.menu.ShortCut;
@ -22,7 +22,6 @@ import sun.swing.DefaultLookup;
import javax.swing.BorderFactory;
import javax.swing.DefaultListModel;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListCellRenderer;
@ -33,8 +32,6 @@ import javax.swing.event.ListSelectionListener;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
@ -89,22 +86,14 @@ public class UISimpleListControlPane extends BasicPane {
toolbarDef.addShortCut(sj.getShortCut());
}
toolBar = ToolBarDef.createJToolBar();
toolBar.setUI(new UIToolBarUI(){
@Override
public void paint(Graphics g, JComponent c) {
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.WHITE);
g2.fillRect(0, 0, c.getWidth(), c.getHeight());
}
});
toolbarDef.updateToolBar(toolBar);
// 封装一层,加边框
JPanel toolBarPane = new JPanel(new BorderLayout());
toolBarPane.add(toolBar, BorderLayout.CENTER);
toolBarPane.setBorder(BorderFactory.createMatteBorder(1, 1, 0, 1, UIConstants.RULER_LINE_COLOR));
toolBarPane.setBorder(FineBorderFactory.createDefaultUnderlineBorder());
listPane.add(toolBarPane, BorderLayout.NORTH);
contentPane.setBorder(FineBorderFactory.createWrappedRoundBorder());
return contentPane;
}
@ -420,7 +409,6 @@ public class UISimpleListControlPane extends BasicPane {
private void initComponents() {
label = new UILabel();
// label.setBorder(BorderFactory.createEmptyBorder(3, 10, 3, 0));
initialLabelForeground = label.getForeground();
this.setLayout(new BorderLayout());
this.add(label, BorderLayout.CENTER);

2
designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java

@ -159,7 +159,7 @@ public class UICalendarPanel extends JPanel {
private JPanel createNorthPane() {
JPanel pNorth = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane();
pNorth.setBackground(new Color(0xFFFFFF));
pNorth.setPreferredSize(new Dimension(1, 22));
pNorth.setPreferredSize(scale(new Dimension(1, 22)));
pNorth.add(Box.createHorizontalStrut(5));
pNorth.add(createSkipButton(Calendar.YEAR, -1, new Icon[]{

4
designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java

@ -7,6 +7,8 @@ import java.awt.Dimension;
import java.text.SimpleDateFormat;
import java.util.Date;
import static com.fine.theme.utils.FineUIScale.scale;
public class UIDayLabel extends UILabel {
@ -29,7 +31,7 @@ public class UIDayLabel extends UILabel {
setHorizontalAlignment(UILabel.CENTER);
setFont(DesignUtils.getDefaultGUIFont());
this.date = date;
setPreferredSize(new Dimension(30, 18));
setPreferredSize(scale(new Dimension(30, 18)));
if (isSmallLabel) {
setText(dayFormat.format(date));
} else {

6
designer-base/src/main/java/com/fr/design/gui/frpane/ClosableBubbleFloatPane.java

@ -1,10 +1,9 @@
package com.fr.design.gui.frpane;
import com.fr.base.BaseUtils;
import com.fine.theme.icon.LazyIcon;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.Icon;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Point;
@ -30,8 +29,7 @@ public abstract class ClosableBubbleFloatPane<T> extends UIBubbleFloatPane<T> {
protected JPanel initTopOptionMenu() {
JPanel menu = new JPanel(new BorderLayout());
Icon icon = BaseUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png");
UILabel label = new UILabel(icon);
UILabel label = new UILabel(new LazyIcon("close"));
label.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {

48
designer-base/src/main/java/com/fr/design/gui/frpane/FineTabbedPane.java

@ -4,9 +4,14 @@ import com.fine.swing.ui.layout.Box;
import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.gui.ibutton.FitUIButtonGroup;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.utils.ColorUtils;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.List;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
@ -42,15 +47,15 @@ public class FineTabbedPane extends Box {
private final UIButtonGroup<String> tabGroup;
private final Map<String, JComponent> tabComponents;
private final int[] tabLayout;
private final boolean useFitTab ;
private FineTabbedPane(Map<String, JComponent> tabComponents, float headRatio, int[] tabLayout) {
private FineTabbedPane(Map<String, JComponent> tabComponents, float headRatio, int[] tabLayout, boolean useFitTab) {
this.headRatio = headRatio;
this.tabComponents = tabComponents;
this.tabLayout = tabLayout;
this.useFitTab = useFitTab;
String[] titleArray = tabComponents.keySet().toArray(new String[0]);
this.tabGroup = new UIButtonGroup<>(titleArray, titleArray, tabLayout);
this.tabGroup = useFitTab ? new FitUIButtonGroup<>(titleArray, titleArray, tabLayout) : new UIButtonGroup<>(titleArray, titleArray, tabLayout);
initLayout();
initListeners();
}
@ -71,6 +76,7 @@ public class FineTabbedPane extends Box {
private int[] tabLayout;
private float headRatio = 0.5f;
private final Map<String, JComponent> tabComponents = new LinkedHashMap<>();
private boolean useFitTab = false;
/**
* 设置头部居中比例0-1之间
@ -94,6 +100,16 @@ public class FineTabbedPane extends Box {
return this;
}
/**
* 设置使用自适应文本Tab
*
* @return TabPaneBuilder
*/
public TabPaneBuilder withAdaptiveFit() {
this.useFitTab = true;
return this;
}
/**
* 添加tab标签
*
@ -122,7 +138,7 @@ public class FineTabbedPane extends Box {
} else if (Arrays.stream(tabLayout).sum() != tabComponents.size()) {
throw new IllegalArgumentException("illegal tab layout argument!");
}
return new FineTabbedPane(tabComponents, headRatio, tabLayout);
return new FineTabbedPane(tabComponents, headRatio, tabLayout, useFitTab);
}
}
@ -131,11 +147,10 @@ public class FineTabbedPane extends Box {
setMatchParentSize(true);
float flexRatio = (1 - headRatio) / 2;
int headHeight = FlatUIUtils.getUIInt("Component.defaultHeight",24) * tabLayout.length / 2;
Component component = useFitTab ? row(flex(), cell(tabGroup), flex()).getComponent() : row(flex(flexRatio), cell(tabGroup).weight(headRatio), flex(flexRatio)).getComponent();
add(
column(
row(
flex(flexRatio), cell(tabGroup).weight(headRatio), flex(flexRatio)
),
cell(component),
flex()
),
column(
@ -170,6 +185,23 @@ public class FineTabbedPane extends Box {
});
tabGroup.setSelectedIndex(0);
cards.show(centerPane, String.valueOf(tabGroup.getSelectedItem()));
if (!useFitTab) {
initTabListeners();
}
}
private void initTabListeners() {
List<UIToggleButton> tabs = tabGroup.getLabelButtonList();
for (UIToggleButton tab : tabs) {
tab.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
if (tab.getPreferredSize().width > tab.getWidth()) {
tab.setToolTipText(tab.getText());
}
}
});
}
}
private void fireStateChanged() {

3
designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPane.java

@ -38,9 +38,10 @@ public class UINumberDragPane extends BasicBeanPane<Double> implements GlobalNam
public UINumberDragPane(double minValue, double maxValue, double dierta) {
dragBar = new UISlider((int) minValue, (int) maxValue);
dragBar.setPaintLabels(true);
dragBar.setMajorTickSpacing((int) maxValue);
dragBar.setMajorTickSpacing((int) maxValue - (int) minValue);
spinner = createUISpinner(minValue, maxValue, dierta);
spinner.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation"));
spinner.setValue(dragBar.getValue());
this.setLayout(new BorderLayout());
this.add(Layouts.row(
cell(dragBar).weight(0.7), flex(0.1), cell(spinner).weight(0.7)

53
designer-base/src/main/java/com/fr/design/gui/ibutton/FitUIButtonGroup.java

@ -0,0 +1,53 @@
package com.fr.design.gui.ibutton;
import com.fine.swing.ui.layout.Row;
import java.util.List;
import static com.fine.theme.utils.FineClientProperties.BUTTON_GROUP_POSITION;
import static com.fine.theme.utils.FineClientProperties.BUTTON_TYPE_GROUP_FIT;
import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE;
/**
* 自适应文案宽度的ButtonGroup
*
* @author Levy.Xie
* @since 11.0
* Created on 2024/08/28
*/
public class FitUIButtonGroup<T> extends UIButtonGroup<T> {
public FitUIButtonGroup(String[] textArray) {
super(textArray);
}
public FitUIButtonGroup(String[] textArray, T[] objects) {
super(textArray, objects);
}
public FitUIButtonGroup(String[] textArray, T[] objects, int[] customCols) {
super(textArray, objects, customCols);
}
@Override
protected void initLayout(int[] cols, boolean inToolbar) {
Row row = new Row();
List<UIToggleButton> buttonList = getLabelButtonList();
for (int i = 0; i < buttonList.size(); i++) {
row.add(buttonList.get(i));
if (i != buttonList.size() - 1 && !inToolbar) {
row.add(createDivider());
}
}
add(row);
}
@Override
protected void initButton(UIToggleButton labelButton, int index) {
labelButton.setBorderPainted(false);
labelButton.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_GROUP_FIT);
labelButton.putClientProperty(BUTTON_GROUP_POSITION, getGroupButtonPosition(index));
labelButtonList.add(labelButton);
}
}

9
designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java

@ -1,6 +1,7 @@
package com.fr.design.gui.ibutton;
import com.fine.swing.ui.layout.Column;
import com.fine.swing.ui.layout.Layouts;
import com.fine.swing.ui.layout.Row;
import com.fine.swing.ui.layout.Spacer;
import com.fine.theme.light.ui.FineRoundBorder;
@ -213,24 +214,24 @@ public class UIButtonGroup<T> extends Column implements GlobalNameObserver, UIOb
int col = cols[row];
Row rowContainer = new Row();
for (int j = 0; j < col; j++) {
rowContainer.add(cell(getLabelButtonList().get(currentIndex)).weight(1.0));
Layouts.populate(rowContainer, cell(getLabelButtonList().get(currentIndex)).weight(1.0));
currentIndex++;
if (j != col - 1 && !inToolbar) {
rowContainer.add(createDivider());
}
}
add(rowContainer);
Layouts.populate(this, cell(rowContainer).weight(1.0));
if (row != cols.length - 1) {
add(createDivider());
}
}
}
private List<UIToggleButton> getLabelButtonList() {
public List<UIToggleButton> getLabelButtonList() {
return labelButtonList;
}
private Spacer createDivider() {
protected Spacer createDivider() {
Spacer spacer = new Spacer(FineUIScale.scale(1));
spacer.setBorder(new LineBorder(FineUIUtils.getUIColor("defaultBorderColor", "Component.borderColor")));
return spacer;

16
designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java

@ -5,6 +5,8 @@ import com.fine.swing.ui.layout.Row;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.third.guava.collect.Streams;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.AbstractButton;
import javax.swing.ButtonGroup;
import javax.swing.Icon;
@ -72,6 +74,20 @@ public class UIHeadGroup extends Row {
add(buttonGroup());
setSelectedIndex(0);
setBorder(new ScaledEmptyBorder(2, 2, 2, 2));
initButtonListeners();
}
private void initButtonListeners() {
for (AbstractButton tab : btns) {
tab.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
if (tab.getPreferredSize().width > tab.getWidth()) {
tab.setToolTipText(tab.getText());
}
}
});
}
}
private Layouts.Cell<?>[] buttonGroup() {

2
designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java

@ -233,7 +233,7 @@ public class ColorSchemeComboBox extends UIComboBox {
@Override
public Dimension getPreferredSize() {
Dimension preferredSize = super.getPreferredSize();
preferredSize.setSize(super.getPreferredSize().getWidth(), FineUIScale.scale(HEIGHT));
preferredSize.setSize(ColorSchemeComboBox.this.getPreferredSize().width, FineUIScale.scale(HEIGHT));
return preferredSize;
}

15
designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java

@ -1,17 +1,13 @@
package com.fr.design.gui.icombobox;
import com.fine.theme.light.ui.FineComboBoxUI;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JComboBox;
import javax.swing.JComponent;
@ -25,7 +21,6 @@ import javax.swing.UIManager;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.event.PopupMenuListener;
import javax.swing.plaf.basic.BasicComboBoxUI;
import javax.swing.plaf.basic.ComboPopup;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
@ -34,13 +29,9 @@ import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import java.util.Enumeration;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.IllegalComponentStateException;
import java.awt.RenderingHints;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
@ -50,10 +41,12 @@ import java.awt.event.MouseListener;
import java.awt.event.MouseMotionAdapter;
import java.awt.event.MouseMotionListener;
import static com.fine.theme.utils.FineUIScale.scale;
public class FRTreeComboBox extends UIComboBox {
private static final int PAGE_DIFF = 5;
private static final int DEFAULT_HEIGHT = 120;
private static final int PAGE_DIFF = scale(5);
private static final int DEFAULT_HEIGHT = scale(120);
// richer:下拉展示用的tree
protected JTree tree;

2
designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java

@ -129,7 +129,7 @@ public class LineComboBox extends UIComboBox {
}
public Dimension getPreferredSize() {
return new Dimension(getWidth(), FineUIScale.scale(LINE_HEIGHT));
return new Dimension(super.getPreferredSize().width, FineUIScale.scale(LINE_HEIGHT));
}
public Dimension getMinimumSize() {

127
designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java

@ -3,27 +3,26 @@ package com.fr.design.gui.icontainer;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIUtils;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.BorderFactory;
import javax.swing.UIManager;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.Icon;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.border.Border;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.LayoutManager;
import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
@ -34,32 +33,87 @@ import java.awt.event.MouseMotionListener;
public class UIEastResizableContainer extends JPanel {
private static final long serialVersionUID = 1854340560790476907L;
public static final int MAX_CONTAINER_WIDTH = FineUIScale.scale(340);
public static final int MIN_CONTAINER_WIDTH = FineUIScale.scale(286);
public static final int MAX_CONTAINER_WIDTH = FineUIUtils.getScaledI18nDimension(
"com.fr.design.mainframe.EastRegionContainerPane.maximum").width;
public static final int MIN_CONTAINER_WIDTH = FineUIUtils.getScaledI18nDimension(
"com.fr.design.mainframe.EastRegionContainerPane.minimum").width;
public static final int STD_CONTAINER_WIDTH = FineUIUtils.getScaledI18nDimension(
"com.fr.design.mainframe.EastRegionContainerPane.standard").width;
private int containerWidth = STD_CONTAINER_WIDTH;
private int preferredWidth = STD_CONTAINER_WIDTH;
protected final int leftPaneWidth = FineUIScale.scale(42);
protected final int topToolPaneHeight = FineUIScale.scale(40);
private int containerWidth = FineUIScale.scale(240);
private int preferredWidth = FineUIScale.scale(240);
private int topToolPaneHeight = FineUIScale.scale(40);
private int leftPaneWidth = FineUIScale.scale(42);
private static final int ARROW_RANGE = FineUIScale.scale(35);
private JComponent leftPane;
private JComponent rightPane;
private TopToolPane topToolPane;
private static final int ARROW_MARGIN = FineUIScale.scale(15);
private static final int ARROW_RANGE = FineUIScale.scale(35);
private static final int DRAG_GAP_SIZE = 10;
private Point dragPoint;
public UIEastResizableContainer() {
this(new JPanel(), new JPanel());
initMouseListener();
}
private void initMouseListener() {
MouseAdapter mouseAdapter = new MouseAdapter() {
@Override
public void mouseMoved(MouseEvent e) {
updateCursor(e);
}
@Override
public void mousePressed(MouseEvent e) {
if (isEnableDrag(e)) {
dragPoint = e.getPoint();
}
}
@Override
public void mouseDragged(MouseEvent e) {
resizePanel(e);
}
};
addMouseListener(mouseAdapter);
addMouseMotionListener(mouseAdapter);
}
private void updateCursor(MouseEvent e) {
if (isEnableDrag(e)) {
setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR));
} else {
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
protected boolean isEnableDrag(MouseEvent e) {
return e.getX() <= DRAG_GAP_SIZE && isRightPaneVisible();
}
protected void resizePanel(MouseEvent e) {
if (!isRightPaneVisible()) {
return;
}
int dx = e.getX() - dragPoint.x;
Dimension size = getSize();
int newWidth = size.width - dx;
// 限制container大小为指定范围
containerWidth = Math.max(MIN_CONTAINER_WIDTH, Math.min(newWidth, MAX_CONTAINER_WIDTH));
SwingUtilities.invokeLater(this::revalidate);
}
/**
* 设置面板宽度
*
* @param width
* @param width 宽度
*/
public void setContainerWidth(int width) {
this.containerWidth = width;
@ -70,8 +124,6 @@ public class UIEastResizableContainer extends JPanel {
return containerWidth > leftPaneWidth;
}
private void setPreferredWidth(int width) {
this.preferredWidth = width;
}
@ -81,7 +133,7 @@ public class UIEastResizableContainer extends JPanel {
this.rightPane = rightPane;
this.topToolPane = new TopToolPane();
topToolPane.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 1, 0));
topToolPane.setBorder(BorderFactory.createMatteBorder(0 ,1, 0, 1, UIManager.getColor("East.border")));
topToolPane.setBorder(BorderFactory.createMatteBorder(0, 1, 0, 1, UIManager.getColor("East.border")));
setLayout(containerLayout);
add(topToolPane);
@ -89,38 +141,6 @@ public class UIEastResizableContainer extends JPanel {
add(rightPane);
}
public static void main(String... args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
JPanel leftPane = new JPanel();
// leftPane.setBackground(Color.yellow);
JPanel rightPane = new JPanel();
// rightPane.setBackground(Color.green);
UIButton b1, b2;
b1 = new UIButton("b1");
b2 = new UIButton("b2");
b1.setPreferredSize(new Dimension(40, 40));
b2.setPreferredSize(new Dimension(40, 40));
leftPane.add(b1);
leftPane.add(b2);
UIEastResizableContainer bb = new UIEastResizableContainer(leftPane, rightPane);
JPanel cc = new JPanel();
// cc.setBackground(Color.WHITE);
content.add(bb, BorderLayout.EAST);
content.add(cc, BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(500, 500);
jf.setVisible(true);
}
/**
* 将面板设置成最佳的宽度
*/
@ -156,7 +176,6 @@ public class UIEastResizableContainer extends JPanel {
@Override
public void removeLayoutComponent(Component comp) {
// TODO Auto-generated method stub
}
@ -182,7 +201,7 @@ public class UIEastResizableContainer extends JPanel {
@Override
public void addLayoutComponent(String name, Component comp) {
// do nothing
}
};

2
designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java

@ -123,6 +123,8 @@ public class UIModeControlContainer extends JLayeredPane {
horizontToolPane = new JPanel() {
@Override
public void paint(Graphics g) {
g.setColor(FineUIUtils.getUIColor("fill.normal", "fill.normal"));
g.fillRect(0, 0, getWidth(), getHeight());
if (upEditMode) {
g.drawImage(UIConstants.DRAG_DOT, (getWidth() - toolPaneHeight) / 2, 3, toolPaneHeight, 8, null);
}

11
designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java

@ -391,17 +391,6 @@ public class UIResizableContainer extends JPanel {
repaint();
}
@Override
public void mouseClicked(MouseEvent e) {
if (e.getX() <= ARROW_RANGE) {
toolPaneY = 0;
} else if (e.getX() >= getWidth() - ARROW_RANGE) {
toolPaneY = UIResizableContainer.this.getHeight() - toolPaneHeight - getParameterPaneHeight();
} else {
return;
}
refreshContainer();
}
});
}

3
designer-base/src/main/java/com/fr/design/gui/itooltip/MultiLineToolTip.java

@ -1,10 +1,11 @@
package com.fr.design.gui.itooltip;
import com.fine.theme.light.ui.FineTooltipUI;
import javax.swing.JToolTip;
public class MultiLineToolTip extends JToolTip {
public MultiLineToolTip() {
setUI(new MultiLineToolTipUI());
setUI(new FineTooltipUI());
}
}

14
designer-base/src/main/java/com/fr/design/gui/style/FollowingThemePane.java

@ -1,6 +1,6 @@
package com.fr.design.gui.style;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineLayoutBuilder;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.theme.TemplateTheme;
import com.fr.design.dialog.BasicPane;
@ -12,15 +12,11 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
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.JTemplate;
import com.fr.design.widget.FRWidgetFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
@ -71,14 +67,8 @@ public class FollowingThemePane extends BasicPane implements UIObserver {
});
UILabel followingThemeLabel = FRWidgetFactory.createLineWrapLabel(name);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
JPanel followingThemePane =
TableLayoutHelper.createGapTableLayoutPane( new Component[][]{new Component[] { followingThemeLabel, FRGUIPaneFactory.createBorderLayoutNorthPaneWithComponent(followingThemeButtonGroup)}},
new double[] { p }, new double[] {FineUIScale.scale(SETTING_LABEL_WIDTH), f }, 10, 0);
JPanel followingThemePane = FineLayoutBuilder.createHorizontalLayout(0, new double[]{1.2, 3}, followingThemeLabel, followingThemeButtonGroup);
followingThemePane.setVisible(false);
followingThemePane.setPreferredSize(new Dimension(FineUIScale.scale(275), (int) followingThemePane.getPreferredSize().getHeight()));
add(followingThemePane, BorderLayout.NORTH);
container = FRGUIPaneFactory.createBorderLayout_S_Pane();

3
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java

@ -24,6 +24,7 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import javax.swing.JTextArea;
import javax.swing.UIManager;
import javax.swing.event.CaretEvent;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.TextUI;
@ -73,7 +74,7 @@ int currentCaretY; // Used to know when to rehighlight current line.
private RTAMouseListener mouseListener;
private static final Color DEFAULT_CARET_COLOR = new ColorUIResource(255,51,51);
private static final Color DEFAULT_CURRENT_LINE_HIGHLIGHT_COLOR = new Color(255,255,170);
private static final Color DEFAULT_CURRENT_LINE_HIGHLIGHT_COLOR = UIManager.getColor("TextArea.currentLineHighlightColor");
private static final Color DEFAULT_MARGIN_LINE_COLOR = new Color(255,224,224);
private static final int DEFAULT_TAB_SIZE = 4;
private static final int DEFAULT_MARGIN_LINE_POSITION = 80;

6
designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperNorthPane.java

@ -64,14 +64,14 @@ public abstract class AbstractHyperNorthPane<T extends Hyperlink> extends BasicB
UILabel widthLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Designer_Width"));
widthTextFiled = new UISpinner(0, Integer.MAX_VALUE, 1, DEFAULT_V_VALUE);
newWindowConfPane.add(column(10,
row(cell(heightLabel).weight(0.13), cell(heightTextFiled).weight(0.87)),
row(cell(widthLabel).weight(0.13), cell(widthTextFiled).weight(0.87))
row(cell(heightLabel).weight(0.2), cell(heightTextFiled).weight(0.8)),
row(cell(widthLabel).weight(0.2), cell(widthTextFiled).weight(0.8))
).getComponent());
JPanel centerPanel = new JPanel(new BorderLayout());
centerPanel.add(column(10,
row(cell(targetFrameLabel).weight(0.13), cell(targetFrameComboBox).weight(0.87)),
row(cell(targetFrameLabel).weight(0.2), cell(targetFrameComboBox).weight(0.8)),
cell(newWindowConfPane)
).getComponent());
newWindowConfPane.setVisible(false);

7
designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java

@ -44,7 +44,6 @@ import java.util.List;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.flex;
import static com.fine.swing.ui.layout.Layouts.row;
/**
@ -174,8 +173,8 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane<ReportletHyp
});
reportletNamePane.add(row(4,
cell(reportPathTextField).weight(0.85),
cell(browserButton).weight(0.15)
cell(reportPathTextField).weight(0.8),
cell(browserButton).weight(0.2)
).getComponent());
return reportletNamePane;
}
@ -292,7 +291,7 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane<ReportletHyp
postComboBox = new UIComboBox(new String[]{"GET", "POST"});
showParameterInterface = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Parameter_UI_Display"));
showParameterInterface.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Parameter_UI_Display"));
content.add(row(4,
cell(postComboBox).weight(0.75),
cell(showParameterInterface).weight(0.25)

4
designer-base/src/main/java/com/fr/design/hyperlink/WebHyperNorthPane.java

@ -57,8 +57,8 @@ public class WebHyperNorthPane extends AbstractHyperNorthPane<WebHyperlink> {
UILabel urlLabel = new UILabel("URL");
JPanel urlWithHelp = new JPanel(new BorderLayout());
urlWithHelp.add(row(
cell(urlLabel).weight(0.13),
cell(urlTextField).weight(0.87)
cell(urlLabel).weight(0.2),
cell(urlTextField).weight(0.8)
).getComponent());
if (this.needRenamePane) {

5
designer-base/src/main/java/com/fr/design/javascript/EmailPane.java

@ -13,6 +13,7 @@ import com.fr.design.layout.TableLayout;
import com.fr.js.EmailJavaScript;
import com.fr.stable.StringUtils;
import com.fr.workspace.server.repository.config.ConfigRepository;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
@ -64,7 +65,7 @@ public class EmailPane extends FurtherBasicBeanPane<EmailJavaScript> {
initCenterPane(mainTextLabel, scrollPane, fill, preferred);
this.add(centerPane, BorderLayout.CENTER);
mainTextEditor.setAutoscrolls(true);
checkEmailConfig(EmailCenter.isEmailConfigValid());
checkEmailConfig(ConfigRepository.getInstance().isEmailConfigValid());
}
/**
@ -128,7 +129,7 @@ public class EmailPane extends FurtherBasicBeanPane<EmailJavaScript> {
if (showTplContent != null) {
showTplContent.setSelected(ob ==null ? false: ob.isShowTplContent());
}
checkEmailConfig(EmailCenter.isEmailConfigValid());
checkEmailConfig(ConfigRepository.getInstance().isEmailConfigValid());
}
@Override

13
designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java

@ -1,6 +1,5 @@
package com.fr.design.javascript;
import com.fine.theme.utils.FineUIScale;
import com.fr.base.BaseFormula;
import com.fr.base.Parameter;
import com.fr.base.extension.FileExtension;
@ -147,7 +146,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
}
});
return column(LayoutConstants.VERTICAL_GAP,
row(cell(parameterLabel).weight(0.1), cell(extendParametersCheckBox).weight(0.2), flex(0.7)),
row(cell(parameterLabel).weight(0.2), cell(extendParametersCheckBox).weight(0.3), flex(0.5)),
cell(parameterViewPane)
).getComponent();
}
@ -180,9 +179,9 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
});
return column(LayoutConstants.HORIZONTAL_GAP,
row(
cell(nameLabel).weight(0.1),
cell(defaultNameRadio).weight(0.15),
row(LayoutConstants.HGAP_LARGE, cell(customNameRadio), cell(fileNameFormulaEditor)).weight(0.75)
cell(nameLabel).weight(0.2),
cell(defaultNameRadio).weight(0.25),
row(LayoutConstants.HGAP_LARGE, cell(customNameRadio), cell(fileNameFormulaEditor).weight(1)).weight(0.55)
),
cell(fileNameTipLabel)
).getComponent();
@ -234,7 +233,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
UILabel typeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Type"));
exportTypeComboBox = getComboBoxWithModel(new String[]{ExportJavaScript.EXPORT_PDF, ExportJavaScript.EXPORT_EXCEL_PAGE, ExportJavaScript.EXPORT_EXCEL_SIMPLE, ExportJavaScript.EXPORT_EXCEL_SHEET, ExportJavaScript.EXPORT_WORD, ExportJavaScript.EXPORT_IMAGE}
, EXPORT_TYPES_MAP);
return row(cell(typeLabel).weight(0.1), cell(exportTypeComboBox).weight(0.5), flex(0.4)).getComponent();
return row(cell(typeLabel).weight(0.2), cell(exportTypeComboBox).weight(0.6), flex(0.2)).getComponent();
}
@Override
@ -794,7 +793,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
}
}
});
return row(cell(templateLabel).weight(0.1), cell(currentTemplateRadio).weight(0.15), cell(otherTemplateRadio).weight(0.15), flex(0.6)).getComponent();
return row(cell(templateLabel).weight(0.2), cell(currentTemplateRadio).weight(0.25), cell(otherTemplateRadio).weight(0.25), flex(0.3)).getComponent();
}
@Override

1
designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java

@ -104,6 +104,7 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
*/
public UIButton createCallButton() {
UIButton callButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Callback_Function"));
callButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Callback_Function"));
callButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {

27
designer-base/src/main/java/com/fr/design/lock/LockInfoDialog.java

@ -1,7 +1,11 @@
package com.fr.design.lock;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIScale;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit;
@ -39,12 +43,12 @@ public class LockInfoDialog extends JDialog {
super(DesignerContext.getDesignerFrame());
this.saveEnum = saveEnum;
JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
panel.setBorder(new ScaledEmptyBorder(0, 10, 0, 0));
panel.add(createContentPane(userInfo), BorderLayout.CENTER);
panel.add(createControlPane(), BorderLayout.SOUTH);
this.getContentPane().add(panel);
this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Title_Hint"));
this.setSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.lock.LockInfoDialog"));
this.setSize(FineUIScale.scale(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.lock.LockInfoDialog")));
this.setResizable(false);
this.setModal(true);
GUICoreUtils.centerWindow(this);
@ -53,40 +57,37 @@ public class LockInfoDialog extends JDialog {
private JPanel createContentPane(UserInfo userInfo) {
JPanel contentPanel = new JPanel(new BorderLayout());
contentPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
JPanel messagePane = new JPanel(new BorderLayout(13, 0));
UILabel iconLabel = new UILabel(IOUtils.readIcon("/com/fr/design/images/warnings/warning32.png"));
iconLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
contentPanel.setBorder(new ScaledEmptyBorder(10, 0, 10, 10));
JPanel messagePane = FRGUIPaneFactory.createScaledBorderLayout_S_Pane(10, 0);
UILabel iconLabel = new UILabel(new LazyIcon("warning", 20));
messagePane.add(iconLabel, BorderLayout.WEST);
UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Template_Lock_And_SaveAs_Tip"));
tipLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
messagePane.add(tipLabel, BorderLayout.CENTER);
contentPanel.add(messagePane, BorderLayout.NORTH);
JPanel detailInfoPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
detailInfoPane.setBorder(BorderFactory.createEmptyBorder(0, 45, 0,0));
detailInfoPane.setBorder(new ScaledEmptyBorder(0, 30, 0,0));
if (userInfo != null && StringUtils.isNotEmpty(userInfo.getUserName())) {
UILabel label = createLabel(Toolkit.i18nText("Fine-Design_Template_Lock_Holder", userInfo.getUserName()));
label .setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
detailInfoPane.add(label);
}
if (userInfo != null && StringUtils.isNotEmpty(userInfo.getIp())) {
detailInfoPane.add(createLabel(Toolkit.i18nText("Fine-Design_Template_Lock_Holder_Ip", userInfo.getIp()) ));
}
detailInfoPane.add(createLabel(Toolkit.i18nText("Fine-Design_Template_Lock_Get_Time", FORMATTER.format(LocalDateTime.now()))));
contentPanel.add(detailInfoPane, BorderLayout.CENTER);
contentPanel.add(new UIScrollPane(detailInfoPane), BorderLayout.CENTER);
return contentPanel;
}
private UILabel createLabel(String text) {
UILabel label = new UILabel(text);
label.setForeground(Color.GRAY);
label.setBorder(BorderFactory.createEmptyBorder(8, 0, 0, 0));
label.setBorder(new ScaledEmptyBorder(10, 0, 0, 0));
return label;
}
private JPanel createControlPane() {
JPanel controlPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 5));
controlPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0,5));
JPanel controlPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, FineUIScale.scale(10), 0));
controlPane.setBorder(new ScaledEmptyBorder(0, 0, 10,10));
UIButton saveAsButton = new UIButton(Toolkit.i18nText("Fine_Design_Template_Lock_Save_As"));
UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Button_Cancel"));
saveAsButton.addActionListener(new ActionListener() {

26
designer-base/src/main/java/com/fr/design/mainframe/DecodeDialog.java

@ -1,11 +1,15 @@
package com.fr.design.mainframe;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JDialog;
import javax.swing.JPanel;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.BaseUtils;
import com.fr.base.io.XMLEncryptUtils;
import com.fr.design.DesignerEnvManager;
@ -19,6 +23,9 @@ import com.fr.stable.CodeUtils;
import com.fr.stable.StringUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
public class DecodeDialog {
private UITextField jt;
@ -32,22 +39,18 @@ public class DecodeDialog {
this.file = file;
jd = new JDialog();
jd.setLayout(null);
jd.setLayout(new BorderLayout());
UILabel newNameLable = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ECP_Input_Pwd"));
newNameLable.setBounds(20, 10, 130, 30);
jt = new UITextField(StringUtils.EMPTY);
jt.selectAll();
jt.setBounds(130, 15, 150, 20);
jd.add(newNameLable);
jd.add(jt);
jd.add(row(20, cell(newNameLable), cell(jt)).getComponent(), BorderLayout.NORTH);
hintsLabel = new UILabel();
hintsLabel.setBounds(20, 50, 250, 30);
hintsLabel.setForeground(Color.RED);
hintsLabel.setVisible(false);
confirmButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"));
confirmButton.setBounds(180, 90, 60, 25);
FineUIStyle.setStyle(confirmButton, FineUIStyle.PLAIN_BUTTON);
confirmButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String key = jt.getText();
@ -64,16 +67,17 @@ public class DecodeDialog {
});
UIButton cancelButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cancel"));
cancelButton.setBounds(250, 90, 60, 25);
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jd.dispose();
}
});
jd.add(cancelButton);
jd.add(confirmButton);
jd.add(hintsLabel);
JPanel buttonPane = new JPanel(new BorderLayout());
buttonPane.setBorder(new ScaledEmptyBorder(10, 10, 10, 10));
buttonPane.add(row(8, cell(confirmButton), cell(cancelButton)).getComponent(), BorderLayout.EAST);
jd.add(buttonPane, BorderLayout.SOUTH);
jd.add(hintsLabel, BorderLayout.CENTER);
jd.setSize(340, 180);
jd.setModal(true);
jd.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ECP_Decode"));

1
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -755,6 +755,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
refresh();
DesignerFrameFileDealerPane.getInstance().refreshDockingView();
TemplateTreePane.getInstance().refreshDockingView();
TableDataTreePane.getInstanceWithoutRefreshEverytime(DesignModelAdapter.getCurrentModelAdapter()).resetAddMenuDef();
}
/**

3
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -708,7 +708,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
// 确认按钮
confirmButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Confirm"));
confirmButton.setPreferredSize(new Dimension(60, 25));
confirmButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@ -719,8 +718,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
// 取消按钮
UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel"));
cancelButton.setPreferredSize(new Dimension(60, 25));
cancelButton.addActionListener(new ActionListener() {
@Override

13
designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

@ -142,10 +142,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private static int containerWidth() {
if (FRContext.isChineseEnv()) {
return UIEastResizableContainer.MIN_CONTAINER_WIDTH;
}
return UIEastResizableContainer.MAX_CONTAINER_WIDTH;
return UIEastResizableContainer.STD_CONTAINER_WIDTH;
}
@Override
protected boolean isEnableDrag(MouseEvent e) {
return super.isEnableDrag(e)
&& e.getY() > topToolPaneHeight + leftPane.getPreferredSize().height;
}
/**
@ -836,7 +839,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
if (StringUtils.equals(KEY_WIDGET_SETTINGS, name)) {
title = currentMode.getTitle();
button.setToolTipText(title);
UILabel uiLabel = (UILabel) ((BorderLayout) popupToolPane.contentPane.getLayout()).getLayoutComponent(BorderLayout.WEST);
UILabel uiLabel = (UILabel) ((BorderLayout) popupToolPane.contentPane.getLayout()).getLayoutComponent(BorderLayout.CENTER);
uiLabel.setText(title);
}
} catch (Exception e) {

3
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.theme;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIScale;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.GraphHelper;
@ -50,7 +51,7 @@ public class TemplateThemeBlock<T extends TemplateTheme> extends JPanel {
private final TemplateThemeProfilePane<T> profilePane;
private final Icon theme4currentTemplateMarkIcon = IOUtils.readIcon("/com/fr/design/form/images/theme4currentTemplate.png");
private final Icon theme4NewTemplateMarkIcon= IOUtils.readIcon("/com/fr/design/form/images/theme4newTemplate.png");
private final Icon profileIcon = IOUtils.readIcon("/com/fr/design/icon/icon_edit.png");
private final Icon profileIcon = new LazyIcon("theme_edit");
private final boolean displayTheme4NewTemplateMarker;
private final ThumbnailPane thumbnailPane;

13
designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeDialog.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.theme.dialog;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
@ -14,17 +15,19 @@ import java.awt.Window;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import static com.fine.theme.utils.FineUIScale.scale;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/8/16
*/
public abstract class TemplateThemeDialog extends JDialog {
public static final int DIALOG_TITLE_HEIGHT = 28;
public static final int DIALOG_TITLE_HEIGHT = scale(28);
public static final int DIALOG_BOTTOM_ACTION_BAR_HEIGHT = 30;
public static final int DIALOG_BOTTOM_ACTION_BUTTON_GAP = 10;
public static final int DIALOG_BOTTOM_ACTION_BUTTON_HEIGHT = 20;
public static final int DIALOG_BOTTOM_ACTION_BAR_HEIGHT = scale(30);
public static final int DIALOG_BOTTOM_ACTION_BUTTON_GAP = scale(10);
public static final int DIALOG_BOTTOM_ACTION_BUTTON_HEIGHT = scale(20);
private final JPanel contentContainer;
private final JPanel actionContainer;
@ -97,7 +100,7 @@ public abstract class TemplateThemeDialog extends JDialog {
private JPanel createActionsContainer(int align, UIButton... buttons) {
JPanel container = new JPanel(new FlowLayout(align, DIALOG_BOTTOM_ACTION_BUTTON_GAP, 0));
int paddingVertical = getPaddingVertical();
container.setBorder(BorderFactory.createEmptyBorder(paddingVertical, 0, paddingVertical, 0));
container.setBorder(new ScaledEmptyBorder(paddingVertical, 0, paddingVertical, 0));
if (buttons == null || buttons.length == 0) {
return container;

6
designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java

@ -9,14 +9,16 @@ import com.fr.design.mainframe.theme.TemplateThemeGridPane;
import javax.swing.JPanel;
import java.awt.Window;
import static com.fine.theme.utils.FineUIScale.scale;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/8/13
*/
public class TemplateThemeGridPagesDialog extends TemplateThemeDialog implements TemplateThemeGridPagesPane.PageChangeListener {
public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + 48;
public static final int CONTENT_HEIGHT = TemplateThemeGridPane.CONTENT_HEIGHT + 37;
public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + scale(48);
public static final int CONTENT_HEIGHT = TemplateThemeGridPane.CONTENT_HEIGHT + scale(37);
protected TemplateThemeGridPagesPane overallPane;

3
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartFontPane.java

@ -83,13 +83,14 @@ public class ChartFontPane extends BasicPane {
double[] rows = {p, p, p};
double[] columnSize = {labelWidth, totalWidth};
UILabel text = new UILabel(getUILabelText(), SwingConstants.LEFT);
text.setToolTipText(getUILabelText());
Component[][] components = {
new Component[]{null, null},
new Component[]{text, fontNameComboBox},
new Component[]{null, buttonPane}
};
return TableLayoutHelper.createGapTableLayoutPane(components, rows, columnSize, 5, 0);
return TableLayoutHelper.createGapTableLayoutPane(components, rows, columnSize, 5, 10);
}
public String getUILabelText() {

1
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartSeriesStylePane.java

@ -28,6 +28,7 @@ public class ChartSeriesStylePane extends AbstractChartStylePane {
protected void initComponents() {
colorTypeButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Custom_Color"),
Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual")});
colorTypeButton.getButton(0).setToolTipText(Toolkit.i18nText("Fine-Design_Chart_Custom_Color"));
gradientBar = new FixedGradientBar(4, 130);
initListener();
}

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

@ -10,7 +10,6 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.mainframe.vcs.VcsRecycleSettingHelper;
import com.fr.workspace.server.vcs.VcsConfig;
@ -63,7 +62,7 @@ public class RecycleSettingPane extends BasicPane {
FineTabbedPane tabbedPane = FineTabbedPane.builder()
.addTab(Toolkit.i18nText("Fine-Design_Vcs_Recycle_Content"), recycleScrollPane)
.addTab(Toolkit.i18nText("Fine-Design_Basic_Carton_General_Settings"), settingScrollPane)
.withHeadRatio(0.3f).build();
.withAdaptiveFit().build();
this.add(tabbedPane, BorderLayout.CENTER);
}

5
designer-base/src/main/java/com/fr/design/parameter/ParameterInputPane.java

@ -3,6 +3,7 @@
*/
package com.fr.design.parameter;
import com.fine.theme.utils.FineUIUtils;
import com.fr.base.BaseFormula;
import com.fr.base.StoreProcedureParameter;
import com.fr.base.Utils;
@ -75,8 +76,8 @@ public class ParameterInputPane extends BasicPane {
//Content Pane.
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
this.add(new JScrollPane(contentPane), BorderLayout.CENTER);
contentPane.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameters") + ":"));
this.add(FineUIUtils.wrapComponentWithTitle(new JScrollPane(
contentPane), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameters")), BorderLayout.CENTER);
flowTableLayoutHelper = new FlowTableLayoutHelper();

18
designer-base/src/main/java/com/fr/design/parameter/ParameterPane.java

@ -45,14 +45,16 @@ public class ParameterPane extends BasicBeanPane<Parameter> {
valueEditor = ValueEditorPaneFactory.createBasicValueEditorPane();
// richer:要排列显示的控件
JPanel centerPane = column(LayoutConstants.VERTICAL_GAP,
row(20,
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name"))).weight(0.1),
cell(nameTextField).weight(0.8),
flex(0.1)),
row(20,
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Default_Value"))).weight(0.1),
cell(valueEditor).weight(0.8),
flex(0.1))
row(
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name"))).weight(0.2),
cell(nameTextField).weight(0.7),
flex(0.1)
),
row(
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Default_Value"))).weight(0.2),
cell(valueEditor).weight(0.7),
flex(0.1)
)
).getComponent();
centerPane.setBorder(new ScaledEmptyBorder(0, 20, 0, 0));
this.add(centerPane, BorderLayout.CENTER);

3
designer-base/src/main/java/com/fr/design/remote/button/IconButton.java

@ -1,5 +1,6 @@
package com.fr.design.remote.button;
import com.fine.theme.icon.LazyIcon;
import com.fr.base.BaseUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils;
@ -26,7 +27,7 @@ public final class IconButton extends JButton {
}
public IconButton() {
this(BaseUtils.readIcon("com/fr/design/remote/images/icon_tab_close_normal.png"));
this(new LazyIcon("close"));
}
@Override

21
designer-base/src/main/java/com/fr/design/remote/ui/AbstractListControlPane.java

@ -1,8 +1,12 @@
package com.fr.design.remote.ui;
import com.fine.theme.icon.LazyIcon;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.FineBorderFactory;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
@ -35,8 +39,7 @@ import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.util.ArrayList;
import java.util.List;
@ -100,7 +103,6 @@ public abstract class AbstractListControlPane extends BasicPane {
// 左右分割布局
JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, leftPane, cardPane);
mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor()));
mainSplitPane.setOneTouchExpandable(true);
add(mainSplitPane, BorderLayout.CENTER);
mainSplitPane.setDividerLocation(shortCuts.length * SHORT_WIDTH);
@ -120,6 +122,12 @@ public abstract class AbstractListControlPane extends BasicPane {
toolbarDef.addShortCut(sj.getShortCut());
}
toolBar = ToolBarDef.createJToolBar();
toolBar.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE));
toolBar.setBorder(BorderFactory.createCompoundBorder(
FineBorderFactory.createUnderlineBorder(FlatUIUtils.getUIColor("defaultBorderColor", Color.GRAY)),
new ScaledEmptyBorder(3, 0, 3, 0)
));
toolBar.setBorderPainted(true);
toolbarDef.updateToolBar(toolBar);
leftPane.add(toolBar, BorderLayout.NORTH);
}
@ -128,7 +136,9 @@ public abstract class AbstractListControlPane extends BasicPane {
private void initLeftList(JPanel leftPane) {
authorityList = createList();
authorityList.setName(LIST_NAME);
authorityList.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE));
leftPane.add(new UIScrollPane(authorityList), BorderLayout.CENTER);
leftPane.setBorder(FineBorderFactory.createWrappedRoundBorder());
authorityList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
@ -503,7 +513,7 @@ public abstract class AbstractListControlPane extends BasicPane {
AddItemUpdateAction() {
this.setName(Toolkit.i18nText("Fine-Design_Basic_Action_Choose"));
this.setMnemonic('A');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png"));
this.setSmallIcon(new LazyIcon("add_popup"));
}
@Override
@ -572,8 +582,7 @@ public abstract class AbstractListControlPane extends BasicPane {
RemoveItemAction() {
this.setName(Toolkit.i18nText("Fine-Design_Basic_Action_Remove"));
this.setMnemonic('R');
this.setSmallIcon(BaseUtils
.readIcon(IconPathConstants.TD_REMOVE_ICON_PATH));
this.setSmallIcon(new LazyIcon("remove"));
}
@Override

36
designer-base/src/main/java/com/fr/design/remote/ui/AbstractManagerPane.java

@ -1,5 +1,11 @@
package com.fr.design.remote.ui;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.BaseUtils;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane;
@ -46,6 +52,9 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
/**
* 选择设计角色用户面板的基类
@ -197,7 +206,7 @@ public abstract class AbstractManagerPane extends BasicPane {
public AbstractManagerPane() {
this.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4));
this.setBorder(new ScaledEmptyBorder(10, 10, 10, 10));
this.setLayout(new BorderLayout());
this.add(
TableLayoutHelper.createCommonTableLayoutPane(
@ -235,22 +244,19 @@ public abstract class AbstractManagerPane extends BasicPane {
}
protected abstract JPanel leftPanel();
protected abstract String leftPanelTitle();
private JPanel createLeftPanel() {
JPanel content = leftPanel();
// 搜索
JPanel searchPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 5));
searchPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
keyField.setPreferredSize(new Dimension(270, 20));
JPanel searchPanel = new JPanel(new BorderLayout());
keyField.requestFocus();
keyField.addKeyListener(keyFieldKeyListener);
keyField.getDocument().addDocumentListener(documentListener);
keyButton.setIcon(BaseUtils.readIcon("com/fr/design/images/buttonicon/user_search_normal.png"));
keyButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Search"));
keyButton.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Search"));
keyButton.addActionListener(keyButtonActionListener);
searchPanel.add(keyField);
searchPanel.add(keyButton);
searchPanel.add(row(10, cell(keyField).weight(0.45), cell(keyButton).weight(0.1)).getComponent());
// 内容列表
addingListModel = new DefaultListModel<>();
@ -283,7 +289,10 @@ public abstract class AbstractManagerPane extends BasicPane {
content.add(searchPanel, BorderLayout.NORTH);
content.add(listPane, BorderLayout.CENTER);
return content;
JPanel pane = new JPanel(new BorderLayout());
pane.add(FineUIUtils.wrapComponentWithTitle(content, leftPanelTitle()));
return pane;
}
protected abstract AddingMemberListCellRender getAddingMemberListCellRender();
@ -291,6 +300,7 @@ public abstract class AbstractManagerPane extends BasicPane {
protected abstract AddedMemberListCellRender getAddedMemberListCellRender();
protected abstract JPanel rightPanel();
protected abstract String rightPanelTitle();
private JPanel createRightPanel() {
JPanel content = rightPanel();
@ -301,8 +311,8 @@ public abstract class AbstractManagerPane extends BasicPane {
Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Selected_Member_Count",
String.valueOf(addedMembers.size()))
);
countLabel.setBorder(BorderFactory.createEmptyBorder(7, 12, 8, 0));
countLabel.setForeground(new Color(0x8F8F92));
FineUIStyle.setStyle(countLabel, FineUIStyle.LABEL_TIP);
countLabel.setPreferredSize(new Dimension((int) countLabel.getPreferredSize().getWidth(), FineUIScale.scale(20)));
addedListModel = new DefaultListModel<>();
addedList = new AddedMemberList(addedListModel);
@ -316,7 +326,9 @@ public abstract class AbstractManagerPane extends BasicPane {
content.add(countLabel, BorderLayout.NORTH);
content.add(listPane, BorderLayout.CENTER);
return content;
JPanel pane = new JPanel(new BorderLayout());
pane.add(FineUIUtils.wrapComponentWithTitle(content, rightPanelTitle()));
return pane;
}

13
designer-base/src/main/java/com/fr/design/remote/ui/AuthorityEditorPane.java

@ -1,5 +1,7 @@
package com.fr.design.remote.ui;
import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.UITitledBorder;
import com.fr.design.gui.icontainer.UIScrollPane;
@ -30,20 +32,13 @@ public class AuthorityEditorPane extends BasicBeanPane<DesignAuthority> {
// 模板设计权限配置
public AuthorityEditorPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(
BorderFactory.createCompoundBorder(
new EmptyBorder(6, 0, 6, 6),
UITitledBorder.createBorderWithTitle(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Template_Authority_Config")
)
)
);
IOFileNodeFilter filter = new IOFileNodeFilter(new String[]{".cptx", ".cpt", ".class", ".frm", ".form"});
tree.setDigIn(true);
tree.setFileNodeFilter(filter);
UIScrollPane scrollPane = new UIScrollPane(tree);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
this.add(scrollPane, BorderLayout.CENTER);
this.add(FineUIUtils.wrapComponentWithTitle(scrollPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Template_Authority_Config")), BorderLayout.CENTER);
this.setBorder(new ScaledEmptyBorder(0, 15, 0, 0));
tree.refreshEnv();
}

3
designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListCustomRolePane.java

@ -1,5 +1,6 @@
package com.fr.design.remote.ui;
import com.fine.theme.icon.LazyIcon;
import com.fr.base.BaseUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.design.remote.RemoteDesignAuthorityCreator;
@ -15,7 +16,7 @@ public class AuthorityListCustomRolePane extends AbstractListControlPane {
new RemoteDesignAuthorityCreator(
// 远程设计用户
Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Custom"),
BaseUtils.readIcon("com/fr/design/remote/images/icon_Member_normal@1x.png"),
new LazyIcon("member"),
DesignAuthority.class,
AuthorityEditorPane.class)
};

3
designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListUserPane.java

@ -1,5 +1,6 @@
package com.fr.design.remote.ui;
import com.fine.theme.icon.LazyIcon;
import com.fr.base.BaseUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.design.remote.RemoteDesignAuthorityCreator;
@ -15,7 +16,7 @@ public class AuthorityListUserPane extends AbstractListControlPane {
new RemoteDesignAuthorityCreator(
// 远程设计用户
Toolkit.i18nText("Fine-Design_Basic_Remote_Design_User"),
BaseUtils.readIcon("com/fr/design/remote/images/icon_Member_normal@1x.png"),
new LazyIcon("member"),
DesignAuthority.class,
AuthorityEditorPane.class)
};

9
designer-base/src/main/java/com/fr/design/remote/ui/AuthorityManagerPane.java

@ -1,6 +1,7 @@
package com.fr.design.remote.ui;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.FineTabbedPane;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
@ -18,12 +19,12 @@ public class AuthorityManagerPane extends BasicPane {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
//Tabbed Pane
UITabbedPane tabbedPane = new UITabbedPane();
FineTabbedPane tabbedPane = FineTabbedPane.builder()
.addTab(Toolkit.i18nText("Fine-Design_Basic_User"), userList)
.addTab(Toolkit.i18nText("Fine-Design_Basic_Role"), roleList)
.withHeadRatio(0.2f).build();
this.add(tabbedPane, BorderLayout.CENTER);
tabbedPane.addTab(Toolkit.i18nText("Fine-Design_Basic_User"), userList);
tabbedPane.addTab(Toolkit.i18nText("Fine-Design_Basic_Role"), roleList);
}
@Override

37
designer-base/src/main/java/com/fr/design/remote/ui/CustomRoleManagerPane.java

@ -1,7 +1,9 @@
package com.fr.design.remote.ui;
import com.fine.theme.utils.FineUIUtils;
import com.fr.design.border.UITitledBorder;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.remote.ui.list.AddedMemberListCellRender;
import com.fr.design.remote.ui.list.AddingMemberListCellRender;
import com.fr.design.remote.ui.list.cell.AddedCustomRoleListCellRender;
@ -30,37 +32,26 @@ public class CustomRoleManagerPane extends AbstractManagerPane {
@Override
protected JPanel rightPanel(){
JPanel content = new JPanel(new BorderLayout());
content.setBorder(
BorderFactory.createCompoundBorder(
new EmptyBorder(6, 0, 0, 0),
UITitledBorder.createBorderWithTitle(
// 已选择的设计角色
Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Selected_Custom"),
4
)
)
);
JPanel content = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(0, 10));
return content;
}
@Override
protected JPanel leftPanel(){
JPanel content = new JPanel(new BorderLayout());
protected String rightPanelTitle() {
return Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Selected_Custom");
}
content.setBorder(
BorderFactory.createCompoundBorder(
new EmptyBorder(6, 0, 0, 0),
UITitledBorder.createBorderWithTitle(
// 决策系统角色
Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Decision_Custom"),
4)
)
);
@Override
protected JPanel leftPanel(){
JPanel content = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(0, 10));
return content;
}
@Override
protected String leftPanelTitle() {
return Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Decision_Custom");
}
@Override
protected AddingMemberListCellRender getAddingMemberListCellRender() {
return new AddingCustomRoleListCellRender();

36
designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java

@ -2,6 +2,7 @@ package com.fr.design.remote.ui;
import com.fr.design.border.UITitledBorder;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.remote.ui.list.AddedMemberListCellRender;
import com.fr.design.remote.ui.list.AddingMemberListCellRender;
import com.fr.design.remote.ui.list.cell.AddedUserListCellRender;
@ -30,37 +31,26 @@ public class UserManagerPane extends AbstractManagerPane {
@Override
protected JPanel rightPanel(){
JPanel content = new JPanel(new BorderLayout());
content.setBorder(
BorderFactory.createCompoundBorder(
new EmptyBorder(6, 0, 0, 0),
UITitledBorder.createBorderWithTitle(
// 已选择的设计用户
Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Selected_User"),
4
)
)
);
JPanel content = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(0, 10));
return content;
}
@Override
protected JPanel leftPanel(){
JPanel content = new JPanel(new BorderLayout());
protected String rightPanelTitle() {
return Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Selected_User");
}
content.setBorder(
BorderFactory.createCompoundBorder(
new EmptyBorder(6, 0, 0, 0),
UITitledBorder.createBorderWithTitle(
// 决策系统用户
Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Decision_User"),
4)
)
);
@Override
protected JPanel leftPanel(){
JPanel content = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(0, 10));
return content;
}
@Override
protected String leftPanelTitle() {
return Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Decision_User");
}
@Override
protected AddingMemberListCellRender getAddingMemberListCellRender() {
return new AddingUserListCellRender();

15
designer-base/src/main/java/com/fr/design/remote/ui/list/AddedMemberListCellRender.java

@ -1,5 +1,8 @@
package com.fr.design.remote.ui.list;
import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.utils.FineUIScale;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.remote.button.IconButton;
import com.fr.workspace.server.authority.RemoteDesignMember;
@ -9,9 +12,9 @@ import javax.swing.Icon;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListCellRenderer;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
public abstract class AddedMemberListCellRender extends JPanel implements ListCellRenderer<RemoteDesignMember> {
@ -19,16 +22,14 @@ public abstract class AddedMemberListCellRender extends JPanel implements ListCe
private UILabel label;
public AddedMemberListCellRender() {
this.setBorder(BorderFactory.createEmptyBorder());
this.setLayout(new FlowLayout(FlowLayout.LEFT));
this.setBorder(new ScaledEmptyBorder(0, 4, 0, 0));
this.setLayout(new BorderLayout());
label = new UILabel();
label.setPreferredSize(new Dimension(264, 20));
this.setPreferredSize(new Dimension(this.getPreferredSize().width, 25));
label.setIcon(getMemberIcon());
this.add(label);
this.add(new IconButton());
this.add(Layouts.row(Layouts.cell(label), Layouts.flex(), Layouts.cell(new IconButton()))
.with(it -> it.setPreferredSize(new Dimension((int) it.getPreferredSize().getWidth(), FineUIScale.scale( 20)))).getComponent());
}
@Override

21
designer-base/src/main/java/com/fr/design/remote/ui/list/AddingMemberListCellRender.java

@ -1,7 +1,11 @@
package com.fr.design.remote.ui.list;
import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.utils.FineUIScale;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.remote.button.IconButton;
import com.fr.workspace.server.authority.RemoteDesignMember;
import javax.swing.BorderFactory;
@ -10,9 +14,7 @@ import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListCellRenderer;
import javax.swing.SwingConstants;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.*;
public abstract class AddingMemberListCellRender extends JPanel implements ListCellRenderer<RemoteDesignMember> {
@ -21,20 +23,21 @@ public abstract class AddingMemberListCellRender extends JPanel implements ListC
public AddingMemberListCellRender() {
this.setBorder(BorderFactory.createEmptyBorder());
this.setLayout(new FlowLayout(FlowLayout.LEFT));
this.setBorder(new ScaledEmptyBorder(0, 4, 0, 0));
this.setLayout(new BorderLayout());
label = new UILabel();
label.setPreferredSize(new Dimension(260, 20));
this.setPreferredSize(new Dimension(this.getPreferredSize().width, 25));
label.setIcon(getMemberIcon());
check = new UICheckBox();
check.setSelected(false);
check.setEnabled(true);
this.add(label);
this.add(check);
label = new UILabel();
label.setIcon(getMemberIcon());
this.add(Layouts.row(Layouts.cell(label), Layouts.flex(), Layouts.cell(check))
.with(it -> it.setPreferredSize(new Dimension((int) it.getPreferredSize().getWidth(), FineUIScale.scale( 20)))).getComponent());
}

5
designer-base/src/main/java/com/fr/design/remote/ui/list/AuthorityListCellRenderer.java

@ -1,5 +1,7 @@
package com.fr.design.remote.ui.list;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.report.DesignAuthority;
import sun.swing.DefaultLookup;
@ -9,8 +11,7 @@ import javax.swing.JList;
import javax.swing.ListCellRenderer;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import java.awt.Color;
import java.awt.Component;
import java.awt.*;
public abstract class AuthorityListCellRenderer extends
JLabel implements ListCellRenderer<DesignAuthority> {

3
designer-base/src/main/java/com/fr/design/remote/ui/list/cell/AddedCustomRoleListCellRender.java

@ -1,5 +1,6 @@
package com.fr.design.remote.ui.list.cell;
import com.fine.theme.icon.LazyIcon;
import com.fr.base.BaseUtils;
import com.fr.design.remote.constants.MemberIcon;
import com.fr.design.remote.ui.list.AddedMemberListCellRender;
@ -15,7 +16,7 @@ import javax.swing.Icon;
public class AddedCustomRoleListCellRender extends AddedMemberListCellRender {
@Override
protected Icon getMemberIcon() {
return BaseUtils.readIcon(MemberIcon.CUSTOM_ROLE_ICON);
return new LazyIcon("role");
}
@Override

3
designer-base/src/main/java/com/fr/design/remote/ui/list/cell/AddedUserListCellRender.java

@ -1,5 +1,6 @@
package com.fr.design.remote.ui.list.cell;
import com.fine.theme.icon.LazyIcon;
import com.fr.base.BaseUtils;
import com.fr.design.remote.constants.MemberIcon;
import com.fr.design.remote.ui.list.AddedMemberListCellRender;
@ -15,7 +16,7 @@ import javax.swing.Icon;
public class AddedUserListCellRender extends AddedMemberListCellRender {
@Override
protected Icon getMemberIcon() {
return BaseUtils.readIcon(MemberIcon.USER_ICON);
return new LazyIcon("member");
}
@Override

3
designer-base/src/main/java/com/fr/design/remote/ui/list/cell/AddingCustomRoleListCellRender.java

@ -1,5 +1,6 @@
package com.fr.design.remote.ui.list.cell;
import com.fine.theme.icon.LazyIcon;
import com.fr.base.BaseUtils;
import com.fr.design.remote.constants.MemberIcon;
import com.fr.design.remote.ui.list.AddingMemberListCellRender;
@ -15,7 +16,7 @@ import javax.swing.Icon;
public class AddingCustomRoleListCellRender extends AddingMemberListCellRender {
@Override
protected Icon getMemberIcon() {
return BaseUtils.readIcon(MemberIcon.CUSTOM_ROLE_ICON);
return new LazyIcon("role");
}
@Override

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save