Browse Source

Merging in latest from upstream (DESIGN/design:refs/heads/fbp/feature)

* commit '603b881e05926a00f132b5200dbc8e8b8448f181': (76 commits)
  无jira任务,修复打包
  修改图标-标签-边框布局&修改行高列宽弹窗布局
  fix: 调整规范问题
  newui fix: 视觉修复
  无jira任务 代码质量
  REPORT-131077 【迭代】【FR血缘】服务器数据集新建 程序/内置数据集/存储过程/关联数据集,保存后再次为空消失
  REPORT-133276  fbp设计器完全删除jxbrowser 6.x
  REPORT-133286 fbp设计器获取云中心网址为空 代码质量
  REPORT-133286 fbp设计器获取云中心网址为空
  无jira任务 子类方法添加注解
  REPORT-133275 fbp设计器清理存在javafx webview替代页面
  REPORT-132799 & REPORT-131838 & REPORT-132389 & REPORT-132382 & REPORT-132380 & REPORT-132375 & REPORT-132357 & REPORT-132231 & REPORT-132227【newUI】fix:国际化布局调整及Tab统一修复/fbp回归问题修复
  REPORT-132799 & REPORT-131838 & REPORT-132389 & REPORT-132382 & REPORT-132380 & REPORT-132375 & REPORT-132357 & REPORT-132231 & REPORT-132227【newUI】fix:国际化布局调整及Tab统一修复/fbp回归问题修复
  REPORT-133167 & REPORT-133157 fix:细节缩放问题修复
  REPORT-133198 fix:List面板背景逻辑调整
  模板解密对话框修改
  REPORT-133037 fix:自动刷新面板修复&参数面板移动端显示效果优化
  REPORT-132601 fix:图表标题面板问题修复
  REPORT-132916 fix:仪表盘、气泡图漏翻新面板补充
  REPORT-133106 fix:参数面板遮罩层修复
  ...
fbp/feature
Zongyu.Wang-王宗雨 3 months ago
parent
commit
9b1e37505f
  1. 5
      build.gradle
  2. 107
      designer-base/src/main/java/com/fine/theme/light/ui/FineOptionPaneUI.java
  3. 11
      designer-base/src/main/java/com/fine/theme/light/ui/FineToggleButtonUI.java
  4. 1
      designer-base/src/main/java/com/fine/theme/utils/FineClientProperties.java
  5. 12
      designer-base/src/main/java/com/fine/theme/utils/FineUIScale.java
  6. 2
      designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java
  7. 23
      designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java
  8. 16
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  9. 3
      designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java
  10. 34
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  11. 20
      designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java
  12. 5
      designer-base/src/main/java/com/fr/design/backup/DesignContext.java
  13. 28
      designer-base/src/main/java/com/fr/design/components/notification/NotificationDialog.java
  14. 4
      designer-base/src/main/java/com/fr/design/condition/DSColumnLiteConditionPane.java
  15. 7
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  16. 8
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  17. 4
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataCreatorProducer.java
  18. 21
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  19. 16
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  20. 3
      designer-base/src/main/java/com/fr/design/data/datapane/connect/AdvancePane.java
  21. 21
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  22. 2
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java
  23. 42
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java
  24. 9
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java
  25. 38
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  26. 8
      designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java
  27. 1
      designer-base/src/main/java/com/fr/design/data/datapane/management/search/pane/FineSearchPane.java
  28. 2
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  29. 1
      designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java
  30. 12
      designer-base/src/main/java/com/fr/design/data/tabledata/LocalTableDataSource.java
  31. 17
      designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataJSBridge.java
  32. 40
      designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataPane.java
  33. 1
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java
  34. 1
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  35. 20
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java
  36. 24
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java
  37. 10
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java
  38. 4
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java
  39. 14
      designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java
  40. 115
      designer-base/src/main/java/com/fr/design/dialog/FineJOptionPane.java
  41. 2
      designer-base/src/main/java/com/fr/design/dialog/TipDialog.java
  42. 35
      designer-base/src/main/java/com/fr/design/dialog/UIDetailErrorLinkDialog.java
  43. 2
      designer-base/src/main/java/com/fr/design/editor/ValueEditorPane.java
  44. 36
      designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java
  45. 42
      designer-base/src/main/java/com/fr/design/extra/LoginDialog.java
  46. 200
      designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java
  47. 54
      designer-base/src/main/java/com/fr/design/extra/LoginWebPane.java
  48. 2
      designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java
  49. 601
      designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java
  50. 112
      designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java
  51. 32
      designer-base/src/main/java/com/fr/design/extra/QQLoginDialog.java
  52. 46
      designer-base/src/main/java/com/fr/design/extra/ShopDialog.java
  53. 31
      designer-base/src/main/java/com/fr/design/extra/ShopManagerPane.java
  54. 36
      designer-base/src/main/java/com/fr/design/extra/ShopPaneConfig.java
  55. 307
      designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java
  56. 4
      designer-base/src/main/java/com/fr/design/extra/exe/PluginLoginExecutor.java
  57. 2
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java
  58. 44
      designer-base/src/main/java/com/fr/design/formula/DefaultTinyFormulaPane.java
  59. 5
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  60. 12
      designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java
  61. 12
      designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java
  62. 4
      designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneHelper.java
  63. 3
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java
  64. 18
      designer-base/src/main/java/com/fr/design/gui/controlpane/UISimpleListControlPane.java
  65. 2
      designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java
  66. 4
      designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java
  67. 6
      designer-base/src/main/java/com/fr/design/gui/frpane/ClosableBubbleFloatPane.java
  68. 48
      designer-base/src/main/java/com/fr/design/gui/frpane/FineTabbedPane.java
  69. 3
      designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPane.java
  70. 10
      designer-base/src/main/java/com/fr/design/gui/frpane/UnitInputPane.java
  71. 53
      designer-base/src/main/java/com/fr/design/gui/ibutton/FitUIButtonGroup.java
  72. 9
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java
  73. 16
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java
  74. 2
      designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java
  75. 15
      designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java
  76. 2
      designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java
  77. 127
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java
  78. 2
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java
  79. 13
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java
  80. 3
      designer-base/src/main/java/com/fr/design/gui/itooltip/MultiLineToolTip.java
  81. 14
      designer-base/src/main/java/com/fr/design/gui/style/FollowingThemePane.java
  82. 3
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java
  83. 6
      designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperNorthPane.java
  84. 7
      designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java
  85. 4
      designer-base/src/main/java/com/fr/design/hyperlink/WebHyperNorthPane.java
  86. 5
      designer-base/src/main/java/com/fr/design/javascript/EmailPane.java
  87. 13
      designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java
  88. 1
      designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java
  89. 47
      designer-base/src/main/java/com/fr/design/jxbrowser/JxUIPane.java
  90. 27
      designer-base/src/main/java/com/fr/design/lock/LockInfoDialog.java
  91. 6
      designer-base/src/main/java/com/fr/design/login/DesignerLoginHelper.java
  92. 30
      designer-base/src/main/java/com/fr/design/login/executor/DesignerLoginBrowserExecutor.java
  93. 3
      designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java
  94. 18
      designer-base/src/main/java/com/fr/design/login/message/NotificationActionType.java
  95. 26
      designer-base/src/main/java/com/fr/design/mainframe/DecodeDialog.java
  96. 1
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  97. 20
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  98. 13
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  99. 8
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ColorFillStylePane.java
  100. 3
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java
  101. Some files were not shown because too many files have changed in this diff Show More

5
build.gradle

@ -95,7 +95,6 @@ allprojects {
// messenger
implementation 'com.fr.messenger:fine-messenger:' + carinaVersion
implementation 'com.install4j:install4j-runtime:8.0.4'
implementation 'com.fr.third:jxbrowser:6.23'
implementation "com.fr.third:jxbrowser-v7:${jxBrowserVersion}"
implementation "com.fr.third:jxbrowser-swing-v7:${jxBrowserVersion}"
implementation 'com.fr.third.server:servlet-api:3.0'
@ -131,18 +130,14 @@ allprojects {
// mac_x64, mac_aarch64, windows_x64
if (OperatingSystem.current().isMacOsX() && "aarch64".equals(System.getProperty("os.arch"))) {
dependencies {
// jxbrowser 6.23M16.23jar还是需要留着
implementation 'com.fr.third:jxbrowser-mac:6.23'
implementation "com.fr.third:jxbrowser-mac-arm-v7:${jxBrowserVersion}"
}
} else if (OperatingSystem.current().isMacOsX()) {
dependencies {
implementation 'com.fr.third:jxbrowser-mac:6.23'
implementation "com.fr.third:jxbrowser-mac-v7:${jxBrowserVersion}"
}
} else if (OperatingSystem.current().isWindows()) {
dependencies {
implementation 'com.fr.third:jxbrowser-win64:6.23'
implementation "com.fr.third:jxbrowser-win64-v7:${jxBrowserVersion}"
}
}

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"));
}
}

16
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -1020,22 +1020,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
designerLoginConfigManager.setPluginRemindOnFirstLaunch(pluginRemindOnFirstLaunch);
}
public boolean isUseOldVersionLogin() {
return designerLoginConfigManager.isUseOldVersionLogin();
}
public void setUseOldVersionLogin(boolean useOldVersionLogin) {
designerLoginConfigManager.setUseOldVersionLogin(useOldVersionLogin);
}
public boolean isUseNewPluginFirst() {
return designerLoginConfigManager.isUseNewPluginFirst();
}
public void setUseNewPluginFirst(boolean useNewPluginFirst) {
designerLoginConfigManager.setUseNewPluginFirst(useNewPluginFirst);
}
/**
* 内置服务器是否使用时启动
*

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

34
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;
@ -310,10 +310,6 @@ public class PreferencePane extends BasicPane {
cell(createLengthPane()),
// 服务器设置
cell(createServerPane()),
// 插件管理设置
cell(createUpmSelectorPane()).with(it -> it.setVisible(!OperatingSystem.isLinux() && JdkVersion.LE_8.support())),
// 登录选项
cell(createLoginSelectorPane()).with(it -> it.setVisible(SupportOSImpl.DESIGNER_LOGIN.support())),
// Oracle设置
cell(createOraclePane()),
// 内存设置
@ -346,6 +342,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 +728,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,
@ -967,11 +964,7 @@ public class PreferencePane extends BasicPane {
this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort()));
if (useOptimizedUPMCheckbox != null) {
useOptimizedUPMCheckbox.setSelected(checkOptimizedUPMUse());
}
if (useNewVersionLoginCheckbox != null) {
useNewVersionLoginCheckbox.setSelected(!DesignerEnvManager.getEnvManager().isUseOldVersionLogin());
useOptimizedUPMCheckbox.setSelected(true);
}
useUniverseDBMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseUniverseDBM());
@ -1010,15 +1003,6 @@ public class PreferencePane extends BasicPane {
this.startupPageEnabledCheckBox.setSelected(designerEnvManager.isStartupPageEnabled());
}
private boolean checkOptimizedUPMUse() {
//如果是没手动配置过则默认开启
//isUseNewPluginFirst如果为true说明没手动配置过,直接开启
//走到这里说明checkBox不为空,机型肯定符合
return DesignerEnvManager.getEnvManager().isUseNewPluginFirst()
|| ServerPreferenceConfig.getInstance().isUseOptimizedUPM()
|| DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter();
}
private int chooseCase(int sign) {
switch (sign) {
case 0:
@ -1085,8 +1069,6 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setImageCompress(this.imageCompressPanelCheckBox.isSelected());
boolean optimizedUPMFlag = this.useOptimizedUPMCheckbox != null && this.useOptimizedUPMCheckbox.isSelected();
designerEnvManager.setUseOptimizedUPM4Adapter(optimizedUPMFlag);
//只有取消掉使用新插件管理器这个选项才需要把useNewPluginFirst置false(意味着用户手动配置了,如果勾选着的话,这个useNewPluginFirst为true就行了)
designerEnvManager.setUseNewPluginFirst(optimizedUPMFlag);
boolean cloudDelayFlag = this.cloudAnalyticsDelayCheckBox.isSelected();
designerEnvManager.setCloudAnalyticsDelay(cloudDelayFlag);
// cloudDelayFlag默认为true,如果用户手动配置过才会是false,则后续的云端运维配置都按照用户意愿来
@ -1124,10 +1106,6 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setAutoPushUpdateEnabled(this.autoPushUpdateCheckBox.isSelected());
}
if (useNewVersionLoginCheckbox != null) {
designerEnvManager.setUseOldVersionLogin(!this.useNewVersionLoginCheckbox.isSelected());
}
designerEnvManager.setUndoLimit(maxUndoLimit.getSelectedIndex() * SELECTED_INDEX_5);
if (maxUndoLimit.getSelectedIndex() == SELECTED_INDEX_5) {
designerEnvManager.setUndoLimit(MAX_UNDO_LIMIT_50);
@ -1251,7 +1229,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;

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

@ -261,13 +261,28 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
try {
switch (entryEventKind) {
case REMOVED:
deleteDatas.add(TableDataBeanHelper.getServerDataSetBean(s, tabledata));
ServerDataSetBean remove = TableDataBeanHelper.getServerDataSetBean(s, tabledata);
if (StringUtils.isNotEmpty(remove.getDatasetData())) {
deleteDatas.add(remove);
} else {
FineLoggerFactory.getLogger().error("Unable to find the corresponding processor : {}", tabledata.getClass());
}
break;
case ADDED:
addDatas.add(TableDataBeanHelper.getServerDataSetBean(s, tabledata));
ServerDataSetBean add = TableDataBeanHelper.getServerDataSetBean(s, tabledata);
if (StringUtils.isNotEmpty(add.getDatasetData())) {
addDatas.add(add);
} else {
FineLoggerFactory.getLogger().error("Unable to find the corresponding processor : {}", tabledata.getClass());
}
break;
case UPDATED:
updateDatas.add(TableDataBeanHelper.getServerDataSetBean(s, tabledata));
ServerDataSetBean update = TableDataBeanHelper.getServerDataSetBean(s, tabledata);
if (StringUtils.isNotEmpty(update.getDatasetData())) {
updateDatas.add(update);
} else {
FineLoggerFactory.getLogger().error("Unable to find the corresponding processor : {}", tabledata.getClass());
}
break;
default:
break;

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();

20
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;
@ -17,6 +18,7 @@ import com.fr.stable.StringUtils;
import javax.swing.DefaultCellEditor;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.UIManager;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableCellRenderer;
@ -25,6 +27,7 @@ import javax.swing.table.TableColumn;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
@ -42,7 +45,7 @@ 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 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 +72,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();
@ -246,17 +251,24 @@ public class EmbeddedTableDataPane extends AbstractTableDataPane<EmbeddedTableDa
// 行号显示,每次dateJTable的表结构发生变化时都要调用
TableColumn tableColumn = dataJTable.getColumnModel().getColumn(0);
tableColumn.setCellRenderer(new CellRenderer());
tableColumn.setMaxWidth(Math.max(dataJTable.getColumnCount(), MIN_CELL_WIDTH));
tableColumn.setMaxWidth(FineUIScale.scale(Math.max(dataJTable.getColumnCount(), MIN_CELL_WIDTH)));
// 没有列数据的时候,压缩行号
if (dataJTable.getColumnModel().getColumnCount() > 1) {
dataJTable.getTableHeader().setPreferredSize(new Dimension(super.getWidth(), FineUIScale.scale((Integer) UIManager.get("Table.rowHeight"))));
} else {
dataJTable.getTableHeader().setPreferredSize(new Dimension(super.getWidth(), FineUIScale.scale(4)));
}
}
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());

42
designer-base/src/main/java/com/fr/design/extra/LoginDialog.java

@ -1,42 +0,0 @@
package com.fr.design.extra;
import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StableUtils;
import javax.swing.*;
import java.awt.*;
/**
* Created by vito on 2017/5/5.
*/
public class LoginDialog extends UIDialog {
private static final Dimension DEFAULT_SHOP = new Dimension(401, 301);
public LoginDialog(Frame frame, Component pane) {
super(frame);
init(pane);
}
public LoginDialog(Dialog dialog, Component pane) {
super(dialog);
init(pane);
}
private void init(Component pane) {
if (StableUtils.getMajorJavaVersion() >= 8) {
setUndecorated(true);
}
JPanel panel = (JPanel) getContentPane();
panel.setLayout(new BorderLayout());
add(pane, BorderLayout.CENTER);
setSize(DEFAULT_SHOP);
GUICoreUtils.centerWindow(this);
setResizable(false);
}
@Override
public void checkValid() throws Exception {
// do nothing
}
}

200
designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java

@ -1,200 +0,0 @@
package com.fr.design.extra;
import com.fanruan.carina.Carina;
import com.fanruan.cloud.FanruanCloud;
import com.fanruan.config.bbs.FineBBSConfigProvider;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.exe.PluginLoginExecutor;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.locale.impl.BbsRegisterMark;
import com.fr.design.locale.impl.BbsResetMark;
import com.fr.design.login.service.DesignerLoginClient;
import com.fr.design.login.service.DesignerLoginResult;
import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javafx.concurrent.Task;
import javafx.scene.web.WebEngine;
import netscape.javascript.JSObject;
import javax.swing.*;
import java.awt.*;
import java.net.URI;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* @author vito
*/
public class LoginWebBridge {
//最低消息的条数
private static final int MIN_MESSAGE_COUNT = 0;
//网络连接失败
private static final String NET_FAILED = "-4";
//用户名,密码为空
private static final String LOGIN_INFO_EMPTY = "-5";
private static final Color LOGIN_BACKGROUND = new Color(184, 220, 242);
private static LoginWebBridge helper;
//消息条数
private int messageCount;
private UIDialog uiDialog;
private UIDialog qqDialog;
private UILabel uiLabel;
private WebEngine webEngine;
private LoginWebBridge() {
}
public static LoginWebBridge getHelper() {
if (helper != null) {
return helper;
}
synchronized (LoginWebBridge.class) {
if (helper == null) {
helper = new LoginWebBridge();
}
return helper;
}
}
public static LoginWebBridge getHelper(WebEngine webEngine) {
getHelper();
helper.setWebEngine(webEngine);
return helper;
}
public void setWebEngine(WebEngine webEngine) {
this.webEngine = webEngine;
}
public int getMessageCount() {
return messageCount;
}
/**
* 设置获取的消息长度并设置显示
*
* @param count
*/
public void setMessageCount(int count) {
if (count == MIN_MESSAGE_COUNT) {
Carina.config(FineBBSConfigProvider.class).setBbsUsername(DesignerEnvManager.getEnvManager().getDesignerLoginUsername());
return;
}
this.messageCount = count;
StringBuilder sb = new StringBuilder();
sb.append(StringUtils.BLANK).append(DesignerEnvManager.getEnvManager().getDesignerLoginUsername())
.append("(").append(this.messageCount)
.append(")").append(StringUtils.BLANK);
Carina.config(FineBBSConfigProvider.class).setBbsUsername(sb.toString());
}
public void setQQDialog(UIDialog qqDialog) {
closeQQWindow();
this.qqDialog = qqDialog;
}
public void setDialogHandle(UIDialog uiDialog) {
closeWindow();
this.uiDialog = uiDialog;
}
public void setUILabel(UILabel uiLabel) {
this.uiLabel = uiLabel;
}
/**
* 测试论坛网络连接
*
* @return
*/
private boolean testConnection() {
HttpClient client = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("bbs.test"));
return client.isServerAlive();
}
/**
* 注册页面
*/
public void registerHref() {
try {
LocaleMark<String> registerMark = LocaleCenter.getMark(BbsRegisterMark.class);
Desktop.getDesktop().browse(new URI(registerMark.getValue()));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
/**
* 忘记密码
*/
public void forgetHref() {
try {
LocaleMark<String> resetMark = LocaleCenter.getMark(BbsResetMark.class);
Desktop.getDesktop().browse(new URI(resetMark.getValue()));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
/**
* 设计器端的用户登录
*
* @param username 用户名
* @param password 密码
* @return 登录信息标志
*/
public void defaultLogin(String username, String password, final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new PluginLoginExecutor(username, password));
ExecutorService es = Executors.newSingleThreadExecutor(new NamedThreadFactory("bbsDefaultLogin"));
es.submit(task);
es.shutdown();
}
/**
* 登录操作
*
* @param userInfo 登录信息
* @param password 密码
* @return 登录信息标志
*/
public String login(String userInfo, String password) {
DesignerLoginClient client = new DesignerLoginClient();
DesignerLoginResult result = client.login(userInfo, password);
int uid = result.getUid();
if (uid > 0) {
closeWindow();
}
return String.valueOf(uid);
}
/**
* 关闭窗口
*/
public void closeWindow() {
if (uiDialog != null) {
uiDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
uiDialog.setVisible(false);
}
}
/**
* 关闭QQ授权窗口
*/
public void closeQQWindow() {
if (qqDialog != null) {
qqDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
qqDialog.setVisible(false);
}
}
public void openUrlAtLocalWebBrowser(WebEngine eng, String url) {
// do nothing
}
}

54
designer-base/src/main/java/com/fr/design/extra/LoginWebPane.java

@ -1,54 +0,0 @@
package com.fr.design.extra;
import com.fr.design.dialog.FineJOptionPane;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebEvent;
import javafx.scene.web.WebView;
import netscape.javascript.JSObject;
import javax.swing.*;
/**
* Created by zhaohehe on 16/7/26.
*/
public class LoginWebPane extends JFXPanel {
public LoginWebPane(final String installHome) {
Platform.setImplicitExit(false);
Platform.runLater(new Runnable() {
@Override
public void run() {
BorderPane root = new BorderPane();
Scene scene = new Scene(root);
LoginWebPane.this.setScene(scene);
WebView webView = new WebView();
WebEngine webEngine = webView.getEngine();
webEngine.load("file:///" + installHome + "/scripts/login.html");
webEngine.setOnAlert(new EventHandler<WebEvent<String>>() {
@Override
public void handle(WebEvent<String> event) {
showAlert(event.getData());
}
});
JSObject obj = (JSObject) webEngine.executeScript("window");
obj.setMember("LoginHelper", LoginWebBridge.getHelper(webEngine));
webView.setContextMenuEnabled(false);//屏蔽右键
root.setCenter(webView);
}
});
}
private void showAlert(final String message) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
FineJOptionPane.showMessageDialog(LoginWebPane.this, message);
}
});
}
}

2
designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java

@ -30,13 +30,11 @@ import com.fr.plugin.view.PluginView;
import com.fr.plugin.xml.PluginElementName;
import com.fr.plugin.xml.PluginXmlElement;
import com.fr.stable.StringUtils;
import com.teamdev.jxbrowser.chromium.JSArray;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import java.io.File;
import java.net.HttpURLConnection;
import java.util.ArrayList;
import java.util.List;

601
designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java

@ -1,601 +0,0 @@
package com.fr.design.extra;
import com.fanruan.carina.Carina;
import com.fanruan.cloud.FanruanCloud;
import com.fanruan.config.bbs.FineBBSConfigProvider;
import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.exe.GetInstalledPluginsExecutor;
import com.fr.design.extra.exe.GetPluginCategoriesExecutor;
import com.fr.design.extra.exe.GetPluginFromStoreExecutor;
import com.fr.design.extra.exe.GetPluginPrefixExecutor;
import com.fr.design.extra.exe.PluginLoginExecutor;
import com.fr.design.extra.exe.ReadUpdateOnlineExecutor;
import com.fr.design.extra.exe.SearchOnlineExecutor;
import com.fr.design.locale.impl.BbsRegisterMark;
import com.fr.design.locale.impl.BbsResetMark;
import com.fr.design.locale.impl.BbsSpaceMark;
import com.fr.design.login.DesignerLoginSource;
import com.fr.design.plugin.DesignerPluginContext;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import javafx.concurrent.Task;
import javafx.scene.web.WebEngine;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import netscape.javascript.JSObject;
import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* 开放给Web组件的接口,用于安装,卸载,更新以及更改插件可用状态
*/
public class PluginWebBridge {
private static final String THREAD_NAME_TEMPLATE = "pluginbridge-thread-%s";
private static final String ACTION = "action";
private static final String KEYWORD = "keyword";
private static final String PLUGIN_INFO = "pluginInfo";
private static final int COREPOOLSIZE = 3;
private static final int MAXPOOLSIZE = 5;
private static PluginWebBridge helper;
private UIDialog uiDialog;
private ACTIONS actions;
private Map<String, Object> config;
private WebEngine webEngine;
private ExecutorService threadPoolExecutor = new ThreadPoolExecutor(COREPOOLSIZE, MAXPOOLSIZE,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(COREPOOLSIZE),
new ThreadFactoryBuilder().setNameFormat(THREAD_NAME_TEMPLATE).build());
private PluginWebBridge() {
}
public static PluginWebBridge getHelper() {
if (helper != null) {
return helper;
}
synchronized (PluginWebBridge.class) {
if (helper == null) {
helper = new PluginWebBridge();
}
return helper;
}
}
public static PluginWebBridge getHelper(WebEngine webEngine) {
getHelper();
helper.setEngine(webEngine);
return helper;
}
/**
* 获取打开动作配置
*
* @return 配置信息
*/
public String getRunConfig() {
if (actions != null) {
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put(ACTION, actions.getContext());
Set<String> keySet = config.keySet();
for (String key : keySet) {
jsonObject.put(key, config.get(key).toString());
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return jsonObject.toString();
}
return StringUtils.EMPTY;
}
/**
* 配置打开动作
*
* @param action 动作
* @param config 参数
*/
public void setRunConfig(ACTIONS action, Map<String, Object> config) {
this.actions = action;
this.config = config;
}
/**
* 清楚打开动作
*/
public void clearRunConfig() {
this.actions = null;
this.config = null;
}
/**
* 打开时搜索
*
* @param keyword 关键词
*/
public void openWithSearch(String keyword) {
HashMap<String, Object> map = new HashMap<String, Object>(2);
map.put(KEYWORD, keyword);
setRunConfig(ACTIONS.SEARCH, map);
}
/**
* 根据插件信息跳转到应用中心
*
* @param keyword
* @param pluginInfo
*/
public void showResultInStore(String keyword, String pluginInfo) {
HashMap<String, Object> map = new HashMap<>();
map.put(KEYWORD, keyword);
map.put(PLUGIN_INFO, pluginInfo);
setRunConfig(ACTIONS.SHOW_RESULT, map);
}
public void setEngine(WebEngine webEngine) {
this.webEngine = webEngine;
}
public void setDialogHandle(UIDialog uiDialog) {
closeWindow();
this.uiDialog = uiDialog;
}
/**
* 从插件服务器上安装插件
*
* @param pluginInfo 插件的ID
* @param callback 回调函数
*/
public void installPluginOnline(final String pluginInfo, final JSObject callback) {
JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback));
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo);
PluginOperateUtils.installPluginOnline(pluginMarker, jsCallback);
}
/**
* 从磁盘上选择插件安装包进行安装
*
* @param filePath 插件包的路径
*/
public void installPluginFromDisk(final String filePath, final JSObject callback) {
JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback));
File file = new File(filePath);
PluginOperateUtils.installPluginFromDisk(file, jsCallback);
}
/**
* 卸载当前选中的插件
*
* @param pluginInfo 插件信息
*/
public void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSObject callback) {
JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback));
PluginOperateUtils.uninstallPlugin(pluginInfo, isForce, jsCallback);
}
/**
* 从插件服务器上更新选中的插件
*
* @param pluginIDs 插件集合
*/
public void updatePluginOnline(JSObject pluginIDs, final JSObject callback) {
JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback));
String[] pluginInfos = jsObjectToStringArray(pluginIDs);
List<PluginMarker> pluginMarkerList = new ArrayList<PluginMarker>();
for (int i = 0; i < pluginInfos.length; i++) {
pluginMarkerList.add(PluginUtils.createPluginMarker(pluginInfos[i]));
}
PluginOperateUtils.updatePluginOnline(pluginMarkerList, jsCallback);
}
/**
* 从磁盘上选择插件安装包进行插件升级
*
* @param filePath 插件包的路径
*/
public void updatePluginFromDisk(String filePath, final JSObject callback) {
JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback));
File file = new File(filePath);
PluginOperateUtils.updatePluginFromDisk(file, jsCallback);
}
/**
* 修改选中的插件的活跃状态
*
* @param pluginID 插件ID
*/
public void setPluginActive(String pluginID, final JSObject callback) {
JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback));
PluginOperateUtils.setPluginActive(pluginID, jsCallback);
}
/**
* 已安装插件检查更新
*/
public void readUpdateOnline(final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new ReadUpdateOnlineExecutor());
threadPoolExecutor.submit(task);
}
/**
* 选择文件对话框
*
* @return 选择的文件的路径
*/
public String showFileChooser() {
return showFileChooserWithFilter(StringUtils.EMPTY, StringUtils.EMPTY);
}
/**
* 选择文件对话框
*
* @param des 过滤文件描述
* @param filter 文件的后缀
* @return 选择的文件的路径
* 这里换用JFileChooser会卡死,不知道为什么
*/
public String showFileChooserWithFilter(String des, String filter) {
FileChooser fileChooser = new FileChooser();
if (StringUtils.isNotEmpty(filter)) {
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter(des, filter));
}
File selectedFile = fileChooser.showOpenDialog(new Stage());
if (selectedFile == null) {
return null;
}
return selectedFile.getAbsolutePath();
}
/**
* 选择文件对话框
*
* @param des 过滤文件描述
* @param args 文件的后缀
* @return 选择的文件的路径
*/
public String showFileChooserWithFilters(String des, JSObject args) {
FileChooser fileChooser = new FileChooser();
String[] filters = jsObjectToStringArray(args);
if (ArrayUtils.isNotEmpty(filters)) {
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter(des, filters));
}
File selectedFile = fileChooser.showOpenDialog(new Stage());
if (selectedFile == null) {
return null;
}
return selectedFile.getAbsolutePath();
}
/**
* 获取已经安装的插件的数组
*
* @return 已安装的插件组成的数组
*/
public void getInstalledPlugins(final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new GetInstalledPluginsExecutor());
threadPoolExecutor.submit(task);
}
private String[] jsObjectToStringArray(JSObject obj) {
if (obj == null) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
int len = (int) obj.getMember("length");
List<String> list = new ArrayList<>();
for (int i = 0; i < len; i++) {
list.add(obj.getSlot(i).toString());
}
return list.toArray(new String[len]);
}
/**
* 搜索在线插件
*
* @param keyword 关键字
*/
public void searchPlugin(String keyword, final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new SearchOnlineExecutor(keyword));
threadPoolExecutor.submit(task);
}
/**
* 根据条件获取在线插件的
*
* @param category 分类
* @param seller 卖家性质
* @param fee 收费类型
* @param callback 回调函数
*/
public void getPluginFromStore(String category, String seller, String fee, final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginFromStoreExecutor(category, seller, fee, ""));
threadPoolExecutor.submit(task);
}
/**
* 根据条件获取在线插件
*
* @param info 插件信息
* @param callback 回调函数
*/
public void getPluginFromStoreNew(String info, final JSObject callback) {
try {
Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginFromStoreExecutor(new JSONObject(info)));
threadPoolExecutor.submit(task);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
public void getPluginPrefix(final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginPrefixExecutor());
threadPoolExecutor.submit(task);
}
/**
* 在线获取插件分类
*
* @param callback 回调函数
*/
public void getPluginCategories(final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginCategoriesExecutor());
threadPoolExecutor.submit(task);
}
/**
* 展示一个重启的对话框(少用,莫名其妙会有bug)
*
* @param message 展示的消息
*/
public void showRestartMessage(String message) {
int rv = JOptionPane.showOptionDialog(
null,
message,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
JOptionPane.YES_NO_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null,
new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Restart_Designer"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Restart_Designer_Later")},
null
);
if (rv == JOptionPane.OK_OPTION) {
RestartHelper.restart();
}
}
/**
* 关闭窗口
*/
public void closeWindow() {
if (uiDialog != null) {
uiDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
uiDialog.setVisible(false);
}
if (uiDialog == DesignerPluginContext.getPluginDialog()) {
DesignerPluginContext.setPluginDialog(null);
}
}
/**
* 窗口是否无装饰(判断是否使用系统标题栏)
*/
public boolean isCustomTitleBar() {
if (uiDialog != null) {
return uiDialog.isUndecorated();
}
return false;
}
/**
* 获取系统登录的用户名
*
* @param callback
*/
public String getLoginInfo(final JSObject callback) {
registerLoginInfo(callback);
return DesignerEnvManager.getEnvManager().getDesignerLoginUsername();
}
/**
* 系统登录注册
*
* @param callback
*/
public void registerLoginInfo(final JSObject callback) {
JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback));
PluginOperateUtils.getLoginInfo(jsCallback);
}
/**
* 打开论坛消息界面
*/
public void getPriviteMessage() {
try {
LocaleMark<String> spaceMark = LocaleCenter.getMark(BbsSpaceMark.class);
Desktop.getDesktop().browse(new URI(spaceMark.getValue()));
} catch (Exception exp) {
FineLoggerFactory.getLogger().info(exp.getMessage());
}
}
/**
* 打开登录页面
*/
public void loginContent() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
UserLoginContext.fireLoginContextListener(DesignerLoginSource.NORMAL);
}
});
}
/**
* 在本地浏览器里打开url
* tips:重载的时候,需要给js调用的方法需要放在前面,否则可能不会被调用(此乃坑)
* 所以最好的是不要重载在js可以访问的接口文件中
*
* @param url 要打开的地址
*/
public void openShopUrlAtWebBrowser(String url) {
openUrlAtLocalWebBrowser(webEngine, url);
}
/**
* 在本地浏览器里打开url
*
* @param eng web引擎
* @param url 要打开的地址
*/
public void openUrlAtLocalWebBrowser(WebEngine eng, String url) {
if (Desktop.isDesktopSupported()) {
try {
//创建一个URI实例,注意不是URL
URI uri = URI.create(url);
//获取当前系统桌面扩展
Desktop desktop = Desktop.getDesktop();
//判断系统桌面是否支持要执行的功能
if (desktop.isSupported(Desktop.Action.BROWSE)) {
//获取系统默认浏览器打开链接
desktop.browse(uri);
}
} catch (NullPointerException e) {
//此为uri为空时抛出异常
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (IOException e) {
//此为无法获取系统默认浏览器
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
/**
* 注册页面
*/
public void registerHref() {
try {
LocaleMark<String> registerMark = LocaleCenter.getMark(BbsRegisterMark.class);
Desktop.getDesktop().browse(new URI(registerMark.getValue()));
} catch (Exception e) {
FineLoggerFactory.getLogger().info(e.getMessage());
}
}
/*-------------------------------登录部分的处理----------------------------------*/
/**
* 忘记密码
*/
public void forgetHref() {
try {
LocaleMark<String> resetMark = LocaleCenter.getMark(BbsResetMark.class);
Desktop.getDesktop().browse(new URI(resetMark.getValue()));
} catch (Exception e) {
FineLoggerFactory.getLogger().info(e.getMessage());
}
}
/**
* 设计器端的用户登录
*
* @param username 用户名
* @param password 密码
* @return 登录信息标志
*/
public void defaultLogin(String username, String password, final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new PluginLoginExecutor(username, password));
threadPoolExecutor.submit(task);
}
/**
* 通过QQ登录后通知登录
*/
public void ucsynLogin(long uid, String username, String password, final JSONObject callback) {
}
/**
* 清除用户信息
*/
public void clearUserInfo() {
Carina.config(FineBBSConfigProvider.class).setBbsUsername(StringUtils.EMPTY);
}
public void getPackInfo(final JSObject callback){
JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback));
jsCallback.execute(StringUtils.EMPTY);
}
/**
* 初始化设计器部分
*/
public void initExtraDiff(final JSObject callback) {
//todo 初始化设计器其他部分
}
/**
* 国际化(用来做兼容暂时不删)
*/
public String parseI18(final String key) {
return com.fr.design.i18n.Toolkit.i18nText(key);
}
/**
* 是否是在设计器中操作
*/
public boolean isDesigner() {
return true;
}
/**
* 动作枚举
*/
public enum ACTIONS {
SEARCH("search"), SHOW_RESULT("showResult");
private String context;
ACTIONS(String context) {
this.context = context;
}
public String getContext() {
return context;
}
}
}

112
designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java

@ -1,112 +0,0 @@
package com.fr.design.extra;
import com.fr.base.TemplateUtils;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebEvent;
import javafx.scene.web.WebView;
import netscape.javascript.JSObject;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
/**
* Created by richie on 16/3/19.
*/
public class PluginWebPane extends JFXPanel {
private static final String RESOURCE_URL = "resourceURL";
private static final String LANGUAGE = "language";
private static final String URL_PLUS = "+";
private static final String URL_SPACING = "%20";
private static final String URL_PREFIX = "file:///";
private WebEngine webEngine;
public PluginWebPane(final String installHome, final String mainJs) {
Platform.setImplicitExit(false);
Platform.runLater(new Runnable() {
@Override
public void run() {
BorderPane root = new BorderPane();
Scene scene = new Scene(root);
PluginWebPane.this.setScene(scene);
WebView webView = new WebView();
webEngine = webView.getEngine();
try{
String htmlString = getRenderedHtml(installHome, mainJs);
webEngine.loadContent(htmlString);
webEngine.setOnAlert(new EventHandler<WebEvent<String>>() {
@Override
public void handle(WebEvent<String> event) {
showAlert(event.getData());
}
});
JSObject obj = (JSObject) webEngine.executeScript("window");
obj.setMember("PluginHelper", PluginWebBridge.getHelper(webEngine));
webView.setContextMenuEnabled(false);//屏蔽右键
root.setCenter(webView);
}catch (Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
});
}
private String getRenderedHtml(String installHome, String mainJs) throws IOException {
InputStream inp = IOUtils.readResource(StableUtils.pathJoin(installHome, mainJs));
if (inp == null) {
throw new IOException("Not found template: " + mainJs);
}
BufferedReader reader = new BufferedReader(new InputStreamReader(inp, StableUtils.RESOURCE_ENCODER));
BufferedReader read = new BufferedReader(reader);
StringBuffer sb = new StringBuffer();
String line;
Map<String, Object> map4Tpl = new HashMap<String, Object>();
//URL中关于空格的编码与空格所在位置相关:空格被编码成+的情况只能在查询字符串部分出现,而被编码成%20则可以出现在路径和查询字符串中
//URLEncoder会将空格转成+,这边需要+转成%20
map4Tpl.put(RESOURCE_URL, URL_PREFIX + URLEncoder.encode(installHome, EncodeConstants.ENCODING_UTF_8).replace(URL_PLUS, URL_SPACING));
map4Tpl.put(LANGUAGE, GeneralContext.getLocale().toString());
while ((line = read.readLine()) != null) {
if (sb.length() > 0) {
sb.append('\n');
}
sb.append(line);
}
String htmlString = StringUtils.EMPTY;
try{
htmlString = TemplateUtils.renderParameter4Tpl(sb.toString(), map4Tpl);
}catch (Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
reader.close();
inp.close();
return htmlString;
}
private void showAlert(final String message) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
FineJOptionPane.showMessageDialog(PluginWebPane.this, message);
}
});
}
}

32
designer-base/src/main/java/com/fr/design/extra/QQLoginDialog.java

@ -1,32 +0,0 @@
package com.fr.design.extra;
import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
/**
* Created by zhaohehe on 16/7/28.
*/
public class QQLoginDialog extends UIDialog {
private static final Dimension DEFAULT_SHOP = new Dimension(700, 500);
public QQLoginDialog(Frame frame, Component pane) {
super(frame);
setUndecorated(true);
JPanel panel = (JPanel) getContentPane();
panel.setLayout(new BorderLayout());
add(pane, BorderLayout.CENTER);
setSize(DEFAULT_SHOP);
GUICoreUtils.centerWindow(this);
setResizable(false);
setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Manager"));
}
@Override
public void checkValid() throws Exception {
// do nothing
}
}

46
designer-base/src/main/java/com/fr/design/extra/ShopDialog.java

@ -1,46 +0,0 @@
package com.fr.design.extra;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog;
import com.fr.design.jdk.JdkVersion;
import com.fr.design.plugin.DesignerPluginContext;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StableUtils;
import javax.swing.*;
import java.awt.*;
/**
* Created by vito on 16/4/18.
*/
public class ShopDialog extends UIDialog {
public ShopDialog(Frame frame, BasicPane pane) {
super(frame);
if (StableUtils.getMajorJavaVersion() >= 8) {
setUndecorated(true);
}
JPanel panel = (JPanel) getContentPane();
panel.setLayout(new BorderLayout());
add(pane, BorderLayout.CENTER);
setSize(createDefaultDimension());
GUICoreUtils.centerWindow(this);
setResizable(false);
DesignerPluginContext.setPluginDialog(this);
}
private Dimension createDefaultDimension() {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
// jdk11 分辨率较低 缩放较大时 屏幕高度小于或接近设定的高度 需要调整下
if (JdkVersion.GE_9.support() && screenSize.height - 700 < 50) {
return new Dimension(900, screenSize.height - 100);
} else {
return new Dimension(900, 700);
}
}
@Override
public void checkValid() throws Exception {
// do nothing
}
}

31
designer-base/src/main/java/com/fr/design/extra/ShopManagerPane.java

@ -1,31 +0,0 @@
package com.fr.design.extra;
import com.fr.design.dialog.BasicPane;
import java.awt.BorderLayout;
import java.awt.Component;
/**
* @author richie
* @date 2015-03-09
* @since 8.0
* 应用中心的构建采用JavaScript代码来动态实现,但是不总是依赖于服务器端的HTML
* 采用JDK提供的JavaScript引擎,实际是用JavaScript语法实现Java端的功能,并通过JavaScript引擎动态调用
* JavaScript放在安装目录下的scripts/store目录下,检测到新版本的时候,可以通过更新这个目录下的文件实现热更新
* 不直接嵌入WebView组件的原因是什么呢?
* 因为如果直接嵌入WebView,和设计器的交互就需要预先设定好,这样灵活性会差很多,而如果使用JavaScript引擎,
* 就可以直接在JavaScript中和WebView组件做交互,而同时JavaScript中可以调用任何的设计器API.
*/
public class ShopManagerPane extends BasicPane {
public ShopManagerPane(Component webPane) {
setLayout(new BorderLayout());
add(webPane, BorderLayout.CENTER);
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Manager");
}
}

36
designer-base/src/main/java/com/fr/design/extra/ShopPaneConfig.java

@ -1,36 +0,0 @@
package com.fr.design.extra;
import javafx.embed.swing.JFXPanel;
/**
* Created by vito on 2016/9/28.
*/
public abstract class ShopPaneConfig {
private String mainJS;
private String scriptsId;
private JFXPanel webPane;
public ShopPaneConfig() {
this.mainJS = setMainJS();
this.scriptsId = setScriptsId();
this.webPane = setWebPane();
}
abstract String setMainJS();
abstract String setScriptsId();
abstract JFXPanel setWebPane();
public String getMainJS() {
return mainJS;
}
public String getScriptsId() {
return scriptsId;
}
public JFXPanel getWebPane() {
return webPane;
}
}

307
designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java

@ -1,307 +0,0 @@
package com.fr.design.extra;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.login.utils.DesignerLoginUtils;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.CloudCenter;
import com.fr.general.CommonIOUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.PluginStoreConfig;
import com.fr.plugin.PluginStoreConstants;
import com.fr.stable.CommonUtils;
import com.fr.stable.EnvChangedListener;
import com.fanruan.product.ProductConstants;
import com.fr.stable.StableUtils;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.Window;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.util.concurrent.ExecutionException;
/**
* 在合适的 jre 环境下创建带有 WebView 的窗口
*
* @author vito
* @date 2016/9/28
*/
public class WebViewDlgHelper {
private static final String LATEST = "latest";
private static final String SHOP_SCRIPTS = "shop_scripts";
private static final int VERSION_8 = 8;
private static String installHome = PluginStoreConstants.getLocalInstallHome();
private static final String MAIN_JS_PATH = "/scripts/plugin.html";
static {
GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@Override
public void envChanged() {
installHome = PluginStoreConstants.getLocalInstallHome();
}
});
}
public static void createPluginDialog() {
if (StableUtils.getMajorJavaVersion() >= VERSION_8) {
String mainJsPath = StableUtils.pathJoin(installHome, MAIN_JS_PATH);
File file = new File(mainJsPath);
if (!file.exists()) {
int rv = FineJOptionPane.showConfirmDialog(
null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE
);
if (rv == JOptionPane.OK_OPTION) {
downloadShopScripts(SHOP_SCRIPTS);
}
return;
}
// 检测更新前先刷新一下版本号
PluginStoreConstants.refreshProps();
String jarVersion = PluginStoreConfig.getInstance().getEnvVersion();
if (ComparatorUtils.equals(jarVersion, ProductConstants.VERSION)) {
updateShopScripts(SHOP_SCRIPTS);
showPluginDlg();
} else {
int rv = FineJOptionPane.showConfirmDialog(
null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install_Version"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE
);
if (rv == JOptionPane.OK_OPTION) {
downloadShopScripts(SHOP_SCRIPTS);
deleteExtraFile(StableUtils.pathJoin(installHome, "plugin.html"));
}
}
} else {
BasicPane traditionalStorePane = new BasicPane() {
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Manager");
}
};
traditionalStorePane.setLayout(new BorderLayout());
traditionalStorePane.add(initTraditionalStore(), BorderLayout.CENTER);
UIDialog dlg = new ShopDialog(DesignerContext.getDesignerFrame(), traditionalStorePane);
dlg.setVisible(true);
}
}
/**
* 检查script文件夹中的plugin.html文件
*/
public static void checkAndCopyMainFile(String indexPath, String mainJsPath) {
File file = new File(indexPath);
if (!file.exists()) {
copyMainFile(mainJsPath);
}
}
/**
* 將script文件夹中的plugin.html文件复制到webreport下
*/
private static void copyMainFile(String mainJsPath) {
try {
CommonIOUtils.copy(new File(mainJsPath), new File(installHome));
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
/**
* 删除9.0工程下无用的plugin.html文件
*
* @param filePath 待删除文件路径
*/
private static void deleteExtraFile(String filePath) {
CommonIOUtils.deleteFile(new File(filePath));
}
/**
* 以关键词打开设计器商店
*
* @param keyword 关键词
*/
public static void createPluginDialog(String keyword) {
PluginWebBridge.getHelper().openWithSearch(keyword);
createPluginDialog();
}
/**
* 以关键词打开设计器商店显示搜索结果
*
* @param keyword
* @param data
*/
@Deprecated
public static void showPluginInStore(String keyword, String data) {
PluginWebBridge.getHelper().showResultInStore(keyword, data);
createPluginDialog();
}
public static void createLoginDialog() {
if (StableUtils.getMajorJavaVersion() >= VERSION_8) {
File file = new File(StableUtils.pathJoin(installHome, "scripts"));
if (!file.exists()) {
confirmDownLoadShopJS();
} else {
showLoginDlg(DesignerContext.getDesignerFrame());
updateShopScripts(SHOP_SCRIPTS);
}
}
}
public static void createLoginDialog(Window parent) {
if (StableUtils.getMajorJavaVersion() >= VERSION_8) {
File file = new File(StableUtils.pathJoin(installHome, "scripts"));
if (!file.exists()) {
confirmDownLoadShopJS();
} else {
showLoginDlg(parent);
updateShopScripts(SHOP_SCRIPTS);
}
}
}
private static void confirmDownLoadShopJS() {
int rv = FineJOptionPane.showConfirmDialog(
null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE
);
if (rv == JOptionPane.OK_OPTION) {
downloadShopScripts(SHOP_SCRIPTS);
}
}
private static void showPluginDlg() {
try {
Class<?> clazz = Class.forName("com.fr.design.extra.PluginWebPane");
Constructor constructor = clazz.getConstructor(String.class, String.class);
Component webPane = (Component) constructor.newInstance(installHome, MAIN_JS_PATH);
BasicPane managerPane = new ShopManagerPane(webPane);
UIDialog dlg = new ShopDialog(DesignerContext.getDesignerFrame(), managerPane);
PluginWebBridge.getHelper().setDialogHandle(dlg);
dlg.setVisible(true);
DesignerLoginUtils.showPluginRemindOnFirstLaunch(dlg);
} catch (Exception e) {
// ignored
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
private static void showLoginDlg(Window window) {
try {
Class<?> clazz = Class.forName("com.fr.design.extra.LoginWebPane");
Constructor constructor = clazz.getConstructor(String.class);
Component webPane = (Component) constructor.newInstance(installHome);
UIDialog qqdlg;
if (window instanceof Dialog) {
qqdlg = new LoginDialog((Dialog) window, webPane);
} else {
qqdlg = new LoginDialog((Frame) window, webPane);
}
LoginWebBridge.getHelper().setDialogHandle(qqdlg);
qqdlg.setVisible(true);
} catch (Throwable ignored) {
// ignored
}
}
private static Component initTraditionalStore() {
UITabbedPane tabbedPane = new UITabbedPane();
PluginInstalledPane installedPane = new PluginInstalledPane();
tabbedPane.addTab(installedPane.tabTitle(), installedPane);
tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update"), new PluginUpdatePane(tabbedPane));
tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_All_Plugins"), new PluginFromStorePane(tabbedPane));
return tabbedPane;
}
private static void downloadShopScripts(final String scriptsId) {
new SwingWorker<Boolean, Void>() {
@Override
protected Boolean doInBackground() throws Exception {
return PluginUtils.downloadShopScripts(scriptsId, new Process<Double>() {
@Override
public void process(Double integer) {
// 这个注释毫无意义,就是为了通过SonarQube
}
});
}
@Override
protected void done() {
try {
if (get()) {
File scriptZip = new File(StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE));
if (scriptZip.exists()) {
IOUtils.unzip(scriptZip, installHome);
CommonUtils.deleteFile(scriptZip);
}
PluginStoreConstants.refreshProps(); // 下载完刷新一下版本号等
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE);
}
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}.execute();
}
private static void updateShopScripts(final String scriptsId) {
new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
String url = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.update");
if (url != null) {
String text = HttpToolbox.get(url + "?" + PluginUtils.FR_VERSION + "=" + ProductConstants.VERSION + "&version=" + PluginStoreConfig.getInstance().getVersion());
JSONObject resultJSONObject = new JSONObject(text);
String isLatest = resultJSONObject.optString("result");
if (!ComparatorUtils.equals(isLatest, LATEST)) {
int rv = FineJOptionPane.showConfirmDialog(
null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Update"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE
);
if (rv == JOptionPane.OK_OPTION) {
downloadShopScripts(scriptsId);
}
}
}
return null;
}
}.execute();
}
}

4
designer-base/src/main/java/com/fr/design/extra/exe/PluginLoginExecutor.java

@ -1,6 +1,5 @@
package com.fr.design.extra.exe;
import com.fr.design.extra.LoginWebBridge;
import com.fr.design.extra.Process;
import com.fr.design.login.service.DesignerPassportManager;
@ -36,9 +35,6 @@ public class PluginLoginExecutor implements Executor {
@Override
public void run(Process<String> process) {
int uid = DesignerPassportManager.getInstance().login(username, password);
if (uid > 0) {
LoginWebBridge.getHelper().closeWindow();
}
result = String.valueOf(uid);
}
}

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)

10
designer-base/src/main/java/com/fr/design/gui/frpane/UnitInputPane.java

@ -24,6 +24,9 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.math.BigDecimal;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
/**
* For input Number.
*/
@ -43,16 +46,13 @@ public abstract class UnitInputPane extends BasicPane {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel centerPane = FRGUIPaneFactory.createTitledBorderPane("");
this.add(centerPane, BorderLayout.CENTER);
centerPane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 30));
centerPane.setLayout(new FlowLayout(FlowLayout.LEFT, 20, 30));
UILabel titleLabel = new UILabel(title + ":");
centerPane.add(titleLabel);
// Denny:在对话框中加入JSpinner对象
numberFieldSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, MAX_NUM, 1));
GUICoreUtils.setColumnForSpinner(numberFieldSpinner, 24);
numberFieldSpinner.setPreferredSize(new Dimension(60, 20));
numberFieldSpinner.setMinimumSize(new Dimension(60, 20));
centerPane.add(numberFieldSpinner);
numberFieldSpinner.addChangeListener(new ChangeListener() {
@Override
@ -64,7 +64,7 @@ public abstract class UnitInputPane extends BasicPane {
});
unitLabel = new UILabel("");
centerPane.add(unitLabel);
centerPane.add(row(4, cell(numberFieldSpinner), cell(unitLabel)).getComponent());
}
public void setUnitText(String unit) {

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);
}

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

@ -43,7 +43,7 @@ public class UIResizableContainer extends JPanel {
private int direction;
private boolean hasParameterPane;
private static final int MAX_WIDTH = FineUIScale.scale(300);
private static final int MAX_WIDTH = FineUIScale.scale(350);
private static final int ARROW_RANGE = FineUIScale.scale(35);
private static final int ARROW_RANGE_VERTICAL = FineUIScale.scale(25);
@ -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) {

47
designer-base/src/main/java/com/fr/design/jxbrowser/JxUIPane.java

@ -2,19 +2,17 @@ package com.fr.design.jxbrowser;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.i18n.Toolkit;
import com.fr.design.ui.ModernUIConstants;
import com.fr.design.ui.ModernUIPane;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.combination.Pair;
import com.fr.stable.os.OperatingSystem;
import com.fr.web.struct.AssembleComponent;
import com.teamdev.jxbrowser.browser.Browser;
import com.teamdev.jxbrowser.browser.callback.InjectJsCallback;
import com.teamdev.jxbrowser.chromium.events.LoadListener;
import com.teamdev.jxbrowser.chromium.events.ScriptContextListener;
import com.teamdev.jxbrowser.event.Observer;
import com.teamdev.jxbrowser.frame.Frame;
import com.teamdev.jxbrowser.js.JsObject;
@ -50,7 +48,7 @@ import static com.fr.design.ui.ModernUIConstants.WINDOW;
* @since 11.0
* Created on 2023-06-12
*/
public class JxUIPane<T> extends ModernUIPane<T> {
public class JxUIPane<T> extends BasicPane {
public static final ExecutorService DEFAULT_EXECUTOR =
Executors.newSingleThreadExecutor(new NamedThreadFactory("jx-simple", true));
@ -68,11 +66,9 @@ public class JxUIPane<T> extends ModernUIPane<T> {
private JxEngine jxEngine = JxEngine.getInstance();
private JxUIPane() {
super();
}
private JxUIPane(JxEngine jxEngine) {
super();
this.jxEngine = jxEngine;
}
@ -155,7 +151,6 @@ public class JxUIPane<T> extends ModernUIPane<T> {
*
* @param url 新的地址
*/
@Override
public void redirect(String url) {
browser.navigation().loadUrl(encodeWindowsPath(url));
}
@ -166,7 +161,6 @@ public class JxUIPane<T> extends ModernUIPane<T> {
* @param url 新的地址
* @param map 初始化参数
*/
@Override
public void redirect(String url, Map<String, String> map) {
setMap(map);
browser.navigation().loadUrl(encodeWindowsPath(url));
@ -186,7 +180,11 @@ public class JxUIPane<T> extends ModernUIPane<T> {
}
@Override
/**
* 更新数据到界面
*
* @param t 数据类
*/
public void populate(final T t) {
setInjectJsCallback(params -> {
executeJsObject(params.frame(), WINDOW + DOT + namespace)
@ -195,7 +193,6 @@ public class JxUIPane<T> extends ModernUIPane<T> {
});
}
@Override
@Nullable
public T update() {
if (browser.mainFrame().isPresent()) {
@ -283,7 +280,7 @@ public class JxUIPane<T> extends ModernUIPane<T> {
*
* @param <T> 参数
*/
public static class Builder<T> extends ModernUIPane.Builder<T> {
public static class Builder<T> {
private JxEngine jxEngine;
private String namespace;
private String variable;
@ -302,8 +299,6 @@ public class JxUIPane<T> extends ModernUIPane<T> {
private String html;
public Builder() {
// 为了兼容继承关系,但又不允许创建,用这个方式先处理一下
super((ModernUIPane<T>) null);
this.jxEngine = JxEngine.getInstance();
this.namespace = DEFAULT_NAMESPACE;
this.variable = DEFAULT_VARIABLE;
@ -342,24 +337,14 @@ public class JxUIPane<T> extends ModernUIPane<T> {
return this;
}
@Override
public Builder<T> prepareForV6(ScriptContextListener contextListener) {
return this;
}
@Override
public Builder<T> prepareForV6(LoadListener loadListener) {
return this;
}
@Override
public JxUIPane.Builder<T> prepareForV7(InjectJsCallback callback) {
prepare(callback);
return this;
}
@Override
public JxUIPane.Builder<T> prepareForV7(Class event, Observer listener) {
/**
* 注册一个监听器
*
* @param event 事件
* @param listener 监听器
* @return builder
*/
public JxUIPane.Builder<T> prepare(Class event, Observer listener) {
listenerPair = new Pair<>(event, listener);
return this;
}

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() {

6
designer-base/src/main/java/com/fr/design/login/DesignerLoginHelper.java

@ -2,10 +2,8 @@ package com.fr.design.login;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.WebViewDlgHelper;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.plugin.DesignerPluginContext;
import com.fr.design.update.ui.dialog.UpdateMainDialog;
import com.fr.general.GeneralContext;
@ -47,10 +45,6 @@ public class DesignerLoginHelper {
}
public static void showLoginDialog(DesignerLoginSource source, Map<String, String> params, Window window) {
if (!SupportOSImpl.DESIGNER_LOGIN.support() || DesignerEnvManager.getEnvManager().isUseOldVersionLogin()) {
WebViewDlgHelper.createLoginDialog(window);
return;
}
boolean hasJxBrowser = true;
try {
Class.forName(JXBROWSER);

30
designer-base/src/main/java/com/fr/design/login/executor/DesignerLoginBrowserExecutor.java

@ -1,30 +0,0 @@
package com.fr.design.login.executor;
import com.fr.design.bridge.exec.JSExecutor;
import com.teamdev.jxbrowser.chromium.JSFunction;
import com.teamdev.jxbrowser.chromium.JSObject;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-04-18
*/
public class DesignerLoginBrowserExecutor implements JSExecutor {
public static DesignerLoginBrowserExecutor create(JSObject window, JSFunction callback) {
return new DesignerLoginBrowserExecutor(window, callback);
}
private JSObject window;
private JSFunction callback;
private DesignerLoginBrowserExecutor(JSObject window, JSFunction callback) {
this.window = window;
this.callback = callback;
}
@Override
public void executor(String newValue) {
callback.invoke(window, newValue);
}
}

3
designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java

@ -43,8 +43,7 @@ public class DesignerGuideHelper {
if (!DesignerLoginUtils.isOnline()
|| !SupportOSImpl.DESIGNER_LOGIN.support()
|| !FRContext.isChineseEnv()
|| DesignerPushUpdateManager.getInstance().isShouldPopUp()
|| DesignerEnvManager.getEnvManager().isUseOldVersionLogin()) {
|| DesignerPushUpdateManager.getInstance().isShouldPopUp()) {
return;
}
if (isActivatedForOneWeek()) {

18
designer-base/src/main/java/com/fr/design/login/message/NotificationActionType.java

@ -1,20 +1,15 @@
package com.fr.design.login.message;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.dialog.NotificationDialogAction;
import com.fr.design.extra.WebViewDlgHelper;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.upm.UpmFinder;
import com.fr.design.utils.DesignUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.os.Arch;
import com.fr.stable.os.OperatingSystem;
/**
* @author Lanlan
@ -31,17 +26,10 @@ public enum NotificationActionType {
@Override
public void doClick() {
try {
if (Arch.getArch() == Arch.ARM || OperatingSystem.isLinux() || SupportOSImpl.MACOS_WEB_PLUGIN_MANAGEMENT.support()) {
DesignUtils.visitEnvServerByParameters("#management/plugin", null, null);
return;
}
if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() || SupportOSImpl.MACOS_NEW_PLUGIN_MANAGEMENT.support()) {
UpmFinder.showUPMDialog();
} else {
WebViewDlgHelper.createPluginDialog();
}
} catch (Exception e) {
UpmFinder.showUPMDialog();
} catch (Throwable e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
DesignUtils.visitEnvServerByParameters("#management/plugin", null, null);
}
}
}),

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();
}
/**

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

@ -1,6 +1,9 @@
package com.fr.design.mainframe;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineLayoutBuilder;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.BaseUtils;
import com.fr.base.extension.FileExtension;
import com.fr.base.vcs.DesignerMode;
@ -224,13 +227,15 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
JPanel panel = new JPanel(new BorderLayout());
if (WorkContext.getCurrent().isRoot()) {
rightToolBar = new UIToolbar(FlowLayout.RIGHT);
rightToolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR));
JPanel contentPane = FineLayoutBuilder.asBorderLayoutWrapped(rightToolBar);
contentPane.setBorder(BorderFactory.createCompoundBorder(new ScaledEmptyBorder(4, 8, 4, 8),
BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR)));
rightToolBar.setBorderPainted(true);
UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine_Design_Template_Lock_Status"));
tipLabel.setForeground(Color.GRAY);
FineUIStyle.setStyle(tipLabel, FineUIStyle.LABEL_TIP);
rightToolBar.add(tipLabel);
UIButton button = new UIButton(IOUtils.readIcon("/com/fr/design/images/toolbarbtn/lock.png"));
button.setRolloverIcon(IOUtils.readIcon("/com/fr/design/images/toolbarbtn/unlock.png"));
UIButton button = new UIButton(new LazyIcon("locked"));
button.setRolloverIcon(new LazyIcon("unlocked"));
button.setBorderPainted(false);
button.setContentAreaFilled(false);
button.set4ToolbarButton();
@ -243,7 +248,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE,
IOUtils.readIcon("/com/fr/design/images/warnings/warning32.png"),
new LazyIcon("warning", 20),
new Object[] {Toolkit.i18nText("Fine_Design_Template_UnLock_I_Known"), Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")}, null);
if (option == JOptionPane.YES_OPTION) {
String path = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, TemplateTreePane.getInstance().getTemplateFileTree().getSelectedTemplatePath());
@ -264,7 +269,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
});
rightToolBar.add(button);
refreshRightToolBarBy(TemplateTreePane.getInstance().getFileNode());
panel.add(rightToolBar, BorderLayout.EAST);
panel.add(contentPane, BorderLayout.EAST);
}
return panel;
}
@ -708,7 +713,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 +723,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) {

8
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ColorFillStylePane.java

@ -86,6 +86,14 @@ public class ColorFillStylePane extends BasicBeanPane<ColorFillStyle> {
return customPane;
}
@Override
public void repaint() {
if (colorAdjustPane != null) {
colorAdjustPane.repaint();
}
super.repaint();
}
protected ColorSchemeComboBox createColorSchemeComboBox() {
return new ColorSchemeComboBox();
}

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;

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

Loading…
Cancel
Save