Browse Source

Merge pull request #2601 in DESIGN/design from release/10.0 to final/10.0

* commit '60e7ffb8caeffaada30053fd179d73aebc69d0fa': (247 commits)
  CHART-15187 箱型图面板截断
  CHART-16188 柱形图条件属性中增加文本方向button
  CHART-16171 对富文本内容进行decode
  REPORT-39914 创建远程工作目录问题
  REPORT-39629 组件块显示标题时问号按钮点不到
  REPORT-41135 【冒烟】第一次预览数据模板数据集,加载弹窗不消失 【问题原因】这个加载弹窗是个AutoProgressBar进度条,之前的逻辑中,进度条在SwingWorker线程中start并且close,而与进度条显示更新相关的逻辑在EDT中,所以有时候会出现SwingWorker中AutoProgressBar先close掉了,但是AutoProgressBar中还在继续对进度条进行赋值操作,又因为没有设置ProgressMonitor的millsToDecideToPopup,导致赋值操作会进入某个判断分支并使弹窗再度弹出,弹出后就不会自动关闭了 【改动方案】将close操作放入EDT线程中执行(顺便修复一些导包问题与过时方法)
  CHART-16173 柱形图富文本标签时文本方向调整成横向
  REPORT-37609 - 日文版屏蔽更新还原功能
  更新:将StoreProcedureDataWrapper中无用的dialog及相关逻辑移除,将原本以dialog为父窗口的两个AutoProgressBar的父窗口也修改为new JFrame(),避免出现二级弹窗被遮盖的问题
  更新:将两个SwingWorker合并,将注释掉的代码和多余的逻辑删除
  REPORT-40822 存储过程数据集》编辑界面点击预览,预览框出现在编辑界面背面 【问题原因】设计器中,在弹窗的弹窗场景里,如果是使用DesignerContext.getDesignerFrame()获取父弹窗的话有点问题,会造成第二级的弹窗位于第一级弹窗背后。另外这里的预览会有闪屏现象,原因是在StoreProcedureDataWrapper中会在一个SwingWorker中将dialog(测试的时候发现这个dialog一直没有预览数据)置为可见,但是在另一个SwingWorker中又会将其置为不可见,然后在后续逻辑中重新构建一个包含预览数据的弹窗弹出,这样会造成弹窗又开又关又开,闪屏 【改动思路】传入new JFrame()作为父弹窗,就可以保证预览的弹窗在最上层了;关于闪屏,这边改为第一个空白的dialog置为可见那行代码注释掉,然后自己测试,修改前后预览失败的表现基本一致(修改后无闪屏);另外还修改了一些导包问题
  REPORT-38778 去掉社区和模板商城的小红点,修正使用工厂类引起的bug,修改预装组件的逻辑
  CHART-15747  修改其他交互属性,导致条件属性中的系列名勾选被去掉
  CHART-16117 选择富文本编辑器时,不应设置dirty
  填充面板时更新初始参数
  CHART-15948 富文本编辑器默认内容
  REPORT-37609 - 日文版屏蔽更新还原功能
  MOBILE-29637 & MOBILE-29634【设计器】tab手势设计变更,取消滑动设置与圆点指示器设置的关联关系 & 【RN】release jar,默认样式tab标题字号变小了
  REPORT-37609 - 日文版屏蔽更新还原功能
  REPORT-37609 - 日文版屏蔽更新还原功能
  ...
final/10.0
superman 4 years ago
parent
commit
30813e0c01
  1. 3
      build.gradle
  2. 30
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  3. 4
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  4. 2
      designer-base/src/main/java/com/fr/design/constants/UIConstants.java
  5. 10
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  6. 12
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataCreatorProducer.java
  7. 58
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  8. 21
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTree.java
  9. 11
      designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataComboBox.java
  10. 18
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  11. 50
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  12. 2
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  13. 1
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java
  14. 67
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java
  15. 2
      designer-base/src/main/java/com/fr/design/dialog/ErrorDialog.java
  16. 5
      designer-base/src/main/java/com/fr/design/dialog/UIDialog.java
  17. 38
      designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java
  18. 2
      designer-base/src/main/java/com/fr/design/extra/LoginDialog.java
  19. 2
      designer-base/src/main/java/com/fr/design/extra/ShopDialog.java
  20. 4
      designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java
  21. 25
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  22. 8
      designer-base/src/main/java/com/fr/design/gui/columnrow/ColumnRowPane.java
  23. 7
      designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java
  24. 2
      designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneHelper.java
  25. 23
      designer-base/src/main/java/com/fr/design/gui/frpane/JTreeAutoBuildPane.java
  26. 4
      designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBoxTest.java
  27. 10
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java
  28. 106
      designer-base/src/main/java/com/fr/design/gui/ipasswordfield/UIPasswordFieldWithFixedLength.java
  29. 29
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java
  30. 12
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java
  31. 25
      designer-base/src/main/java/com/fr/design/gui/style/FRFontPane.java
  32. 8
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/ConfigurableCaret.java
  33. 38
      designer-base/src/main/java/com/fr/design/jdk/JdkVersion.java
  34. 17
      designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java
  35. 36
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  36. 4
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  37. 59
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  38. 20
      designer-base/src/main/java/com/fr/design/mainframe/PromptWindow.java
  39. 54
      designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java
  40. 43
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  41. 47
      designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java
  42. 49
      designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java
  43. 31
      designer-base/src/main/java/com/fr/design/menu/SnapChatUtil.java
  44. 22
      designer-base/src/main/java/com/fr/design/notification/AbstractSnapChat.java
  45. 4
      designer-base/src/main/java/com/fr/design/notification/SnapChat.java
  46. 32
      designer-base/src/main/java/com/fr/design/notification/SnapChatFactory.java
  47. 11
      designer-base/src/main/java/com/fr/design/notification/SnapChatKey.java
  48. 5
      designer-base/src/main/java/com/fr/design/object/NameObject.java
  49. 6
      designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java
  50. 252
      designer-base/src/main/java/com/fr/design/parameter/ParameterInputPane.java
  51. 46
      designer-base/src/main/java/com/fr/design/style/FormatPane.java
  52. 20
      designer-base/src/main/java/com/fr/design/style/color/NewColorSelectBox.java
  53. 129
      designer-base/src/main/java/com/fr/design/update/factory/DirectoryOperationFactory.java
  54. 50
      designer-base/src/main/java/com/fr/design/update/factory/UpdateFileFactory.java
  55. 4
      designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreDialog.java
  56. 10
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  57. 36
      designer-base/src/main/java/com/fr/design/update/utils/UpdateFileUtils.java
  58. 67
      designer-base/src/main/java/com/fr/design/upm/UpmFinder.java
  59. 27
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  60. 6
      designer-base/src/main/java/com/fr/design/web/CustomIconPane.java
  61. 24
      designer-base/src/main/java/com/fr/env/EnvListPane.java
  62. 53
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  63. 18
      designer-base/src/main/java/com/fr/start/BaseDesigner.java
  64. 21
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java
  65. 6
      designer-base/src/main/java/com/fr/start/server/ServerTray.java
  66. BIN
      designer-base/src/main/resources/com/fr/design/images/reportcolumns/col_ja_JP.png
  67. BIN
      designer-base/src/main/resources/com/fr/design/images/reportcolumns/col_ko_KR.png
  68. 0
      designer-base/src/main/resources/com/fr/design/images/reportcolumns/col_zh.png
  69. BIN
      designer-base/src/main/resources/com/fr/design/images/reportcolumns/col_zh_TW.png
  70. BIN
      designer-base/src/main/resources/com/fr/design/images/reportcolumns/row_ja_JP.png
  71. BIN
      designer-base/src/main/resources/com/fr/design/images/reportcolumns/row_ko_KR.png
  72. 0
      designer-base/src/main/resources/com/fr/design/images/reportcolumns/row_zh.png
  73. BIN
      designer-base/src/main/resources/com/fr/design/images/reportcolumns/row_zh_TW.png
  74. 8
      designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java
  75. 26
      designer-base/src/test/java/com/fr/design/data/datapane/TableDataPaneListPaneTest.java
  76. 67
      designer-base/src/test/java/com/fr/design/env/RemoteDesignerWorkspaceInfoTest.java
  77. 28
      designer-base/src/test/java/com/fr/design/update/factory/UpdateFileFactoryTest.java
  78. 27
      designer-base/src/test/java/com/fr/design/update/utils/UpdateFileUtilsTest.java
  79. 7
      designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java
  80. 5
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/ReportDataPane.java
  81. 4
      designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java
  82. 4
      designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java
  83. 4
      designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaPlotPane.java
  84. 4
      designer-chart/src/main/java/com/fr/van/chart/bar/VanChartBarPlotPane.java
  85. 180
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java
  86. 3
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableResultDataSeriesPane.java
  87. 1
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/UIComboBoxWithEditLabel.java
  88. 35
      designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubblePlotPane.java
  89. 2
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnConditionPane.java
  90. 17
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnLabelConditionPane.java
  91. 47
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelDetailPane.java
  92. 25
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelNoCheckPane.java
  93. 20
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelPane.java
  94. 4
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotPane.java
  95. 8
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java
  96. 10
      designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java
  97. 32
      designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java
  98. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java
  99. 27
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPaneWithBackGroundLabel.java
  100. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPane.java
  101. Some files were not shown because too many files have changed in this diff Show More

3
build.gradle

@ -64,7 +64,7 @@ allprojects {
implementation 'org.swingexplorer:swexpl:2.0.1'
implementation 'org.swingexplorer:swag:1.0'
implementation 'net.java.dev.jna:jna:5.4.0'
implementation 'org.apache.tomcat:tomcat-catalina:8.5.32'
implementation 'org.apache.tomcat:tomcat-catalina:8.5.57'
implementation 'io.socket:socket.io-client:0.7.0'
implementation 'com.fr.third:fine-third:' + frVersion
implementation 'com.fr.core:fine-core:' + frDevVersion
@ -73,6 +73,7 @@ allprojects {
implementation 'com.fr.decision:fine-decision:' + frVersion
implementation 'com.fr.schedule:fine-schedule:' + frVersion
implementation 'com.fr.report:fine-report-engine:' + frDevVersion
implementation 'com.fr.design:design-i18n:' + frDevVersion
testImplementation 'org.easymock:easymock:3.5.1'
testImplementation 'org.powermock:powermock-module-junit4:1.7.1'
testImplementation 'org.powermock:powermock-api-easymock:1.7.1'

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

@ -163,7 +163,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
* alphafine
*/
private AlphaFineConfigManager alphaFineConfigManager = AlphaFineConfigManager.getInstance();
/**
* 阅后即焚的配置项
*/
@ -218,14 +218,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (needCheckEnv) {
checkNameEnvMap();
}
GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@Override
public void envChanged() {
designerEnvManager.setCurrentDirectoryPrefix(FILEFactory.ENV_PREFIX);
designerEnvManager.setDialogCurrentDirectory(ProjectConstants.REPORTLETS_NAME);
}
GeneralContext.addEnvChangedListener(() -> {
designerEnvManager.setCurrentDirectoryPrefix(FILEFactory.ENV_PREFIX);
designerEnvManager.setDialogCurrentDirectory(ProjectConstants.REPORTLETS_NAME);
});
}
@ -1424,7 +1419,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
* @return
*/
private Locale checkLocale(Locale locale) {
return SupportLocale.getInstance().isSupport(locale) ? locale : Locale.US;
// Yvan: REPORT-39341,有一些情况下,获取到的是zh-Hans-CN这种,需要找到项目中最匹配的Locale
return SupportLocale.getInstance().isSupport(locale) ?
locale : SupportLocale.getInstance().getSuitableLocale(locale);
}
private void readReportLengthUnit(XMLableReader reader) {
@ -1475,7 +1472,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
public String getUUID() {
return StringUtils.isEmpty(uuid) ? UUID.randomUUID().toString() : uuid;
if (StringUtils.isEmpty(uuid)) {
uuid = UUID.randomUUID().toString();
}
return uuid;
}
public int getActiveKeyStatus() {
@ -1578,7 +1578,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
}
}
private void readSnapChatConfig(XMLableReader reader) {
reader.readXMLObject(this.snapChatConfig = SnapChatConfig.getInstance());
}
@ -1801,14 +1801,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
writeSnapChatConfig(writer);
writer.end();
}
private void writeSnapChatConfig(XMLPrintWriter writer) {
if (this.snapChatConfig != null) {
this.snapChatConfig.writeXML(writer);
}
}
private void writeAlphaFineAttr(XMLPrintWriter writer) {
if (this.alphaFineConfigManager != null) {
this.alphaFineConfigManager.writeXML(writer);

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

@ -20,6 +20,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.iprogressbar.UIProgressBarUI;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.jdk.JdkVersion;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
@ -39,6 +40,7 @@ import com.fr.general.log.Log4jConfig;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants;
import com.fr.stable.StableUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.third.apache.log4j.Level;
import com.fr.transaction.Configurations;
@ -216,7 +218,7 @@ public class PreferencePane extends BasicPane {
oracleSpace = new UICheckBox(i18nText("Fine-Design_Basic_Show_All_Oracle_Tables"));
oraclePane.add(oracleSpace);
if (!OperatingSystem.isLinux()) {
if (!OperatingSystem.isLinux() && JdkVersion.LE_8.support()) {
JPanel upmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Update_Plugin_Manager"));
useOptimizedUPMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_New_Update_Plugin_Manager"));
upmSelectorPane.add(useOptimizedUPMCheckbox);

2
designer-base/src/main/java/com/fr/design/constants/UIConstants.java

@ -37,7 +37,7 @@ public interface UIConstants {
public static final Image APPFIT_H3 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/H3.png");
public static final Image APPFIT_H4 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/H4.png");
public static final Border CELL_ATTR_ZEROBORDER = BorderFactory.createEmptyBorder(0, 0, 0, 0);
public static final Border CELL_ATTR_ZEROBORDER = BorderFactory.createEmptyBorder(0, 1, 0, 0);
public static final Border CELL_ATTR_EMPTYBORDER = BorderFactory.createEmptyBorder(0, 10, 0, 0);
public static final Border CELL_ATTR_PRESENTBORDER = BorderFactory.createEmptyBorder(0, 5, 0, 0);
public static final Border CELL_ATTR_NORMALBORDER = BorderFactory.createEmptyBorder(0, 10, 0, 15);

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

@ -50,6 +50,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@ -74,7 +75,7 @@ public abstract class DesignTableDataManager {
private static java.util.Map<String, String> dsNameChangedMap = new HashMap<String, String>();
private static List<ChangeListener> globalDsListeners = new ArrayList<>();
private static Map<String, List<ChangeListener>> dsListenersMap = new HashMap<String, List<ChangeListener>>();
private static Map<String, List<ChangeListener>> dsListenersMap = new ConcurrentHashMap<>();
public static String NO_PARAMETER = "no_paramater_pane";
@ -96,8 +97,8 @@ public abstract class DesignTableDataManager {
*/
private static void fireDsChanged() {
fireDsChanged(globalDsListeners);
for (Entry<String, List<ChangeListener>> listenerEntry : dsListenersMap.entrySet()) {
List<ChangeListener> dsListeners = listenerEntry.getValue();
for (Iterator<Entry<String, List<ChangeListener>>> entryIterator = dsListenersMap.entrySet().iterator(); entryIterator.hasNext(); ) {
List<ChangeListener> dsListeners = entryIterator.next().getValue();
fireDsChanged(dsListeners);
}
}
@ -189,6 +190,7 @@ public abstract class DesignTableDataManager {
}
dsListeners.add(l);
}
/**
* 获取数据源source中dsName的所有字段
*
@ -279,7 +281,7 @@ public abstract class DesignTableDataManager {
Entry<String, TableDataWrapper> entry = entryIt.next();
list.add(entry.getKey());
}
return list.toArray(new String[list.size()]);
return list.toArray(new String[0]);
}
/**

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

@ -72,24 +72,18 @@ public class TableDataCreatorProducer {
public TableDataNameObjectCreator[] createServerTableDataCreator() {
TableDataNameObjectCreator dataBase = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Database_Query"),
"ds",
"/com/fr/design/images/data/dock/serverdatabase.png", DBTableData.class,
DBTableDataPane.class);
TableDataNameObjectCreator ds_Class = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Class"),
"Class",
"/com/fr/design/images/data/dock/serverclasstabledata.png", ClassTableData.class,
ClassTableDataPane.class);
TableDataNameObjectCreator table = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Embedded"),
"Embedded",
"/com/fr/design/images/data/dock/serverdatatable.png", EmbeddedTableData.class,
EmbeddedTableDataPane.class);
TableDataNameObjectCreator fileTable = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_File"),
"File",
"/com/fr/design/images/data/file.png", FileTableData.class,
FileTableDataSmallPane.class);
TableDataNameObjectCreator treeTable = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Tree"),
"Tree",
"/com/fr/design/images/data/tree.png",
RecursionTableData.class, GlobalTreeTableDataPane.class) {
public boolean isNeedParameterWhenPopulateJControlPane() {
@ -97,7 +91,6 @@ public class TableDataCreatorProducer {
}
};
TableDataNameObjectCreator multiTable = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Relation"),
"Multi",
"/com/fr/design/images/data/multi.png",
ConditionTableData.class, GlobalMultiTDTableDataPane.class) {
public boolean isNeedParameterWhenPopulateJControlPane() {
@ -105,7 +98,6 @@ public class TableDataCreatorProducer {
}
};
TableDataNameObjectCreator storeProcedure = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Stored_Procedure"),
"Proc",
"/com/fr/design/images/data/store_procedure.png",
StoreProcedure.class, ProcedureDataPane.class) {
@Override
@ -113,9 +105,7 @@ public class TableDataCreatorProducer {
return true;
}
};
TableDataNameObjectCreator[] creators = new TableDataNameObjectCreator[]{dataBase, ds_Class, table, fileTable, storeProcedure, multiTable, treeTable};
return merge(creators, ExtraDesignClassManager.getInstance().getServerTableDataCreators());
}
@ -141,6 +131,6 @@ public class TableDataCreatorProducer {
for (int i = 0; i < coverIndexList.size(); i ++) {
creators[coverIndexList.get(i)] = coverCreators.get(i);
}
return (TableDataNameObjectCreator[])ArrayUtils.addAll(creators, list.toArray(new TableDataNameObjectCreator[list.size()]));
return ArrayUtils.addAll(creators, list.toArray(new TableDataNameObjectCreator[0]));
}
}

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

@ -7,6 +7,7 @@ import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.design.data.BasicTableDataUtils;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.NameInspector;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.ilist.ListModelElement;
@ -23,18 +24,20 @@ import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* TableDataList Pane.
*/
public class TableDataPaneListPane extends JListControlPane implements TableDataPaneController {
private boolean isNamePermitted = true;
private Map<String, String> dsNameChangedMap = new HashMap<String, String>();
private Map<String, String> dsNameChangedMap = new HashMap<>();
public TableDataPaneListPane() {
super();
@ -43,11 +46,15 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
@Override
public void propertyChange() {
isNamePermitted = true;
TableDataSource source = DesignTableDataManager.getEditingTableDataSource();
String[] allDSNames = DesignTableDataManager.getAllDSNames(source);
String[] allListNames = nameableList.getAllNames();
allListNames[nameableList.getSelectedIndex()] = StringUtils.EMPTY;
String tempName = getEditingName();
if (ComparatorUtils.equals(tempName, selectedName)) {
//说明双击之后又取消了,啥也不用做
return;
}
Set<String> allDSNames = DesignTableDataManager.getGlobalDataSet().keySet();
String[] allListNames = nameableList.getAllNames();
allListNames[editingIndex] = StringUtils.EMPTY;
Object editingType = getEditingType();
if (!BasicTableDataUtils.checkName(tempName)) {
@ -61,15 +68,14 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
isNamePermitted = false;
nameableList.stopEditing();
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this),
Toolkit.i18nText("Fine-Design_Basic_Table_Data_Empty_Name_Tips"),
Toolkit.i18nText("Fine-Design_Report_Alert"),
JOptionPane.WARNING_MESSAGE);
Toolkit.i18nText("Fine-Design_Basic_Table_Data_Empty_Name_Tips"),
Toolkit.i18nText("Fine-Design_Report_Alert"),
JOptionPane.WARNING_MESSAGE);
setIllegalIndex(editingIndex);
return;
}
if (!ComparatorUtils.equals(tempName, selectedName)
&& isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName)) {
boolean isRepeated = isNameRepeated(new Collection[]{allDSNames, Arrays.asList(allListNames)}, tempName);
if (isRepeated) {
isNamePermitted = false;
nameableList.stopEditing();
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Table_Data_Duplicate_Name_Tips", tempName));
@ -81,11 +87,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
setIllegalIndex(editingIndex);
}
if (nameableList.getSelectedValue() instanceof ListModelElement) {
Nameable selected = ((ListModelElement) nameableList.getSelectedValue()).wrapper;
if (!ComparatorUtils.equals(tempName, selected.getName()) && !isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName)) {
rename(selected.getName(), tempName);
}
rename(selectedName, isRepeated ? NameInspector.ILLEGAL_NAME_HOLDER : tempName);
}
}
});
@ -93,7 +95,19 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
@Override
public void rename(String oldName, String newName) {
dsNameChangedMap.put(oldName, newName);
//如果a改成了b,b又被改成了c,就认为是a改成了c
for (Map.Entry<String, String> entry : dsNameChangedMap.entrySet()) {
if (StringUtils.equals(oldName, entry.getValue())) {
oldName = entry.getKey();
break;
}
}
if (StringUtils.equals(oldName, newName)) {
//a -> b;b -> a,说明没改
dsNameChangedMap.remove(oldName);
} else {
dsNameChangedMap.put(oldName, newName);
}
}
/**
@ -148,7 +162,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
String[] allDsNames = DesignTableDataManager.getAllDSNames(source);
// richer:生成的名字从1开始. kunsnat: 添加属性从0开始.
int count = 1;
int count = 1;
while (isDsNameRepeated(prefix + count, allDsNames)) {
count++;
}
@ -192,7 +206,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
}
}
populate(nameObjectList.toArray(new NameObject[nameObjectList.size()]));
populate(nameObjectList.toArray(new NameObject[0]));
}
/**
@ -209,10 +223,10 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
}
while (procedurenameIt.hasNext()) {
String name = procedurenameIt.next();
nameObjectList.add(new NameObject(name, ProcedureConfig.getInstance().getProcedure(name)));
nameObjectList.add(new NameObject(name, ProcedureConfig.getInstance().getProcedure(name)));
}
populate(nameObjectList.toArray(new NameObject[nameObjectList.size()]));
populate(nameObjectList.toArray(new NameObject[0]));
}
@Override
@ -220,7 +234,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
tableDataConfig.removeAllTableData();
ProcedureConfig.getInstance().removeAllProcedure();
Nameable[] tableDataArray = this.update();
Map<String,TableData> tableDataMap = new LinkedHashMap<String,TableData>();
Map<String, TableData> tableDataMap = new LinkedHashMap<String, TableData>();
for (int i = 0; i < tableDataArray.length; i++) {
NameObject nameObject = (NameObject) tableDataArray[i];
tableDataMap.put(nameObject.getName(), (TableData) nameObject.getObject());

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

@ -1,21 +1,22 @@
package com.fr.design.data.datapane;
import com.fr.base.BaseUtils;
import com.fr.general.NameObject;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.gui.itree.refreshabletree.UserObjectRefreshJTree;
import com.fr.design.icon.IconPathConstants;
import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.Color;
import java.awt.Component;
/**
* TableData Tree
@ -31,6 +32,7 @@ public class TableDataTree extends UserObjectRefreshJTree<TableDataSourceOP> {
this.setCellRenderer(tableDataTreeCellRenderer);
this.setEditable(false);
}
// CellRenderer
private DefaultTreeCellRenderer tableDataTreeCellRenderer = new DefaultTreeCellRenderer() {
private static final long serialVersionUID = 1L;
@ -66,14 +68,7 @@ public class TableDataTree extends UserObjectRefreshJTree<TableDataSourceOP> {
this.setIcon(null);
this.setText(PENDING.toString());
}
// 这里新建一个Label作为render是因为JTree在动态刷新的时候,节点上render画布的的宽度不会变,会使得一部分比较长的数据显示为"..."
UILabel label = new UILabel();
label.setText(getText());
label.setIcon(getIcon());
Dimension dim = label.getPreferredSize();
dim.height += 2;
this.setSize(dim);
this.setPreferredSize(dim);
this.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));
this.setBackgroundNonSelectionColor(UIConstants.TREE_BACKGROUND);
this.setTextSelectionColor(Color.WHITE);
this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE);
@ -152,7 +147,7 @@ public class TableDataTree extends UserObjectRefreshJTree<TableDataSourceOP> {
/*
* p:获得选中的NameObject = name + tabledata.
*/
*/
public NameObject getSelectedNameObject() {
TreePath selectedTreePath = this.getSelectionPath();
if (selectedTreePath == null) {

11
designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataComboBox.java

@ -69,7 +69,16 @@ public class TreeTableDataComboBox extends UIComboBox {
}
}
}
/**
* 带参刷新方法
* @param source 数据源数据集
*/
public void refresh(TableDataSource source) {
this.source = source;
refresh();
}
public void setSelectedTableDataByName(String name) {
TableDataWrapper tableDataWrapper;
if (res_map.get(name) != null) {

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

@ -8,7 +8,7 @@ import com.fr.design.border.UITitledBorder;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ipasswordfield.UIPassWordField;
import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.layout.FRGUIPaneFactory;
@ -24,8 +24,18 @@ import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
@ -108,7 +118,7 @@ public class JDBCDefPane extends JPanel {
urlTextField = new UITextField(15);
userNameTextField = new UITextField(15);
userNameTextField.setName(USER_NAME);
passwordTextField = new UIPassWordField(15);
passwordTextField = new UIPasswordFieldWithFixedLength(15);
dbtypeButton = new UIButton(".");
dbtypeButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Click_Get_Default_URL"));
dbtypeButton.addActionListener(dbtypeButtonActionListener);

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

@ -15,20 +15,31 @@ import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.iprogressbar.AutoProgressBar;
import com.fr.design.gui.itable.SortableJTable;
import com.fr.design.gui.itable.TableSorter;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.ui.util.UIUtil;
import com.fr.function.TIME;
import com.fr.general.FRFont;
import com.fr.log.FineLoggerFactory;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;
@ -81,7 +92,7 @@ public class PreviewTablePane extends BasicPane {
JPanel currentPreviewPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
previewNumberPanel.add(currentPreviewPanel);
currentPreviewPanel.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Current_Preview_Rows") + ":"));
currentPreviewPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Current_Preview_Rows") + ":"));
currentRowsField = new UINumberField();
currentPreviewPanel.add(currentRowsField);
@ -91,7 +102,7 @@ public class PreviewTablePane extends BasicPane {
JPanel maxPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
previewNumberPanel.add(maxPanel);
maxPanel.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Maximum_Number_of_Preview_Rows") + ":"));
maxPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Datasource_Maximum_Number_of_Preview_Rows") + ":"));
maxPreviewNumberField = new UINumberField();
maxPanel.add(maxPreviewNumberField);
@ -158,7 +169,7 @@ public class PreviewTablePane extends BasicPane {
if (this.dialog == null) {
this.dialog = this.showWindow(new JFrame());
}
progressBar = new AutoProgressBar(this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) {
progressBar = new AutoProgressBar(this, Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) {
public void doMonitorCanceled() {
if (getWorker() != null) {
getWorker().cancel(true);
@ -174,7 +185,7 @@ public class PreviewTablePane extends BasicPane {
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview");
return Toolkit.i18nText("Fine-Design_Basic_Preview");
}
private void addLoadedListener(LoadedEventListener l) {
@ -268,7 +279,7 @@ public class PreviewTablePane extends BasicPane {
*/
public static EmbeddedTableData previewTableData(TableData tableData, final int keyIndex, final int valueIndex) {
PreviewTablePane previewTablePane = new PreviewTablePane();
previewTablePane.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Data")));
previewTablePane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Basic_Data")));
try {
previewTablePane.populate(tableData);
previewTablePane.resetPreviewTableColumnColor();
@ -298,13 +309,13 @@ public class PreviewTablePane extends BasicPane {
try {
int choiceColumn = Integer.parseInt(columnErrMessage.trim());
int tatalColumn = Integer.parseInt(tatolColumnErrMessage.trim());
columnErrMessage = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Preview_Warn_Text", choiceColumn + 1, tatalColumn);
columnErrMessage = Toolkit.i18nText("Fine-Design_Basic_Tabledata_Preview_Warn_Text", choiceColumn + 1, tatalColumn);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return;
}
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), columnErrMessage, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE);
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), columnErrMessage, Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE);
}
private void populate(TableData tableData) throws Exception {
@ -317,7 +328,7 @@ public class PreviewTablePane extends BasicPane {
}
private void previewTableDataSQL() throws Exception {
connectionBar = new AutoProgressBar(this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Now_Create_Connection"), "", 0, 100) {
connectionBar = new AutoProgressBar(this, Toolkit.i18nText("Fine-Design_Basic_Utils_Now_Create_Connection"), "", 0, 100) {
public void doMonitorCanceled() {
getWorker().cancel(true);
getDialog().setVisible(false);
@ -365,13 +376,14 @@ public class PreviewTablePane extends BasicPane {
if (tableData instanceof DBTableData) {
boolean status = DataOperator.getInstance().testConnection(((DBTableData) tableData).getDatabase());
if (!status) {
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
}
}
} finally {
connectionBar.close();
// 将close操作放到EDT线程中
UIUtil.invokeLaterIfNeeded(() -> connectionBar.close());
}
TableDataSource dataSource = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getTarget();
TableDataSource dataSource = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget();
previewTableData = DesignTableDataManager.previewTableDataNeedInputParameters(dataSource, tableData, (int) maxPreviewNumberField.getValue(), true, progressBar);
// parameterInputDialog
// update之后的parameters,转成一个parameterMap,用于预览TableData
@ -396,7 +408,7 @@ public class PreviewTablePane extends BasicPane {
if (!(e instanceof CancellationException)) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
}
dialog.setVisible(false);
} finally {
@ -425,7 +437,7 @@ public class PreviewTablePane extends BasicPane {
public static void previewStoreData(final ProcedureDataModel storeProcedureDataModel, final int keyIndex, final int valueIndex) {
final PreviewTablePane previewTablePane = new PreviewTablePane();
previewTablePane.storeProcedureDataModel = storeProcedureDataModel;
previewTablePane.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Data")));
previewTablePane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Basic_Data")));
try {
previewTablePane.populateStoreDataSQL();
@ -442,7 +454,7 @@ public class PreviewTablePane extends BasicPane {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
previewTablePane.fireLoadedListener();
previewTablePane.showWindow(DesignerContext.getDesignerFrame()).setVisible(true);
previewTablePane.showWindow(new JFrame()).setVisible(true);
}
/**
@ -456,7 +468,7 @@ public class PreviewTablePane extends BasicPane {
for (int i = 0; i < tableSize; i++) {
PreviewTablePane previewTablePane = new PreviewTablePane();
previewTablePane.storeProcedureDataModel = storeProcedureDataModels[i];
previewTablePane.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Data")));
previewTablePane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Basic_Data")));
try {
previewTablePane.populateStoreDataSQL();
} catch (Exception e) {
@ -469,13 +481,13 @@ public class PreviewTablePane extends BasicPane {
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview");
return Toolkit.i18nText("Fine-Design_Basic_Preview");
}
};
prieviewPane.setLayout(FRGUIPaneFactory.createBorderLayout());
prieviewPane.add(tabPreviewpane, BorderLayout.CENTER);
prieviewPane.showWindow(DesignerContext.getDesignerFrame()).setVisible(true);
prieviewPane.showWindow(new JFrame()).setVisible(true);
}
private void populateStoreDataSQL() throws Exception {

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

@ -218,7 +218,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
paramTexts[0] = SqlUtils.tryPureSqlText(sqlTextPane.getText());
paramTexts[1] = SqlUtils.tryPureSqlText(pageQuery);
List<ParameterProvider> existParameterList = editorPane.update();
Parameter[] ps = existParameterList == null ? new Parameter[0] : existParameterList.toArray(new Parameter[existParameterList.size()]);
Parameter[] ps = existParameterList == null ? new Parameter[0] : existParameterList.toArray(new Parameter[0]);
editorPane.populate(ParameterUtils.analyzeAndUnionParameters(paramTexts, ps));
}

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

@ -73,6 +73,7 @@ public class MaxMemRowCountPanel extends UIToolbar {
switchCache = new UIComboBox(CACHE_LIST);
switchCache.addActionListener(switchStateL);
numberSpinner = new UISpinner(0, Integer.MAX_VALUE, 1);
numberSpinner.setNumberFieldColumns(4);
}
private void showAllPanel() {

67
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java

@ -7,17 +7,16 @@ import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.data.operator.DataOperator;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.iprogressbar.AutoProgressBar;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import javax.swing.Icon;
import javax.swing.JOptionPane;
import javax.swing.JFrame;
import javax.swing.SwingWorker;
import java.util.ArrayList;
import java.util.Arrays;
@ -50,7 +49,6 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
private AutoProgressBar connectionBar;
private ProcedureDataModel[] dataModels;
private SwingWorker worker;
private BasicDialog dialog;
private int previewModel;
public StoreProcedureDataWrapper(StoreProcedure storeProcedure, String storeprocedureName, String dsName) {
@ -71,19 +69,8 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
if (needLoad) {
setWorker();
}
dialog = PreviewTablePane.getInstance().getDialog();
dialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() {
getWorker().cancel(true);
}
public void doCancel() {
getWorker().cancel(true);
}
});
loadingBar = new AutoProgressBar(dialog, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) {
loadingBar = new AutoProgressBar(new JFrame(), Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) {
public void doMonitorCanceled() {
getDialog().setVisible(false);
getWorker().cancel(true);
}
};
@ -93,17 +80,17 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
* 数据集执行结果返回的所有字段
*
* @return 数据集执行结果返回的所有字段
*
*
*
* @date 2014-12-3-下午7:43:17
*
*
*/
public List<String> calculateColumnNameList() {
if (columnNameList != null) {
return columnNameList;
}
if (!createStore(false)) {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_No_TableData"));
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Engine_No_TableData"));
return new ArrayList<String>();
}
columnNameList = Arrays.asList(procedureDataModel.getColumnName());
@ -114,10 +101,10 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
* 生成子节点
*
* @return 节点数组
*
*
*
* @date 2014-12-3-下午7:06:47
*
*
*/
public ExpandMutableTreeNode[] load() {
List<String> namelist;
@ -160,25 +147,16 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
/**
* 预览数据
*
*
* @param previewModel 预览模式, 全部还是一个
*
*
*
* @date 2014-12-3-下午7:05:50
*
*
*/
public void previewData(final int previewModel) {
this.previewModel = previewModel;
new SwingWorker() {
protected Object doInBackground() throws Exception {
loadingBar.close();
PreviewTablePane.resetPreviewTable();
dialog.setVisible(true);
return null;
}
}.execute();
connectionBar = new AutoProgressBar(dialog, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Now_Create_Connection"), "", 0, 100) {
connectionBar = new AutoProgressBar(new JFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Now_Create_Connection"), "", 0, 100) {
public void doMonitorCanceled() {
connectionBar.close();
worker.cancel(true);
@ -190,13 +168,13 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
private void setWorker() {
worker = new SwingWorker<Void, Void>() {
protected Void doInBackground() throws Exception {
loadingBar.close();
PreviewTablePane.resetPreviewTable();
connectionBar.start();
boolean status = DataOperator.getInstance().testConnection(((StoreProcedure) getTableData()).getDatabaseConnection());
if (!status) {
connectionBar.close();
// bug 61345 预览失败时,关闭窗口
dialog.setVisible(false);
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
}
connectionBar.close();
storeProcedure.resetDataModelList();
@ -208,7 +186,6 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
try {
get();
loadingBar.close();
dialog.setVisible(false);
switch (previewModel) {
case StoreProcedureDataWrapper.PREVIEW_ALL:
PreviewTablePane.previewStoreDataWithAllDs(dataModels);
@ -228,10 +205,6 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
};
}
private BasicDialog getDialog() {
return this.dialog;
}
private SwingWorker getWorker() {
return this.worker;
}
@ -240,10 +213,10 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
/**
* 预览返回的一个数据集
*
*
*
* @date 2014-12-3-下午7:42:53
*
*
*/
public void previewData() {
previewData(-1, -1);
@ -253,13 +226,13 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
/**
* 预览返回的一个数据集带有显示值和实际值的标记结果
*
*
* @param keyIndex 实际值
* @param valueIndex 显示值
*
*
*
* @date 2014-12-3-下午7:42:27
*
*
*/
public void previewData(final int keyIndex, final int valueIndex) {
PreviewTablePane.previewStoreData(procedureDataModel, keyIndex, valueIndex);

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

@ -35,7 +35,7 @@ public abstract class ErrorDialog extends JDialog implements ActionListener {
JPanel messagePane = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true);
UILabel boldFontLabel = new UILabel(message);
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Send_Report_To_Us"));
Font font = FRFont.getInstance("Dialog", Font.BOLD, 20);
Font font = FRFont.getInstance(label.getFont().getFontName(), Font.BOLD, 20);
boldFontLabel.setFont(font);
messagePane.add(boldFontLabel);
messagePane.add(label);

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

@ -116,6 +116,11 @@ public abstract class UIDialog extends JDialog {
doCancel();
}
});
applyEnterAction();
}
protected void applyEnterAction() {
JPanel defaultPane = (JPanel) this.getContentPane();
InputMap inputMapAncestor = defaultPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
ActionMap actionMap = defaultPane.getActionMap();

38
designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java vendored

@ -40,6 +40,12 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
private WorkspaceConnectionInfo connection;
/**
* 标记下新创建的远程工作目录 兼容存留的远程目录客户升级后再回退 读取为密文
* 仅保证当前新增是加密的
*/
private boolean newCreated;
public static RemoteDesignerWorkspaceInfo create(WorkspaceConnectionInfo connection) {
RemoteDesignerWorkspaceInfo info = new RemoteDesignerWorkspaceInfo();
info.connection = connection;
@ -79,12 +85,21 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
return remindTime;
}
public boolean isNewCreated() {
return newCreated;
}
public void setNewCreated(boolean newCreated) {
this.newCreated = newCreated;
}
@Override
public void readXML(XMLableReader reader) {
if (reader.isAttr()) {
this.name = reader.getAttrAsString("name", StringUtils.EMPTY);
this.remindTime = reader.getAttrAsString("remindTime", StringUtils.EMPTY);
this.newCreated = reader.getAttrAsBoolean("newCreated", false);
}
if (reader.isChildNode()) {
String tagName = reader.getTagName();
@ -92,32 +107,49 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
String url = reader.getAttrAsString("url", StringUtils.EMPTY);
String username = reader.getAttrAsString("username", StringUtils.EMPTY);
//密码解密
String password = SecurityToolbox.defaultDecrypt(reader.getAttrAsString("password", StringUtils.EMPTY).replaceAll(" ", "\r\n"));
String password = SecurityToolbox.defaultDecrypt(reader.getAttrAsString("password", StringUtils.EMPTY).replaceAll(StringUtils.BLANK, "\r\n"));
String certPath = reader.getAttrAsString("certPath", StringUtils.EMPTY);
String certSecretKey = reader.getAttrAsString("certSecretKey", StringUtils.EMPTY);
String certSecretKey = readCertSecretKey(reader);
boolean rememberPwd = reader.getAttrAsBoolean("rememberPwd", true);
this.connection = new WorkspaceConnectionInfo(url, username, password, certPath, certSecretKey, rememberPwd);
}
}
}
private String readCertSecretKey(XMLableReader reader) {
if (isNewCreated()) {
return SecurityToolbox.defaultDecrypt(reader.getAttrAsString("certSecretKey", StringUtils.EMPTY).replaceAll(StringUtils.BLANK, "\r\n"));
} else {
return reader.getAttrAsString("certSecretKey", StringUtils.EMPTY);
}
}
@Override
public void writeXML(XMLPrintWriter writer) {
writer.attr("name", name);
writer.attr("remindTime", remindTime);
writer.attr("newCreated", isNewCreated());
if (this.connection != null) {
writer.startTAG("Connection");
writer.attr("url", connection.getUrl());
writer.attr("username", connection.getUserName());
writer.attr("password", SecurityToolbox.defaultEncrypt(connection.getPassword()));
writer.attr("certPath", connection.getCertPath());
writer.attr("certSecretKey", connection.getCertSecretKey());
writeCertSecretKey(writer);
writer.attr("rememberPwd", connection.isRememberPwd());
writer.end();
}
}
private void writeCertSecretKey(XMLPrintWriter writer) {
if (isNewCreated()) {
writer.attr("certSecretKey", SecurityToolbox.defaultEncrypt(connection.getCertSecretKey()));
} else {
writer.attr("certSecretKey", connection.getCertSecretKey());
}
}
@Override
@SuppressWarnings("squid:S2975")
public Object clone() throws CloneNotSupportedException {

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

@ -24,7 +24,7 @@ public class LoginDialog extends UIDialog {
}
private void init(Component pane) {
if (StableUtils.getMajorJavaVersion() == 8) {
if (StableUtils.getMajorJavaVersion() >= 8) {
setUndecorated(true);
}
JPanel panel = (JPanel) getContentPane();

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

@ -16,7 +16,7 @@ public class ShopDialog extends UIDialog {
public ShopDialog(Frame frame, BasicPane pane) {
super(frame);
if (StableUtils.getMajorJavaVersion() == 8) {
if (StableUtils.getMajorJavaVersion() >= 8) {
setUndecorated(true);
}
JPanel panel = (JPanel) getContentPane();

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

@ -159,7 +159,7 @@ public class WebViewDlgHelper {
}
public static void createLoginDialog() {
if (StableUtils.getMajorJavaVersion() == VERSION_8) {
if (StableUtils.getMajorJavaVersion() >= VERSION_8) {
File file = new File(StableUtils.pathJoin(installHome, "scripts"));
if (!file.exists()) {
confirmDownLoadShopJS();
@ -172,7 +172,7 @@ public class WebViewDlgHelper {
public static void createLoginDialog(Window parent) {
if (StableUtils.getMajorJavaVersion() == VERSION_8) {
if (StableUtils.getMajorJavaVersion() >= VERSION_8) {
File file = new File(StableUtils.pathJoin(installHome, "scripts"));
if (!file.exists()) {
confirmDownLoadShopJS();

25
designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java

@ -17,14 +17,31 @@ import com.fr.file.FILE;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants;
import com.fr.stable.ProductConstants;
import com.fr.third.javax.annotation.Nonnull;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.TplOperator;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.ButtonModel;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.SwingConstants;
import javax.swing.plaf.basic.BasicMenuItemUI;
import java.awt.*;
import java.awt.AWTEvent;
import java.awt.AlphaComposite;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.AWTEventListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -171,6 +188,8 @@ public class MutilTempalteTabPane extends JComponent {
private UIMenuItem initCloseOther() {
UIMenuItem closeOther = new UIMenuItem(Toolkit.i18nText("Fine-Design_Basic_FS_Close_Other_Templates"));
// Yvan: 英文下文本显示不全,后续发现如果将模板名设置的比较短,其它语言也会出现显示不全的问题,所以设置一下文本水平居中
closeOther.setHorizontalAlignment(SwingConstants.CENTER);
setListDownItemPreferredSize(closeOther);
closeOther.addActionListener(new ActionListener() {
@Override

8
designer-base/src/main/java/com/fr/design/gui/columnrow/ColumnRowPane.java

@ -200,13 +200,17 @@ public class ColumnRowPane extends JPanel implements UIObserver {
column = 0;
}
removeDocumentListener(d);
columnSpinner.setValue(StableUtils.convertIntToABC(column + 1));
String colValue = StableUtils.convertIntToABC(column + 1);
columnSpinner.setValue(colValue);
((DefaultEditor) columnSpinner.getEditor()).getTextField().setText(colValue);
int row = columnRow.getRow();
// shoc 小于0就蹦了
if (row < 0) {
row = 0;
}
rowSpinner.setValue("" + (row + 1));
String rowValue = Integer.toString(row + 1);
rowSpinner.setValue(rowValue);
((DefaultEditor) rowSpinner.getEditor()).getTextField().setText(rowValue);
addDocumentListener(d);
fireChanged();
}

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

@ -27,6 +27,7 @@ import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Collection;
public abstract class JListControlPane extends JControlPane implements ListControlPaneProvider {
private static final String LIST_NAME = "JControl_List";
@ -190,9 +191,9 @@ public abstract class JListControlPane extends JControlPane implements ListContr
return getHelper().getSelectedName();
}
protected boolean isNameRepeated(java.util.List[] list, String name) {
for (int i = 0; i < list.length; i++) {
if (list[i].contains(name)) {
protected boolean isNameRepeated(Collection[] collections, String name) {
for (int i = 0; i < collections.length; i++) {
if (collections[i].contains(name)) {
isNameRepeated = true;
return true;
}

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

@ -65,7 +65,7 @@ class ListControlPaneHelper {
res.add(((ListModelElement) listModel.getElementAt(i)).wrapper);
}
return res.toArray(new Nameable[res.size()]);
return res.toArray(new Nameable[0]);
}
/**

23
designer-base/src/main/java/com/fr/design/gui/frpane/JTreeAutoBuildPane.java

@ -26,14 +26,14 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.List;
import javax.swing.*;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
public class JTreeAutoBuildPane extends BasicPane implements PreviewLabel.Previewable, EditOrNewLabel.Editable {
private TreeTableDataComboBox treeTableDataComboBox;
@ -61,6 +61,23 @@ public class JTreeAutoBuildPane extends BasicPane implements PreviewLabel.Previe
tdChange();
}
});
// REPORT-38762 加一个展开监听事件,下拉框展开时刷新一下数据集
treeTableDataComboBox.addPopupMenuListener(new PopupMenuListener() {
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
treeTableDataComboBox.refresh(DesignTableDataManager.getEditingTableDataSource());
}
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
}
@Override
public void popupMenuCanceled(PopupMenuEvent e) {
}
});
selectTreeDataPanel.add(treeTableDataComboBox);
treeTableDataComboBox.setPreferredSize(new Dimension(200, 25));
treeTableDataComboBox.setSelectedIndex(-1);

4
designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBoxTest.java

@ -3,10 +3,10 @@
*/
package com.fr.design.gui.icombobox;
import com.fr.design.gui.UILookAndFeel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.log.FineLoggerFactory;
import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
import javax.swing.JFrame;
import javax.swing.JPanel;
@ -23,7 +23,7 @@ import java.awt.event.ItemListener;
public class LazyComboBoxTest {
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(new WindowsLookAndFeel());
UIManager.setLookAndFeel(new UILookAndFeel());
} catch (UnsupportedLookAndFeelException e1) {
FineLoggerFactory.getLogger().error(e1.getMessage(), e1);
}

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

@ -19,7 +19,7 @@ import java.awt.event.MouseMotionListener;
public class UIEastResizableContainer extends JPanel {
private static final long serialVersionUID = 1854340560790476907L;
public static final int MAX_CONTAINER_WIDTH = 500;
public static final int MAX_CONTAINER_WIDTH = 340;
public static final int MIN_CONTAINER_WIDTH = 286;
private int containerWidth = 240;
@ -266,13 +266,7 @@ public class UIEastResizableContainer extends JPanel {
@Override
public void mouseDragged(MouseEvent e) {
containerWidth = UIEastResizableContainer.this.getWidth() + (UIEastResizableContainer.this.getLocationOnScreen().x - e.getXOnScreen());
containerWidth = Math.min(containerWidth, MAX_CONTAINER_WIDTH);
containerWidth = Math.max(containerWidth, MIN_CONTAINER_WIDTH);
refreshContainer();
if ( DesignModeContext.isAuthorityEditing()) {
DesignerContext.getDesignerFrame().doResize();
}
// do noting
}
});
addMouseListener(new MouseAdapter() {

106
designer-base/src/main/java/com/fr/design/gui/ipasswordfield/UIPasswordFieldWithFixedLength.java

@ -0,0 +1,106 @@
package com.fr.design.gui.ipasswordfield;
import com.fr.stable.StringUtils;
import org.jetbrains.annotations.NotNull;
import javax.swing.text.Document;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/**
* @author Yvan
* @version 10.0
* Created by Yvan on 2020-08-11
* 有固定长度的"*"回显的密码框避免泄露密码长度
*/
public class UIPasswordFieldWithFixedLength extends UIPassWordField {
/**
* 展示密码为固定8位长度的特殊字符"*"组成
*/
private static final String DISPLAY_PASSWORD = "********";
/**
* 实际密码
*/
private String realPassword;
/**
* 用于判断是否清空密码
*/
private boolean clearPassword;
public UIPasswordFieldWithFixedLength() {
this(null, null, 0);
}
public UIPasswordFieldWithFixedLength(String text) {
this(null, text, 0);
}
public UIPasswordFieldWithFixedLength(int columns) {
this(null, null, columns);
}
public UIPasswordFieldWithFixedLength(String text, int columns) {
this(null, text, columns);
}
public UIPasswordFieldWithFixedLength(Document doc, String txt, int columns) {
super(doc, txt, columns);
initRealPassword(txt);
}
/**
* 为realPassword赋初值并添加一个鼠标单击事件
*/
public void initRealPassword(String text) {
this.realPassword = text == null ? StringUtils.EMPTY : text;
this.clearPassword = true;
addShowFixedLengthPasswordListener();
}
/**
* 当鼠标点击密码框第一次做出键入动作时清空显示密码与实际密码用户需要重新输入密码
*/
private void addShowFixedLengthPasswordListener() {
this.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
UIPasswordFieldWithFixedLength.this.clearPassword = true;
}
});
this.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (clearPassword) {
UIPasswordFieldWithFixedLength.this.setText(StringUtils.EMPTY);
UIPasswordFieldWithFixedLength.this.clearPassword = false;
UIPasswordFieldWithFixedLength.this.updateUI();
}
}
});
}
@Override
public void setText(@NotNull String t) {
this.realPassword = t;
// 看到代码中有些场景是将密码置为空字符串的,所以在这里加个判断
if (StringUtils.isEmpty(t)) {
super.setText(t);
} else {
super.setText(DISPLAY_PASSWORD);
}
}
@Override
public char[] getPassword() {
//如果用户刚清空密码框,并输入了新密码,则返回输入内容,否则返回realPassword
String text = new String(super.getPassword());
if (!StringUtils.isEmpty(text) && StringUtils.isEmpty(realPassword)) {
return text.toCharArray();
}
return realPassword.toCharArray();
}
}

29
designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java

@ -30,6 +30,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
private static final int LEN = 13;
private static final int WIDTH = 13;
private static final int HEIGHT = 10;
private static final int DEFAULT_NUMBERFIELD_COLUMNS = 2;
private UINumberField textField;
private UIButton preButton;
private UIButton nextButton;
@ -40,9 +41,22 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
private UIObserverListener uiObserverListener;
private GlobalNameListener globalNameListener = null;
private boolean lessMinValue = false;
/**
* Spinner内的数字文本框长度
*/
private int numberFieldColumns;
public UISpinner(double minValue, double maxValue, double dierta) {
init(minValue, maxValue, dierta);
}
public UISpinner(double minValue, double maxValue, double dierta, double defaultValue) {
init(minValue, maxValue, dierta);
textField.setValue(defaultValue);
}
private void init(double minValue, double maxValue, double dierta) {
this.minValue = minValue;
this.maxValue = maxValue;
this.dierta = dierta;
@ -50,11 +64,6 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
iniListener();
}
public UISpinner(double minValue, double maxValue, double dierta, double defaultValue) {
this(minValue, maxValue, dierta);
textField.setValue(defaultValue);
}
private void iniListener() {
if (shouldResponseChangeListener()) {
this.addChangeListener(new ChangeListener() {
@ -156,6 +165,13 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
fireStateChanged();
}
/**
* 设置Spinner内的数字输入框列数
* @param numberFieldColumns 输入框列数
*/
public void setNumberFieldColumns(int numberFieldColumns) {
textField.setColumns(numberFieldColumns);
}
public void setEnabled(boolean flag) {
super.setEnabled(flag);
@ -308,7 +324,8 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
}
protected UINumberField initNumberField() {
return new UINumberField(2) {
int columns = this.numberFieldColumns == 0 ? DEFAULT_NUMBERFIELD_COLUMNS : this.numberFieldColumns;
return new UINumberField(columns) {
public boolean shouldResponseChangeListener() {
return false;
}

12
designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java

@ -2,7 +2,6 @@ package com.fr.design.gui.itree.filetree;
import com.fr.base.FRContext;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.gui.itree.refreshabletree.RefreshableJTree;
import com.fr.design.i18n.Toolkit;
@ -14,13 +13,13 @@ import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils;
import com.fr.workspace.WorkContext;
import javax.swing.BorderFactory;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
@ -79,14 +78,7 @@ public class EnvFileTree extends RefreshableJTree {
this.setIcon(null);
this.setText(PENDING.toString());
}
// 这里新建一个Label作为render是因为JTree在动态刷新的时候,节点上render画布的的宽度不会变,会使得一部分比较长的数据显示为"..."
UILabel label = new UILabel();
label.setText(getText());
label.setIcon(getIcon());
this.setSize(label.getPreferredSize());
Dimension dim = label.getPreferredSize();
dim.height += 2;
this.setPreferredSize(dim);
this.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));
this.setBackgroundNonSelectionColor(UIConstants.TREE_BACKGROUND);
this.setTextSelectionColor(Color.WHITE);
this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE);

25
designer-base/src/main/java/com/fr/design/gui/style/FRFontPane.java

@ -25,10 +25,20 @@ import com.fr.general.FRFont;
import com.fr.stable.Constants;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.RenderingHints;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Vector;
@ -67,11 +77,20 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private UIToggleButton subPane;
private JPanel linePane;
private int italic_bold;
/**
* LeftPane和RightPane之间的间隙也是fontSizeStyleComboBox与fontSizeComboBox之间的间隙之前的默认值为VGAP_LARGE
*/
private int hGapBetweenLeftPaneAndRightPane = LayoutConstants.VGAP_LARGE;
public FRFontPane() {
this.initComponents();
}
public FRFontPane(int hGapBetweenLeftPaneAndRightPane) {
this.hGapBetweenLeftPaneAndRightPane = hGapBetweenLeftPaneAndRightPane;
this.initComponents();
}
public static void main(String[] args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
@ -345,7 +364,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private JPanel createPane() {
JPanel createPane = new JPanel(new BorderLayout());
createPane.add(fontNameComboBox, BorderLayout.NORTH);
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{createLeftPane(), createRightPane()}}, TableLayoutHelper.FILL_LASTCOLUMN, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE);
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{createLeftPane(), createRightPane()}}, TableLayoutHelper.FILL_LASTCOLUMN, hGapBetweenLeftPaneAndRightPane, LayoutConstants.VGAP_LARGE);
jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
createPane.add(jPanel, BorderLayout.CENTER);
return createPane;

8
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/ConfigurableCaret.java

@ -12,6 +12,7 @@ import java.awt.*;
import java.awt.event.*;
import java.awt.datatransfer.*;
import java.awt.event.ActionEvent;
import java.awt.geom.Line2D;
import java.io.*;
import javax.swing.*;
import javax.swing.plaf.*;
@ -454,9 +455,10 @@ public class ConfigurableCaret extends DefaultCaret {
// A thicker vertical line.
case THICK_VERTICAL_LINE_STYLE:
g.drawLine(r.x,r.y, r.x,r.y+r.height);
r.x++;
g.drawLine(r.x,r.y, r.x,r.y+r.height);
Graphics2D g2 = (Graphics2D) g;
g2.setStroke(new BasicStroke(2));
// 向右再移动一个位置 避免光标太接近文字内容
g2.draw(new Line2D.Float(r.x + 1, r.y, r.x + 1, r.y + r.height));
break;
} // End of switch (style).

38
designer-base/src/main/java/com/fr/design/jdk/JdkVersion.java

@ -0,0 +1,38 @@
package com.fr.design.jdk;
import com.fr.stable.StableUtils;
/**
* 设计器运行jdk版本
*
* @author hades
* @version 10.0
* Created by hades on 2020/9/27
*/
public enum JdkVersion {
/**
* 小于或等于jdk 8
*/
LE_8 {
@Override
public boolean support() {
return StableUtils.getMajorJavaVersion() <= 8;
}
},
/**
* 大于或等于jdk 9
*/
GE_9 {
@Override
public boolean support() {
return StableUtils.getMajorJavaVersion() >= 9;
}
};
abstract public boolean support();
}

17
designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java

@ -156,7 +156,20 @@ public enum SupportLocaleImpl implements SupportLocale {
set.add(Locale.TAIWAN);
return set;
}
}
},
/**
* 更新升级-帮助菜单下
*/
UPDATE_HELP {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<>();
set.add(Locale.US);
set.add(Locale.KOREA);
set.add(Locale.CHINA);
set.add(Locale.TAIWAN);
return set;
}
}
}

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

@ -257,8 +257,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
};
private ProgressDialog progressDialog;
public DesignerFrame(ToolBarMenuDock ad) {
setName(DESIGNER_FRAME_NAME);
@ -338,7 +336,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
this.setDropTarget(new DropTarget(this, DnDConstants.ACTION_MOVE, new FileDropTargetListener(), true));
closeMode = UIConstants.CLOSE_OF_AUTHORITY;
initMenuPane();
this.progressDialog = new ProgressDialog(this);
}
public void resizeFrame() {
@ -748,9 +745,15 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param al 组件名称
*/
public void checkCombineUp(boolean flag, ArrayList<String> al) {
combineUp.checkComponentsByNames(flag, al);
//Yvan: 检查当前是否为WORK_SHEET状态,因为只有WORK_SHEET中含有格式刷组件,此时是不需要进行checkComponentsByNames的
JTemplate<?, ?> jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jTemplate != null) {
// 第一个条件满足后还需要添加一重判断,判断是编辑报表块还是参数面板,编辑报表块时则直接return
if (jTemplate.getMenuState() == DesignState.WORK_SHEET && !jTemplate.isUpMode()) {
return;
}
combineUp.checkComponentsByNames(flag, al);
}
}
/**
@ -1262,23 +1265,15 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
}
@Deprecated
public ProgressDialog getProgressDialog() {
return progressDialog;
return new ProgressDialog(this);
}
public void showProgressDialog() {
progressDialog.setVisible(true);
}
/**
* 隐藏进度框
*/
public void hideProgressDialog() {
@Deprecated
public void openProgressDialog() {
progressDialog.setVisible(false);
}
/**
@ -1286,17 +1281,17 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
*
* @param progress 进度值
*/
@Deprecated
public void updateProgress(int progress) {
progressDialog.setProgressValue(progress);
}
/**
* 释放进度框
*/
@Deprecated
public void disposeProgressDialog() {
progressDialog.dispose();
}
/**
@ -1307,4 +1302,5 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
public boolean isDesignerOpened() {
return designerOpened;
}
}

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

@ -556,7 +556,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
);
newNameLabel.setHorizontalAlignment(SwingConstants.RIGHT);
newNameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
newNameLabel.setPreferredSize(new Dimension(118, 15));
//newNameLabel.setPreferredSize(new Dimension(118, 15));
// 重命名输入框
nameField = new UITextField(oldName);
@ -856,7 +856,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
BorderLayout.CENTER);
this.setSize(340, 180);
this.setSize(380, 180);
this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Mkdir"));
this.setResizable(false);
this.setAlwaysOnTop(true);

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

@ -12,6 +12,8 @@ import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.gui.icontainer.UIEastResizableContainer;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.menu.SnapChatUtil;
import com.fr.design.notification.SnapChat;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils;
@ -171,7 +173,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}
updateAllPropertyPane();
}
}); }
});
}
}, filter);
PluginListenerRegistration.getInstance().listen(
PluginEventType.BeforeStop,
@ -221,11 +224,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
String key = provider.key();
PropertyItemBean itemBean = provider.getItem();
PropertyItem propertyItem = new PropertyItem(itemBean.getName(),
itemBean.getTitle(),
itemBean.getBtnIconName(),
itemBean.getBtnIconBaseDir(),
itemBean.getVisibleModes(),
itemBean.getEnableModes());
itemBean.getTitle(),
itemBean.getBtnIconName(),
itemBean.getBtnIconBaseDir(),
itemBean.getVisibleModes(),
itemBean.getEnableModes(),
itemBean.getSnapChat(),
itemBean.getPromptWindow());
UIButton button = propertyItem.getButton();
List<ActionListener> buttonListeners = itemBean.getButtonListeners();
if (buttonListeners != null) {
@ -324,6 +329,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
cellElement.popupDialog.showDefaultPane();
}
}
// 禁用单元格元素tab
private void enableCellElementPane(PropertyItem cellElement) {
cellElement.setEnabled(true);
@ -381,7 +387,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
/**
* 可通过此方法判断当前的编辑模式
* */
*/
public PropertyMode getCurrentMode() {
return currentMode;
}
@ -511,7 +517,10 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
propertyItemMap.get(key).replaceContentPane(pane);
PropertyItem item = propertyItemMap.get(key);
if (item != null) {
item.replaceContentPane(pane);
}
}
});
}
@ -524,7 +533,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceHeaderPane(paraPane);
}
public static void main(String[] args){
public static void main(String[] args) {
JFrame jf = new JFrame("test");
// jf = new JFrame("test");
@ -546,7 +555,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
// leftPane.add(b2);
// leftPane.setLayout(new BoxLayout(leftPane, BoxLayout.Y_AXIS));
JPanel content = (JPanel)jf.getContentPane();
JPanel content = (JPanel) jf.getContentPane();
// content.setLayout(null);
content.add(cc, BorderLayout.CENTER);
content.add(new EastRegionContainerPane(), BorderLayout.EAST);
@ -654,6 +663,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
class PropertyItem {
private SnapChat snapChat;
private UIButton button;
private String name; // 用于 card 切换
private String title; // 用于显示
@ -664,6 +674,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private FixedPopupPane popupPane; // 左侧固定弹出框
private PopupToolPane popupToolPane; // 弹出工具条
private PopupDialog popupDialog; // 弹出框
private PromptWindow promptWindow; //提示窗
private boolean isPoppedOut = false; // 是否弹出
private boolean isVisible = true; // 是否可见
private boolean replace = false; // 是否被替代
@ -684,14 +695,16 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public PropertyItem(String name, String title, String btnIconName, PropertyMode[] visibleModes, PropertyMode[] enableModes) {
this(name, title, btnIconName, ICON_BASE_DIR, visibleModes, enableModes);
this(name, title, btnIconName, ICON_BASE_DIR, visibleModes, enableModes, null, null);
}
public PropertyItem(String name, String title, String btnIconName, String iconBaseDir, PropertyMode[] visibleModes, PropertyMode[] enableModes) {
public PropertyItem(String name, String title, String btnIconName, String iconBaseDir, PropertyMode[] visibleModes, PropertyMode[] enableModes, SnapChat snapChat, PromptWindow promptWindow) {
this.name = name;
this.title = title;
this.btnIconName = btnIconName;
this.iconBaseDir = iconBaseDir;
this.snapChat = snapChat;
this.promptWindow = promptWindow;
initButton();
initPropertyPanel();
initModes(visibleModes, enableModes);
@ -832,7 +845,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
if (isRightPaneVisible()) {
hideCurrentPopupPane();
replaceContentPane(contentPane);
} else if(popupPane != null && popupPane.isVisible()) {
} else if (popupPane != null && popupPane.isVisible()) {
popupPane.replaceContentPane(contentArea);
}
}
@ -869,9 +882,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public Dimension getPreferredSize() {
return new Dimension(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT);
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
if (snapChat != null && !snapChat.hasRead()) {
SnapChatUtil.paintPropertyItemPoint(g, getBounds());
}
}
};
button.set4LargeToolbarButton();
@ -899,6 +916,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
popupFixedPane();
}
setTabButtonSelected();
if (snapChat != null && !snapChat.hasRead()) {
snapChat.markRead();
if (promptWindow != null) {
promptWindow.showWindow();
}
}
}
});
button.setToolTipText(title);
@ -1012,8 +1035,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}
/**
* @Description:刷新currentPopupPane面板位置当设计器缩放时会调用这个函数
* @param
* @Description:刷新currentPopupPane面板位置当设计器缩放时会调用这个函数
* @return:
* @Author: Henry.Wang
* @date: 2020/7/30 11:39
@ -1028,8 +1051,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}
/**
* @Description:清空currentPopupPane数据当切换模板时会调用这个函数
* @param
* @Description:清空currentPopupPane数据当切换模板时会调用这个函数
* @return:
* @Author: Henry.Wang
* @date: 2020/7/30 11:42
@ -1068,12 +1091,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}
repaint();
}
@Override
public void mouseClicked(MouseEvent e) {
if (e.getX() >= ARROW_RANGE_START) {
onPop();
}
}
@Override
public void mouseReleased(MouseEvent e) {
mouseDownCompCoords = null;
@ -1081,6 +1106,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
contentPane.setBackground(originColor);
}
}
@Override
public void mousePressed(MouseEvent e) {
if (e.getX() < ARROW_RANGE_START) {
@ -1102,6 +1128,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}
repaint();
}
@Override
public void mouseDragged(MouseEvent e) {
if (isMovable && mouseDownCompCoords != null) {
@ -1214,6 +1241,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private Container contentPane;
private JPanel defaultPane; // 无可用配置项
private PropertyItem propertyItem;
public PopupDialog(PropertyItem propertyItem) {
super(DesignerContext.getDesignerFrame());
container = getContentPane();
@ -1316,6 +1344,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
mouseDownCompCoords = e.getLocationOnScreen();
}
}
@Override
public void mouseReleased(MouseEvent e) {
mouseDownCompCoords = null;

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

@ -0,0 +1,20 @@
package com.fr.design.mainframe;
import javax.swing.JWindow;
/**
* @Author: Yuan.Wang
* @Date: 2020/10/9
* 只关心Window的显示和隐藏操作时可以实现该接口
*/
public interface PromptWindow {
/**
* 显示弹窗
*/
void showWindow();
/**
* 隐藏弹窗
*/
void hideWindow();
}

54
designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java

@ -1,5 +1,7 @@
package com.fr.design.mainframe;
import com.fr.design.notification.SnapChat;
import java.awt.event.ActionListener;
import java.util.List;
@ -7,71 +9,89 @@ import java.util.List;
* created by Harrison on 2020/03/23
**/
public class PropertyItemBean {
private String name;
private String title;
private String btnIconName;
private String btnIconBaseDir;
private SnapChat snapChat;
private PromptWindow promptWindow;
private EastRegionContainerPane.PropertyMode[] visibleModes;
private EastRegionContainerPane.PropertyMode[] enableModes;
private List<ActionListener> buttonListeners;
public PropertyItemBean() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getBtnIconName() {
return btnIconName;
}
public void setBtnIconName(String btnIconName) {
this.btnIconName = btnIconName;
}
public String getBtnIconBaseDir() {
return btnIconBaseDir;
}
public void setBtnIconBaseDir(String btnIconBaseDir) {
this.btnIconBaseDir = btnIconBaseDir;
}
public SnapChat getSnapChat() {
return snapChat;
}
public void setSnapChat(SnapChat snapChat) {
this.snapChat = snapChat;
}
public PromptWindow getPromptWindow() {
return promptWindow;
}
public void setPromptWindow(PromptWindow promptWindow) {
this.promptWindow = promptWindow;
}
public EastRegionContainerPane.PropertyMode[] getVisibleModes() {
return visibleModes;
}
public void setVisibleModes(EastRegionContainerPane.PropertyMode[] visibleModes) {
this.visibleModes = visibleModes;
}
public EastRegionContainerPane.PropertyMode[] getEnableModes() {
return enableModes;
}
public void setEnableModes(EastRegionContainerPane.PropertyMode[] enableModes) {
this.enableModes = enableModes;
}
public List<ActionListener> getButtonListeners() {
return buttonListeners;
}
public void setButtonListeners(List<ActionListener> buttonListeners) {
this.buttonListeners = buttonListeners;
}

43
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -54,9 +54,7 @@ import com.fr.design.mainframe.ToolBarNewTemplatePane;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.SnapChatMenuDef;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.notification.SnapChatAllTypes;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.remote.action.RemoteDesignAuthManagerAction;
import com.fr.design.update.actions.SoftwareUpdateAction;
@ -530,35 +528,18 @@ public abstract class ToolBarMenuDock {
* @return 帮组菜单的子菜单
*/
public ShortCut[] createHelpShortCuts() {
final java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>();
Locale locale = GeneralContext.getLocale();
final java.util.List<ShortCut> shortCuts = new ArrayList<>();
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new VideoAction());
}
}, SupportLocaleImpl.VIDEO);
LocaleCenter.buildAction(() -> shortCuts.add(new VideoAction()), SupportLocaleImpl.VIDEO);
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new TutorialAction());
}
}, SupportLocaleImpl.TUTORIAL_HELP);
LocaleCenter.buildAction(() -> shortCuts.add(new TutorialAction()), SupportLocaleImpl.TUTORIAL_HELP);
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new TechSupportAction());
}
}, SupportLocaleImpl.TECH_SUPPORT_HELP);
LocaleCenter.buildAction(() -> shortCuts.add(new TechSupportAction()), SupportLocaleImpl.TECH_SUPPORT_HELP);
//远程不使用更新升级,产品演示
if (WorkContext.getCurrent().isLocal()) {
shortCuts.add(new WebDemoAction());
shortCuts.add(new SoftwareUpdateAction());
LocaleCenter.buildAction(() -> shortCuts.add(new SoftwareUpdateAction()), SupportLocaleImpl.UPDATE_HELP);
}
if (AlphaFineConfigManager.isALPHALicAvailable()) {
shortCuts.add(new AlphaFineAction());
@ -566,12 +547,7 @@ public abstract class ToolBarMenuDock {
shortCuts.add(SeparatorDef.DEFAULT);
if (DesignerEnvManager.getEnvManager().isOpenDebug()) {
OSSupportCenter.buildAction(new OSBasedAction() {
@Override
public void execute(Object... objects) {
shortCuts.add(new FineUIAction());
}
}, SupportOSImpl.FINEUI);
OSSupportCenter.buildAction(objects -> shortCuts.add(new FineUIAction()), SupportOSImpl.FINEUI);
}
shortCuts.add(new AboutAction());
@ -655,11 +631,8 @@ public abstract class ToolBarMenuDock {
}
public MenuDef createCommunityMenuDef() {
MenuDef menuDef = new SnapChatMenuDef(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community"),
'C',
SnapChatAllTypes.Menu.BBS);
MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community"), 'C');
ShortCut[] otherCommunityShortCuts = createCommunityShortCuts();
for (ShortCut shortCut : otherCommunityShortCuts) {
menuDef.addShortCut(shortCut);

47
designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java

@ -4,6 +4,7 @@ import com.fr.design.gui.imenu.UIMenu;
import com.fr.design.gui.imenu.UIScrollMenu;
import com.fr.design.notification.SnapChat;
import com.fr.design.notification.SnapChatConfig;
import com.fr.design.notification.SnapChatFactory;
import com.fr.design.notification.SnapChatKey;
import javax.swing.JMenu;
@ -19,47 +20,49 @@ import java.awt.image.BufferedImage;
* created by Harrison on 2020/03/16
**/
public class SnapChatMenuDef extends MenuDef implements SnapChat {
private SnapChatKey uniqueKey;
private SnapChatMenuUI menuUI = new SnapChatMenuUI(this);
private SnapChat snapChat ;
public SnapChatMenuDef(String name, SnapChatKey uniqueKey) {
super(name);
this.uniqueKey = uniqueKey;
snapChat = SnapChatFactory.createSnapChat(true, uniqueKey);
}
public SnapChatMenuDef(Boolean rePaint, SnapChatKey uniqueKey) {
super(rePaint);
this.uniqueKey = uniqueKey;
snapChat = SnapChatFactory.createSnapChat(true, uniqueKey);
}
public SnapChatMenuDef(String name, char mnemonic, SnapChatKey uniqueKey) {
super(name, mnemonic);
this.uniqueKey = uniqueKey;
snapChat = SnapChatFactory.createSnapChat(true, uniqueKey);
}
@Override
public boolean hasRead() {
String calcKey = calcKey();
Boolean val = SnapChatConfig.getInstance().hasRead(calcKey);
// 默认读过了。
return val == null ? defaultStatus() : val;
return snapChat.hasRead();
}
@Override
public void markRead() {
String calcKey = calcKey();
SnapChatConfig.getInstance().markRead(calcKey);
snapChat.markRead();
}
@Override
public boolean defaultStatus() {
return true;
return snapChat.defaultStatus();
}
@Override
public SnapChatKey key() {
return snapChat.key();
}
@Override
public void addShortCut(ShortCut shortCut) {
@ -74,13 +77,6 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat {
super.insertShortCut(index, shortCut);
}
@Override
public SnapChatKey key() {
return this.uniqueKey;
}
@Override
protected MenuListener createMenuListener() {
@ -97,17 +93,12 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat {
if (shortCut instanceof SnapChatUpdateAction) {
SnapChatUpdateAction action = (SnapChatUpdateAction) shortCut;
if (!action.hasRead()) {
String calcKey = calcKey();
String calcKey = snapChat.calcKey();
SnapChatConfig.getInstance().resetRead(calcKey);
}
}
}
private String calcKey() {
return key().calc();
}
@Override
protected UIMenu createJMenu0() {

49
designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java

@ -3,7 +3,7 @@ package com.fr.design.menu;
import com.fr.design.actions.UpdateAction;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.notification.SnapChat;
import com.fr.design.notification.SnapChatConfig;
import com.fr.design.notification.SnapChatFactory;
import com.fr.design.notification.SnapChatKey;
import java.awt.event.ActionEvent;
@ -12,57 +12,46 @@ import java.awt.event.ActionEvent;
* created by Harrison on 2020/03/22
**/
public abstract class SnapChatUpdateAction extends UpdateAction implements SnapChat {
private SnapChatKey uniqueKey;
private SnapChat snapChat ;
public SnapChatUpdateAction(SnapChatKey uniqueKey) {
this.uniqueKey = uniqueKey;
snapChat = SnapChatFactory.createSnapChat(false, uniqueKey);
}
@Override
public final void actionPerformed(ActionEvent e) {
markRead();
actionPerformed0(e);
}
protected abstract void actionPerformed0(ActionEvent e);
@Override
public boolean hasRead() {
String calcKey = calcKey();
Boolean val = SnapChatConfig.getInstance().hasRead(calcKey);
return val == null ? defaultStatus() : val;
return snapChat.hasRead();
}
@Override
public void markRead() {
String calcKey = calcKey();
SnapChatConfig.getInstance().markRead(calcKey);
snapChat.markRead();
}
@Override
public boolean defaultStatus() {
return false;
return snapChat.defaultStatus();
}
@Override
public SnapChatKey key() {
return this.uniqueKey;
}
private String calcKey() {
return key().calc();
return snapChat.key();
}
@Override
public UIMenuItem createMenuItem() {
Object object = this.getValue(UIMenuItem.class.getName());
if (object == null && !(object instanceof UIMenuItem)) {
UIMenuItem menuItem = new UIMenuItem(this);
@ -70,10 +59,10 @@ public abstract class SnapChatUpdateAction extends UpdateAction implements SnapC
menuItem.setName(getName());
menuItem.setUI(new SnapChatMenuItemUI(this));
object = menuItem;
this.putValue(UIMenuItem.class.getName(), object);
}
return (UIMenuItem) object;
}
}

31
designer-base/src/main/java/com/fr/design/menu/SnapChatUtil.java

@ -10,24 +10,31 @@ import java.awt.geom.Ellipse2D;
* created by Harrison on 2020/03/22
**/
public class SnapChatUtil {
private static final int WIDTH = 4;
private static final int HEIGHT = 4;
private static final int TOP_GAP = 4;
private static final int RIGHT_GAP = 6;
/**
* 绘制菜单项的小红点
*/
public static void paintSnapChat(Graphics g, Rectangle textRect) {
Color oldColor = g.getColor();
double x = textRect.getWidth();
x += textRect.getX();
x += 2;
double x = textRect.getWidth() + textRect.getX() + 2;
double y = textRect.getY();
paintRedPoint(g, new Ellipse2D.Double(x, y, WIDTH, HEIGHT));
}
public static void paintPropertyItemPoint(Graphics g, Rectangle bounds) {
double x = bounds.getWidth() - RIGHT_GAP;
paintRedPoint(g, new Ellipse2D.Double(x, TOP_GAP, WIDTH, HEIGHT));
}
private static void paintRedPoint(Graphics g, Ellipse2D.Double shape) {
Color oldColor = g.getColor();
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(Color.red);
Ellipse2D.Double shape =
new Ellipse2D.Double(x, y, 4, 4);
g2d.fill(shape);
g2d.draw(shape);
g2d.setColor(oldColor);
}
}

22
designer-base/src/main/java/com/fr/design/notification/AbstractSnapChat.java

@ -0,0 +1,22 @@
package com.fr.design.notification;
/**
* @Author: Yuan.Wang
* @Date: 2020/9/27
*/
public abstract class AbstractSnapChat implements SnapChat {
@Override
public boolean hasRead() {
String calcKey = calcKey();
Boolean val = SnapChatConfig.getInstance().hasRead(calcKey);
return val == null ? defaultStatus() : val;
}
@Override
public void markRead() {
String calcKey = calcKey();
SnapChatConfig.getInstance().markRead(calcKey);
}
}

4
designer-base/src/main/java/com/fr/design/notification/SnapChat.java

@ -32,4 +32,8 @@ public interface SnapChat {
* @return 字符标志
*/
SnapChatKey key();
default String calcKey() {
return key().calc();
}
}

32
designer-base/src/main/java/com/fr/design/notification/SnapChatFactory.java

@ -0,0 +1,32 @@
package com.fr.design.notification;
import com.fr.plugin.context.PluginContext;
/**
* @Author: Yuan.Wang
* @Date: 2020/10/10
*/
public class SnapChatFactory {
public static SnapChat createSnapChat(boolean defaultStatus, SnapChatKey snapChatKey) {
return createSnapChat(defaultStatus, snapChatKey, null);
}
public static SnapChat createSnapChat(boolean defaultStatus, SnapChatKey snapChatKey, PluginContext context) {
return new AbstractSnapChat() {
@Override
public boolean defaultStatus() {
return defaultStatus;
}
@Override
public SnapChatKey key() {
return snapChatKey;
}
@Override
public String calcKey() {
return context == null ? key().calc() : key().calc(context);
}
};
}
}

11
designer-base/src/main/java/com/fr/design/notification/SnapChatKey.java

@ -1,9 +1,18 @@
package com.fr.design.notification;
import com.fr.plugin.context.PluginContext;
/**
* created by Harrison on 2020/03/16
**/
public interface SnapChatKey {
String calc();
/**
* 插件刚被安装时不能通过PluginContexts.getContext()方法获取插件上下文因此加一个接口
*/
default String calc(PluginContext context) {
throw new UnsupportedOperationException();
}
}

5
designer-base/src/main/java/com/fr/design/object/NameObject.java

@ -2,6 +2,7 @@ package com.fr.design.object;
import com.fr.base.BaseUtils;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StableUtils;
/**
*
@ -60,10 +61,10 @@ public class NameObject<T> {
return "Name:" + this.getName() + "\tObject:" + this.getObject();
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@SuppressWarnings({ "rawtypes"})
public Object clone() throws CloneNotSupportedException {
NameObject newNameObject = (NameObject)super.clone();
newNameObject.object = BaseUtils.cloneObject(this.object);
newNameObject.object = StableUtils.cloneObject(this.object);
return newNameObject;
}

6
designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java

@ -2,8 +2,10 @@ package com.fr.design.os.impl;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.extra.WebViewDlgHelper;
import com.fr.design.jdk.JdkVersion;
import com.fr.design.upm.UpmFinder;
import com.fr.design.utils.DesignUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.os.Arch;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction;
@ -17,11 +19,11 @@ public class PMDialogAction implements OSBasedAction {
private static String PLUGIN_MANAGER_ROUTE = "#management/plugin";
@Override
public void execute(Object... objects) {
if(Arch.getArch() == Arch.ARM){
if(Arch.getArch() == Arch.ARM || OperatingSystem.isLinux()){
DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null);
return;
}
if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() && !OperatingSystem.isLinux()) {
if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() && JdkVersion.LE_8.support()) {
UpmFinder.showUPMDialog();
} else {
WebViewDlgHelper.createPluginDialog();

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

@ -20,14 +20,18 @@ import com.fr.design.editor.editor.TextEditor;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
@ -37,31 +41,34 @@ import java.util.Map.Entry;
/**
* The dialog used to input parameter.
*
* @editor zhou
* @since 2012-3-26上午11:09:45
*/
public class ParameterInputPane extends BasicPane {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
*
*/
private static final long serialVersionUID = 1L;
// alex:保存编辑器对应的参数的名字
private java.util.Map<ValueEditorPane, String> editorNameMap; // Map<Editor, Name>
private boolean allowBlank = true;
// alex:保存编辑器对应的参数的名字
private java.util.Map<ValueEditorPane,String> editorNameMap; // Map<Editor, Name>
private FlowTableLayoutHelper flowTableLayoutHelper;
private boolean allowBlank = true;
/**
/**
* Constructor.
*/
public ParameterInputPane(ParameterProvider[] parameters) {
this.initComponents(parameters);
}
public ParameterInputPane(ParameterProvider[] parameters, boolean allowBlank) {
this.allowBlank = allowBlank;
this.initComponents(parameters);
}
public ParameterInputPane(ParameterProvider[] parameters, boolean allowBlank) {
this.allowBlank = allowBlank;
this.initComponents(parameters);
}
private void initComponents(ParameterProvider[] parameters) {
this.setLayout(new BorderLayout(0, 4));
@ -71,24 +78,24 @@ public class ParameterInputPane extends BasicPane {
this.add(new JScrollPane(contentPane), BorderLayout.CENTER);
contentPane.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameters") + ":"));
FlowTableLayoutHelper flowTableLayoutHelper = new FlowTableLayoutHelper();
flowTableLayoutHelper = new FlowTableLayoutHelper();
editorNameMap = new java.util.HashMap<ValueEditorPane, String>();
editorNameMap = new java.util.HashMap<ValueEditorPane,String>();
//Parameter list.
java.util.List<String> nameAddedList = new java.util.ArrayList<String>(); // alex:已经加到界面中去的参数名
if (parameters != null && parameters.length > 0) {
for (int i = 0; i < parameters.length; i++) {
ParameterProvider parameter = parameters[i];
// alex:已经在界面中的参数,不加了
if (nameAddedList.contains(parameter.getName())) {
continue;
}
if(parameter instanceof StoreProcedureParameter
&& ((StoreProcedureParameter) parameter).getSchema() == StoreProcedureConstants.OUT) {
continue;
}
continue;
}
if (parameter instanceof StoreProcedureParameter
&& ((StoreProcedureParameter) parameter).getSchema() == StoreProcedureConstants.OUT) {
continue;
}
final Object pv = parameter.getValue();
Editor[] editors = makeEditorByValue(pv);
@ -100,135 +107,140 @@ public class ParameterInputPane extends BasicPane {
editPane.setPreferredSize(new Dimension(180, editPane.getPreferredSize().height));
String parameterDisplayName = parameter.getName();
if(StringUtils.isNotBlank(parameter.getName())) {
parameterDisplayName = parameter.getName();
if (StringUtils.isNotBlank(parameter.getName())) {
parameterDisplayName = parameter.getName();
}
contentPane.add(flowTableLayoutHelper.createLabelFlowPane(parameterDisplayName + ":", editPane));
//add editor to parameter hashtable.
initTextListener(textF);
initTextListener(textF);
this.editorNameMap.put(textF, parameter.getName());
nameAddedList.add(parameter.getName());
}
}
}
@Override
public void addNotify() {
super.addNotify();
// windows 高DPI下,使用getPreferredSize必须在添加到容器之后,否则得到的数值不准确,因此先放到这调整大小
flowTableLayoutHelper.adjustLabelWidth();
}
protected void initTextListener(ValueEditorPane textF) {
textF.getCurrentEditor().addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified();
}
});
}
private Editor[] makeEditorByValue(Object pv) {
Editor[] editors = {null};
if (pv instanceof Integer) {
editors[0] = new IntegerEditor();
} else if (pv instanceof Double || pv instanceof Float) {
editors[0] = new DoubleEditor();
} else if (pv instanceof Float) {
editors[0] = new FloatEditor();
} else if (pv instanceof Date) {
editors[0] = new DateEditor(true, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Date"));
} else if (pv instanceof Boolean) {
editors[0] = new BooleanEditor();
} else if (pv instanceof BaseFormula) {
editors = ValueEditorPaneFactory.basicEditors();
} else {
editors[0] = new TextEditor();
}
return editors;
}
textF.getCurrentEditor().addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified();
}
});
}
private Editor[] makeEditorByValue(Object pv) {
Editor[] editors = {null};
if (pv instanceof Integer) {
editors[0] = new IntegerEditor();
} else if (pv instanceof Double || pv instanceof Float) {
editors[0] = new DoubleEditor();
} else if (pv instanceof Float) {
editors[0] = new FloatEditor();
} else if (pv instanceof Date) {
editors[0] = new DateEditor(true, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Date"));
} else if (pv instanceof Boolean) {
editors[0] = new BooleanEditor();
} else if (pv instanceof BaseFormula) {
editors = ValueEditorPaneFactory.basicEditors();
} else {
editors[0] = new TextEditor();
}
return editors;
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameters");
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameters");
}
/**
* Update
*/
public Map<String,Object> update() {
java.util.Map<String,Object> nameValueMap = new java.util.HashMap<String,Object>();
Iterator<Entry<ValueEditorPane, String>> entryIt = this.editorNameMap.entrySet().iterator();
while(entryIt.hasNext()) {
java.util.Map.Entry<ValueEditorPane, String> entry = entryIt.next();
ValueEditorPane editor = entry.getKey();
String parameterName = entry.getValue();
Object editorStringValue = editor.update();
nameValueMap.put(parameterName, editorStringValue);
}
return nameValueMap;
public Map<String, Object> update() {
java.util.Map<String, Object> nameValueMap = new java.util.HashMap<String, Object>();
Iterator<Entry<ValueEditorPane, String>> entryIt = this.editorNameMap.entrySet().iterator();
while (entryIt.hasNext()) {
java.util.Map.Entry<ValueEditorPane, String> entry = entryIt.next();
ValueEditorPane editor = entry.getKey();
String parameterName = entry.getValue();
Object editorStringValue = editor.update();
nameValueMap.put(parameterName, editorStringValue);
}
return nameValueMap;
}
public void checkValid() throws Exception {
if (!allowBlank) {
boolean valid = true;
String error = "";
Iterator<Entry<ValueEditorPane, String>> entryIt = this.editorNameMap.entrySet().iterator();
while (entryIt.hasNext()) {
java.util.Map.Entry<ValueEditorPane, String> entry = entryIt.next();
ValueEditorPane editor = entry.getKey();
String parameterName = entry.getValue();
Object editorStringValue = editor.update();
if (editorStringValue == null || StringUtils.isEmpty(Utils.objectToString(editorStringValue))) {
valid = false;
error += parameterName + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Not_Null_Des") + "\n";
}
}
if (!valid) {
throw new Exception(error);
}
}
}
public void checkValid() throws Exception {
if (!allowBlank) {
boolean valid = true;
String error = "";
Iterator<Entry<ValueEditorPane, String>> entryIt = this.editorNameMap.entrySet().iterator();
while (entryIt.hasNext()) {
java.util.Map.Entry<ValueEditorPane, String> entry = entryIt.next();
ValueEditorPane editor = entry.getKey();
String parameterName = entry.getValue();
Object editorStringValue = editor.update();
if (editorStringValue == null || StringUtils.isEmpty(Utils.objectToString(editorStringValue))) {
valid = false;
error += parameterName + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Not_Null_Des") + "\n";
}
}
if (!valid) {
throw new Exception(error);
}
}
}
/**
* The class help to flowlayout components
*/
private static class FlowTableLayoutHelper {
private List<UILabel> labelList = new ArrayList<UILabel>();
private List<UILabel> labelList = new ArrayList<UILabel>();
public FlowTableLayoutHelper() {
}
public FlowTableLayoutHelper() {
}
public JPanel createLabelFlowPane(String text, JComponent comp) {
JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
public JPanel createLabelFlowPane(String text, JComponent comp) {
JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
UILabel textLabel = new UILabel(text);
centerPane.add(textLabel);
textLabel.setHorizontalAlignment(SwingConstants.LEFT);
UILabel textLabel = new UILabel(text);
centerPane.add(textLabel);
textLabel.setHorizontalAlignment(SwingConstants.LEFT);
this.labelList.add(textLabel);
centerPane.add(comp);
this.labelList.add(textLabel);
centerPane.add(comp);
return centerPane;
}
return centerPane;
}
public void adjustLabelWidth() {
int maxWidth = 0;
public void adjustLabelWidth() {
int maxWidth = 0;
for (int i = 0; i < labelList.size(); i++) {
maxWidth = Math.max(maxWidth, labelList.get(i).getPreferredSize().width);
}
for (int i = 0; i < labelList.size(); i++) {
maxWidth = Math.max(maxWidth, labelList.get(i).getPreferredSize().width);
}
for (int i = 0; i < labelList.size(); i++) {
UILabel label = labelList.get(i);
for (int i = 0; i < labelList.size(); i++) {
UILabel label = labelList.get(i);
Dimension labelDim = new Dimension(maxWidth, label.getPreferredSize().height);
Dimension labelDim = new Dimension(maxWidth, label.getPreferredSize().height);
label.setPreferredSize(labelDim);
label.setSize(labelDim);
label.setMinimumSize(labelDim);
}
}
label.setPreferredSize(labelDim);
label.setSize(labelDim);
label.setMinimumSize(labelDim);
}
}
}
}
}

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

@ -45,7 +45,7 @@ import java.util.Date;
*/
public class FormatPane extends BasicPane {
private static final long serialVersionUID = 724330854437726751L;
private Format format;
private UILabel sampleLabel; //preview label.
private UIRadioButton nullRadioButton;
@ -59,14 +59,14 @@ public class FormatPane extends BasicPane {
//content pane.
private UITextField patternTextField = null;
private JList patternList = null;
/**
* Constructor.
*/
public FormatPane() {
this.initComponents();
}
public UILabel getSampleLabel() {
return sampleLabel;
}
@ -74,7 +74,7 @@ public class FormatPane extends BasicPane {
public void setSampleLabel(UILabel sampleLabel) {
this.sampleLabel = sampleLabel;
}
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createM_BorderLayout());
@ -172,7 +172,7 @@ public class FormatPane extends BasicPane {
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style");
}
/**
* Populate
*/
@ -185,17 +185,17 @@ public class FormatPane extends BasicPane {
} else {
if (format instanceof DecimalFormat) {
checkDecimalFormat();
} else if (format instanceof SimpleDateFormat) {
} else if (format instanceof SimpleDateFormat) {
//date and time
checkDateFormat();
} else if (format instanceof TextFormat) {
checkDateFormat();
} else if (format instanceof TextFormat) {
//Text
this.textRadioButton.setSelected(true);
this.applyRadioActionListener(this.textRadioButton);
}
}
}
private void checkDateFormat() {
String pattern = ((SimpleDateFormat) format).toPattern();
if(pattern == null) {
@ -276,7 +276,7 @@ public class FormatPane extends BasicPane {
}
}
}
/**
* 百分比面板
*/
@ -296,7 +296,7 @@ public class FormatPane extends BasicPane {
/**
* 是否属于数组中的列表样式
*
*
* @param stringArray 格式数组
* @param pattern 输入的格式
* @return 返回在数组中的位置
@ -323,7 +323,7 @@ public class FormatPane extends BasicPane {
}
return FormatField.getInstance().getFormat(getFormatContents(), text);
}
private int getFormatContents(){
if (nullRadioButton.isSelected())
return FormatContents.NULL;
@ -335,7 +335,7 @@ public class FormatPane extends BasicPane {
return FormatContents.PERCENT;
else if (scientificRadioButton.isSelected())
return FormatContents.SCIENTIFIC;
else if (dateRadioButton.isSelected())
else if (dateRadioButton.isSelected())
return FormatContents.DATE;
else if (timeRadioButton.isSelected())
return FormatContents.TIME;
@ -380,7 +380,7 @@ public class FormatPane extends BasicPane {
ActionEvent evt = new ActionEvent(radioButton, 100, "");
this.radioActionListener.actionPerformed(evt);
}
/**
* Radio selection listener.
*/
@ -393,6 +393,7 @@ public class FormatPane extends BasicPane {
patternTextField.setEditable(true);
patternList.setEnabled(true);
int contents = getContents(source);
String[] patternArray = FormatField.getInstance().getFormatArray(contents);
@ -407,6 +408,7 @@ public class FormatPane extends BasicPane {
//maybe need to select the first item.
String text = patternTextField.getText();
if (hasPattenText(text, patternModel)) {
String pattern = null;
if (format instanceof DecimalFormat) {
@ -418,6 +420,10 @@ public class FormatPane extends BasicPane {
if (pattern != null) {
patternList.setSelectedValue(pattern, true);
if (patternList.getSelectedIndex() == -1) {
//patten不在下拉框里面
patternList.setSelectedIndex(0);
}
} else {
patternList.setSelectedIndex(0);
}
@ -426,13 +432,13 @@ public class FormatPane extends BasicPane {
};
private boolean hasPattenText (String text, DefaultListModel patternModel) {
return (text == null || text.length() <= 0) && patternModel.size() > 0;
return StringUtils.isEmpty(text) && patternModel.size() > 0;
}
private void setPatternTextEnable() {
patternTextField.setEnabled(false);
patternTextField.setEditable(false);
patternTextField.setText("");
patternTextField.setText(StringUtils.EMPTY);
patternList.setEnabled(false);
}
@ -459,7 +465,7 @@ public class FormatPane extends BasicPane {
}
return contents;
}
/**
* text pattern document listener.
*/
@ -477,7 +483,7 @@ public class FormatPane extends BasicPane {
refreshPreviewLabel();
}
};
/**
* Pattern list selection listener.
*/
@ -487,5 +493,5 @@ public class FormatPane extends BasicPane {
patternTextField.setText((String) patternList.getSelectedValue());
}
};
}

20
designer-base/src/main/java/com/fr/design/style/color/NewColorSelectBox.java

@ -30,23 +30,27 @@ public class NewColorSelectBox extends AbstractSelectBox<Color> implements UIObs
iniListener();
}
private void iniListener(){
protected void iniListener(){
if(shouldResponseChangeListener()){
this.addSelectChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if(uiObserverListener == null){
return;
}
if (globalNameListener != null && shouldResponseNameListener()){
globalNameListener.setGlobalName(newColorSelectBoxName);
}
uiObserverListener.doChange();
attributeChange();
}
});
}
}
protected void attributeChange() {
if(uiObserverListener == null){
return;
}
if (globalNameListener != null && shouldResponseNameListener()){
globalNameListener.setGlobalName(newColorSelectBoxName);
}
uiObserverListener.doChange();
}
/**
* 初始化下拉面板
* @param preferredWidth 面板大小

129
designer-base/src/main/java/com/fr/design/update/factory/DirectoryOperationFactory.java

@ -1,129 +0,0 @@
package com.fr.design.update.factory;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StableUtils;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Arrays;
/**
* Created by XINZAI on 2018/8/21.
*/
public class DirectoryOperationFactory {
/**
* 新建一个目录
*
* @param dirPath 目录路径
*/
public static void createNewDirectory(String dirPath) {
try {
File newDirPath = new File(dirPath);
if (!newDirPath.exists()) {
StableUtils.mkdirs(newDirPath);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
}
/**
* 删除目录
*
* @param dirPath 目录路径
*/
public static void deleteDirectory(String dirPath) {
try {
File dir = new File(dirPath);
if (dir.isDirectory()) {
File[] file = dir.listFiles();
for (File fileTemp : file) {
deleteDirectory(fileTemp.toString());
fileTemp.delete();
}
} else {
dir.delete();
}
dir.delete();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
}
/**
* 复制目录
*
* @param oldDirPath 被复制目录
* @param newDirPath 新目录
*/
public static void copyDirectory(String oldDirPath, String newDirPath) {
File oldDir = new File(oldDirPath);
if (oldDir.isDirectory()) {
StableUtils.mkdirs(new File(newDirPath));
File[] files = oldDir.listFiles();
for (File fileTemp : files) {
copyDirectory(fileTemp.toString(), newDirPath + "/" + fileTemp.getName());
}
} else {
try {
copy(oldDirPath, newDirPath);
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
}
}
private static void copy(String path1, String path2) throws IOException {
try (DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(path1)));
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(path2)))) {
byte[] date = new byte[in.available()];
in.read(date);
out.write(date);
}
}
/**
* 移动目录
*
* @param oldDirPath 被移动目录
* @param newDirPath 新目录
*/
public static void moveDirectory(String oldDirPath, String newDirPath) {
copyDirectory(oldDirPath, newDirPath);
deleteDirectory(oldDirPath);
}
/**
* 列出过滤后的文件
*
* @param installHome 安装目录
* @param backupdir 备份目录
* @return String数组
*/
public static String[] listFilteredFiles(String installHome, String backupdir) {
File backupDir = new File(StableUtils.pathJoin(installHome, backupdir));
StableUtils.mkdirs(backupDir);
File[] fileNames = backupDir.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.isDirectory();
}
});
String[] jarFileName = new String[fileNames.length];
int j = 0;
for (File fileName : fileNames) {
if ((fileName.isDirectory()) && (ArrayUtils.getLength(fileName.listFiles()) > 0)) {//判断备份文件夹中是否为空,为空不显示
jarFileName[j++] = fileName.getName();
}
}
return Arrays.copyOf(jarFileName, j);
}
}

50
designer-base/src/main/java/com/fr/design/update/factory/UpdateFileFactory.java

@ -0,0 +1,50 @@
package com.fr.design.update.factory;
import com.fr.decision.update.data.UpdateConstants;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import java.io.File;;
/**
* @author Bryant
* @version 10.0
* Created by Bryant on 2020-09-29
*/
public class UpdateFileFactory {
private UpdateFileFactory() {
}
public static File[] getBackupVersions() {
File[] versions = null;
try {
File backupDir = new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR));
StableUtils.mkdirs(backupDir);
versions = backupDir.listFiles();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return versions;
}
public static boolean isBackupVersionsValid(String version) {
boolean designerValid = false;
boolean envValid = false;
try {
File designerLib = new File(StableUtils.pathJoin(version, UpdateConstants.DESIGNERBACKUPPATH));
File[] jars = designerLib.listFiles();
if (jars != null && jars.length > 0) {
designerValid = true;
}
File envLib = new File(StableUtils.pathJoin(version, UpdateConstants.BACKUPPATH));
jars = envLib.listFiles();
if (jars != null && jars.length > 0) {
envValid = true;
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return designerValid && envValid;
}
}

4
designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreDialog.java

@ -4,7 +4,7 @@ import com.fr.decision.update.data.UpdateConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.update.factory.DirectoryOperationFactory;
import com.fr.design.update.utils.UpdateFileUtils;
import com.fr.design.update.ui.widget.ColorfulCellRender;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.ArrayUtils;
@ -86,7 +86,7 @@ public class RestoreDialog extends JDialog {
JPanel jarListPane = new JPanel();
jarListPane.setLayout(new BoxLayout(jarListPane, BoxLayout.Y_AXIS));
String[] jarBackupFiles = DirectoryOperationFactory.listFilteredFiles(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR);
String[] jarBackupFiles = UpdateFileUtils.listBackupVersions();
ArrayUtils.reverse(jarBackupFiles);
String[] jarFilesList = ((jarBackupFiles.length < NUMOFCELL_LEAST) ? Arrays.copyOf(jarBackupFiles, NUMOFCELL_LEAST) : jarBackupFiles);

10
designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java

@ -17,7 +17,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.update.actions.FileProcess;
import com.fr.design.update.domain.UpdateInfoCachePropertyManager;
import com.fr.design.update.factory.DirectoryOperationFactory;
import com.fr.design.update.utils.UpdateFileUtils;
import com.fr.design.update.ui.widget.LoadingLabel;
import com.fr.design.update.ui.widget.UpdateActionLabel;
import com.fr.design.update.ui.widget.UpdateInfoTable;
@ -320,7 +320,7 @@ public class UpdateMainDialog extends UIDialog {
}
});
//choose RestoreLabel to show
boolean isNeedRestore = ArrayUtils.isNotEmpty(DirectoryOperationFactory.listFilteredFiles(StableUtils.getInstallHome(), getBackupDirectory()));
boolean isNeedRestore = ArrayUtils.isNotEmpty(UpdateFileUtils.listBackupVersions());
jarRestoreLabel = isNeedRestore ? jarRestorePreviousRevision : noJarPreviousRevision;
}
@ -544,7 +544,7 @@ public class UpdateMainDialog extends UIDialog {
private void showDownLoadInfo() {
//形如 Build#release-2018.07.31.03.03.52.80
String buildNO = downloadFileConfig.optString("buildNO");
Date jarDate = (new SimpleDateFormat("yyyy.MM.dd")).parse(buildNO, new ParsePosition(buildNO.indexOf("-") + 1));
Date jarDate = (new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss")).parse(buildNO, new ParsePosition(buildNO.indexOf("-") + 1));
String serverVersionNO = downloadFileConfig.optString("versionNO");
String currentVersionNO = ProductConstants.RELEASE_VERSION;
String[] serverVersionSplitStr = serverVersionNO.split("\\.");
@ -556,8 +556,8 @@ public class UpdateMainDialog extends UIDialog {
//形如 Build#release-2018.07.31.03.03.52.80
String currentNO = GeneralUtils.readBuildNO();
if (!".".equals(StableUtils.getInstallHome())) {
Date currentDate = (new SimpleDateFormat("yyyy.MM.dd")).parse(currentNO, new ParsePosition(currentNO.indexOf("-") + 1));
if (DateUtils.subtractDate(jarDate, currentDate, DateUtils.DAY) > 0) {
Date currentDate = (new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss")).parse(currentNO, new ParsePosition(currentNO.indexOf("-") + 1));
if (DateUtils.subtractDate(jarDate, currentDate, DateUtils.SECOND) > 0) {
updateButton.setEnabled(true);
updateLabel.setVisible(true);
loadingLabel.stopLoading(buildNO.contains("-") ? buildNO.substring(buildNO.lastIndexOf("-") + 1) : buildNO);

36
designer-base/src/main/java/com/fr/design/update/utils/UpdateFileUtils.java

@ -0,0 +1,36 @@
package com.fr.design.update.utils;
import com.fr.design.update.factory.UpdateFileFactory;
import com.fr.stable.StableUtils;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* @author Bryant
* @version 10.0
* Created by Bryant on 2020-09-25
*/
public class UpdateFileUtils {
/**
* 列出过滤后的文件
*
* @return String数组
*/
public static String[] listBackupVersions() {
File[] versionBackup = UpdateFileFactory.getBackupVersions();
List<String> versions = new ArrayList<>();
if (versionBackup != null) {
for (File file : versionBackup) {
if (UpdateFileFactory.isBackupVersionsValid(file.getAbsolutePath())) {
versions.add(file.getName());
} else {
StableUtils.deleteFile(file);
}
}
}
String[] result = new String[versions.size()];
return versions.toArray(result);
}
}

67
designer-base/src/main/java/com/fr/design/upm/UpmFinder.java

@ -10,6 +10,7 @@ import com.fr.design.update.ui.dialog.UpdateMainDialog;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import com.fr.workspace.Workspace;
@ -17,6 +18,7 @@ import com.fr.workspace.WorkspaceEvent;
import javax.swing.*;
import java.io.File;
import java.util.Locale;
/**
* @author richie
@ -27,6 +29,7 @@ public class UpmFinder {
private static final String UPM_DIR = "/upm";
private static final String MAIN_RESOURCE_PATH = UPM_DIR + "/plugin_design.html";
private static final String JXBROWSER = "com.teamdev.jxbrowser.chromium.Browser";
public static String installHome = FRContext.getCommonOperator().getWebRootPath();
@ -56,39 +59,49 @@ public class UpmFinder {
}
public static void showUPMDialog() {
boolean flag = true;
boolean hasJxBrowser = true;
try {
Class.forName("com.teamdev.jxbrowser.chromium.Browser");
Class.forName(JXBROWSER);
} catch (ClassNotFoundException e) {
flag = false;
hasJxBrowser = false;
}
if (flag) {
if (!checkUPMResourcesExist()){
// upm下载
int val = FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
if (val == JOptionPane.OK_OPTION){
try {
UpmResourceLoader.INSTANCE.download();
UpmResourceLoader.INSTANCE.install();
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"),
Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE);
} catch (Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(), e);
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Updater_Download_Failed"),
Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE);
}
if (hasJxBrowser) {
showUpmPane();
} else {
showUpdatePane();
}
}
private static void showUpmPane() {
if (!checkUPMResourcesExist()){
// upm下载
int val = FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
if (val == JOptionPane.OK_OPTION){
try {
UpmResourceLoader.INSTANCE.download();
UpmResourceLoader.INSTANCE.install();
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"),
Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE);
} catch (Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(), e);
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Updater_Download_Failed"),
Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE);
}
}
else {
UpmShowPane upmPane = new UpmShowPane();
if (dialog == null) {
dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane);
}
dialog.setVisible(true);
}
else {
UpmShowPane upmPane = new UpmShowPane();
if (dialog == null) {
dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane);
}
} else {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message"));
dialog.setVisible(true);
}
}
private static void showUpdatePane() {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message"));
if (!GeneralContext.getLocale().equals(Locale.JAPAN)) {
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.setAutoUpdateAfterInit();
dialog.showDialog();

27
designer-base/src/main/java/com/fr/design/utils/DesignUtils.java

@ -19,10 +19,10 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.CommonCodeUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.start.ServerStarter;
import com.fr.workspace.WorkContext;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.Desktop;
@ -31,7 +31,6 @@ import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
@ -83,6 +82,7 @@ public class DesignUtils {
/**
* 判断设计器端口是否被其他程序占用
* 尝试去通信无回应就是其他程序占用端口否则需要继续判断是否为设计器进程未关闭
*
* @return
*/
public static boolean isPortOccupied() {
@ -153,7 +153,7 @@ public class DesignUtils {
return;
}
try (Socket socket = new Socket("localhost", port)) {
clientSend(lines, socket);
clientSend(lines, socket);
} catch (Exception ignore) {
}
@ -189,10 +189,10 @@ public class DesignUtils {
DesignerEnvManager.getEnvManager().setCurrentEnv2Default();
ServerStarter.browserDemoURL();
} else if ("check".equals(line)) {
clientSend(new String[] {"response"}, socket);
clientSend(new String[]{"response"}, socket);
} else if ("end".equals(line)) {
DesignerExiter.getInstance().execute(); }
else if (StringUtils.isNotEmpty(line)) {
DesignerExiter.getInstance().execute();
} else if (StringUtils.isNotEmpty(line)) {
File f = new File(line);
String path = f.getAbsolutePath();
@ -219,7 +219,7 @@ public class DesignUtils {
}
public static void responseToClient(Socket socket) {
public static void responseToClient(Socket socket) {
try (OutputStream outputStream = socket.getOutputStream()) {
outputStream.write("reponse".getBytes(StandardCharsets.UTF_8));
outputStream.flush();
@ -285,13 +285,20 @@ public class DesignUtils {
return key.startsWith("TextField.") || key.startsWith("PasswordField.");
}
/**
* 获取当前系统语言下设计器用的默认字体
*
* @return 默认字体
*/
private static FRFont getCurrentLocaleFont() {
FRFont guiFRFont;
Locale defaultLocale = Locale.getDefault();
if (isDisplaySimSun(defaultLocale)) {
// JDK9 之后宋体在计算label中字母的空间上出现问题,暂时先用雅黑兼容,以后再统一字体
if (StableUtils.getMajorJavaVersion() >= 9 && OperatingSystem.isWindows()) {
guiFRFont = getNamedFont("Microsoft YaHei");
} else if (isDisplaySimSun(defaultLocale)) {
guiFRFont = getNamedFont("SimSun");
} else {
} else {
guiFRFont = getNamedFont("Dialog");
}

6
designer-base/src/main/java/com/fr/design/web/CustomIconPane.java

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper;
import com.fr.base.Icon;
import com.fr.base.IconManager;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
@ -401,9 +402,8 @@ public class CustomIconPane extends BasicPane {
private void init() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
double p = TableLayout.PREFERRED;
double rowSize[] = {p, p};
double columnSize[] = {p, p, p};
double[] rowSize = {p, p};
double[] columnSize = {p, p};
UIButton browseButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_SelectIcon"));
browseButton.setPreferredSize(new Dimension(80, 25));
browseButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Click_this_button"));

24
designer-base/src/main/java/com/fr/env/EnvListPane.java vendored

@ -3,6 +3,7 @@ package com.fr.env;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.env.LocalDesignerWorkspaceInfo;
import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.design.gui.controlpane.JListControlPane;
@ -17,8 +18,10 @@ import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
/**
* @author yaohwu
@ -98,11 +101,30 @@ public class EnvListPane extends JListControlPane {
DesignerEnvManager mgr = DesignerEnvManager.getEnvManager();
//这里代码时序换一下,因为update中需要借助mgr来获取提醒时间,已确认mgr对res无依赖
Nameable[] res = this.update();
Set<Nameable> set = findNewWorkSpaceInfo(res);
mgr.clearAllEnv();
for (Nameable re : res) {
NameObject nameObject = (NameObject) re;
mgr.putEnv(nameObject.getName(), (DesignerWorkspaceInfo) nameObject.getObject());
DesignerWorkspaceInfo info = (DesignerWorkspaceInfo) nameObject.getObject();
if (set.contains(re) && info.getType() == DesignerWorkspaceType.Remote) {
RemoteDesignerWorkspaceInfo newInfo = (RemoteDesignerWorkspaceInfo) info;
newInfo.setNewCreated(true);
mgr.putEnv(nameObject.getName(), newInfo);
} else {
mgr.putEnv(nameObject.getName(), info);
}
}
return this.getSelectedName();
}
private Set<Nameable> findNewWorkSpaceInfo(Nameable[] res) {
Set<Nameable> set = new HashSet<>();
for (Nameable val : res) {
NameObject nameObject = (NameObject) val;
if (DesignerEnvManager.getEnvManager().getWorkspaceInfo(nameObject.getName()) == null) {
set.add(val);
}
}
return set;
}
}

53
designer-base/src/main/java/com/fr/env/RemoteEnvPane.java vendored

@ -1,7 +1,5 @@
package com.fr.env;
import com.fr.base.FRContext;
import com.fr.base.ServerConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
@ -13,6 +11,7 @@ import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ipasswordfield.UIPassWordField;
import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
@ -26,7 +25,17 @@ import com.fr.workspace.WorkContext;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.exception.WorkspaceAuthException;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JTextPane;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.ToolTipManager;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
@ -96,7 +105,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
/**
* 密码
*/
private UIPassWordField passwordInput = new UIPassWordField();
private UIPassWordField passwordInput = new UIPasswordFieldWithFixedLength();
/**
* 是否记住密码
*/
@ -108,7 +117,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
/**
* https密钥
*/
private UIPassWordField certSecretKeyInput = new UIPassWordField();
private UIPassWordField certSecretKeyInput = new UIPasswordFieldWithFixedLength();
/**
* 选择证书文件按钮
*/
@ -323,6 +332,8 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
this.remoteWorkspaceURL = RemoteWorkspaceURL.createDefaultURL();
this.usernameInput.setText(StringUtils.EMPTY);
this.passwordInput.setText(StringUtils.EMPTY);
this.certPathInput.setText(StringUtils.EMPTY);
this.certSecretKeyInput.setText(StringUtils.EMPTY);
this.rememberPwdCheckbox.setSelected(true);
}
@ -433,38 +444,6 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
new double[]{FILL}
));
setDefaultAppAndServlet();
}
/**
* 设置 app servlet 默认值
*/
private void setDefaultAppAndServlet() {
setWrap(webAppNameInput, () -> FRContext.getCommonOperator().getAppName(), RemoteWorkspaceURL.DEFAULT_WEB_APP_NAME);
setWrap(servletNameInput, () -> ServerConfig.getInstance().getServletName(), RemoteWorkspaceURL.DEFAULT_SERVLET_NAME);
}
private void setWrap(final UITextField textField, final Supplier<String> supplier, final String defaultName) {
new SwingWorker<String, Void>() {
@Override
protected String doInBackground() throws Exception {
return supplier.get();
}
@Override
protected void done() {
String name = defaultName;
try {
name = get();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage() , e);
}
if (StringUtils.isEmpty(textField.getText())) {
textField.setText(name);
}
}
}.execute();
}

18
designer-base/src/main/java/com/fr/start/BaseDesigner.java

@ -64,14 +64,11 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
@Override
public void on(Event event, Null param) {
EventDispatcher.stopListen(this);
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
UIUtil.invokeLaterIfNeeded(() -> {
// 打开上次的文件
showDesignerFrame(false);
DesignerLaunchStatus.setStatus(DesignerLaunchStatus.OPEN_LAST_FILE_COMPLETE);
}
// 打开上次的文件
showDesignerFrame(false);
DesignerLaunchStatus.setStatus(DesignerLaunchStatus.OPEN_LAST_FILE_COMPLETE);
});
}
});
@ -90,12 +87,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
}
public void show() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
refreshTemplateTree();
}
});
UIUtil.invokeLaterIfNeeded(this::refreshTemplateTree);
}
private void refreshTemplateTree() {

21
designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java

@ -32,7 +32,7 @@ public class FineEmbedServerMonitor {
*/
private static final int STEP_HEARTBEAT = 40;
private static volatile FineEmbedServerMonitor monitor;
private static ProgressDialog progressBar = DesignerContext.getDesignerFrame().getProgressDialog();
private static ProgressDialog progressDialog = new ProgressDialog(DesignerContext.getDesignerFrame());
//由于默认值的字体不支持韩文,所以要对韩文单独生成字体
private FRFont font = null;
private static final int FONT_RGB = 333334;
@ -47,7 +47,7 @@ public class FineEmbedServerMonitor {
@Override
public void on(Event event, Null aNull) {
getInstance().reset();
DesignerContext.getDesignerFrame().hideProgressDialog();
progressDialog.dispose();
}
});
}
@ -64,7 +64,7 @@ public class FineEmbedServerMonitor {
}
public int getProgress() {
if (progress == progressBar.getProgressMaximum()) {
if (progress == progressDialog.getProgressMaximum()) {
return progress;
} else {
progress += STEP;
@ -73,7 +73,7 @@ public class FineEmbedServerMonitor {
}
public void setComplete() {
this.progress = progressBar.getProgressMaximum();
this.progress = progressDialog.getProgressMaximum();
}
public void reset() {
@ -81,7 +81,7 @@ public class FineEmbedServerMonitor {
}
public boolean isComplete() {
return this.progress >= progressBar.getProgressMaximum();
return this.progress >= progressDialog.getProgressMaximum();
}
public void monitor() {
@ -92,11 +92,12 @@ public class FineEmbedServerMonitor {
public void run() {
if (isComplete()) {
scheduler.shutdown();
DesignerContext.getDesignerFrame().hideProgressDialog();
progressDialog.dispose();
return;
}
if (!DesignerContext.getDesignerFrame().getProgressDialog().isVisible()) {
DesignerContext.getDesignerFrame().showProgressDialog();
if (!progressDialog.isVisible()) {
progressDialog = new ProgressDialog(DesignerContext.getDesignerFrame());
progressDialog.setVisible(true);
//如果为韩文则改变字体
LocaleCenter.buildAction(new LocaleAction() {
@Override
@ -105,9 +106,9 @@ public class FineEmbedServerMonitor {
}
}, SupportLocaleImpl.SUPPORT_KOREA);
String text = Toolkit.i18nText("Fine-Design_Basic_Loading_Embed_Server");
DesignerContext.getDesignerFrame().getProgressDialog().updateLoadingText(text, font);
progressDialog.updateLoadingText(text, font);
}
DesignerContext.getDesignerFrame().updateProgress(getProgress());
progressDialog.setProgressValue(getProgress());
}
}, 0, STEP_HEARTBEAT, TimeUnit.MILLISECONDS);

6
designer-base/src/main/java/com/fr/start/server/ServerTray.java

@ -29,9 +29,9 @@ public class ServerTray {
private MenuItem stopMenu;
private Image trayStartedImage = BaseUtils.readImage("/com/fr/base/images/oem/trayStarted.png");
private Image trayStartedImage = BaseUtils.readImage("/com/fr/base/images/oem/trayStarted@2x.png");
private Image trayStoppedImage = BaseUtils.readImage("/com/fr/base/images/oem/trayStopped.png");
private Image trayStoppedImage = BaseUtils.readImage("/com/fr/base/images/oem/trayStopped@2x.png");
private ServerManageFrame serverManageFrame;
@ -188,4 +188,4 @@ public class ServerTray {
}
});
}
}
}

BIN
designer-base/src/main/resources/com/fr/design/images/reportcolumns/col_ja_JP.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/reportcolumns/col_ko_KR.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

0
designer-base/src/main/resources/com/fr/design/images/reportcolumns/col.png → designer-base/src/main/resources/com/fr/design/images/reportcolumns/col_zh.png

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/reportcolumns/col_zh_TW.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/reportcolumns/row_ja_JP.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/reportcolumns/row_ko_KR.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

0
designer-base/src/main/resources/com/fr/design/images/reportcolumns/row.png → designer-base/src/main/resources/com/fr/design/images/reportcolumns/row_zh.png

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/reportcolumns/row_zh_TW.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

8
designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java

@ -3,6 +3,7 @@ package com.fr.design;
import junit.framework.TestCase;
import java.util.Locale;
import org.junit.Assert;
public class DesignerEnvManagerTest extends TestCase{
@ -17,4 +18,11 @@ public class DesignerEnvManagerTest extends TestCase{
assertEquals("下边界", envManager.getLanguage(), Locale.SIMPLIFIED_CHINESE);
}
public void testGetUUID() {
DesignerEnvManager envManager = new DesignerEnvManager();
String uuid0 = envManager.getUUID();
String uuid1 = envManager.getUUID();
Assert.assertEquals(uuid0, uuid1);
}
}

26
designer-base/src/test/java/com/fr/design/data/datapane/TableDataPaneListPaneTest.java

@ -0,0 +1,26 @@
package com.fr.design.data.datapane;
import org.junit.Test;
import java.util.Map;
import static org.junit.Assert.*;
/**
* @author Yyming
* @version 10.0
* Created by Yyming on 2020/9/29
*/
public class TableDataPaneListPaneTest {
@Test
public void rename() {
TableDataPaneListPane listPane = new TableDataPaneListPane();
listPane.rename("111", "222");
listPane.rename("222", "333");
Map<String, String> dsNameChangedMap = listPane.getDsNameChangedMap();
assertEquals(1, dsNameChangedMap.size());
listPane.rename("333","111");
assertEquals(0, dsNameChangedMap.size());
}
}

67
designer-base/src/test/java/com/fr/design/env/RemoteDesignerWorkspaceInfoTest.java vendored

@ -1,9 +1,16 @@
package com.fr.design.env;
import com.fr.invoke.Reflect;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReaderHelper;
import com.fr.stable.xml.XMLableReader;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import junit.framework.TestCase;
import org.junit.Assert;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
/**
* @author hades
* @version 10.0
@ -22,4 +29,64 @@ public class RemoteDesignerWorkspaceInfoTest extends TestCase {
Assert.assertFalse(workspaceInfo3.checkValid());
}
public void testReadXml() {
String xml0 = "<Connection url=\"https://192.168.101.171:8075/webroot/decision\" username=\"1\" password=\"EclFl2zl5ti32lqQIh9r/7iCd0Vmhm5uuLol+zs+oi4JWN8F6JA2Ym4PYeQOAR5cjvIdzhUgwoG/\n" +
"AJF1Ht1CFLfZqrztuJsWpP8GlMvqZb/Gi3TT2idJC/qHU6Am1jFe0qJoytyWUi5zGnZicTfVgDir\n" +
"gE0kuw1ONOzFCkVfNbLrC+DXIIbVa7ramqbsVa6/LDEqOJvfAE36cBYJjWGHjOT91ixldaCyEX8m\n" +
"0xmw5xvEuEiTgRUHufbKCEG0FOR1xvS3D3C9vlauoqDI1INOyUOawQvpuQ552AjZi/FH1v+eNt+q\n" +
"eU7iCzsKb6P5KomaKUTZ8EPlSR/+Ihzg5VjAyg==\" certPath=\"\" certSecretKey=\"bofKLt/G93T2NudGR71Npb1GCPSUVeC34dtFGa+DHRl2GfP3WM4Nitb/LwdA/mml5BNl/S5f4txt\n" +
"0jxK4r08BoWoleKt5r7C0Fapj6Ccm+qVP6ywaxN1PSC0ML8Fowo3VYhv2BVzdodMLLliIVngostk\n" +
"76gqsiatzJb0XiPnzb0UpjWs7lpgCw+XDBk2Qfpv/U8fyPmLkAxA+085w55vzLluu7o2ilaveOUk\n" +
"hmT3NfZinTTZd+dQJxfVfUgjKJdZ9C+EM/IkzY1gVYXYuZ8gl5wd5RkjC3VUOu36akmB09gXJ4S8\n" +
"z8ZdHilA5L9tneuS5C05DMRJ6CdO+avGJgJAtw==\" rememberPwd=\"true\"/>";
String xml1 = "<Connection url=\"https://192.168.101.171:8075/webroot/decision\" username=\"1\" password=\"EclFl2zl5ti32lqQIh9r/7iCd0Vmhm5uuLol+zs+oi4JWN8F6JA2Ym4PYeQOAR5cjvIdzhUgwoG/\n" +
"AJF1Ht1CFLfZqrztuJsWpP8GlMvqZb/Gi3TT2idJC/qHU6Am1jFe0qJoytyWUi5zGnZicTfVgDir\n" +
"gE0kuw1ONOzFCkVfNbLrC+DXIIbVa7ramqbsVa6/LDEqOJvfAE36cBYJjWGHjOT91ixldaCyEX8m\n" +
"0xmw5xvEuEiTgRUHufbKCEG0FOR1xvS3D3C9vlauoqDI1INOyUOawQvpuQ552AjZi/FH1v+eNt+q\n" +
"eU7iCzsKb6P5KomaKUTZ8EPlSR/+Ihzg5VjAyg==\" certPath=\"\" certSecretKey=\"xxxxxxx\" rememberPwd=\"true\"/>";
byte[] bytes0 = xml0.getBytes();
byte[] bytes1 = xml1.getBytes();
RemoteDesignerWorkspaceInfo info = new RemoteDesignerWorkspaceInfo();
ByteArrayInputStream in0 = new ByteArrayInputStream(bytes0);
ByteArrayInputStream in1 = new ByteArrayInputStream(bytes1);
try {
XMLableReader reader0 = XMLReaderHelper.createXMLableReader(in0, XMLPrintWriter.XML_ENCODER);
Reflect.on(reader0).set("state", 1);
info.setNewCreated(true);
info.readXML(reader0);
Assert.assertEquals("xxxxxxx", info.getConnection().getCertSecretKey());
XMLableReader reader1 = XMLReaderHelper.createXMLableReader(in1, XMLPrintWriter.XML_ENCODER);
Reflect.on(reader1).set("state", 1);
info.setNewCreated(false);
info.readXML(reader1);
Assert.assertEquals("xxxxxxx", info.getConnection().getCertSecretKey());
} catch (Exception ignore) {
}
}
public void testWriteXml() {
ByteArrayOutputStream out0 = new ByteArrayOutputStream();
XMLPrintWriter writer0 = XMLPrintWriter.create(out0);
RemoteDesignerWorkspaceInfo info0 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("127.0.0.1", "1", "1", "/xxx", "xxxxx", true));
info0.setNewCreated(true);
info0.writeXML(writer0);
writer0.close();
String result0 = new String(out0.toByteArray());
Assert.assertTrue(result0.contains("certSecretKey"));
Assert.assertFalse(result0.contains("certSecretKey=\"xxxxx\""));
ByteArrayOutputStream out1 = new ByteArrayOutputStream();
XMLPrintWriter writer1 = XMLPrintWriter.create(out1);
RemoteDesignerWorkspaceInfo info1 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("127.0.0.1", "1", "1", "/xxx", "xxxxx", true));
info1.writeXML(writer1);
writer1.close();
String result1 = new String(out1.toByteArray());
Assert.assertTrue(result1.contains("certSecretKey"));
Assert.assertTrue(result1.contains("certSecretKey=\"xxxxx\""));
}
}

28
designer-base/src/test/java/com/fr/design/update/factory/UpdateFileFactoryTest.java

@ -0,0 +1,28 @@
package com.fr.design.update.factory;
import com.fr.decision.update.data.UpdateConstants;
import com.fr.stable.StableUtils;
import org.junit.Assert;
import org.junit.Test;
import java.io.File;
public class UpdateFileFactoryTest {
@Test
public void testGetBackupVersions() {
Assert.assertEquals(0, UpdateFileFactory.getBackupVersions().length);
File backupDir = new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR));
StableUtils.deleteFile(backupDir);
}
@Test
public void testIsBackupVersionsValid() {
File des = new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR, "test", UpdateConstants.BACKUPPATH, "test"));
File env = new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR, "test", UpdateConstants.DESIGNERBACKUPPATH, "test"));
StableUtils.mkdirs(des);
StableUtils.mkdirs(env);
Assert.assertTrue(UpdateFileFactory.isBackupVersionsValid(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR, "test")));
StableUtils.deleteFile(new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR)));
}
}

27
designer-base/src/test/java/com/fr/design/update/utils/UpdateFileUtilsTest.java

@ -0,0 +1,27 @@
package com.fr.design.update.utils;
import com.fr.decision.update.data.UpdateConstants;
import com.fr.stable.StableUtils;
import org.junit.Assert;
import org.junit.Test;
import java.io.File;
/**
* @author Bryant
* @version 10.0
* Created by Bryant on 2020-09-25
*/
public class UpdateFileUtilsTest {
@Test
public void testListFilteredFiles() {
File des = new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR, "test", UpdateConstants.BACKUPPATH, "test"));
File env = new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR, "test", UpdateConstants.DESIGNERBACKUPPATH, "test"));
StableUtils.mkdirs(des);
StableUtils.mkdirs(env);
String[] result = UpdateFileUtils.listBackupVersions();
Assert.assertEquals(1, result.length);
StableUtils.deleteFile(new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR)));
}
}

7
designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java

@ -82,6 +82,10 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends BasicBeanPane<T
return false;
}
protected boolean seriesComboBoxHasNone() {
return false;
}
public void checkBoxUse(boolean hasUse) {
nameOrValue.setEnabled(hasUse);
useFieldValuePane.checkBoxUse(hasUse);
@ -147,8 +151,7 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends BasicBeanPane<T
private void initComponents() {
series = new UIComboBox();
series = seriesComboBoxHasNone() ? new UIComboBoxWithNone() : new UIComboBox();
value = valueComboBoxHasNone() ? new UIComboBoxWithNone() : new UIComboBox();
value.addItemListener(new ItemListener() {
@Override

5
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/ReportDataPane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.chart.gui.data;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Plot;
@ -8,6 +9,7 @@ import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.plugin.chart.custom.CustomDefinition;
import java.awt.*;
@ -45,7 +47,8 @@ public class ReportDataPane extends FurtherBasicBeanPane<ChartCollection>{
* @return 界面是否接受对象
*/
public boolean accept(Object ob) {
return ob instanceof ChartCollection && ((ChartCollection)ob).getSelectedChart().getFilterDefinition() instanceof ReportDataDefinition;
TopDefinitionProvider filterDefinition = ((ChartCollection) ob).getSelectedChartProvider(Chart.class).getFilterDefinition();
return ob instanceof ChartCollection && filterDefinition instanceof ReportDataDefinition && !(filterDefinition instanceof CustomDefinition);
}
/**

4
designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java

@ -22,6 +22,10 @@ public class ExtendedCustomFieldComboBoxPane extends AbstractCustomFieldComboBox
return new ExtendedCustomFieldNamePane();
}
@Override
protected boolean seriesComboBoxHasNone() {
return true;
}
@Override
public void populateBean(AbstractDataConfig ob) {

4
designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java

@ -41,7 +41,9 @@ public class UIComboBoxWithNone extends UIComboBox {
public void setSelectedItem(Object anObject) {
super.setSelectedItem(anObject);
if (getSelectedIndex() == -1) {//找不到的都选中无。中文的无 英文下是none。
//找不到的都选中无。中文的无 英文下是none。
//改正:找不到的且anObject不是null的 全部选中无。
if (getSelectedIndex() == -1 && anObject != null) {
super.setSelectedItem(getDefaultLocaleString());
}
}

4
designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaPlotPane.java

@ -5,12 +5,12 @@ import com.fr.chart.chartattr.Plot;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.area.AreaIndependentVanChart;
import com.fr.plugin.chart.area.VanChartAreaPlot;
import com.fr.van.chart.designer.type.AbstractVanChartTypePane;
import com.fr.van.chart.designer.type.AbstractRectanglePlotPane;
/**
* Created by Mitisky on 15/11/18.
*/
public class VanChartAreaPlotPane extends AbstractVanChartTypePane {
public class VanChartAreaPlotPane extends AbstractRectanglePlotPane {
@Override
protected String[] getTypeIconPath() {

4
designer-chart/src/main/java/com/fr/van/chart/bar/VanChartBarPlotPane.java

@ -5,12 +5,12 @@ import com.fr.chart.chartattr.Plot;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.bar.BarIndependentVanChart;
import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.van.chart.designer.type.AbstractVanChartTypePane;
import com.fr.van.chart.designer.type.AbstractRectanglePlotPane;
/**
* Created by Mitisky on 15/10/20.
*/
public class VanChartBarPlotPane extends AbstractVanChartTypePane {
public class VanChartBarPlotPane extends AbstractRectanglePlotPane {
@Override
protected String[] getTypeIconPath() {

180
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java

@ -1,19 +1,29 @@
package com.fr.van.chart.box;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat;
import com.fr.plugin.chart.box.attr.AttrBoxTooltipContent;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.Map;
public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
@ -27,6 +37,14 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
private VanChartFormatPaneWithCheckBox min;
private VanChartFormatPaneWithCheckBox outlier;
private VanChartFormatPaneWithoutCheckBox richTextNumber;
private VanChartFormatPaneWithoutCheckBox richTextMax;
private VanChartFormatPaneWithoutCheckBox richTextQ3;
private VanChartFormatPaneWithoutCheckBox richTextMedian;
private VanChartFormatPaneWithoutCheckBox richTextQ1;
private VanChartFormatPaneWithoutCheckBox richTextMin;
private VanChartFormatPaneWithoutCheckBox richTextOutlier;
private JPanel dataNumberPane;
private JPanel dataOutlierPane;
@ -36,8 +54,8 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
}
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane);
seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane);
setCategoryNameFormatPane(new CategoryNameFormatPaneWithCheckBox(parent, showOnPane));
setSeriesNameFormatPane(new SeriesNameFormatPaneWithCheckBox(parent, showOnPane));
number = new VanChartFormatPaneWithCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
@ -76,7 +94,48 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
};
}
protected JPanel createCommonPanel() {
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
setRichTextCategoryNameFormatPane(new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane));
richTextNumber = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Data_Number");
}
};
richTextMax = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Max_Value");
}
};
richTextQ3 = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Data_Q3");
}
};
richTextMedian = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Data_Median");
}
};
richTextQ1 = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Data_Q1");
}
};
richTextMin = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Min_Value");
}
};
richTextOutlier = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Outlier_Value");
}
};
}
protected JPanel createCommonFormatPanel() {
JPanel commonPanel = new JPanel(new BorderLayout());
commonPanel.add(createCateAndSeriesPane(), BorderLayout.NORTH);
@ -86,6 +145,20 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
return commonPanel;
}
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextCategoryNameFormatPane(), null},
new Component[]{getRichTextSeriesNameFormatPane(), null},
new Component[]{richTextNumber, null},
new Component[]{richTextMax, null},
new Component[]{richTextQ3, null},
new Component[]{richTextMedian, null},
new Component[]{richTextQ1, null},
new Component[]{richTextMin, null},
new Component[]{richTextOutlier, null}
};
}
protected double[] getRowSize(double p) {
return new double[]{p, p, p, p, p, p, p, p, p, p, p, p};
}
@ -93,13 +166,15 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
private JPanel createCateAndSeriesPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, p};
double[] rowSize = {p, p};
double[] columnSize = {f, e};
double[] rowSize = {p, p, p};
Component[][] cateAndSeries = new Component[][]{
new Component[]{categoryNameFormatPane, null},
new Component[]{seriesNameFormatPane, null}
new Component[]{null, null},
new Component[]{null, getCategoryNameFormatPane()},
new Component[]{null, getSeriesNameFormatPane()}
};
return TableLayoutHelper.createTableLayoutPane(cateAndSeries, rowSize, columnSize);
@ -108,13 +183,14 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
private JPanel createDataNumberPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, p};
double[] columnSize = {f, e};
double[] rowSize = {p, p};
Component[][] dataNumber = new Component[][]{
new Component[]{null, null},
new Component[]{number, null},
new Component[]{null, number},
};
dataNumberPane = TableLayoutHelper.createTableLayoutPane(dataNumber, rowSize, columnSize);
@ -125,22 +201,24 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
private JPanel createDataDetailPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f, p};
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
JPanel detailPane = new JPanel(new BorderLayout());
Component[][] dataDetail = new Component[][]{
new Component[]{null, null},
new Component[]{max, null},
new Component[]{q3, null},
new Component[]{median, null},
new Component[]{q1, null},
new Component[]{min, null}
new Component[]{null, max},
new Component[]{new UILabel(getLabelContentTitle()), q3},
new Component[]{null, median},
new Component[]{null, q1},
new Component[]{null, min}
};
Component[][] dataOutlier = new Component[][]{
new Component[]{null, null},
new Component[]{outlier, null},
new Component[]{null, outlier},
};
dataOutlierPane = TableLayoutHelper.createTableLayoutPane(dataOutlier, new double[]{p, p}, columnSize);
@ -152,8 +230,8 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
}
public boolean isDirty() {
return categoryNameFormatPane.isDirty()
|| seriesNameFormatPane.isDirty()
return getCategoryNameFormatPane().isDirty()
|| getSeriesNameFormatPane().isDirty()
|| number.isDirty()
|| max.isDirty()
|| q3.isDirty()
@ -164,8 +242,8 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
}
public void setDirty(boolean isDirty) {
categoryNameFormatPane.setDirty(isDirty);
seriesNameFormatPane.setDirty(isDirty);
getCategoryNameFormatPane().setDirty(isDirty);
getSeriesNameFormatPane().setDirty(isDirty);
number.setDirty(isDirty);
max.setDirty(isDirty);
q3.setDirty(isDirty);
@ -180,8 +258,8 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
}
protected void populateFormatPane(AttrTooltipContent attrTooltipContent) {
categoryNameFormatPane.populate(attrTooltipContent.getCategoryFormat());
seriesNameFormatPane.populate(attrTooltipContent.getSeriesFormat());
getCategoryNameFormatPane().populate(attrTooltipContent.getCategoryFormat());
getSeriesNameFormatPane().populate(attrTooltipContent.getSeriesFormat());
if (attrTooltipContent instanceof AttrBoxTooltipContent) {
AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent;
@ -198,9 +276,46 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
}
}
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
setRichTextAttr(new AttrTooltipRichText());
Map<String, String> params = getRichTextAttr().getParams();
AttrTooltipCategoryFormat categoryFormat = attrTooltipContent.getRichTextCategoryFormat();
getRichTextCategoryNameFormatPane().populate(categoryFormat);
getRichTextCategoryNameFormatPane().updateFormatParams(params, categoryFormat.getJs());
AttrTooltipSeriesFormat seriesFormat = attrTooltipContent.getRichTextSeriesFormat();
getRichTextSeriesNameFormatPane().populate(seriesFormat);
getRichTextSeriesNameFormatPane().updateFormatParams(params, seriesFormat.getJs());
if (attrTooltipContent instanceof AttrBoxTooltipContent) {
AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent;
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{
richTextNumber, richTextMax, richTextQ3, richTextMedian,
richTextQ1, richTextMin, richTextOutlier
};
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
boxTooltipContent.getRichTextNumber(),
boxTooltipContent.getRichTextMax(),
boxTooltipContent.getRichTextQ3(),
boxTooltipContent.getRichTextMedian(),
boxTooltipContent.getRichTextQ1(),
boxTooltipContent.getRichTextMin(),
boxTooltipContent.getRichTextOutlier()
};
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
}
}
protected void updateFormatPane(AttrTooltipContent attrTooltipContent) {
categoryNameFormatPane.update(attrTooltipContent.getCategoryFormat());
seriesNameFormatPane.update(attrTooltipContent.getSeriesFormat());
getCategoryNameFormatPane().update(attrTooltipContent.getCategoryFormat());
getSeriesNameFormatPane().update(attrTooltipContent.getSeriesFormat());
if (attrTooltipContent instanceof AttrBoxTooltipContent) {
AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent;
@ -217,6 +332,23 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
}
}
protected void updateRichEditor(AttrTooltipContent attrTooltipContent) {
getRichTextCategoryNameFormatPane().update(attrTooltipContent.getRichTextCategoryFormat());
getRichTextSeriesNameFormatPane().update(attrTooltipContent.getRichTextSeriesFormat());
if (attrTooltipContent instanceof AttrBoxTooltipContent) {
AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent;
richTextNumber.update(boxTooltipContent.getRichTextNumber());
richTextMax.update(boxTooltipContent.getRichTextMax());
richTextQ3.update(boxTooltipContent.getRichTextQ3());
richTextMedian.update(boxTooltipContent.getRichTextMedian());
richTextQ1.update(boxTooltipContent.getRichTextQ1());
richTextMin.update(boxTooltipContent.getRichTextMin());
richTextOutlier.update(boxTooltipContent.getRichTextOutlier());
}
}
public void checkFormatVisible(boolean detailed) {
this.detailed = detailed;

3
designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableResultDataSeriesPane.java

@ -15,10 +15,10 @@ import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.util.List;
public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPane {
@ -66,6 +66,7 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa
private JPanel createUIComboBoxPane(UIComboBox comboBox, String title) {
UILabel label = new UILabel(title);
label.setPreferredSize(new Dimension(80, 20));
comboBox.setPreferredSize(new Dimension(100, 20));
JPanel panel = new JPanel();

1
designer-chart/src/main/java/com/fr/van/chart/box/data/table/UIComboBoxWithEditLabel.java

@ -31,6 +31,7 @@ public abstract class UIComboBoxWithEditLabel extends JPanel implements UIObserv
editLabel.setPreferredSize(new Dimension(80, 20));
comboBox = new UIComboBox();
comboBox.setPreferredSize(new Dimension(100, 20));
this.setLayout(new BorderLayout(4, 0));
this.add(editLabel, BorderLayout.WEST);

35
designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubblePlotPane.java

@ -12,15 +12,22 @@ import com.fr.chartx.data.field.AbstractColumnFieldCollection;
import com.fr.chartx.data.field.diff.BubbleColumnFieldCollection;
import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.area.VanChartAreaPlot;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.base.VanChartZoom;
import com.fr.plugin.chart.bubble.BubbleIndependentVanChart;
import com.fr.plugin.chart.bubble.VanChartBubblePlot;
import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.plugin.chart.line.VanChartLinePlot;
import com.fr.plugin.chart.scatter.VanChartScatterPlot;
import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.van.chart.designer.type.AbstractVanChartTypePane;
import java.util.HashSet;
import java.util.Set;
/**
* Created by Mitisky on 16/3/31.
*/
@ -32,6 +39,20 @@ public class VanChartBubblePlotPane extends AbstractVanChartTypePane {
private static final float ALPHA = 0.7f;
private static Set<String> forceExtendPlotIds = new HashSet<>();
private static Set<String> extendPlotIds = new HashSet<>();
static {
extendPlotIds.add(VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID);
extendPlotIds.add(VanChartColumnPlot.VAN_CHART_BAR_PLOT_ID);
extendPlotIds.add(VanChartLinePlot.VAN_CHART_LINE_PLOT);
extendPlotIds.add(VanChartAreaPlot.VAN_CHART_AREA_PLOT_ID);
extendPlotIds.add(VanChartScatterPlot.VAN_CHART_SCATTER_PLOT_ID);
forceExtendPlotIds.add(VanChartScatterPlot.VAN_CHART_SCATTER_PLOT_ID);
}
@Override
protected String[] getTypeIconPath() {
return new String[]{"/com/fr/van/chart/bubble/images/bubble.png",
@ -122,16 +143,16 @@ public class VanChartBubblePlotPane extends AbstractVanChartTypePane {
* @param chart
*/
@Override
protected void resetChartAttr4SamePlot(Chart chart) {
protected void resetChartAttr4SamePlot(VanChart chart) {
//图表缩放新设计 恢复用注释。下面2行删除。
VanChartZoom vanChartZoom = new VanChartZoom();
((VanChart) chart).setVanChartZoom(vanChartZoom);
chart.setVanChartZoom(vanChartZoom);
//图表缩放新设计 恢复用注释。下面一行取消注释。
//((VanChart) chart).setZoomAttribute(new ZoomAttribute());
//重置监控刷新选项
resetRefreshMoreLabelAttr((VanChart) chart);
resetRefreshMoreLabelAttr(chart);
}
@Override
@ -147,4 +168,12 @@ public class VanChartBubblePlotPane extends AbstractVanChartTypePane {
}
return false;
}
//是否支持属性的继承
@Override
protected boolean supportExtendAttr(VanChart chart) {
VanChartBubblePlot selectedClonedPlot = (VanChartBubblePlot) getSelectedClonedPlot();
return selectedClonedPlot.isForceBubble() ? forceExtendPlotIds.contains(chart.getID()) :
extendPlotIds.contains(chart.getID());
}
}

2
designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnConditionPane.java

@ -49,7 +49,7 @@ public class VanChartColumnConditionPane extends DataSeriesConditionPane{
classPaneMap.put(AttrBackground.class, new VanChartColumnSeriesColorConditionPane(this));
classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this));
classPaneMap.put(AttrBorder.class, new VanChartColumnLabelBorderPane(this));
classPaneMap.put(AttrLabel.class, new VanChartLabelConditionPane(this, plot));
classPaneMap.put(AttrLabel.class, new VanChartColumnLabelConditionPane(this, plot));
classPaneMap.put(AttrFloatColor.class, new VanChartFloatColorConditionPane(this));
classPaneMap.put(VanChartAttrTrendLine.class, new VanChartTrendLineConditionPane(this));
classPaneMap.put(AttrSeriesImageBackground.class, new VanChartSeriesImageBackgroundConditionPane(this));

17
designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnLabelConditionPane.java

@ -0,0 +1,17 @@
package com.fr.van.chart.column;
import com.fr.chart.chartattr.Plot;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.van.chart.designer.other.condition.item.VanChartLabelConditionPane;
import com.fr.van.chart.designer.style.label.VanChartPlotLabelPane;
public class VanChartColumnLabelConditionPane extends VanChartLabelConditionPane {
public VanChartColumnLabelConditionPane(ConditionAttributesPane conditionAttributesPane, Plot plot) {
super(conditionAttributesPane, plot);
}
protected VanChartPlotLabelPane createLabelPane() {
return new VanChartColumnPlotLabelNoCheckPane(getPlot(),null);
}
}

47
designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelDetailPane.java

@ -0,0 +1,47 @@
package com.fr.van.chart.column;
import com.fr.chart.chartattr.Plot;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.plugin.chart.base.AttrLabelDetail;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.label.VanChartPlotLabelDetailPane;
public class VanChartColumnPlotLabelDetailPane extends VanChartPlotLabelDetailPane {
public VanChartColumnPlotLabelDetailPane(Plot plot, VanChartStylePane parent) {
super(plot, parent);
}
protected boolean hasLabelOrientationPane() {
return !((VanChartColumnPlot) this.getPlot()).isBar();
}
private void checkOrientationEnable(AttrLabelDetail detail) {
AttrTooltipContent content = detail.getContent();
UIButtonGroup<Integer> orientation = getOrientation();
if (orientation != null && content != null) {
if (content.isRichText()) {
orientation.setSelectedIndex(HORIZONTAL_INDEX);
detail.setHorizontal(true);
orientation.setEnabled(false);
} else {
orientation.setEnabled(true);
}
}
}
public void populate(AttrLabelDetail detail) {
super.populate(detail);
checkOrientationEnable(detail);
}
public void update(AttrLabelDetail detail) {
super.update(detail);
checkOrientationEnable(detail);
}
}

25
designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelNoCheckPane.java

@ -0,0 +1,25 @@
package com.fr.van.chart.column;
import com.fr.chart.chartattr.Plot;
import com.fr.plugin.chart.base.AttrLabel;
import com.fr.van.chart.designer.style.VanChartStylePane;
import java.awt.BorderLayout;
public class VanChartColumnPlotLabelNoCheckPane extends VanChartColumnPlotLabelPane {
public VanChartColumnPlotLabelNoCheckPane(Plot plot, VanChartStylePane parent) {
super(plot, parent);
}
protected void addComponents() {
this.setLayout(new BorderLayout());
this.add(getLabelPane(), BorderLayout.CENTER);
}
public void populate(AttrLabel attr) {
super.populate(attr);
getLabelShowCheckBox().setSelected(true);
getLabelPane().setVisible(true);
}
}

20
designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelPane.java

@ -0,0 +1,20 @@
package com.fr.van.chart.column;
import com.fr.chart.chartattr.Plot;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.label.VanChartPlotLabelPane;
import java.awt.BorderLayout;
public class VanChartColumnPlotLabelPane extends VanChartPlotLabelPane {
public VanChartColumnPlotLabelPane(Plot plot, VanChartStylePane parent) {
super(plot, parent);
}
protected void createLabelPane() {
VanChartColumnPlotLabelDetailPane labelDetailPane = new VanChartColumnPlotLabelDetailPane(getPlot(), getParentPane());
setLabelDetailPane(labelDetailPane);
getLabelPane().add(labelDetailPane, BorderLayout.CENTER);
}
}

4
designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotPane.java

@ -5,12 +5,12 @@ import com.fr.chart.chartattr.Plot;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.column.ColumnIndependentVanChart;
import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.van.chart.designer.type.AbstractVanChartTypePane;
import com.fr.van.chart.designer.type.AbstractRectanglePlotPane;
/**
* Created by Mitisky on 15/9/24.
*/
public class VanChartColumnPlotPane extends AbstractVanChartTypePane {
public class VanChartColumnPlotPane extends AbstractRectanglePlotPane {
@Override
protected String[] getTypeIconPath() {

8
designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java

@ -6,18 +6,19 @@ import com.fr.data.condition.ListCondition;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.LiteConditionPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.plugin.chart.base.AttrSeriesStackAndAxis;
import com.fr.van.chart.designer.style.series.VanChartSeriesConditionPane;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
import javax.swing.ScrollPaneConstants;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
@ -46,10 +47,13 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane<Condi
//配置界面
JPanel deployPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.add(deployPane);
deployPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Deploy") + ":", null));
deployPane.add(createDeployPane());
UIScrollPane scrollPane = new UIScrollPane(deployPane);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
this.add(scrollPane);
//条件界面
JPanel conditionPane = FRGUIPaneFactory.createBorderLayout_L_Pane();

10
designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java

@ -119,7 +119,7 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
}
@Override
public void updateBean(Chart chart) {
public void updateBean(VanChart chart) {
//保存上次选中的值,其会在super中更新
int lastState = chart.getPlot().getDetailType();
@ -129,7 +129,7 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
//如果上次的状态和这次的装填不在同一个页面,说明同一个图表內切换了,需要情況数据配置
if (lastState != chart.getPlot().getDetailType()) {
chart.setFilterDefinition(null);
((VanChart) chart).setChartDataDefinition(null);
chart.setChartDataDefinition(null);
}
Chart[] customChart = CustomIndependentVanChart.CustomVanChartTypes;
@ -214,12 +214,12 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
* @param newPlot
*/
@Override
protected void resetChartAttr(Chart chart, Plot newPlot) {
protected void resetChartAttr(VanChart chart, VanChartPlot newPlot) {
super.resetChartAttr(chart, newPlot);
//切换图表清空数据配置
chart.setFilterDefinition(null);
//设置默认不排序
VanChartTools tools = ((VanChart) chart).getVanChartTools();
VanChartTools tools = chart.getVanChartTools();
if (tools != null) {
tools.setSort(false);
}
@ -228,7 +228,7 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
/**
* 更新界面内容
*/
public void populateBean(Chart chart) {
public void populateBean(VanChart chart) {
for (ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
}

32
designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java

@ -7,6 +7,7 @@ import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.style.FormatPane;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.PiePlot4VanChart;
import com.fr.plugin.chart.area.VanChartAreaPlot;
import com.fr.plugin.chart.bubble.VanChartBubblePlot;
import com.fr.plugin.chart.column.VanChartColumnPlot;
@ -23,6 +24,7 @@ import com.fr.plugin.chart.structure.VanChartStructurePlot;
import com.fr.plugin.chart.treemap.VanChartTreeMapPlot;
import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot;
import com.fr.van.chart.bubble.force.VanChartBubbleRefreshTooltipPane;
import com.fr.van.chart.column.VanChartColumnPlotLabelPane;
import com.fr.van.chart.designer.component.VanChartLabelContentPane;
import com.fr.van.chart.designer.component.VanChartRefreshTooltipContentPane;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
@ -38,7 +40,7 @@ import com.fr.van.chart.designer.style.tooltip.VanChartPlotTooltipPane;
import com.fr.van.chart.funnel.designer.style.VanChartFunnelLabelContentPane;
import com.fr.van.chart.funnel.designer.style.VanChartFunnelRefreshTooltipContentPane;
import com.fr.van.chart.funnel.designer.style.VanChartFunnelTooltipContentPane;
import com.fr.van.chart.gantt.designer.style.VanChartGanttLabelContentPane;
import com.fr.van.chart.gantt.designer.style.label.VanChartGanttPlotLabelPane;
import com.fr.van.chart.gantt.designer.style.tooltip.VanChartGanttPlotTooltipPane;
import com.fr.van.chart.gantt.designer.style.tooltip.VanChartGanttTooltipContentPane;
import com.fr.van.chart.gauge.VanChartGaugePlotRefreshTooltipPane;
@ -53,10 +55,10 @@ import com.fr.van.chart.multilayer.style.VanChartMutiPieRefreshTooltipContentPan
import com.fr.van.chart.scatter.VanChartScatterPlotTooltipPane;
import com.fr.van.chart.scatter.VanChartScatterRefreshTooltipContentPane;
import com.fr.van.chart.scatter.component.label.VanChartScatterPlotLabelPane;
import com.fr.van.chart.structure.desinger.style.VanChartStructureLabelContentPane;
import com.fr.van.chart.structure.desinger.style.VanChartStructurePlotLabelPane;
import com.fr.van.chart.structure.desinger.style.VanChartStructureRefreshTooltipContentPane;
import com.fr.van.chart.structure.desinger.style.VanChartStructureTooltipContentPane;
import com.fr.van.chart.wordcloud.designer.style.VanChartWordCloudRefreshTootipContentPane;
import com.fr.van.chart.wordcloud.designer.style.VanChartWordCloudRefreshTooltipContentPane;
import com.fr.van.chart.wordcloud.designer.style.VanChartWordCloudTooltipContentPane;
import javax.swing.BorderFactory;
@ -76,7 +78,7 @@ import java.util.Set;
*/
public class PlotFactory {
private static Set<Class<? extends Plot>> autoAdjustLabelPlots = new HashSet<Class<? extends Plot>>();
private static Set<Class<? extends Plot>> autoAdjustLabelPlots = new HashSet<>();
static {
autoAdjustLabelPlots.add(VanChartColumnPlot.class);
@ -89,15 +91,31 @@ public class PlotFactory {
return autoAdjustLabelPlots.contains(plot.getClass());
}
private static Set<Class<? extends Plot>> borderAndBackgroundLabelPlots = new HashSet<>();
static {
borderAndBackgroundLabelPlots.add(PiePlot4VanChart.class);
borderAndBackgroundLabelPlots.add(VanChartColumnPlot.class);
borderAndBackgroundLabelPlots.add(VanChartLinePlot.class);
borderAndBackgroundLabelPlots.add(VanChartAreaPlot.class);
}
public static boolean hasBorderAndBackgroundPlotLabel(Plot plot) {
return borderAndBackgroundLabelPlots.contains(plot.getClass());
}
/**
* 标签Map
*/
private static Map<Class<? extends Plot>, Class<? extends VanChartPlotLabelPane>> labelMap = new HashMap<Class<? extends Plot>, Class<? extends VanChartPlotLabelPane>>();
private static Map<Class<? extends Plot>, Class<? extends VanChartPlotLabelPane>> labelMap = new HashMap<>();
static {
labelMap.put(VanChartColumnPlot.class, VanChartColumnPlotLabelPane.class);
labelMap.put(VanChartGaugePlot.class, VanChartGaugePlotLabelPane.class);
labelMap.put(VanChartScatterPlot.class, VanChartScatterPlotLabelPane.class);
labelMap.put(VanChartBubblePlot.class, VanChartScatterPlotLabelPane.class);
labelMap.put(VanChartGanttPlot.class, VanChartGanttPlotLabelPane.class);
labelMap.put(VanChartStructurePlot.class, VanChartStructurePlotLabelPane.class);
}
/**
@ -139,8 +157,6 @@ public class PlotFactory {
labelContentMap.put(VanChartTreeMapPlot.class, VanChartMultiPieLabelContentPane.class);
labelContentMap.put(VanChartFunnelPlot.class, VanChartFunnelLabelContentPane.class);
labelContentMap.put(VanChartHeatMapPlot.class, VanChartMapLabelContentPane.class);
labelContentMap.put(VanChartGanttPlot.class, VanChartGanttLabelContentPane.class);
labelContentMap.put(VanChartStructurePlot.class, VanChartStructureLabelContentPane.class);
}
private static Map<Class<? extends Plot>, Class<? extends VanChartTooltipContentPane>> tooltipContentMap = new HashMap<Class<? extends Plot>, Class<? extends VanChartTooltipContentPane>>();
@ -182,7 +198,7 @@ public class PlotFactory {
refreshTooltipContentMap.put(VanChartMultiPiePlot.class, VanChartMutiPieRefreshTooltipContentPane.class);
refreshTooltipContentMap.put(VanChartTreeMapPlot.class, VanChartMutiPieRefreshTooltipContentPane.class);
refreshTooltipContentMap.put(VanChartFunnelPlot.class, VanChartFunnelRefreshTooltipContentPane.class);
refreshTooltipContentMap.put(VanChartWordCloudPlot.class, VanChartWordCloudRefreshTootipContentPane.class);
refreshTooltipContentMap.put(VanChartWordCloudPlot.class, VanChartWordCloudRefreshTooltipContentPane.class);
refreshTooltipContentMap.put(VanChartStructurePlot.class, VanChartStructureRefreshTooltipContentPane.class);
}

3
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java

@ -148,11 +148,12 @@ public class VanChartHtmlLabelPane extends JPanel{
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = { p, f };
double[] rowSize = { p, p};
double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{
new Component[]{isCustomWidth, customWidth},
new Component[]{isCustomHeight, customHeight},
new Component[] {null, null}
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}

27
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPaneWithBackGroundLabel.java

@ -0,0 +1,27 @@
package com.fr.van.chart.designer.component;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
import java.awt.Component;
public class VanChartHtmlLabelPaneWithBackGroundLabel extends VanChartHtmlLabelPane {
protected JPanel createWidthAndHeightPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH;
JPanel panel = super.createWidthAndHeightPane();
Component[][] components = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Background")), panel},
};
return TableLayoutHelper.createTableLayoutPane(components, new double[]{p}, new double[]{d, f});
}
}

2
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPane.java

@ -13,6 +13,6 @@ public class VanChartLabelContentPane extends VanChartTooltipContentPane {
}
protected VanChartHtmlLabelPane createHtmlLabelPane() {
return new VanChartHtmlLabelPane();
return new VanChartHtmlLabelPaneWithBackGroundLabel();
}
}

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

Loading…
Cancel
Save