Browse Source

Merge remote-tracking branch 'origin/bugfix/10.0' into bugfix/10.0

bugfix/10.0
Yvan 4 years ago
parent
commit
bd431d9641
  1. 17
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 4
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  3. 2
      designer-base/src/main/java/com/fr/design/constants/UIConstants.java
  4. 3
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  5. 44
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  6. 19
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTree.java
  7. 9
      designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataComboBox.java
  8. 56
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  9. 50
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  10. 3
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  11. 5
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java
  12. 43
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java
  13. 5
      designer-base/src/main/java/com/fr/design/dialog/UIDialog.java
  14. 14
      designer-base/src/main/java/com/fr/design/extra/ShopDialog.java
  15. 7
      designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java
  16. 2
      designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneHelper.java
  17. 23
      designer-base/src/main/java/com/fr/design/gui/frpane/JTreeAutoBuildPane.java
  18. 17
      designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPane.java
  19. 10
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java
  20. 11
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java
  21. 12
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java
  22. 25
      designer-base/src/main/java/com/fr/design/gui/style/FRFontPane.java
  23. 9
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/ConfigurableCaret.java
  24. 38
      designer-base/src/main/java/com/fr/design/jdk/JdkVersion.java
  25. 17
      designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java
  26. 10
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  27. 4
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  28. 40
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  29. 20
      designer-base/src/main/java/com/fr/design/mainframe/PromptWindow.java
  30. 20
      designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java
  31. 41
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  32. 35
      designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java
  33. 25
      designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java
  34. 27
      designer-base/src/main/java/com/fr/design/menu/SnapChatUtil.java
  35. 22
      designer-base/src/main/java/com/fr/design/notification/AbstractSnapChat.java
  36. 4
      designer-base/src/main/java/com/fr/design/notification/SnapChat.java
  37. 32
      designer-base/src/main/java/com/fr/design/notification/SnapChatFactory.java
  38. 9
      designer-base/src/main/java/com/fr/design/notification/SnapChatKey.java
  39. 5
      designer-base/src/main/java/com/fr/design/object/NameObject.java
  40. 4
      designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java
  41. 19
      designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java
  42. 20
      designer-base/src/main/java/com/fr/design/parameter/ParameterInputPane.java
  43. 10
      designer-base/src/main/java/com/fr/design/style/FormatPane.java
  44. 3
      designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBackgroundPane.java
  45. 10
      designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java
  46. 129
      designer-base/src/main/java/com/fr/design/update/factory/DirectoryOperationFactory.java
  47. 50
      designer-base/src/main/java/com/fr/design/update/factory/UpdateFileFactory.java
  48. 4
      designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreDialog.java
  49. 10
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  50. 36
      designer-base/src/main/java/com/fr/design/update/utils/UpdateFileUtils.java
  51. 23
      designer-base/src/main/java/com/fr/design/upm/UpmFinder.java
  52. 68
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  53. 6
      designer-base/src/main/java/com/fr/design/web/CustomIconPane.java
  54. 4
      designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java
  55. 52
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  56. 26
      designer-base/src/test/java/com/fr/design/data/datapane/TableDataPaneListPaneTest.java
  57. 28
      designer-base/src/test/java/com/fr/design/update/factory/UpdateFileFactoryTest.java
  58. 27
      designer-base/src/test/java/com/fr/design/update/utils/UpdateFileUtilsTest.java
  59. 137
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java
  60. 3
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableResultDataSeriesPane.java
  61. 1
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/UIComboBoxWithEditLabel.java
  62. 2
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnConditionPane.java
  63. 17
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnLabelConditionPane.java
  64. 77
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelDetailPane.java
  65. 25
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelNoCheckPane.java
  66. 20
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelPane.java
  67. 8
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotLabelTabPane.java
  68. 20
      designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java
  69. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java
  70. 27
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPaneWithBackGroundLabel.java
  71. 8
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPane.java
  72. 295
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPaneWithoutRichText.java
  73. 4
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRefreshTooltipContentPane.java
  74. 32
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorDialog.java
  75. 38
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java
  76. 239
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  77. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java
  78. 14
      designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderPane.java
  79. 12
      designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithRadiusPane.java
  80. 210
      designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java
  81. 11
      designer-chart/src/main/java/com/fr/van/chart/designer/component/label/GaugeLabelContentPane.java
  82. 4
      designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/RefreshTooltipContentPaneWithOutSeries.java
  83. 24
      designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/TooltipContentPaneWithOutSeries.java
  84. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java
  85. 11
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java
  86. 57
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java
  87. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartLabelPane.java
  88. 129
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java
  89. 14
      designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java
  90. 32
      designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java
  91. 5
      designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRefreshTooltipContentPane.java
  92. 32
      designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java
  93. 4
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/other/VanChartGanttConditionPane.java
  94. 17
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/label/VanChartGanttLabelConditionPane.java
  95. 8
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/label/VanChartGanttLabelContentPane.java
  96. 25
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/label/VanChartGanttPlotLabelNoCheckPane.java
  97. 5
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java
  98. 8
      designer-chart/src/main/java/com/fr/van/chart/map/designer/VanMapAreaPointAndLineGroupPane.java
  99. 5
      designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java
  100. 4
      designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapRefreshTooltipContentPane.java
  101. Some files were not shown because too many files have changed in this diff Show More

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

@ -418,21 +418,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.isHttps = isHttps; this.isHttps = isHttps;
} }
public String getCertificatePath() {
return certificatePath;
}
public void setCertificatePath(String certificatePath) { public void setCertificatePath(String certificatePath) {
this.certificatePath = certificatePath; this.certificatePath = certificatePath;
} }
public String getCertificatePass() {
return certificatePass;
}
public void setCertificatePass(String certificatePass) { public void setCertificatePass(String certificatePass) {
this.certificatePass = certificatePass; this.certificatePass = certificatePass;
} }
@ -2015,11 +2004,13 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private void writeHttpsParas(XMLPrintWriter writer) { private void writeHttpsParas(XMLPrintWriter writer) {
writer.startTAG(CAS_PARAS); writer.startTAG(CAS_PARAS);
// 这边的密钥path和password没有用处了 当前已经全部储存在对应的WorkspaceConnectionInfo中
// 把历史遗留保存的全部置为空 防止显示明文密钥 后面删除 todo
if (StringUtils.isNotBlank(certificatePath)) { if (StringUtils.isNotBlank(certificatePath)) {
writer.attr(CAS_CERTIFICATE_PATH, certificatePath); writer.attr(CAS_CERTIFICATE_PATH, StringUtils.EMPTY);
} }
if (StringUtils.isNotBlank(certificatePass)) { if (StringUtils.isNotBlank(certificatePass)) {
writer.attr(CAS_CERTIFICATE_PASSWORD, certificatePass); writer.attr(CAS_CERTIFICATE_PASSWORD, StringUtils.EMPTY);
} }
if (isHttps) { if (isHttps) {
writer.attr("enable", true); writer.attr("enable", true);

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.iprogressbar.UIProgressBarUI;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.jdk.JdkVersion;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
@ -39,6 +40,7 @@ import com.fr.general.log.Log4jConfig;
import com.fr.locale.InterProviderFactory; import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StableUtils;
import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.OperatingSystem;
import com.fr.third.apache.log4j.Level; import com.fr.third.apache.log4j.Level;
import com.fr.transaction.Configurations; 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")); oracleSpace = new UICheckBox(i18nText("Fine-Design_Basic_Show_All_Oracle_Tables"));
oraclePane.add(oracleSpace); oraclePane.add(oracleSpace);
if (!OperatingSystem.isLinux()) { if (!OperatingSystem.isLinux() && JdkVersion.LE_8.support()) {
JPanel upmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Update_Plugin_Manager")); JPanel upmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Update_Plugin_Manager"));
useOptimizedUPMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_New_Update_Plugin_Manager")); useOptimizedUPMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_New_Update_Plugin_Manager"));
upmSelectorPane.add(useOptimizedUPMCheckbox); 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_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 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_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_PRESENTBORDER = BorderFactory.createEmptyBorder(0, 5, 0, 0);
public static final Border CELL_ATTR_NORMALBORDER = BorderFactory.createEmptyBorder(0, 10, 0, 15); public static final Border CELL_ATTR_NORMALBORDER = BorderFactory.createEmptyBorder(0, 10, 0, 15);

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

@ -190,6 +190,7 @@ public abstract class DesignTableDataManager {
} }
dsListeners.add(l); dsListeners.add(l);
} }
/** /**
* 获取数据源source中dsName的所有字段 * 获取数据源source中dsName的所有字段
* *
@ -280,7 +281,7 @@ public abstract class DesignTableDataManager {
Entry<String, TableDataWrapper> entry = entryIt.next(); Entry<String, TableDataWrapper> entry = entryIt.next();
list.add(entry.getKey()); list.add(entry.getKey());
} }
return list.toArray(new String[list.size()]); return list.toArray(new String[0]);
} }
/** /**

44
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.BasicTableDataUtils;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.FineJOptionPane; 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.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
@ -23,18 +24,20 @@ import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*; import javax.swing.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* TableDataList Pane. * TableDataList Pane.
*/ */
public class TableDataPaneListPane extends JListControlPane implements TableDataPaneController { public class TableDataPaneListPane extends JListControlPane implements TableDataPaneController {
private boolean isNamePermitted = true; private boolean isNamePermitted = true;
private Map<String, String> dsNameChangedMap = new HashMap<String, String>(); private Map<String, String> dsNameChangedMap = new HashMap<>();
public TableDataPaneListPane() { public TableDataPaneListPane() {
super(); super();
@ -43,11 +46,15 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
@Override @Override
public void propertyChange() { public void propertyChange() {
isNamePermitted = true; isNamePermitted = true;
TableDataSource source = DesignTableDataManager.getEditingTableDataSource();
String[] allDSNames = DesignTableDataManager.getAllDSNames(source);
String[] allListNames = nameableList.getAllNames();
allListNames[nameableList.getSelectedIndex()] = StringUtils.EMPTY;
String tempName = getEditingName(); 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(); Object editingType = getEditingType();
if (!BasicTableDataUtils.checkName(tempName)) { if (!BasicTableDataUtils.checkName(tempName)) {
@ -67,9 +74,8 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
setIllegalIndex(editingIndex); setIllegalIndex(editingIndex);
return; return;
} }
boolean isRepeated = isNameRepeated(new Collection[]{allDSNames, Arrays.asList(allListNames)}, tempName);
if (!ComparatorUtils.equals(tempName, selectedName) if (isRepeated) {
&& isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName)) {
isNamePermitted = false; isNamePermitted = false;
nameableList.stopEditing(); nameableList.stopEditing();
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Table_Data_Duplicate_Name_Tips", tempName)); 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); setIllegalIndex(editingIndex);
} }
if (nameableList.getSelectedValue() instanceof ListModelElement) { if (nameableList.getSelectedValue() instanceof ListModelElement) {
Nameable selected = ((ListModelElement) nameableList.getSelectedValue()).wrapper; rename(selectedName, isRepeated ? NameInspector.ILLEGAL_NAME_HOLDER : tempName);
if (!ComparatorUtils.equals(tempName, selected.getName()) && !isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName)) {
rename(selected.getName(), tempName);
}
} }
} }
}); });
@ -93,8 +95,20 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
@Override @Override
public void rename(String oldName, String newName) { public void rename(String oldName, String 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); dsNameChangedMap.put(oldName, newName);
} }
}
/** /**
* 名字是否允许 * 名字是否允许
@ -192,7 +206,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
} }
} }
populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); populate(nameObjectList.toArray(new NameObject[0]));
} }
/** /**
@ -212,7 +226,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
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 @Override

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

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

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

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

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

@ -11,6 +11,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength; import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
@ -90,9 +91,9 @@ public class JDBCDefPane extends JPanel {
private IntegerEditor DBCP_MAX_WAIT = new IntegerEditor(); private IntegerEditor DBCP_MAX_WAIT = new IntegerEditor();
private UITextField DBCP_VALIDATION_QUERY = new UITextField(); private UITextField DBCP_VALIDATION_QUERY = new UITextField();
private UIComboBox DBCP_TESTONBORROW = new UIComboBox(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Yes")}); private UIComboBox DBCP_TESTONBORROW = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_No"), Toolkit.i18nText("Fine-Design_Basic_Yes")});
private UIComboBox DBCP_TESTONRETURN = new UIComboBox(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Yes")}); private UIComboBox DBCP_TESTONRETURN = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_No"), Toolkit.i18nText("Fine-Design_Basic_Yes")});
private UIComboBox DBCP_TESTWHILEIDLE = new UIComboBox(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Yes")}); private UIComboBox DBCP_TESTWHILEIDLE = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_No"), Toolkit.i18nText("Fine-Design_Basic_Yes")});
private IntegerEditor DBCP_TIMEBETWEENEVICTIONRUNSMILLS = new IntegerEditor(); private IntegerEditor DBCP_TIMEBETWEENEVICTIONRUNSMILLS = new IntegerEditor();
private IntegerEditor DBCP_NUMTESTSPEREVICTIONRUN = new IntegerEditor(); private IntegerEditor DBCP_NUMTESTSPEREVICTIONRUN = new IntegerEditor();
@ -120,13 +121,13 @@ public class JDBCDefPane extends JPanel {
userNameTextField.setName(USER_NAME); userNameTextField.setName(USER_NAME);
passwordTextField = new UIPasswordFieldWithFixedLength(15); passwordTextField = new UIPasswordFieldWithFixedLength(15);
dbtypeButton = new UIButton("."); dbtypeButton = new UIButton(".");
dbtypeButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Click_Get_Default_URL")); dbtypeButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Click_Get_Default_URL"));
dbtypeButton.addActionListener(dbtypeButtonActionListener); dbtypeButton.addActionListener(dbtypeButtonActionListener);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
JPanel dbtypePane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); JPanel dbtypePane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
dbtypePane.add(new UILabel((com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database") + ":"))); dbtypePane.add(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Database") + ":")));
JPanel dbtypeComPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel dbtypeComPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
Component[][] dbtypeComComponents = {{dbtypeComboBox}}; Component[][] dbtypeComComponents = {{dbtypeComboBox}};
double[] dbtypeRowSize = {p}; double[] dbtypeRowSize = {p};
@ -134,10 +135,10 @@ public class JDBCDefPane extends JPanel {
dbtypeComPane = TableLayoutHelper.createTableLayoutPane(dbtypeComComponents, dbtypeRowSize, dbtypeColumnSize); dbtypeComPane = TableLayoutHelper.createTableLayoutPane(dbtypeComComponents, dbtypeRowSize, dbtypeColumnSize);
JPanel driverPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); JPanel driverPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
driverPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Driver") + ":")); driverPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Driver") + ":"));
// 选择ODBC数据源的时候的提示链接 // 选择ODBC数据源的时候的提示链接
JPanel odbcTipsPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); JPanel odbcTipsPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
odbcTipsLink = new ActionLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Odbc_Tips")) { odbcTipsLink = new ActionLabel(Toolkit.i18nText("Fine-Design_Basic_Odbc_Tips")) {
@Override @Override
public void paintComponent(Graphics _gfx) { public void paintComponent(Graphics _gfx) {
super.paintComponent(_gfx); super.paintComponent(_gfx);
@ -146,7 +147,7 @@ public class JDBCDefPane extends JPanel {
} }
}; };
odbcTipsPane.add(odbcTipsLink); odbcTipsPane.add(odbcTipsLink);
odbcTipsLink.setPreferredSize(new Dimension(GraphHelper.getWidth(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Odbc_Tips")), odbcTipsLink.getPreferredSize().height)); odbcTipsLink.setPreferredSize(new Dimension(GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Basic_Odbc_Tips")), odbcTipsLink.getPreferredSize().height));
odbcTipsLink.addActionListener(new ActionListener() { odbcTipsLink.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
String url = CloudCenter.getInstance().acquireUrlByKind("odbc.help"); String url = CloudCenter.getInstance().acquireUrlByKind("odbc.help");
@ -167,26 +168,27 @@ public class JDBCDefPane extends JPanel {
urlComPane = TableLayoutHelper.createCommonTableLayoutPane(urlComComponents, urlRowSize, urlColumnSize, 4); urlComPane = TableLayoutHelper.createCommonTableLayoutPane(urlComComponents, urlRowSize, urlColumnSize, 4);
JPanel userPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); JPanel userPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
userPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_UserName") + ":")); userPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_UserName") + ":"));
JPanel userComPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel userComPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
Component[][] userComComponents = {{userNameTextField, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Password") + ":"), passwordTextField}}; Component[][] userComComponents = {{userNameTextField, new UILabel(Toolkit.i18nText("Fine-Design_Basic_Password") + ":"), passwordTextField}};
double[] userRowSize = {p}; double[] userRowSize = {p};
double[] userColumnSize = {f, p, f}; double[] userColumnSize = {f, p, f};
userComPane = TableLayoutHelper.createCommonTableLayoutPane(userComComponents, userRowSize, userColumnSize, 4); userComPane = TableLayoutHelper.createCommonTableLayoutPane(userComComponents, userRowSize, userColumnSize, 4);
JPanel passwordPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); JPanel passwordPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
passwordPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Password") + ":")); passwordPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Password") + ":"));
Component[][] components = {{dbtypePane, dbtypeComPane}, {driverPane, driverComboBoxAndTips}, {urlPane, urlComPane}, {userPane, userComPane},}; Component[][] components = {{dbtypePane, dbtypeComPane}, {driverPane, driverComboBoxAndTips}, {urlPane, urlComPane}, {userPane, userComPane},};
double[] rowSize = {p, p, p, p}; double[] rowSize = {p, p, p, p};
double[] columnSize = {p, f, 22}; double[] columnSize = {p, f, 22};
JPanel centerPanel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 6); // REPORT-41450 Windows环境的jdk11下dpi为125%时会因为缩放导致显示问题,因此加个水平gap值
JPanel centerPanel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 6, 6);
innerthis.add(centerPanel); innerthis.add(centerPanel);
JPanel southPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel southPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
innerthis.add(southPanel); innerthis.add(southPanel);
southPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 4, 20)); southPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 4, 20));
ActionLabel actionLabel = new ActionLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr")); ActionLabel actionLabel = new ActionLabel(Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr"));
southPanel.add(actionLabel, BorderLayout.EAST); southPanel.add(actionLabel, BorderLayout.EAST);
actionLabel.addActionListener(new ActionListener() { actionLabel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
@ -331,7 +333,7 @@ public class JDBCDefPane extends JPanel {
if (ComparatorUtils.equals(dbtypeComboBox.getSelectedItem(), ("Access"))) { if (ComparatorUtils.equals(dbtypeComboBox.getSelectedItem(), ("Access"))) {
// ben:这个能不能换种处理方案- - // ben:这个能不能换种处理方案- -
JFileChooser filechooser = new JFileChooser(); JFileChooser filechooser = new JFileChooser();
filechooser.setDialogTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Open")); filechooser.setDialogTitle(Toolkit.i18nText("Fine-Design_Basic_Open"));
filechooser.setMultiSelectionEnabled(false); filechooser.setMultiSelectionEnabled(false);
filechooser.addChoosableFileFilter(new ChooseFileFilter(new String[]{"accdb", "mdb"}, "Microsoft Office Access")); filechooser.addChoosableFileFilter(new ChooseFileFilter(new String[]{"accdb", "mdb"}, "Microsoft Office Access"));
int result = filechooser.showOpenDialog(DesignerContext.getDesignerFrame()); int result = filechooser.showOpenDialog(DesignerContext.getDesignerFrame());
@ -373,19 +375,19 @@ public class JDBCDefPane extends JPanel {
double[] rowSize = {f, f, f, f, f, f, f, f, f, f, f, f}; double[] rowSize = {f, f, f, f, f, f, f, f, f, f, f, f};
double[] columnSize = {f, f}; double[] columnSize = {f, f};
Component[][] comps = { Component[][] comps = {
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dbcp_Initial_Size") + ":", SwingConstants.RIGHT), DBCP_INITIAL_SIZE}, {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Initial_Size") + ":", SwingConstants.RIGHT), DBCP_INITIAL_SIZE},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Active") + ":", SwingConstants.RIGHT), DBCP_MAX_ACTIVE}, {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Active") + ":", SwingConstants.RIGHT), DBCP_MAX_ACTIVE},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Idle") + ":", SwingConstants.RIGHT), DBCP_MAX_IDLE}, {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Idle") + ":", SwingConstants.RIGHT), DBCP_MAX_IDLE},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dbcp_Min_Idle") + ":", SwingConstants.RIGHT), DBCP_MIN_IDLE}, {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Min_Idle") + ":", SwingConstants.RIGHT), DBCP_MIN_IDLE},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Max_Wait_Time") + ":", SwingConstants.RIGHT), DBCP_MAX_WAIT}, {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Max_Wait_Time") + ":", SwingConstants.RIGHT), DBCP_MAX_WAIT},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dbcp_Validation_Query") + ":", SwingConstants.RIGHT), DBCP_VALIDATION_QUERY}, {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Validation_Query") + ":", SwingConstants.RIGHT), DBCP_VALIDATION_QUERY},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Borrow") + ":", SwingConstants.RIGHT), DBCP_TESTONBORROW}, {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Borrow") + ":", SwingConstants.RIGHT), DBCP_TESTONBORROW},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Return") + ":", SwingConstants.RIGHT), DBCP_TESTONRETURN}, {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Return") + ":", SwingConstants.RIGHT), DBCP_TESTONRETURN},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_While_Idle") + ":", SwingConstants.RIGHT), DBCP_TESTWHILEIDLE}, {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_While_Idle") + ":", SwingConstants.RIGHT), DBCP_TESTWHILEIDLE},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Evictionruns_millis") + ":", SwingConstants.RIGHT), {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Evictionruns_millis") + ":", SwingConstants.RIGHT),
DBCP_TIMEBETWEENEVICTIONRUNSMILLS}, DBCP_TIMEBETWEENEVICTIONRUNSMILLS},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dbcp_Num_Test_Per_Evction_Run") + ":", SwingConstants.RIGHT), DBCP_NUMTESTSPEREVICTIONRUN}, {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Num_Test_Per_Evction_Run") + ":", SwingConstants.RIGHT), DBCP_NUMTESTSPEREVICTIONRUN},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Mix_Evictable_Idle_Time_Millis") + ":", SwingConstants.RIGHT), {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Mix_Evictable_Idle_Time_Millis") + ":", SwingConstants.RIGHT),
DBCP_MINEVICTABLEIDLETIMEMILLIS}}; DBCP_MINEVICTABLEIDLETIMEMILLIS}};
JPanel contextPane = TableLayoutHelper.createGapTableLayoutPane(comps, rowSize, columnSize, 10, 4); JPanel contextPane = TableLayoutHelper.createGapTableLayoutPane(comps, rowSize, columnSize, 10, 4);
@ -395,7 +397,7 @@ public class JDBCDefPane extends JPanel {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr"); return Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr");
} }
} }

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.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.FineJOptionPane; 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.frpane.UITabbedPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.iprogressbar.AutoProgressBar; import com.fr.design.gui.iprogressbar.AutoProgressBar;
import com.fr.design.gui.itable.SortableJTable; import com.fr.design.gui.itable.SortableJTable;
import com.fr.design.gui.itable.TableSorter; import com.fr.design.gui.itable.TableSorter;
import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.ui.util.UIUtil;
import com.fr.function.TIME; import com.fr.function.TIME;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.log.FineLoggerFactory; 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.DefaultTableCellRenderer;
import javax.swing.table.TableColumn; import javax.swing.table.TableColumn;
import javax.swing.table.TableModel; import javax.swing.table.TableModel;
@ -81,7 +92,7 @@ public class PreviewTablePane extends BasicPane {
JPanel currentPreviewPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel currentPreviewPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
previewNumberPanel.add(currentPreviewPanel); 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(); currentRowsField = new UINumberField();
currentPreviewPanel.add(currentRowsField); currentPreviewPanel.add(currentRowsField);
@ -91,7 +102,7 @@ public class PreviewTablePane extends BasicPane {
JPanel maxPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel maxPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
previewNumberPanel.add(maxPanel); 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(); maxPreviewNumberField = new UINumberField();
maxPanel.add(maxPreviewNumberField); maxPanel.add(maxPreviewNumberField);
@ -158,7 +169,7 @@ public class PreviewTablePane extends BasicPane {
if (this.dialog == null) { if (this.dialog == null) {
this.dialog = this.showWindow(new JFrame()); 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() { public void doMonitorCanceled() {
if (getWorker() != null) { if (getWorker() != null) {
getWorker().cancel(true); getWorker().cancel(true);
@ -174,7 +185,7 @@ public class PreviewTablePane extends BasicPane {
@Override @Override
protected String title4PopupWindow() { 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) { 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) { public static EmbeddedTableData previewTableData(TableData tableData, final int keyIndex, final int valueIndex) {
PreviewTablePane previewTablePane = new PreviewTablePane(); 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 { try {
previewTablePane.populate(tableData); previewTablePane.populate(tableData);
previewTablePane.resetPreviewTableColumnColor(); previewTablePane.resetPreviewTableColumnColor();
@ -298,13 +309,13 @@ public class PreviewTablePane extends BasicPane {
try { try {
int choiceColumn = Integer.parseInt(columnErrMessage.trim()); int choiceColumn = Integer.parseInt(columnErrMessage.trim());
int tatalColumn = Integer.parseInt(tatolColumnErrMessage.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) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
return; return;
} }
FineLoggerFactory.getLogger().error(exp.getMessage(), exp); 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 { private void populate(TableData tableData) throws Exception {
@ -317,7 +328,7 @@ public class PreviewTablePane extends BasicPane {
} }
private void previewTableDataSQL() throws Exception { 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() { public void doMonitorCanceled() {
getWorker().cancel(true); getWorker().cancel(true);
getDialog().setVisible(false); getDialog().setVisible(false);
@ -365,13 +376,14 @@ public class PreviewTablePane extends BasicPane {
if (tableData instanceof DBTableData) { if (tableData instanceof DBTableData) {
boolean status = DataOperator.getInstance().testConnection(((DBTableData) tableData).getDatabase()); boolean status = DataOperator.getInstance().testConnection(((DBTableData) tableData).getDatabase());
if (!status) { 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 { } 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); previewTableData = DesignTableDataManager.previewTableDataNeedInputParameters(dataSource, tableData, (int) maxPreviewNumberField.getValue(), true, progressBar);
// parameterInputDialog // parameterInputDialog
// update之后的parameters,转成一个parameterMap,用于预览TableData // update之后的parameters,转成一个parameterMap,用于预览TableData
@ -396,7 +408,7 @@ public class PreviewTablePane extends BasicPane {
if (!(e instanceof CancellationException)) { if (!(e instanceof CancellationException)) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(), 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); dialog.setVisible(false);
} finally { } finally {
@ -425,7 +437,7 @@ public class PreviewTablePane extends BasicPane {
public static void previewStoreData(final ProcedureDataModel storeProcedureDataModel, final int keyIndex, final int valueIndex) { public static void previewStoreData(final ProcedureDataModel storeProcedureDataModel, final int keyIndex, final int valueIndex) {
final PreviewTablePane previewTablePane = new PreviewTablePane(); final PreviewTablePane previewTablePane = new PreviewTablePane();
previewTablePane.storeProcedureDataModel = storeProcedureDataModel; 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 { try {
previewTablePane.populateStoreDataSQL(); previewTablePane.populateStoreDataSQL();
@ -442,7 +454,7 @@ public class PreviewTablePane extends BasicPane {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
previewTablePane.fireLoadedListener(); 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++) { for (int i = 0; i < tableSize; i++) {
PreviewTablePane previewTablePane = new PreviewTablePane(); PreviewTablePane previewTablePane = new PreviewTablePane();
previewTablePane.storeProcedureDataModel = storeProcedureDataModels[i]; 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 { try {
previewTablePane.populateStoreDataSQL(); previewTablePane.populateStoreDataSQL();
} catch (Exception e) { } catch (Exception e) {
@ -469,13 +481,13 @@ public class PreviewTablePane extends BasicPane {
@Override @Override
protected String title4PopupWindow() { 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.setLayout(FRGUIPaneFactory.createBorderLayout());
prieviewPane.add(tabPreviewpane, BorderLayout.CENTER); prieviewPane.add(tabPreviewpane, BorderLayout.CENTER);
prieviewPane.showWindow(DesignerContext.getDesignerFrame()).setVisible(true); prieviewPane.showWindow(new JFrame()).setVisible(true);
} }
private void populateStoreDataSQL() throws Exception { private void populateStoreDataSQL() throws Exception {

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

@ -185,7 +185,8 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
box.setMinimumSize(new Dimension(300, 400)); box.setMinimumSize(new Dimension(300, 400));
// 防止数据连接名过长时影响 split pane 分割效果 // 防止数据连接名过长时影响 split pane 分割效果
connectionTableProcedurePane.setMinimumSize(new Dimension(250, 400)); // 本界面中给MaxMemRowCountPanel留的空间太小,造成MaxMemRowCountPanel显示异常,这边减小一点最小宽度,拉长MaxMemRowCountPanel
connectionTableProcedurePane.setMinimumSize(new Dimension(230, 400));
connectionTableProcedurePane.setMaximumSize(new Dimension(500, 400)); connectionTableProcedurePane.setMaximumSize(new Dimension(500, 400));
// 使用SplitPane // 使用SplitPane
JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, connectionTableProcedurePane, sqlSplitPane); JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, connectionTableProcedurePane, sqlSplitPane);

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

@ -21,7 +21,7 @@ public class MaxMemRowCountPanel extends UIToolbar {
private static final int MAX_IN_MEMORY = 1; private static final int MAX_IN_MEMORY = 1;
private static final String[] CACHE_LIST = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Save_All_Records_In_Memory"), private static final String[] CACHE_LIST = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Save_All_Records_In_Memory"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Max_Mem_Row_Count") }; com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Max_Mem_Row_Count") };
private static final int MAX_WIDTH = getMaxComBoBoxWidth() > 200 ? 350 : 250; private static final int MAX_WIDTH = getMaxComBoBoxWidth() > 200 ? 350 : 280;
private static final int MAX_COMPONENT_COUNT_OF_MAX_MEMORY = 4; private static final int MAX_COMPONENT_COUNT_OF_MAX_MEMORY = 4;
private static int getMaxComBoBoxWidth() { private static int getMaxComBoBoxWidth() {
int maxWidth = GraphHelper.getWidth(CACHE_LIST[0]); int maxWidth = GraphHelper.getWidth(CACHE_LIST[0]);
@ -72,7 +72,8 @@ public class MaxMemRowCountPanel extends UIToolbar {
this.setBackground(UIConstants.NORMAL_BACKGROUND); this.setBackground(UIConstants.NORMAL_BACKGROUND);
switchCache = new UIComboBox(CACHE_LIST); switchCache = new UIComboBox(CACHE_LIST);
switchCache.addActionListener(switchStateL); switchCache.addActionListener(switchStateL);
numberSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 4); numberSpinner = new UISpinner(0, Integer.MAX_VALUE, 1);
numberSpinner.setNumberFieldColumns(3);
} }
private void showAllPanel() { private void showAllPanel() {

43
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.data.operator.DataOperator;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.preview.PreviewTablePane; 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.dialog.FineJOptionPane;
import com.fr.design.gui.iprogressbar.AutoProgressBar; import com.fr.design.gui.iprogressbar.AutoProgressBar;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JOptionPane; import javax.swing.JFrame;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -50,7 +49,6 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
private AutoProgressBar connectionBar; private AutoProgressBar connectionBar;
private ProcedureDataModel[] dataModels; private ProcedureDataModel[] dataModels;
private SwingWorker worker; private SwingWorker worker;
private BasicDialog dialog;
private int previewModel; private int previewModel;
public StoreProcedureDataWrapper(StoreProcedure storeProcedure, String storeprocedureName, String dsName) { public StoreProcedureDataWrapper(StoreProcedure storeProcedure, String storeprocedureName, String dsName) {
@ -71,19 +69,8 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
if (needLoad) { if (needLoad) {
setWorker(); setWorker();
} }
dialog = PreviewTablePane.getInstance().getDialog(); loadingBar = new AutoProgressBar(new JFrame(), Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) {
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) {
public void doMonitorCanceled() { public void doMonitorCanceled() {
getDialog().setVisible(false);
getWorker().cancel(true); getWorker().cancel(true);
} }
}; };
@ -103,7 +90,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
return columnNameList; return columnNameList;
} }
if (!createStore(false)) { 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>(); return new ArrayList<String>();
} }
columnNameList = Arrays.asList(procedureDataModel.getColumnName()); columnNameList = Arrays.asList(procedureDataModel.getColumnName());
@ -169,16 +156,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
*/ */
public void previewData(final int previewModel) { public void previewData(final int previewModel) {
this.previewModel = previewModel; this.previewModel = previewModel;
new SwingWorker() { connectionBar = new AutoProgressBar(new JFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Now_Create_Connection"), "", 0, 100) {
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) {
public void doMonitorCanceled() { public void doMonitorCanceled() {
connectionBar.close(); connectionBar.close();
worker.cancel(true); worker.cancel(true);
@ -190,13 +168,13 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
private void setWorker() { private void setWorker() {
worker = new SwingWorker<Void, Void>() { worker = new SwingWorker<Void, Void>() {
protected Void doInBackground() throws Exception { protected Void doInBackground() throws Exception {
loadingBar.close();
PreviewTablePane.resetPreviewTable();
connectionBar.start(); connectionBar.start();
boolean status = DataOperator.getInstance().testConnection(((StoreProcedure) getTableData()).getDatabaseConnection()); boolean status = DataOperator.getInstance().testConnection(((StoreProcedure) getTableData()).getDatabaseConnection());
if (!status) { if (!status) {
connectionBar.close(); connectionBar.close();
// bug 61345 预览失败时,关闭窗口 throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
dialog.setVisible(false);
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
} }
connectionBar.close(); connectionBar.close();
storeProcedure.resetDataModelList(); storeProcedure.resetDataModelList();
@ -208,7 +186,6 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
try { try {
get(); get();
loadingBar.close(); loadingBar.close();
dialog.setVisible(false);
switch (previewModel) { switch (previewModel) {
case StoreProcedureDataWrapper.PREVIEW_ALL: case StoreProcedureDataWrapper.PREVIEW_ALL:
PreviewTablePane.previewStoreDataWithAllDs(dataModels); PreviewTablePane.previewStoreDataWithAllDs(dataModels);
@ -228,10 +205,6 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
}; };
} }
private BasicDialog getDialog() {
return this.dialog;
}
private SwingWorker getWorker() { private SwingWorker getWorker() {
return this.worker; return this.worker;
} }

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

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

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

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

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.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.util.Collection;
public abstract class JListControlPane extends JControlPane implements ListControlPaneProvider { public abstract class JListControlPane extends JControlPane implements ListControlPaneProvider {
private static final String LIST_NAME = "JControl_List"; private static final String LIST_NAME = "JControl_List";
@ -190,9 +191,9 @@ public abstract class JListControlPane extends JControlPane implements ListContr
return getHelper().getSelectedName(); return getHelper().getSelectedName();
} }
protected boolean isNameRepeated(java.util.List[] list, String name) { protected boolean isNameRepeated(Collection[] collections, String name) {
for (int i = 0; i < list.length; i++) { for (int i = 0; i < collections.length; i++) {
if (list[i].contains(name)) { if (collections[i].contains(name)) {
isNameRepeated = true; isNameRepeated = true;
return 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); 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.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.List; 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 { public class JTreeAutoBuildPane extends BasicPane implements PreviewLabel.Previewable, EditOrNewLabel.Editable {
private TreeTableDataComboBox treeTableDataComboBox; private TreeTableDataComboBox treeTableDataComboBox;
@ -61,6 +61,23 @@ public class JTreeAutoBuildPane extends BasicPane implements PreviewLabel.Previe
tdChange(); 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); selectTreeDataPanel.add(treeTableDataComboBox);
treeTableDataComboBox.setPreferredSize(new Dimension(200, 25)); treeTableDataComboBox.setPreferredSize(new Dimension(200, 25));
treeTableDataComboBox.setSelectedIndex(-1); treeTableDataComboBox.setSelectedIndex(-1);

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

@ -1,17 +1,16 @@
package com.fr.design.gui.frpane; package com.fr.design.gui.frpane;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.style.NumberDragBar; import com.fr.design.gui.style.NumberDragBar;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Dimension;
public class UINumberDragPane extends BasicBeanPane<Double> implements GlobalNameObserver { public class UINumberDragPane extends BasicBeanPane<Double> implements GlobalNameObserver {
private static final long serialVersionUID = -8681716725163358249L; private static final long serialVersionUID = -8681716725163358249L;
@ -35,7 +34,7 @@ public class UINumberDragPane extends BasicBeanPane<Double> implements GlobalNam
public UINumberDragPane(double minValue, double maxValue, double dierta) { public UINumberDragPane(double minValue, double maxValue, double dierta) {
dragBar = new NumberDragBar((int) minValue, (int) maxValue); dragBar = new NumberDragBar((int) minValue, (int) maxValue);
spinner = new UISpinner(minValue, maxValue, dierta, minValue); spinner = createUISpinner(minValue, maxValue, dierta);
spinner.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")); spinner.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation"));
this.setLayout(new BorderLayout(4, 0)); this.setLayout(new BorderLayout(4, 0));
this.add(spinner, BorderLayout.EAST); this.add(spinner, BorderLayout.EAST);
@ -66,6 +65,10 @@ public class UINumberDragPane extends BasicBeanPane<Double> implements GlobalNam
}); });
} }
protected UISpinner createUISpinner(double minValue, double maxValue, double dierta) {
return new UISpinner(minValue, maxValue, dierta, minValue);
}
/** /**
* 添加事件 * 添加事件
* @param l 事件 * @param l 事件

10
designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java

@ -3,11 +3,12 @@ package com.fr.design.gui.iprogressbar;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JLabel; import javax.swing.JLabel;
@ -57,7 +58,10 @@ public class ProgressDialog extends UIDialog {
progressBar.setMaximum(1000); progressBar.setMaximum(1000);
panel.add(progressBar, BorderLayout.CENTER); panel.add(progressBar, BorderLayout.CENTER);
text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Project"), JLabel.CENTER); text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Project"), JLabel.CENTER);
FRFont font = FRFont.getInstance().applySize(14).applyForeground(new ColorUIResource(333334)); FRFont font = DesignUtils
.getDefaultGUIFont()
.applySize(14)
.applyForeground(new ColorUIResource(333334));
text.setFont(font); text.setFont(font);
panel.add(text, BorderLayout.SOUTH); panel.add(text, BorderLayout.SOUTH);
panel.setVisible(true); panel.setVisible(true);

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

@ -56,10 +56,6 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
textField.setValue(defaultValue); textField.setValue(defaultValue);
} }
public UISpinner(double minValue, double maxValue, double dierta, int numberFieldColumns) {
this.numberFieldColumns = numberFieldColumns;
init(minValue, maxValue, dierta);
}
private void init(double minValue, double maxValue, double dierta) { private void init(double minValue, double maxValue, double dierta) {
this.minValue = minValue; this.minValue = minValue;
this.maxValue = maxValue; this.maxValue = maxValue;
@ -169,6 +165,13 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
fireStateChanged(); fireStateChanged();
} }
/**
* 设置Spinner内的数字输入框列数
* @param numberFieldColumns 输入框列数
*/
public void setNumberFieldColumns(int numberFieldColumns) {
textField.setColumns(numberFieldColumns);
}
public void setEnabled(boolean flag) { public void setEnabled(boolean flag) {
super.setEnabled(flag); super.setEnabled(flag);

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.base.FRContext;
import com.fr.design.constants.UIConstants; 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.ExpandMutableTreeNode;
import com.fr.design.gui.itree.refreshabletree.RefreshableJTree; import com.fr.design.gui.itree.refreshabletree.RefreshableJTree;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -14,13 +13,13 @@ import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.BorderFactory;
import javax.swing.JTree; import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -79,14 +78,7 @@ public class EnvFileTree extends RefreshableJTree {
this.setIcon(null); this.setIcon(null);
this.setText(PENDING.toString()); this.setText(PENDING.toString());
} }
// 这里新建一个Label作为render是因为JTree在动态刷新的时候,节点上render画布的的宽度不会变,会使得一部分比较长的数据显示为"..." this.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));
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.setBackgroundNonSelectionColor(UIConstants.TREE_BACKGROUND); this.setBackgroundNonSelectionColor(UIConstants.TREE_BACKGROUND);
this.setTextSelectionColor(Color.WHITE); this.setTextSelectionColor(Color.WHITE);
this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE); 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 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.ChangeEvent;
import javax.swing.event.ChangeListener; 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.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.Vector; import java.util.Vector;
@ -67,11 +77,20 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private UIToggleButton subPane; private UIToggleButton subPane;
private JPanel linePane; private JPanel linePane;
private int italic_bold; private int italic_bold;
/**
* LeftPane和RightPane之间的间隙也是fontSizeStyleComboBox与fontSizeComboBox之间的间隙之前的默认值为VGAP_LARGE
*/
private int hGapBetweenLeftPaneAndRightPane = LayoutConstants.VGAP_LARGE;
public FRFontPane() { public FRFontPane() {
this.initComponents(); this.initComponents();
} }
public FRFontPane(int hGapBetweenLeftPaneAndRightPane) {
this.hGapBetweenLeftPaneAndRightPane = hGapBetweenLeftPaneAndRightPane;
this.initComponents();
}
public static void main(String[] args) { public static void main(String[] args) {
JFrame jf = new JFrame("test"); JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
@ -345,7 +364,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private JPanel createPane() { private JPanel createPane() {
JPanel createPane = new JPanel(new BorderLayout()); JPanel createPane = new JPanel(new BorderLayout());
createPane.add(fontNameComboBox, BorderLayout.NORTH); 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)); jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
createPane.add(jPanel, BorderLayout.CENTER); createPane.add(jPanel, BorderLayout.CENTER);
return createPane; return createPane;

9
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.event.*;
import java.awt.datatransfer.*; import java.awt.datatransfer.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.geom.Line2D;
import java.io.*; import java.io.*;
import javax.swing.*; import javax.swing.*;
import javax.swing.plaf.*; import javax.swing.plaf.*;
@ -454,9 +455,11 @@ public class ConfigurableCaret extends DefaultCaret {
// A thicker vertical line. // A thicker vertical line.
case THICK_VERTICAL_LINE_STYLE: case THICK_VERTICAL_LINE_STYLE:
g.drawLine(r.x,r.y, r.x,r.y+r.height); Graphics2D g2 = (Graphics2D) g;
r.x++; g2.setStroke(new BasicStroke(2));
g.drawLine(r.x,r.y, r.x,r.y+r.height); // 向右再移动一个位置 避免光标太接近文字内容
// REPORT-41895 光标上方超出背景高亮的部分不会闪烁,会形成一个停留的小点,因此将光标的超出部分截去
g2.draw(new Line2D.Float(r.x + 1, r.y + 1, r.x + 1, r.y + r.height));
break; break;
} // End of switch (style). } // 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); set.add(Locale.TAIWAN);
return set; 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;
}
}
} }

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

@ -548,10 +548,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
contentHeight = layeredPane.getHeight(); contentHeight = layeredPane.getHeight();
contentWidth = layeredPane.getWidth(); contentWidth = layeredPane.getWidth();
layeredPane.remove(basePane); // 这个地方remove和add都是一个对象 完全没有必要remove再add 改变了窗口大小重新设置下 然后有repaint即可
basePane.setBounds(0, 0, contentWidth, contentHeight); basePane.setBounds(0, 0, contentWidth, contentHeight);
layeredPane.add(basePane);
layeredPane.repaint(); layeredPane.repaint();
layeredPane.revalidate();
} }
/** /**
@ -746,11 +746,15 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
*/ */
public void checkCombineUp(boolean flag, ArrayList<String> al) { public void checkCombineUp(boolean flag, ArrayList<String> al) {
//Yvan: 检查当前是否为WORK_SHEET状态,因为只有WORK_SHEET中含有格式刷组件,此时是不需要进行checkComponentsByNames的 //Yvan: 检查当前是否为WORK_SHEET状态,因为只有WORK_SHEET中含有格式刷组件,此时是不需要进行checkComponentsByNames的
if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getMenuState() == DesignState.WORK_SHEET) { JTemplate<?, ?> jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jTemplate != null) {
// 第一个条件满足后还需要添加一重判断,判断是编辑报表块还是参数面板,编辑报表块时则直接return
if (jTemplate.getMenuState() == DesignState.WORK_SHEET && !jTemplate.isUpMode()) {
return; return;
} }
combineUp.checkComponentsByNames(flag, al); combineUp.checkComponentsByNames(flag, al);
} }
}
/** /**
* 刷新工具条. * 刷新工具条.

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.setHorizontalAlignment(SwingConstants.RIGHT);
newNameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); newNameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
newNameLabel.setPreferredSize(new Dimension(118, 15)); //newNameLabel.setPreferredSize(new Dimension(118, 15));
// 重命名输入框 // 重命名输入框
nameField = new UITextField(oldName); nameField = new UITextField(oldName);
@ -578,7 +578,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
} }
}); });
nameField.selectAll(); nameField.selectAll();
nameField.setPreferredSize(new Dimension(180, 20)); nameField.setPreferredSize(new Dimension(170, 20));
JPanel topPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 5)); JPanel topPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 5));
topPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 0, 15)); topPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 0, 15));

40
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.icontainer.UIEastResizableContainer;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.VerticalFlowLayout; 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.ui.util.UIUtil;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.utils.gui.GUIPaintUtils;
@ -171,7 +173,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} }
updateAllPropertyPane(); updateAllPropertyPane();
} }
}); } });
}
}, filter); }, filter);
PluginListenerRegistration.getInstance().listen( PluginListenerRegistration.getInstance().listen(
PluginEventType.BeforeStop, PluginEventType.BeforeStop,
@ -225,7 +228,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
itemBean.getBtnIconName(), itemBean.getBtnIconName(),
itemBean.getBtnIconBaseDir(), itemBean.getBtnIconBaseDir(),
itemBean.getVisibleModes(), itemBean.getVisibleModes(),
itemBean.getEnableModes()); itemBean.getEnableModes(),
itemBean.getSnapChat(),
itemBean.getPromptWindow());
UIButton button = propertyItem.getButton(); UIButton button = propertyItem.getButton();
List<ActionListener> buttonListeners = itemBean.getButtonListeners(); List<ActionListener> buttonListeners = itemBean.getButtonListeners();
if (buttonListeners != null) { if (buttonListeners != null) {
@ -324,6 +329,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
cellElement.popupDialog.showDefaultPane(); cellElement.popupDialog.showDefaultPane();
} }
} }
// 禁用单元格元素tab // 禁用单元格元素tab
private void enableCellElementPane(PropertyItem cellElement) { private void enableCellElementPane(PropertyItem cellElement) {
cellElement.setEnabled(true); cellElement.setEnabled(true);
@ -381,7 +387,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
/** /**
* 可通过此方法判断当前的编辑模式 * 可通过此方法判断当前的编辑模式
* */ */
public PropertyMode getCurrentMode() { public PropertyMode getCurrentMode() {
return currentMode; return currentMode;
} }
@ -657,6 +663,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
class PropertyItem { class PropertyItem {
private SnapChat snapChat;
private UIButton button; private UIButton button;
private String name; // 用于 card 切换 private String name; // 用于 card 切换
private String title; // 用于显示 private String title; // 用于显示
@ -667,6 +674,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private FixedPopupPane popupPane; // 左侧固定弹出框 private FixedPopupPane popupPane; // 左侧固定弹出框
private PopupToolPane popupToolPane; // 弹出工具条 private PopupToolPane popupToolPane; // 弹出工具条
private PopupDialog popupDialog; // 弹出框 private PopupDialog popupDialog; // 弹出框
private PromptWindow promptWindow; //提示窗
private boolean isPoppedOut = false; // 是否弹出 private boolean isPoppedOut = false; // 是否弹出
private boolean isVisible = true; // 是否可见 private boolean isVisible = true; // 是否可见
private boolean replace = false; // 是否被替代 private boolean replace = false; // 是否被替代
@ -687,14 +695,16 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public PropertyItem(String name, String title, String btnIconName, PropertyMode[] visibleModes, PropertyMode[] enableModes) { 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.name = name;
this.title = title; this.title = title;
this.btnIconName = btnIconName; this.btnIconName = btnIconName;
this.iconBaseDir = iconBaseDir; this.iconBaseDir = iconBaseDir;
this.snapChat = snapChat;
this.promptWindow = promptWindow;
initButton(); initButton();
initPropertyPanel(); initPropertyPanel();
initModes(visibleModes, enableModes); initModes(visibleModes, enableModes);
@ -872,9 +882,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT); return new Dimension(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT);
} }
@Override @Override
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
if (snapChat != null && !snapChat.hasRead()) {
SnapChatUtil.paintPropertyItemPoint(g, getBounds());
}
} }
}; };
button.set4LargeToolbarButton(); button.set4LargeToolbarButton();
@ -902,6 +916,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
popupFixedPane(); popupFixedPane();
} }
setTabButtonSelected(); setTabButtonSelected();
if (snapChat != null && !snapChat.hasRead()) {
snapChat.markRead();
if (promptWindow != null) {
promptWindow.showWindow();
}
}
} }
}); });
button.setToolTipText(title); button.setToolTipText(title);
@ -1015,8 +1035,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} }
/** /**
* @Description:刷新currentPopupPane面板位置当设计器缩放时会调用这个函数
* @param * @param
* @Description:刷新currentPopupPane面板位置当设计器缩放时会调用这个函数
* @return: * @return:
* @Author: Henry.Wang * @Author: Henry.Wang
* @date: 2020/7/30 11:39 * @date: 2020/7/30 11:39
@ -1031,8 +1051,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} }
/** /**
* @Description:清空currentPopupPane数据当切换模板时会调用这个函数
* @param * @param
* @Description:清空currentPopupPane数据当切换模板时会调用这个函数
* @return: * @return:
* @Author: Henry.Wang * @Author: Henry.Wang
* @date: 2020/7/30 11:42 * @date: 2020/7/30 11:42
@ -1071,12 +1091,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} }
repaint(); repaint();
} }
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (e.getX() >= ARROW_RANGE_START) { if (e.getX() >= ARROW_RANGE_START) {
onPop(); onPop();
} }
} }
@Override @Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
mouseDownCompCoords = null; mouseDownCompCoords = null;
@ -1084,6 +1106,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
contentPane.setBackground(originColor); contentPane.setBackground(originColor);
} }
} }
@Override @Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
if (e.getX() < ARROW_RANGE_START) { if (e.getX() < ARROW_RANGE_START) {
@ -1105,6 +1128,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} }
repaint(); repaint();
} }
@Override @Override
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
if (isMovable && mouseDownCompCoords != null) { if (isMovable && mouseDownCompCoords != null) {
@ -1217,6 +1241,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private Container contentPane; private Container contentPane;
private JPanel defaultPane; // 无可用配置项 private JPanel defaultPane; // 无可用配置项
private PropertyItem propertyItem; private PropertyItem propertyItem;
public PopupDialog(PropertyItem propertyItem) { public PopupDialog(PropertyItem propertyItem) {
super(DesignerContext.getDesignerFrame()); super(DesignerContext.getDesignerFrame());
container = getContentPane(); container = getContentPane();
@ -1319,6 +1344,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
mouseDownCompCoords = e.getLocationOnScreen(); mouseDownCompCoords = e.getLocationOnScreen();
} }
} }
@Override @Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
mouseDownCompCoords = null; 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();
}

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

@ -1,5 +1,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.design.notification.SnapChat;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.List; import java.util.List;
@ -12,6 +14,8 @@ public class PropertyItemBean {
private String title; private String title;
private String btnIconName; private String btnIconName;
private String btnIconBaseDir; private String btnIconBaseDir;
private SnapChat snapChat;
private PromptWindow promptWindow;
private EastRegionContainerPane.PropertyMode[] visibleModes; private EastRegionContainerPane.PropertyMode[] visibleModes;
private EastRegionContainerPane.PropertyMode[] enableModes; private EastRegionContainerPane.PropertyMode[] enableModes;
private List<ActionListener> buttonListeners; private List<ActionListener> buttonListeners;
@ -52,6 +56,22 @@ public class PropertyItemBean {
this.btnIconBaseDir = 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() { public EastRegionContainerPane.PropertyMode[] getVisibleModes() {
return visibleModes; return visibleModes;
} }

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

35
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.gui.imenu.UIScrollMenu;
import com.fr.design.notification.SnapChat; import com.fr.design.notification.SnapChat;
import com.fr.design.notification.SnapChatConfig; import com.fr.design.notification.SnapChatConfig;
import com.fr.design.notification.SnapChatFactory;
import com.fr.design.notification.SnapChatKey; import com.fr.design.notification.SnapChatKey;
import javax.swing.JMenu; import javax.swing.JMenu;
@ -22,42 +23,44 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat {
private SnapChatKey uniqueKey; private SnapChatKey uniqueKey;
private SnapChatMenuUI menuUI = new SnapChatMenuUI(this); private SnapChatMenuUI menuUI = new SnapChatMenuUI(this);
private SnapChat snapChat ;
public SnapChatMenuDef(String name, SnapChatKey uniqueKey) { public SnapChatMenuDef(String name, SnapChatKey uniqueKey) {
super(name); super(name);
this.uniqueKey = uniqueKey; this.uniqueKey = uniqueKey;
snapChat = SnapChatFactory.createSnapChat(true, uniqueKey);
} }
public SnapChatMenuDef(Boolean rePaint, SnapChatKey uniqueKey) { public SnapChatMenuDef(Boolean rePaint, SnapChatKey uniqueKey) {
super(rePaint); super(rePaint);
this.uniqueKey = uniqueKey; this.uniqueKey = uniqueKey;
snapChat = SnapChatFactory.createSnapChat(true, uniqueKey);
} }
public SnapChatMenuDef(String name, char mnemonic, SnapChatKey uniqueKey) { public SnapChatMenuDef(String name, char mnemonic, SnapChatKey uniqueKey) {
super(name, mnemonic); super(name, mnemonic);
this.uniqueKey = uniqueKey; this.uniqueKey = uniqueKey;
snapChat = SnapChatFactory.createSnapChat(true, uniqueKey);
} }
@Override @Override
public boolean hasRead() { public boolean hasRead() {
return snapChat.hasRead();
String calcKey = calcKey();
Boolean val = SnapChatConfig.getInstance().hasRead(calcKey);
// 默认读过了。
return val == null ? defaultStatus() : val;
} }
@Override @Override
public void markRead() { public void markRead() {
snapChat.markRead();
String calcKey = calcKey();
SnapChatConfig.getInstance().markRead(calcKey);
} }
@Override @Override
public boolean defaultStatus() { public boolean defaultStatus() {
return snapChat.defaultStatus();
}
return true; @Override
public SnapChatKey key() {
return snapChat.key();
} }
@Override @Override
@ -74,13 +77,6 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat {
super.insertShortCut(index, shortCut); super.insertShortCut(index, shortCut);
} }
@Override
public SnapChatKey key() {
return this.uniqueKey;
}
@Override @Override
protected MenuListener createMenuListener() { protected MenuListener createMenuListener() {
@ -97,17 +93,12 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat {
if (shortCut instanceof SnapChatUpdateAction) { if (shortCut instanceof SnapChatUpdateAction) {
SnapChatUpdateAction action = (SnapChatUpdateAction) shortCut; SnapChatUpdateAction action = (SnapChatUpdateAction) shortCut;
if (!action.hasRead()) { if (!action.hasRead()) {
String calcKey = calcKey(); String calcKey = snapChat.calcKey();
SnapChatConfig.getInstance().resetRead(calcKey); SnapChatConfig.getInstance().resetRead(calcKey);
} }
} }
} }
private String calcKey() {
return key().calc();
}
@Override @Override
protected UIMenu createJMenu0() { protected UIMenu createJMenu0() {

25
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.actions.UpdateAction;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.notification.SnapChat; 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 com.fr.design.notification.SnapChatKey;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -14,14 +14,15 @@ import java.awt.event.ActionEvent;
public abstract class SnapChatUpdateAction extends UpdateAction implements SnapChat { public abstract class SnapChatUpdateAction extends UpdateAction implements SnapChat {
private SnapChatKey uniqueKey; private SnapChatKey uniqueKey;
private SnapChat snapChat ;
public SnapChatUpdateAction(SnapChatKey uniqueKey) { public SnapChatUpdateAction(SnapChatKey uniqueKey) {
this.uniqueKey = uniqueKey; this.uniqueKey = uniqueKey;
snapChat = SnapChatFactory.createSnapChat(false, uniqueKey);
} }
@Override @Override
public final void actionPerformed(ActionEvent e) { public final void actionPerformed(ActionEvent e) {
markRead(); markRead();
actionPerformed0(e); actionPerformed0(e);
} }
@ -30,34 +31,22 @@ public abstract class SnapChatUpdateAction extends UpdateAction implements SnapC
@Override @Override
public boolean hasRead() { public boolean hasRead() {
return snapChat.hasRead();
String calcKey = calcKey();
Boolean val = SnapChatConfig.getInstance().hasRead(calcKey);
return val == null ? defaultStatus() : val;
} }
@Override @Override
public void markRead() { public void markRead() {
snapChat.markRead();
String calcKey = calcKey();
SnapChatConfig.getInstance().markRead(calcKey);
} }
@Override @Override
public boolean defaultStatus() { public boolean defaultStatus() {
return snapChat.defaultStatus();
return false;
} }
@Override @Override
public SnapChatKey key() { public SnapChatKey key() {
return snapChat.key();
return this.uniqueKey;
}
private String calcKey() {
return key().calc();
} }
@Override @Override

27
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 * created by Harrison on 2020/03/22
**/ **/
public class SnapChatUtil { 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) { public static void paintSnapChat(Graphics g, Rectangle textRect) {
double x = textRect.getWidth() + textRect.getX() + 2;
Color oldColor = g.getColor();
double x = textRect.getWidth();
x += textRect.getX();
x += 2;
double y = textRect.getY(); 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; Graphics2D g2d = (Graphics2D) g;
g2d.setColor(Color.red); g2d.setColor(Color.red);
Ellipse2D.Double shape =
new Ellipse2D.Double(x, y, 4, 4);
g2d.fill(shape); g2d.fill(shape);
g2d.draw(shape); g2d.draw(shape);
g2d.setColor(oldColor); 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 字符标志 * @return 字符标志
*/ */
SnapChatKey key(); 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);
}
};
}
}

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

@ -1,9 +1,18 @@
package com.fr.design.notification; package com.fr.design.notification;
import com.fr.plugin.context.PluginContext;
/** /**
* created by Harrison on 2020/03/16 * created by Harrison on 2020/03/16
**/ **/
public interface SnapChatKey { public interface SnapChatKey {
String calc(); 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.base.BaseUtils;
import com.fr.general.ComparatorUtils; 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(); return "Name:" + this.getName() + "\tObject:" + this.getObject();
} }
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes"})
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
NameObject newNameObject = (NameObject)super.clone(); NameObject newNameObject = (NameObject)super.clone();
newNameObject.object = BaseUtils.cloneObject(this.object); newNameObject.object = StableUtils.cloneObject(this.object);
return newNameObject; return newNameObject;
} }

4
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.config.ServerPreferenceConfig;
import com.fr.design.extra.WebViewDlgHelper; import com.fr.design.extra.WebViewDlgHelper;
import com.fr.design.jdk.JdkVersion;
import com.fr.design.upm.UpmFinder; import com.fr.design.upm.UpmFinder;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.os.Arch; import com.fr.stable.os.Arch;
import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSBasedAction;
@ -21,7 +23,7 @@ public class PMDialogAction implements OSBasedAction {
DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null); DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null);
return; return;
} }
if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM()) { if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() && JdkVersion.LE_8.support()) {
UpmFinder.showUPMDialog(); UpmFinder.showUPMDialog();
} else { } else {
WebViewDlgHelper.createPluginDialog(); WebViewDlgHelper.createPluginDialog();

19
designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java

@ -7,7 +7,7 @@ import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.NameableSelfCreator; import com.fr.design.gui.controlpane.NameableSelfCreator;
import com.fr.design.gui.controlpane.UnrepeatedNameHelper; import com.fr.design.gui.controlpane.UnrepeatedNameHelper;
import com.fr.design.gui.ilist.ModNameActionListener; import com.fr.design.i18n.Toolkit;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -23,17 +23,12 @@ public class ParameterArrayPane extends JListControlPane {
*/ */
public ParameterArrayPane() { public ParameterArrayPane() {
super(); super();
this.addModNameActionListener(new ModNameActionListener() { this.addModNameActionListener((index, oldName, newName) -> populateSelectedValue());
public void nameModed(int index, String oldName, String newName) {
populateSelectedValue();
}
});
this.addEditingListener(new PropertyChangeAdapter() { this.addEditingListener(new PropertyChangeAdapter() {
public void propertyChange() { public void propertyChange() {
Parameter[] parameters = ParameterConfig.getInstance().getGlobalParameters(); Parameter[] parameters = ParameterConfig.getInstance().getGlobalParameters();
String[] allListNames = nameableList.getAllNames(); String[] allListNames = nameableList.getAllNames();
allListNames[nameableList.getSelectedIndex()] = StringUtils.EMPTY; allListNames[editingIndex] = StringUtils.EMPTY;
String tempName = getEditingName(); String tempName = getEditingName();
if (StringUtils.isEmpty(tempName)) { if (StringUtils.isEmpty(tempName)) {
nameableList.stopEditing(); nameableList.stopEditing();
@ -45,7 +40,7 @@ public class ParameterArrayPane extends JListControlPane {
&& isNameRepeated(new List[]{Arrays.asList(parameters), Arrays.asList(allListNames)}, tempName)) { && isNameRepeated(new List[]{Arrays.asList(parameters), Arrays.asList(allListNames)}, tempName)) {
nameableList.stopEditing(); nameableList.stopEditing();
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Duplicate_Parameter_Name")); Toolkit.i18nText("Fine-Design_Basic_Duplicate_Parameter_Name"));
setIllegalIndex(editingIndex); setIllegalIndex(editingIndex);
} }
} }
@ -55,7 +50,7 @@ public class ParameterArrayPane extends JListControlPane {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_Schedule_Template_Parameter"); return Toolkit.i18nText("Fine-Design_Basic_Engine_Schedule_Template_Parameter");
} }
/** /**
@ -65,7 +60,7 @@ public class ParameterArrayPane extends JListControlPane {
*/ */
public NameableCreator[] createNameableCreators() { public NameableCreator[] createNameableCreators() {
return new NameableCreator[]{ return new NameableCreator[]{
new NameableSelfCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_Parameter_Name"), Parameter.class, ParameterPane.class) { new NameableSelfCreator(Toolkit.i18nText("Fine-Design_Basic_Engine_Parameter_Name"), Parameter.class, ParameterPane.class) {
public Parameter createNameable(UnrepeatedNameHelper helper) { public Parameter createNameable(UnrepeatedNameHelper helper) {
// 返回参数设置面板. // 返回参数设置面板.
return new Parameter(helper.createUnrepeatedName("p")); return new Parameter(helper.createUnrepeatedName("p"));
@ -89,7 +84,7 @@ public class ParameterArrayPane extends JListControlPane {
// Nameable[]居然不能强转成Parameter[],一定要这么写... // Nameable[]居然不能强转成Parameter[],一定要这么写...
Nameable[] res = this.update(); Nameable[] res = this.update();
Parameter[] res_array = new Parameter[res.length]; Parameter[] res_array = new Parameter[res.length];
java.util.Arrays.asList(res).toArray(res_array); Arrays.asList(res).toArray(res_array);
return res_array; return res_array;
} }

20
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.file.HistoryTemplateListCache;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; 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.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.Iterator; import java.util.Iterator;
@ -37,6 +41,7 @@ import java.util.Map.Entry;
/** /**
* The dialog used to input parameter. * The dialog used to input parameter.
*
* @editor zhou * @editor zhou
* @since 2012-3-26上午11:09:45 * @since 2012-3-26上午11:09:45
*/ */
@ -51,6 +56,8 @@ public class ParameterInputPane extends BasicPane {
private boolean allowBlank = true; private boolean allowBlank = true;
private FlowTableLayoutHelper flowTableLayoutHelper;
/** /**
* Constructor. * Constructor.
*/ */
@ -71,7 +78,7 @@ public class ParameterInputPane extends BasicPane {
this.add(new JScrollPane(contentPane), BorderLayout.CENTER); this.add(new JScrollPane(contentPane), BorderLayout.CENTER);
contentPane.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameters") + ":")); 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>();
@ -112,7 +119,12 @@ public class ParameterInputPane extends BasicPane {
nameAddedList.add(parameter.getName()); nameAddedList.add(parameter.getName());
} }
} }
}
@Override
public void addNotify() {
super.addNotify();
// windows 高DPI下,使用getPreferredSize必须在添加到容器之后,否则得到的数值不准确,因此先放到这调整大小
flowTableLayoutHelper.adjustLabelWidth(); flowTableLayoutHelper.adjustLabelWidth();
} }

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

@ -393,6 +393,7 @@ public class FormatPane extends BasicPane {
patternTextField.setEditable(true); patternTextField.setEditable(true);
patternList.setEnabled(true); patternList.setEnabled(true);
int contents = getContents(source); int contents = getContents(source);
String[] patternArray = FormatField.getInstance().getFormatArray(contents); String[] patternArray = FormatField.getInstance().getFormatArray(contents);
@ -407,6 +408,7 @@ public class FormatPane extends BasicPane {
//maybe need to select the first item. //maybe need to select the first item.
String text = patternTextField.getText(); String text = patternTextField.getText();
if (hasPattenText(text, patternModel)) { if (hasPattenText(text, patternModel)) {
String pattern = null; String pattern = null;
if (format instanceof DecimalFormat) { if (format instanceof DecimalFormat) {
@ -418,6 +420,10 @@ public class FormatPane extends BasicPane {
if (pattern != null) { if (pattern != null) {
patternList.setSelectedValue(pattern, true); patternList.setSelectedValue(pattern, true);
if (patternList.getSelectedIndex() == -1) {
//patten不在下拉框里面
patternList.setSelectedIndex(0);
}
} else { } else {
patternList.setSelectedIndex(0); patternList.setSelectedIndex(0);
} }
@ -426,13 +432,13 @@ public class FormatPane extends BasicPane {
}; };
private boolean hasPattenText (String text, DefaultListModel patternModel) { 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() { private void setPatternTextEnable() {
patternTextField.setEnabled(false); patternTextField.setEnabled(false);
patternTextField.setEditable(false); patternTextField.setEditable(false);
patternTextField.setText(""); patternTextField.setText(StringUtils.EMPTY);
patternList.setEnabled(false); patternList.setEnabled(false);
} }

3
designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBackgroundPane.java

@ -26,6 +26,7 @@ import java.awt.event.ActionListener;
*/ */
public class GradientBackgroundPane extends BackgroundDetailPane { public class GradientBackgroundPane extends BackgroundDetailPane {
private static final long serialVersionUID = -6854603990673031897L; private static final long serialVersionUID = -6854603990673031897L;
public static final int DEFAULT_GRADIENT_WIDTH = 254;
private UIRadioButton left2right, top2bottom; private UIRadioButton left2right, top2bottom;
private GradientBar gradientBar; private GradientBar gradientBar;
@ -41,7 +42,7 @@ public class GradientBackgroundPane extends BackgroundDetailPane {
// neil:增加渐变色拖动条 // neil:增加渐变色拖动条
JPanel gradientPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel gradientPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel blankJp = new JPanel(); JPanel blankJp = new JPanel();
gradientBar = new GradientBar(4, 254); gradientBar = new GradientBar(4, DEFAULT_GRADIENT_WIDTH);
blankJp.add(gradientBar); blankJp.add(gradientBar);
UILabel jl = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Drag_To_Select_Gradient")); UILabel jl = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Drag_To_Select_Gradient"));
jl.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); jl.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20));

10
designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java

@ -192,7 +192,15 @@ public class GradientBar extends JComponent implements UIObserver, ColorSelectab
} }
float[] dist = new float[list.size()]; float[] dist = new float[list.size()];
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
dist[i] = (float) ((list.get(i).getX() - 4) / (max - 4)); double value = list.get(i).getX() - 4;
double defaultMax = max - 4;
if (Double.compare(value, defaultMax) > 0) {
// 设置了预定义的渐变色 渐变色起始位置比较大 然后由预定义样式切换到自定义样式 做下等比例转换
dist[i] = (float) (value / (GradientBackgroundPane.DEFAULT_GRADIENT_WIDTH - 4));
list.get(i).setX(max * dist[i]);
} else {
dist[i] = (float) (value / defaultMax);
}
} }
LinearGradientPaint paint = new LinearGradientPaint(start, end, dist, c); LinearGradientPaint paint = new LinearGradientPaint(start, end, dist, c);

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

23
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.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
@ -17,6 +18,7 @@ import com.fr.workspace.WorkspaceEvent;
import javax.swing.*; import javax.swing.*;
import java.io.File; import java.io.File;
import java.util.Locale;
/** /**
* @author richie * @author richie
@ -27,6 +29,7 @@ public class UpmFinder {
private static final String UPM_DIR = "/upm"; private static final String UPM_DIR = "/upm";
private static final String MAIN_RESOURCE_PATH = UPM_DIR + "/plugin_design.html"; 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(); public static String installHome = FRContext.getCommonOperator().getWebRootPath();
@ -56,13 +59,20 @@ public class UpmFinder {
} }
public static void showUPMDialog() { public static void showUPMDialog() {
boolean flag = true; boolean hasJxBrowser = true;
try { try {
Class.forName("com.teamdev.jxbrowser.chromium.Browser"); Class.forName(JXBROWSER);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
flag = false; hasJxBrowser = false;
} }
if (flag) { if (hasJxBrowser) {
showUpmPane();
} else {
showUpdatePane();
}
}
private static void showUpmPane() {
if (!checkUPMResourcesExist()){ if (!checkUPMResourcesExist()){
// upm下载 // upm下载
int val = FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"), int val = FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"),
@ -87,8 +97,11 @@ public class UpmFinder {
} }
dialog.setVisible(true); dialog.setVisible(true);
} }
} else { }
private static void showUpdatePane() {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message")); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message"));
if (!GeneralContext.getLocale().equals(Locale.JAPAN)) {
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame()); UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.setAutoUpdateAfterInit(); dialog.setAutoUpdateAfterInit();
dialog.showDialog(); dialog.showDialog();

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

@ -6,23 +6,31 @@ import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.fun.DesignerEnvProcessor;
import com.fr.design.gui.UILookAndFeel; import com.fr.design.gui.UILookAndFeel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.exit.DesignerExiter; import com.fr.exit.DesignerExiter;
import com.fr.file.FileFILE; import com.fr.file.FileFILE;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.CommonCodeUtils; import com.fr.stable.CommonCodeUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.start.ServerStarter; import com.fr.start.ServerStarter;
import com.fr.value.NotNullLazyValue;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import org.jetbrains.annotations.NotNull;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.UIManager; import javax.swing.UIManager;
import java.awt.Desktop; import java.awt.Desktop;
@ -31,7 +39,6 @@ import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
@ -83,6 +90,7 @@ public class DesignUtils {
/** /**
* 判断设计器端口是否被其他程序占用 * 判断设计器端口是否被其他程序占用
* 尝试去通信无回应就是其他程序占用端口否则需要继续判断是否为设计器进程未关闭 * 尝试去通信无回应就是其他程序占用端口否则需要继续判断是否为设计器进程未关闭
*
* @return * @return
*/ */
public static boolean isPortOccupied() { public static boolean isPortOccupied() {
@ -191,8 +199,8 @@ public class DesignUtils {
} else if ("check".equals(line)) { } else if ("check".equals(line)) {
clientSend(new String[]{"response"}, socket); clientSend(new String[]{"response"}, socket);
} else if ("end".equals(line)) { } else if ("end".equals(line)) {
DesignerExiter.getInstance().execute(); } DesignerExiter.getInstance().execute();
else if (StringUtils.isNotEmpty(line)) { } else if (StringUtils.isNotEmpty(line)) {
File f = new File(line); File f = new File(line);
String path = f.getAbsolutePath(); String path = f.getAbsolutePath();
@ -248,6 +256,7 @@ public class DesignUtils {
// 刷新DesignerFrame里面的面板 // 刷新DesignerFrame里面的面板
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() { public void run() {
if (DesignerContext.getDesignerFrame() == null) { if (DesignerContext.getDesignerFrame() == null) {
return; return;
@ -269,7 +278,7 @@ public class DesignUtils {
FineLoggerFactory.getLogger().error("Substance Raven Graphite failed to initialize"); FineLoggerFactory.getLogger().error("Substance Raven Graphite failed to initialize");
} }
//获取当前系统语言下设计器用的默认字体 //获取当前系统语言下设计器用的默认字体
FRFont guiFRFont = getCurrentLocaleFont(); FRFont guiFRFont = getDefaultGUIFont();
//指定UIManager中字体 //指定UIManager中字体
Enumeration keys = UIManager.getDefaults().keys(); Enumeration keys = UIManager.getDefaults().keys();
while (keys.hasMoreElements()) { while (keys.hasMoreElements()) {
@ -285,19 +294,34 @@ public class DesignUtils {
return key.startsWith("TextField.") || key.startsWith("PasswordField."); return key.startsWith("TextField.") || key.startsWith("PasswordField.");
} }
private static FRFont getCurrentLocaleFont() { /**
* 获取当前系统语言下设计器界面使用的默认字体
*
* @return 默认字体
*/
public static FRFont getDefaultGUIFont() {
return CURRENT_LOCALE_FONT.getValue();
}
/**
* 获取当前系统语言下设计器用的默认字体
*/
private static final NotNullLazyValue<FRFont> CURRENT_LOCALE_FONT = new NotNullLazyValue<FRFont>() {
@NotNull
@Override
protected FRFont compute() {
FRFont guiFRFont; FRFont guiFRFont;
Locale defaultLocale = Locale.getDefault(); Locale defaultLocale = Locale.getDefault();
// JDK9 之后宋体在计算label中字母的空间上出现问题,暂时先用雅黑兼容,以后再统一字体
if (isDisplaySimSun(defaultLocale)) { if (StableUtils.getMajorJavaVersion() >= 9 && OperatingSystem.isWindows()) {
guiFRFont = getNamedFont("Microsoft YaHei");
} else if (isDisplaySimSun(defaultLocale)) {
guiFRFont = getNamedFont("SimSun"); guiFRFont = getNamedFont("SimSun");
} else { } else {
guiFRFont = getNamedFont("Dialog"); guiFRFont = getNamedFont("Dialog");
} }
//先初始化的设计器locale, 后初始化lookandfeel.如果顺序改了, 这边也要调整. String file = Toolkit.i18nText("Fine-Design_Basic_File");
Locale designerLocale = GeneralContext.getLocale();
String file = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_File");
char displayChar = file.charAt(0); char displayChar = file.charAt(0);
if (!guiFRFont.canDisplay(displayChar)) { if (!guiFRFont.canDisplay(displayChar)) {
//如果不能用默认的语言显示字体, 比如想在英文系统里用中文设计器 //如果不能用默认的语言显示字体, 比如想在英文系统里用中文设计器
@ -307,13 +331,14 @@ public class DesignUtils {
//比如想在中文或英文系统里用韩文设计器 //比如想在中文或英文系统里用韩文设计器
guiFRFont = getNamedFont("Dialog"); guiFRFont = getNamedFont("Dialog");
if (!guiFRFont.canDisplay(displayChar)) { if (!guiFRFont.canDisplay(displayChar)) {
FineLoggerFactory.getLogger().error(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_SimSun_Not_Found")); FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Base_SimSun_Not_Found"));
} }
} }
} }
return guiFRFont; return guiFRFont;
} }
};
private static FRFont getNamedFont(String name) { private static FRFont getNamedFont(String name) {
return FRFont.getInstance(name, Font.PLAIN, 12); return FRFont.getInstance(name, Font.PLAIN, 12);
@ -397,4 +422,23 @@ public class DesignUtils {
public static boolean sendFeedBack(FeedBackInfo feedBackInfo) throws Exception { public static boolean sendFeedBack(FeedBackInfo feedBackInfo) throws Exception {
return true; return true;
} }
public static boolean checkDesignerRemoteVersion() {
if (WorkContext.getCurrent().isLocal()) {
return true;
}
String envName = DesignerEnvManager.getEnvManager().getCurEnvName();
DesignerWorkspaceInfo selectedEnv = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName);
String localBranch;
String remoteBranch;
WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection();
localBranch = GeneralUtils.readFullBuildNO();
try {
remoteBranch = new FunctionalHttpRequest(connectionInfo).getServerBranch();
} catch (Exception e) {
return false;
}
return localBranch.contains("#") && localBranch.equals(remoteBranch);
}
} }

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

4
designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java

@ -53,6 +53,7 @@ import javax.swing.BorderFactory;
import javax.swing.DefaultCellEditor; import javax.swing.DefaultCellEditor;
import javax.swing.DefaultComboBoxModel; import javax.swing.DefaultComboBoxModel;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JFrame;
import javax.swing.JList; import javax.swing.JList;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -867,13 +868,14 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
textLabel = new UILabel(); textLabel = new UILabel();
textLabel.addMouseListener(new MouseAdapter() { textLabel.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
vPaneDLG.setAlwaysOnTop(true);
vPaneDLG.setVisible(true); vPaneDLG.setVisible(true);
} }
}); });
vPane = new ValuePane(types); vPane = new ValuePane(types);
vPaneDLG = vPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { vPaneDLG = vPane.showSmallWindow(new JFrame(), new DialogActionAdapter() {
public void doOk() { public void doOk() {
fireEditingStopped(); // Make the renderer fireEditingStopped(); // Make the renderer
// reappear. // reappear.

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

@ -1,7 +1,5 @@
package com.fr.env; package com.fr.env;
import com.fr.base.FRContext;
import com.fr.base.ServerConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
@ -145,6 +143,12 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
* https 证书路径输入框 * https 证书路径输入框
*/ */
private JPanel httpsCertFileInputPanel; private JPanel httpsCertFileInputPanel;
/**
* 当前远程工作目录是否为新创建的
*/
private boolean newCreated;
/** /**
* 主机名web应用Servlet端口监听器 * 主机名web应用Servlet端口监听器
*/ */
@ -329,12 +333,15 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
this.certPathInput.setText(certPath); this.certPathInput.setText(certPath);
this.certSecretKeyInput.setText(certSecretKey); this.certSecretKeyInput.setText(certSecretKey);
this.rememberPwdCheckbox.setSelected(rememberPwd); this.rememberPwdCheckbox.setSelected(rememberPwd);
this.newCreated = ob.isNewCreated();
} else { } else {
this.remoteWorkspaceURL = RemoteWorkspaceURL.createDefaultURL(); this.remoteWorkspaceURL = RemoteWorkspaceURL.createDefaultURL();
this.usernameInput.setText(StringUtils.EMPTY); this.usernameInput.setText(StringUtils.EMPTY);
this.passwordInput.setText(StringUtils.EMPTY); this.passwordInput.setText(StringUtils.EMPTY);
this.certPathInput.setText(StringUtils.EMPTY);
this.certSecretKeyInput.setText(StringUtils.EMPTY);
this.rememberPwdCheckbox.setSelected(true); this.rememberPwdCheckbox.setSelected(true);
this.newCreated = true;
} }
fillRemoteEnvURLField(); fillRemoteEnvURLField();
@ -366,7 +373,9 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
new String(this.certSecretKeyInput.getPassword()), new String(this.certSecretKeyInput.getPassword()),
rememberPwd); rememberPwd);
return RemoteDesignerWorkspaceInfo.create(connection); RemoteDesignerWorkspaceInfo info = RemoteDesignerWorkspaceInfo.create(connection);
info.setNewCreated(newCreated);
return info;
} }
@Override @Override
@ -444,38 +453,6 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
new double[]{FILL} 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();
} }
@ -599,9 +576,6 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
@Override @Override
protected TestConnectionResult doInBackground() throws Exception { protected TestConnectionResult doInBackground() throws Exception {
DesignerEnvManager.getEnvManager().setCertificatePath(connection.getCertPath());
DesignerEnvManager.getEnvManager().setCertificatePass(connection.getCertSecretKey());
try { try {
return TestConnectionResult.parse(WorkContext.getConnector().testConnection(connection), connection); return TestConnectionResult.parse(WorkContext.getConnector().testConnection(connection), connection);
} catch (WorkspaceAuthException ignored) { } catch (WorkspaceAuthException ignored) {

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

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

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

@ -5,7 +5,15 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.plugin.chart.base.AttrTooltipContent; 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.AttrTooltipCategoryFormat;
import com.fr.plugin.chart.base.format.AttrTooltipDataMaxFormat;
import com.fr.plugin.chart.base.format.AttrTooltipDataMedianFormat;
import com.fr.plugin.chart.base.format.AttrTooltipDataMinFormat;
import com.fr.plugin.chart.base.format.AttrTooltipDataNumberFormat;
import com.fr.plugin.chart.base.format.AttrTooltipDataOutlierFormat;
import com.fr.plugin.chart.base.format.AttrTooltipDataQ1Format;
import com.fr.plugin.chart.base.format.AttrTooltipDataQ3Format;
import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat;
import com.fr.plugin.chart.box.attr.AttrBoxTooltipContent; import com.fr.plugin.chart.box.attr.AttrBoxTooltipContent;
@ -47,6 +55,9 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
private JPanel dataNumberPane; private JPanel dataNumberPane;
private JPanel dataOutlierPane; private JPanel dataOutlierPane;
private JPanel richTextNumberPane;
private JPanel richTextOutlierPane;
public VanChartBoxTooltipContentPane(VanChartStylePane parent, JPanel showOnPane, boolean isDetailed) { public VanChartBoxTooltipContentPane(VanChartStylePane parent, JPanel showOnPane, boolean isDetailed) {
super(parent, showOnPane); super(parent, showOnPane);
checkFormatVisible(isDetailed); checkFormatVisible(isDetailed);
@ -144,6 +155,16 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
return commonPanel; return commonPanel;
} }
protected JPanel createRichFormatPanel() {
JPanel richFormatPanel = new JPanel(new BorderLayout());
richFormatPanel.add(createRichTextCateAndSeriesPane(), BorderLayout.NORTH);
richFormatPanel.add(createRichTextDataNumberPane(), BorderLayout.CENTER);
richFormatPanel.add(createRichTextDataDetailPane(), BorderLayout.SOUTH);
return richFormatPanel;
}
protected Component[][] getRichTextComponents() { protected Component[][] getRichTextComponents() {
return new Component[][]{ return new Component[][]{
new Component[]{getRichTextCategoryNameFormatPane(), null}, new Component[]{getRichTextCategoryNameFormatPane(), null},
@ -228,6 +249,72 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
return detailPane; return detailPane;
} }
private JPanel createRichTextCateAndSeriesPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p, p};
Component[][] cateAndSeries = new Component[][]{
new Component[]{null, null},
new Component[]{null, getRichTextCategoryNameFormatPane()},
new Component[]{null, getRichTextSeriesNameFormatPane()}
};
return TableLayoutHelper.createTableLayoutPane(cateAndSeries, rowSize, columnSize);
}
private JPanel createRichTextDataNumberPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p};
Component[][] dataNumber = new Component[][]{
new Component[]{null, null},
new Component[]{null, richTextNumber},
};
richTextNumberPane = TableLayoutHelper.createTableLayoutPane(dataNumber, rowSize, columnSize);
return richTextNumberPane;
}
private JPanel createRichTextDataDetailPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
JPanel detailPane = new JPanel(new BorderLayout());
Component[][] richTextDetail = new Component[][]{
new Component[]{null, null},
new Component[]{null, richTextMax},
new Component[]{new UILabel(getLabelContentTitle()), richTextQ3},
new Component[]{null, richTextMedian},
new Component[]{null, richTextQ1},
new Component[]{null, richTextMin}
};
Component[][] dataOutlier = new Component[][]{
new Component[]{null, null},
new Component[]{null, richTextOutlier},
};
richTextOutlierPane = TableLayoutHelper.createTableLayoutPane(dataOutlier, new double[]{p, p}, columnSize);
detailPane.add(TableLayoutHelper.createTableLayoutPane(richTextDetail, new double[]{p, p, p, p, p, p}, columnSize), BorderLayout.NORTH);
detailPane.add(richTextOutlierPane, BorderLayout.CENTER);
return detailPane;
}
public boolean isDirty() { public boolean isDirty() {
return getCategoryNameFormatPane().isDirty() return getCategoryNameFormatPane().isDirty()
|| getSeriesNameFormatPane().isDirty() || getSeriesNameFormatPane().isDirty()
@ -276,6 +363,7 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
} }
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
setRichTextAttr(new AttrTooltipRichText());
Map<String, String> params = getRichTextAttr().getParams(); Map<String, String> params = getRichTextAttr().getParams();
AttrTooltipCategoryFormat categoryFormat = attrTooltipContent.getRichTextCategoryFormat(); AttrTooltipCategoryFormat categoryFormat = attrTooltipContent.getRichTextCategoryFormat();
@ -289,24 +377,48 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
if (attrTooltipContent instanceof AttrBoxTooltipContent) { if (attrTooltipContent instanceof AttrBoxTooltipContent) {
AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent; AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent;
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = getFormatPaneGroup();
AttrTooltipFormat[] formatGroup = getFormatGroup(boxTooltipContent);
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
}
}
private VanChartFormatPaneWithoutCheckBox[] getFormatPaneGroup() {
if (detailed) {
return new VanChartFormatPaneWithoutCheckBox[]{
richTextNumber, richTextMax, richTextQ3, richTextMedian, richTextNumber, richTextMax, richTextQ3, richTextMedian,
richTextQ1, richTextMin, richTextOutlier richTextQ1, richTextMin, richTextOutlier
}; };
}
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ return new VanChartFormatPaneWithoutCheckBox[]{
boxTooltipContent.getRichTextNumber(), richTextMax, richTextQ3, richTextMedian, richTextQ1, richTextMin
boxTooltipContent.getRichTextMax(),
boxTooltipContent.getRichTextQ3(),
boxTooltipContent.getRichTextMedian(),
boxTooltipContent.getRichTextQ1(),
boxTooltipContent.getRichTextMin(),
boxTooltipContent.getRichTextOutlier()
}; };
}
populateRichTextFormat(formatPaneGroup, formatGroup); private AttrTooltipFormat[] getFormatGroup(AttrBoxTooltipContent boxTooltipContent) {
populateRichText(attrTooltipContent.getRichTextAttr()); AttrTooltipDataNumberFormat richTextNumber = boxTooltipContent.getRichTextNumber();
AttrTooltipDataMaxFormat richTextMaxFormat = boxTooltipContent.getRichTextMax();
AttrTooltipDataQ3Format richTextQ3Format = boxTooltipContent.getRichTextQ3();
AttrTooltipDataMedianFormat richTextMedianFormat = boxTooltipContent.getRichTextMedian();
AttrTooltipDataQ1Format richTextQ1Format = boxTooltipContent.getRichTextQ1();
AttrTooltipDataMinFormat richTextMinFormat = boxTooltipContent.getRichTextMin();
AttrTooltipDataOutlierFormat richTextOutlierFormat = boxTooltipContent.getRichTextOutlier();
if (detailed) {
return new AttrTooltipFormat[]{
richTextNumber, richTextMaxFormat, richTextQ3Format, richTextMedianFormat,
richTextQ1Format, richTextMinFormat, richTextOutlierFormat
};
} }
return new AttrTooltipFormat[]{
richTextMaxFormat, richTextQ3Format, richTextMedianFormat, richTextQ1Format, richTextMinFormat
};
} }
protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { protected void updateFormatPane(AttrTooltipContent attrTooltipContent) {
@ -350,5 +462,8 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
dataNumberPane.setVisible(detailed); dataNumberPane.setVisible(detailed);
dataOutlierPane.setVisible(detailed); dataOutlierPane.setVisible(detailed);
richTextNumberPane.setVisible(detailed);
richTextOutlierPane.setVisible(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.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.util.List;
public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPane { public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPane {
@ -66,6 +66,7 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa
private JPanel createUIComboBoxPane(UIComboBox comboBox, String title) { private JPanel createUIComboBoxPane(UIComboBox comboBox, String title) {
UILabel label = new UILabel(title); UILabel label = new UILabel(title);
label.setPreferredSize(new Dimension(80, 20)); label.setPreferredSize(new Dimension(80, 20));
comboBox.setPreferredSize(new Dimension(100, 20));
JPanel panel = new JPanel(); 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)); editLabel.setPreferredSize(new Dimension(80, 20));
comboBox = new UIComboBox(); comboBox = new UIComboBox();
comboBox.setPreferredSize(new Dimension(100, 20));
this.setLayout(new BorderLayout(4, 0)); this.setLayout(new BorderLayout(4, 0));
this.add(editLabel, BorderLayout.WEST); this.add(editLabel, BorderLayout.WEST);

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(AttrBackground.class, new VanChartColumnSeriesColorConditionPane(this));
classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this)); classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this));
classPaneMap.put(AttrBorder.class, new VanChartColumnLabelBorderPane(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(AttrFloatColor.class, new VanChartFloatColorConditionPane(this));
classPaneMap.put(VanChartAttrTrendLine.class, new VanChartTrendLineConditionPane(this)); classPaneMap.put(VanChartAttrTrendLine.class, new VanChartTrendLineConditionPane(this));
classPaneMap.put(AttrSeriesImageBackground.class, new VanChartSeriesImageBackgroundConditionPane(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);
}
}

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

@ -0,0 +1,77 @@
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.component.VanChartLabelContentPane;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
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 void initToolTipContentPane(Plot plot) {
VanChartLabelContentPane dataLabelContentPane = new VanChartLabelContentPane(getParentPane(), VanChartColumnPlotLabelDetailPane.this) {
protected void checkCardPane() {
super.checkCardPane();
checkOrientationPane();
}
};
setDataLabelContentPane(dataLabelContentPane);
}
private void checkOrientationPane() {
VanChartLabelContentPane dataLabelContentPane = (VanChartLabelContentPane) getDataLabelContentPane();
UIButtonGroup<Integer> content = dataLabelContentPane.getContent();
UIButtonGroup<Integer> orientation = getOrientation();
if (content == null || orientation == null) {
return;
}
if (content.getSelectedIndex() == VanChartTooltipContentPane.RICH_EDITOR_INDEX) {
orientation.setSelectedIndex(HORIZONTAL_INDEX);
orientation.setEnabled(false);
} else {
orientation.setEnabled(true);
}
}
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);
}
}

8
designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotLabelTabPane.java

@ -83,14 +83,14 @@ public class VanChartCustomPlotLabelTabPane extends VanChartCustomPlotTabPane<Va
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); List<VanChartPlot> customPlotList = plot.getCustomPlotList();
for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++) { for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++) {
ConditionAttr attrList = customPlotList.get(i).getConditionCollection().getDefaultAttr(); ConditionAttr attrList = customPlotList.get(i).getConditionCollection().getDefaultAttr();
DataSeriesCondition attr = customPlotList.get(i).getAttrLabelFromConditionCollection();
if (attr != null) {
attrList.remove(attr);
}
VanChartPlotLabelPane labelPane = (VanChartPlotLabelPane) paneList.get(i); VanChartPlotLabelPane labelPane = (VanChartPlotLabelPane) paneList.get(i);
AttrLabel attrLabel = labelPane.update(); AttrLabel attrLabel = labelPane.update();
DataSeriesCondition attr = customPlotList.get(i).getAttrLabelFromConditionCollection();
if (attr != null) {
attrList.remove(attr);
}
if (attrLabel != null) { if (attrLabel != null) {
attrList.addDataSeriesCondition(attrLabel); attrList.addDataSeriesCondition(attrLabel);
} }

20
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.design.gui.style.FormatPane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.PiePlot4VanChart;
import com.fr.plugin.chart.area.VanChartAreaPlot; import com.fr.plugin.chart.area.VanChartAreaPlot;
import com.fr.plugin.chart.bubble.VanChartBubblePlot; import com.fr.plugin.chart.bubble.VanChartBubblePlot;
import com.fr.plugin.chart.column.VanChartColumnPlot; 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.treemap.VanChartTreeMapPlot;
import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot; import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot;
import com.fr.van.chart.bubble.force.VanChartBubbleRefreshTooltipPane; 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.VanChartLabelContentPane;
import com.fr.van.chart.designer.component.VanChartRefreshTooltipContentPane; import com.fr.van.chart.designer.component.VanChartRefreshTooltipContentPane;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
@ -76,7 +78,7 @@ import java.util.Set;
*/ */
public class PlotFactory { 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 { static {
autoAdjustLabelPlots.add(VanChartColumnPlot.class); autoAdjustLabelPlots.add(VanChartColumnPlot.class);
@ -89,12 +91,26 @@ public class PlotFactory {
return autoAdjustLabelPlots.contains(plot.getClass()); 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 * 标签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 { static {
labelMap.put(VanChartColumnPlot.class, VanChartColumnPlotLabelPane.class);
labelMap.put(VanChartGaugePlot.class, VanChartGaugePlotLabelPane.class); labelMap.put(VanChartGaugePlot.class, VanChartGaugePlotLabelPane.class);
labelMap.put(VanChartScatterPlot.class, VanChartScatterPlotLabelPane.class); labelMap.put(VanChartScatterPlot.class, VanChartScatterPlotLabelPane.class);
labelMap.put(VanChartBubblePlot.class, VanChartScatterPlotLabelPane.class); labelMap.put(VanChartBubblePlot.class, VanChartScatterPlotLabelPane.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 p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = { p, f }; double[] columnSize = { p, f };
double[] rowSize = { p, p}; double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{isCustomWidth, customWidth}, new Component[]{isCustomWidth, customWidth},
new Component[]{isCustomHeight, customHeight}, new Component[]{isCustomHeight, customHeight},
new Component[] {null, null}
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); 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});
}
}

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

@ -1,5 +1,7 @@
package com.fr.van.chart.designer.component; package com.fr.van.chart.designer.component;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.type.TextAlign;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -13,6 +15,10 @@ public class VanChartLabelContentPane extends VanChartTooltipContentPane {
} }
protected VanChartHtmlLabelPane createHtmlLabelPane() { protected VanChartHtmlLabelPane createHtmlLabelPane() {
return new VanChartHtmlLabelPane(); return new VanChartHtmlLabelPaneWithBackGroundLabel();
}
protected AttrTooltipContent createAttrTooltip() {
return new AttrTooltipContent(TextAlign.CENTER);
} }
} }

295
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPaneWithoutRichText.java

@ -1,295 +0,0 @@
package com.fr.van.chart.designer.component;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class VanChartLabelContentPaneWithoutRichText extends BasicBeanPane<AttrTooltipContent> {
private UIButtonGroup<Integer> content;
private ValueFormatPaneWithCheckBox valueFormatPane;
private PercentFormatPaneWithCheckBox percentFormatPane;
private CategoryNameFormatPaneWithCheckBox categoryNameFormatPane;
private SeriesNameFormatPaneWithCheckBox seriesNameFormatPane;
//监控刷新时,自动数据点提示使用
private ChangedValueFormatPaneWithCheckBox changedValueFormatPane;
private ChangedPercentFormatPaneWithCheckBox changedPercentFormatPane;
private JPanel centerPane;
private JPanel commonPanel;
private VanChartHtmlLabelPane htmlLabelPane;
private VanChartStylePane parent;
private JPanel showOnPane;
public VanChartLabelContentPaneWithoutRichText(VanChartStylePane parent, JPanel showOnPane) {
this.parent = parent;
this.showOnPane = showOnPane;
this.setLayout(new BorderLayout());
this.add(createLabelContentPane(), BorderLayout.CENTER);
}
public ValueFormatPaneWithCheckBox getValueFormatPane() {
return valueFormatPane;
}
public void setValueFormatPane(ValueFormatPaneWithCheckBox valueFormatPane) {
this.valueFormatPane = valueFormatPane;
}
public PercentFormatPaneWithCheckBox getPercentFormatPane() {
return percentFormatPane;
}
public void setPercentFormatPane(PercentFormatPaneWithCheckBox percentFormatPane) {
this.percentFormatPane = percentFormatPane;
}
public CategoryNameFormatPaneWithCheckBox getCategoryNameFormatPane() {
return categoryNameFormatPane;
}
public void setCategoryNameFormatPane(CategoryNameFormatPaneWithCheckBox categoryNameFormatPane) {
this.categoryNameFormatPane = categoryNameFormatPane;
}
public SeriesNameFormatPaneWithCheckBox getSeriesNameFormatPane() {
return seriesNameFormatPane;
}
public void setSeriesNameFormatPane(SeriesNameFormatPaneWithCheckBox seriesNameFormatPane) {
this.seriesNameFormatPane = seriesNameFormatPane;
}
private JPanel createLabelContentPane() {
content = new UIButtonGroup<Integer>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Common"),
Toolkit.i18nText("Fine-Design_Chart_Custom")
});
initFormatPane(parent, showOnPane);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
commonPanel = createCommonPanel();
htmlLabelPane = createHtmlLabelPane();
htmlLabelPane.setParent(parent);
centerPane = new JPanel(new CardLayout()) {
@Override
public Dimension getPreferredSize() {
if (content.getSelectedIndex() == 0) {
return commonPanel.getPreferredSize();
} else {
return new Dimension(commonPanel.getPreferredSize().width, htmlLabelPane.getPreferredSize().height);
}
}
};
centerPane.add(htmlLabelPane, Toolkit.i18nText("Fine-Design_Chart_Custom"));
centerPane.add(commonPanel, Toolkit.i18nText("Fine-Design_Chart_Common"));
double[] column = {f, e};
double[] row = {p, p, p};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(getLabelContentTitle()), content},
new Component[]{null, centerPane},
};
initContentListener();
JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, column);
return getLabelContentPane(contentPane);
}
protected String getLabelContentTitle() {
return Toolkit.i18nText("Fine-Design_Report_Text");
}
protected JPanel getLabelContentPane(JPanel contentPane) {
return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Content"), contentPane);
}
protected VanChartHtmlLabelPane createHtmlLabelPane() {
return new VanChartHtmlLabelPane();
}
protected JPanel createCommonPanel() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f, p};
double[] rowSize = getRowSize(p);
return TableLayoutHelper.createTableLayoutPane(getPaneComponents(), rowSize, columnSize);
}
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane);
seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane);
valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane);
percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane);
}
protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) {
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel);
}
protected double[] getRowSize(double p) {
return new double[]{p, p, p, p};
}
protected Component[][] getPaneComponents() {
return new Component[][]{
new Component[]{categoryNameFormatPane, null},
new Component[]{seriesNameFormatPane, null},
new Component[]{valueFormatPane, null},
new Component[]{percentFormatPane, null},
};
}
private void initContentListener() {
content.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkCardPane();
}
});
}
private void checkCardPane() {
CardLayout cardLayout = (CardLayout) centerPane.getLayout();
if (content.getSelectedIndex() == 1) {
cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Custom"));
if (isDirty()) {
setCustomFormatterText();
setDirty(false);
}
} else {
cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Common"));
}
}
protected void setCustomFormatterText() {
htmlLabelPane.setCustomFormatterText(updateBean().getFormatterTextFromCommon());
}
public boolean isDirty() {
return categoryNameFormatPane.isDirty() || seriesNameFormatPane.isDirty() || valueFormatPane.isDirty() || percentFormatPane.isDirty()
|| (changedValueFormatPane != null && changedValueFormatPane.isDirty()) || (changedValueFormatPane != null && changedPercentFormatPane.isDirty());
}
public void setDirty(boolean isDirty) {
categoryNameFormatPane.setDirty(isDirty);
seriesNameFormatPane.setDirty(isDirty);
valueFormatPane.setDirty(isDirty);
percentFormatPane.setDirty(isDirty);
if (changedValueFormatPane != null) {
changedValueFormatPane.setDirty(isDirty);
}
if (changedPercentFormatPane != null) {
changedPercentFormatPane.setDirty(isDirty);
}
}
@Override
protected String title4PopupWindow() {
return "";
}
@Override
public void populateBean(AttrTooltipContent attrTooltipContent) {
if (attrTooltipContent == null) {
return;
}
content.setSelectedIndex(attrTooltipContent.isCommon() ? 0 : 1);
populateFormatPane(attrTooltipContent);
htmlLabelPane.populate(attrTooltipContent.getHtmlLabel());
if (!attrTooltipContent.isCommon()) {
setDirty(false);
}
checkCardPane();
}
protected void populateFormatPane(AttrTooltipContent attrTooltipContent) {
categoryNameFormatPane.populate(attrTooltipContent.getCategoryFormat());
seriesNameFormatPane.populate(attrTooltipContent.getSeriesFormat());
valueFormatPane.populate(attrTooltipContent.getValueFormat());
percentFormatPane.populate(attrTooltipContent.getPercentFormat());
if (changedValueFormatPane != null) {
changedValueFormatPane.populate(attrTooltipContent.getChangedValueFormat());
}
if (changedPercentFormatPane != null) {
changedPercentFormatPane.populate(attrTooltipContent.getChangedPercentFormat());
}
}
public AttrTooltipContent updateBean() {
AttrTooltipContent attrTooltipContent = createAttrTooltip();
attrTooltipContent.setCommon(content.getSelectedIndex() == 0);
updateFormatPane(attrTooltipContent);
updateFormatsWithPaneWidth(attrTooltipContent);
htmlLabelPane.update(attrTooltipContent.getHtmlLabel());
return attrTooltipContent;
}
protected AttrTooltipContent createAttrTooltip() {
return new AttrTooltipContent();
}
protected void updateFormatPane(AttrTooltipContent attrTooltipContent) {
categoryNameFormatPane.update(attrTooltipContent.getCategoryFormat());
seriesNameFormatPane.update(attrTooltipContent.getSeriesFormat());
valueFormatPane.update(attrTooltipContent.getValueFormat());
percentFormatPane.update(attrTooltipContent.getPercentFormat());
if (changedValueFormatPane != null) {
changedValueFormatPane.update(attrTooltipContent.getChangedValueFormat());
}
if (changedPercentFormatPane != null) {
changedPercentFormatPane.update(attrTooltipContent.getChangedPercentFormat());
}
}
private void updateFormatsWithPaneWidth(AttrTooltipContent attrTooltipContent) {
int paneWidth = seriesNameFormatPane.getWidth();
if (paneWidth == 0) {
attrTooltipContent.getSeriesFormat().setEnable(false);
}
}
}

4
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRefreshTooltipContentPane.java

@ -22,6 +22,10 @@ public class VanChartRefreshTooltipContentPane extends VanChartTooltipContentPan
return new double[]{p,p,p,p,p,p}; return new double[]{p,p,p,p,p,p};
} }
protected boolean supportRichEditor() {
return false;
}
@Override @Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initFormatPane(parent, showOnPane); super.initFormatPane(parent, showOnPane);

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

@ -0,0 +1,32 @@
package com.fr.van.chart.designer.component;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.GUICoreUtils;
import java.awt.Dimension;
import java.awt.Frame;
public class VanChartRichEditorDialog extends BasicDialog {
public static final Dimension DEFAULT = new Dimension(960, 600);
public VanChartRichEditorDialog(Frame parent, BasicPane pane) {
super(parent, pane);
this.setTitle(Toolkit.i18nText("Fine-Design_Report_RichTextEditor"));
this.setBasicDialogSize(DEFAULT);
GUICoreUtils.centerWindow(this);
this.setResizable(true);
this.setModal(true);
}
protected void applyEnterAction() {
}
public void checkValid() {
}
}

38
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java

@ -2,6 +2,7 @@ package com.fr.van.chart.designer.component;
import com.fr.design.ui.ModernUIPane; import com.fr.design.ui.ModernUIPane;
import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.type.TextAlign;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.teamdev.jxbrowser.chromium.Browser; import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.JSValue; import com.teamdev.jxbrowser.chromium.JSValue;
@ -69,18 +70,35 @@ public class VanChartRichEditorPane {
paramsStr.deleteCharAt(len - 1); paramsStr.deleteCharAt(len - 1);
} }
return new RichEditorModel(richText.getContent(), richText.isAuto(), paramsStr.toString()); String content = richText.getContent();
String initParams = StringUtils.EMPTY;
String align = StringUtils.EMPTY;
if (content.contains("data-id") && !content.contains("class")) {
initParams = richText.getInitParamsContent();
String left = TextAlign.LEFT.getAlign();
String center = TextAlign.CENTER.getAlign();
align = content.contains(left) ? left : center;
}
return new RichEditorModel(content, richText.isAuto(), paramsStr.toString(), initParams, align);
} }
public static class RichEditorModel { public static class RichEditorModel {
private String content; private String content;
private boolean auto; private boolean auto;
private String params; private String params;
private String initParams;
private String align;
public RichEditorModel(String content, boolean auto, String params) { public RichEditorModel(String content, boolean auto, String params, String initParams, String align) {
this.content = content; this.content = content;
this.auto = auto; this.auto = auto;
this.params = params; this.params = params;
this.initParams = initParams;
this.align = align;
} }
public String getContent() { public String getContent() {
@ -106,5 +124,21 @@ public class VanChartRichEditorPane {
public void setParams(String params) { public void setParams(String params) {
this.params = params; this.params = params;
} }
public String getInitParams() {
return initParams;
}
public void setInitParams(String initParams) {
this.initParams = initParams;
}
public String getAlign() {
return align;
}
public void setAlign(String align) {
this.align = align;
}
} }
} }

239
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java

@ -9,11 +9,14 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.ui.ModernUIPane; import com.fr.design.ui.ModernUIPane;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; 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.CategoryNameFormatPaneWithoutCheckBox;
@ -32,7 +35,6 @@ import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheck
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -51,6 +53,15 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
private static final long serialVersionUID = 8825929000117843641L; private static final long serialVersionUID = 8825929000117843641L;
// 字符样式button
private static final int TEXT_ATTR_AUTO_INDEX = 0;
private static final int TEXT_ATTR_CUSTOM_INDEX = 1;
// 标签内容button
public static final int COMMON_INDEX = 0;
public static final int RICH_EDITOR_INDEX = 1;
public static final int CUSTOM_INDEX_WITH_RICH_EDITOR = 2;
public static final int CUSTOM_INDEX_WITHOUT_RICH_EDITOR = 1;
private UIButtonGroup<Integer> content; private UIButtonGroup<Integer> content;
private CategoryNameFormatPaneWithCheckBox categoryNameFormatPane; private CategoryNameFormatPaneWithCheckBox categoryNameFormatPane;
@ -73,6 +84,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
private JPanel commonPanel; private JPanel commonPanel;
private JPanel editorPanel; private JPanel editorPanel;
private JPanel htmlPanel; private JPanel htmlPanel;
private JPanel stylePanel;
private UIButtonGroup<Integer> styleButton; private UIButtonGroup<Integer> styleButton;
private ChartTextAttrPane textAttrPane; private ChartTextAttrPane textAttrPane;
private VanChartHtmlLabelPane htmlLabelPane; private VanChartHtmlLabelPane htmlLabelPane;
@ -190,10 +202,18 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
this.richTextChangedPercentFormatPane = richTextChangedPercentFormatPane; this.richTextChangedPercentFormatPane = richTextChangedPercentFormatPane;
} }
public UIButtonGroup<Integer> getContent() {
return content;
}
public AttrTooltipRichText getRichTextAttr() { public AttrTooltipRichText getRichTextAttr() {
return richText; return richText;
} }
public void setRichTextAttr(AttrTooltipRichText richText) {
this.richText = richText;
}
private JPanel createLabelContentPane() { private JPanel createLabelContentPane() {
initDetailPane(); initDetailPane();
initCenterPane(); initCenterPane();
@ -202,6 +222,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
content.add(createButtonPane(), BorderLayout.NORTH); content.add(createButtonPane(), BorderLayout.NORTH);
content.add(centerPanel, BorderLayout.CENTER); content.add(centerPanel, BorderLayout.CENTER);
content.add(stylePanel, BorderLayout.SOUTH);
initContentListener(); initContentListener();
@ -209,20 +230,29 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
} }
private void initDetailPane() { private void initDetailPane() {
commonPanel = createCommonPanel(); commonPanel = createCommonFormatPanel();
editorPanel = createRichEditorPanel(); editorPanel = createRichEditorPanel();
htmlPanel = createHtmlPane(); htmlPanel = createHtmlPane();
stylePanel = createCommonStylePane();
} }
private void initCenterPane() { private void initCenterPane() {
if (supportRichEditor()) {
initCenterPaneWithRichEditor();
} else {
initCenterPaneWithoutRichEditor();
}
}
private void initCenterPaneWithRichEditor() {
centerPanel = new JPanel(new CardLayout()) { centerPanel = new JPanel(new CardLayout()) {
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
if (content.getSelectedIndex() == 0) { if (content.getSelectedIndex() == COMMON_INDEX) {
return commonPanel.getPreferredSize(); return commonPanel.getPreferredSize();
} else if (content.getSelectedIndex() == 1) { } else if (content.getSelectedIndex() == RICH_EDITOR_INDEX) {
return editorPanel.getPreferredSize(); return editorPanel.getPreferredSize();
} else { } else {
return htmlPanel.getPreferredSize(); return new Dimension(commonPanel.getPreferredSize().width, htmlLabelPane.getPreferredSize().height);
} }
} }
}; };
@ -232,6 +262,21 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
centerPanel.add(htmlPanel, Toolkit.i18nText("Fine-Design_Chart_Custom")); centerPanel.add(htmlPanel, Toolkit.i18nText("Fine-Design_Chart_Custom"));
} }
private void initCenterPaneWithoutRichEditor() {
centerPanel = new JPanel(new CardLayout()) {
public Dimension getPreferredSize() {
if (content.getSelectedIndex() == COMMON_INDEX) {
return commonPanel.getPreferredSize();
} else {
return new Dimension(commonPanel.getPreferredSize().width, htmlLabelPane.getPreferredSize().height);
}
}
};
centerPanel.add(commonPanel, Toolkit.i18nText("Fine-Design_Chart_Common"));
centerPanel.add(htmlPanel, Toolkit.i18nText("Fine-Design_Chart_Custom"));
}
protected String getLabelContentTitle() { protected String getLabelContentTitle() {
return Toolkit.i18nText("Fine-Design_Report_Text"); return Toolkit.i18nText("Fine-Design_Report_Text");
} }
@ -240,6 +285,14 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Content"), contentPane); return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Content"), contentPane);
} }
protected boolean supportRichEditor() {
return true;
}
protected boolean hasTextStylePane() {
return true;
}
private JPanel createButtonPane() { private JPanel createButtonPane() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
@ -247,11 +300,18 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
double[] column = {f, p}; double[] column = {f, p};
double[] row = {p, p}; double[] row = {p, p};
if (supportRichEditor()) {
content = new UIButtonGroup<>(new String[]{ content = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Common"), Toolkit.i18nText("Fine-Design_Chart_Common"),
Toolkit.i18nText("Fine-Design_Chart_Rich_Text"), Toolkit.i18nText("Fine-Design_Chart_Rich_Text"),
Toolkit.i18nText("Fine-Design_Chart_Custom") Toolkit.i18nText("Fine-Design_Chart_Custom")
}); });
} else {
content = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Common"),
Toolkit.i18nText("Fine-Design_Chart_Custom")
});
}
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
@ -261,15 +321,6 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, column); return TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, column);
} }
private JPanel createCommonPanel() {
JPanel common = new JPanel(new BorderLayout());
common.add(createCommonFormatPanel(), BorderLayout.CENTER);
common.add(createCommonStylePane(), BorderLayout.SOUTH);
return common;
}
protected JPanel createCommonFormatPanel() { protected JPanel createCommonFormatPanel() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
@ -285,7 +336,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p}, new double[]{f, e}); return TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p}, new double[]{f, e});
} }
private JPanel createCommonStylePane() { protected JPanel createCommonStylePane() {
styleButton = new UIButtonGroup<>(new String[]{ styleButton = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Automatic"), Toolkit.i18nText("Fine-Design_Chart_Automatic"),
Toolkit.i18nText("Fine-Design_Chart_Custom") Toolkit.i18nText("Fine-Design_Chart_Custom")
@ -321,7 +372,12 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
} }
private void checkStylePane() { private void checkStylePane() {
textAttrPane.setVisible(styleButton.getSelectedIndex() == 1); if (hasTextStylePane()) {
stylePanel.setVisible(true);
textAttrPane.setVisible(styleButton.getSelectedIndex() == TEXT_ATTR_CUSTOM_INDEX);
} else {
stylePanel.setVisible(false);
}
} }
private JPanel createRichEditorPanel() { private JPanel createRichEditorPanel() {
@ -332,17 +388,22 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
double[] columnSize = {f, e}; double[] columnSize = {f, e};
double[] rowSize = {p, p, p}; double[] rowSize = {p, p, p};
JPanel formatContent = TableLayoutHelper.createTableLayoutPane(getRichTextComponents(), getRowSize(p), new double[]{f, p});
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Content_Style")), createRichEditorButton()}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Content_Style")), createRichEditorButton()},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Use_Format")), formatContent} new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Use_Format")), createRichFormatPanel()}
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
protected JPanel createRichFormatPanel() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
return TableLayoutHelper.createTableLayoutPane(getRichTextComponents(), getRowSize(p), new double[]{f, p});
}
private JComponent createRichEditorButton() { private JComponent createRichEditorButton() {
UIButton contentTextArea = new UIButton(Toolkit.i18nText("Fine-Design_Chart_Rich_Text_Edit")); UIButton contentTextArea = new UIButton(Toolkit.i18nText("Fine-Design_Chart_Rich_Text_Edit"));
@ -357,7 +418,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
private void fireRichEditor() { private void fireRichEditor() {
final ModernUIPane<VanChartRichEditorPane.RichEditorModel> pane = VanChartRichEditorPane.createRichEditorPane(richText); final ModernUIPane<VanChartRichEditorPane.RichEditorModel> pane = VanChartRichEditorPane.createRichEditorPane(richText);
BasicDialog dialog = pane.showWindow(new JFrame()); BasicDialog dialog = new VanChartRichEditorDialog(DesignerContext.getDesignerFrame(), pane);
pane.populate(VanChartRichEditorPane.getRichEditorModel(richText)); pane.populate(VanChartRichEditorPane.getRichEditorModel(richText));
@ -456,19 +517,47 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
} }
private void checkCardPane() { protected void checkCardPane() {
if (supportRichEditor()) {
checkCardPaneWithRichEditor();
} else {
checkCardPaneWithoutRichEditor();
}
}
private void checkCardPaneWithRichEditor() {
CardLayout cardLayout = (CardLayout) centerPanel.getLayout(); CardLayout cardLayout = (CardLayout) centerPanel.getLayout();
if (content.getSelectedIndex() == 2) {
if (content.getSelectedIndex() == CUSTOM_INDEX_WITH_RICH_EDITOR) {
cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Custom")); cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Custom"));
if(isDirty()){ checkCustomPane();
setCustomFormatterText(); } else if (content.getSelectedIndex() == RICH_EDITOR_INDEX) {
setDirty(false);
}
} else if (content.getSelectedIndex() == 1) {
cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Rich_Text")); cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Rich_Text"));
} else { } else {
cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Common")); cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Common"));
} }
stylePanel.setVisible(hasTextStylePane() && content.getSelectedIndex() != RICH_EDITOR_INDEX);
}
private void checkCardPaneWithoutRichEditor() {
CardLayout cardLayout = (CardLayout) centerPanel.getLayout();
if (content.getSelectedIndex() == CUSTOM_INDEX_WITHOUT_RICH_EDITOR) {
cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Custom"));
checkCustomPane();
} else {
cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Common"));
}
stylePanel.setVisible(hasTextStylePane());
}
private void checkCustomPane() {
if (isDirty()) {
setCustomFormatterText();
setDirty(false);
}
} }
protected void setCustomFormatterText() { protected void setCustomFormatterText() {
@ -511,32 +600,47 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return; return;
} }
if (attrTooltipContent.isCommon()) { populateTypeButton(attrTooltipContent);
content.setSelectedIndex(0); populateFormatPane(attrTooltipContent);
} else if (attrTooltipContent.isRichText()) { if (supportRichEditor()) {
content.setSelectedIndex(1); populateRichEditor(attrTooltipContent);
} else {
content.setSelectedIndex(2);
} }
if (hasTextStylePane()) {
if (attrTooltipContent.isCustom()) { if (attrTooltipContent.isCustom()) {
styleButton.setSelectedIndex(1); styleButton.setSelectedIndex(TEXT_ATTR_CUSTOM_INDEX);
} else { } else {
styleButton.setSelectedIndex(0); styleButton.setSelectedIndex(TEXT_ATTR_AUTO_INDEX);
} }
this.textAttrPane.populate(attrTooltipContent.getTextAttr()); this.textAttrPane.populate(attrTooltipContent.getTextAttr());
}
populateFormatPane(attrTooltipContent);
populateRichEditor(attrTooltipContent);
htmlLabelPane.populate(attrTooltipContent.getHtmlLabel()); htmlLabelPane.populate(attrTooltipContent.getHtmlLabel());
if(!attrTooltipContent.isCommon()){ if (!(attrTooltipContent.isCommon() || attrTooltipContent.isRichText())) {
setDirty(false); setDirty(false);
} }
checkCardPane();
checkStylePane(); checkStylePane();
checkCardPane();
}
private void populateTypeButton(AttrTooltipContent attrTooltipContent) {
if (supportRichEditor()) {
if (attrTooltipContent.isCommon()) {
content.setSelectedIndex(COMMON_INDEX);
} else if (attrTooltipContent.isRichText()) {
content.setSelectedIndex(RICH_EDITOR_INDEX);
} else {
content.setSelectedIndex(CUSTOM_INDEX_WITH_RICH_EDITOR);
}
return;
}
if (attrTooltipContent.isCommon()) {
content.setSelectedIndex(COMMON_INDEX);
} else {
content.setSelectedIndex(CUSTOM_INDEX_WITHOUT_RICH_EDITOR);
}
} }
protected void populateFormatPane(AttrTooltipContent attrTooltipContent) { protected void populateFormatPane(AttrTooltipContent attrTooltipContent) {
@ -587,8 +691,11 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
attrTooltipContent.getRichTextChangedPercentFormat() attrTooltipContent.getRichTextChangedPercentFormat()
}; };
richText = new AttrTooltipRichText();
populateRichTextFormat(formatPaneGroup, formatGroup); populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr()); populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
} }
protected void populateRichTextFormat(VanChartFormatPaneWithCheckBox[] formatPaneGroup, AttrTooltipFormat[] formatGroup) { protected void populateRichTextFormat(VanChartFormatPaneWithCheckBox[] formatPaneGroup, AttrTooltipFormat[] formatGroup) {
@ -608,28 +715,48 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
protected void populateRichText(AttrTooltipRichText tooltipRichText) { protected void populateRichText(AttrTooltipRichText tooltipRichText) {
if (tooltipRichText != null) { if (tooltipRichText != null) {
updateLocalRichText(tooltipRichText.getContent(), tooltipRichText.isAuto()); updateLocalRichText(tooltipRichText.getContent(), tooltipRichText.isAuto());
setDirty(false); richText.setInitParamsContent(tooltipRichText.getInitParamsContent());
}
}
protected void checkRichEditorState(AttrTooltipContent attrTooltipContent) {
if (ComparatorUtils.equals(richText.getInitParamsContent(), StringUtils.EMPTY)) {
richText.setContent(attrTooltipContent.getRichTextDefaultContent());
richText.setInitParamsContent(attrTooltipContent.getRichTextDefaultParams());
} }
} }
public AttrTooltipContent updateBean() { public AttrTooltipContent updateBean() {
AttrTooltipContent attrTooltipContent = createAttrTooltip(); AttrTooltipContent attrTooltipContent = createAttrTooltip();
attrTooltipContent.setCommon(content.getSelectedIndex() == 0); updateLabelType(attrTooltipContent);
attrTooltipContent.setRichText(content.getSelectedIndex() == 1);
attrTooltipContent.setCustom(styleButton.getSelectedIndex() == 1);
attrTooltipContent.setTextAttr(this.textAttrPane.update());
updateFormatPane(attrTooltipContent); updateFormatPane(attrTooltipContent);
if (supportRichEditor()) {
updateRichEditor(attrTooltipContent); updateRichEditor(attrTooltipContent);
updateTooltipRichText(attrTooltipContent); updateTooltipRichText(attrTooltipContent);
updateFormatsWithPaneWidth(attrTooltipContent); }
if (hasTextStylePane()) {
attrTooltipContent.setCustom(styleButton.getSelectedIndex() == TEXT_ATTR_CUSTOM_INDEX);
attrTooltipContent.setTextAttr(this.textAttrPane.update());
}
htmlLabelPane.update(attrTooltipContent.getHtmlLabel()); htmlLabelPane.update(attrTooltipContent.getHtmlLabel());
return attrTooltipContent; return attrTooltipContent;
} }
private void updateLabelType(AttrTooltipContent attrTooltipContent) {
if (supportRichEditor()) {
attrTooltipContent.setCommon(content.getSelectedIndex() == COMMON_INDEX);
attrTooltipContent.setRichText(content.getSelectedIndex() == RICH_EDITOR_INDEX);
return;
}
attrTooltipContent.setCommon(content.getSelectedIndex() == COMMON_INDEX);
attrTooltipContent.setRichText(false);
}
protected AttrTooltipContent createAttrTooltip() { protected AttrTooltipContent createAttrTooltip() {
return new AttrTooltipContent(); return new AttrTooltipContent();
} }
@ -685,20 +812,8 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
if (attrTooltipContent != null) { if (attrTooltipContent != null) {
AttrTooltipRichText tooltipRichText = attrTooltipContent.getRichTextAttr(); AttrTooltipRichText tooltipRichText = attrTooltipContent.getRichTextAttr();
tooltipRichText.setContent(richText.getContent()); tooltipRichText.setContent(richText.getContent());
tooltipRichText.setInitParamsContent(richText.getInitParamsContent());
tooltipRichText.setAuto(richText.isAuto()); tooltipRichText.setAuto(richText.isAuto());
} }
} }
/**
* CHART-1295
* 通过格式的面板宽度来判断在自定义js代码中是否显示this.seriesName字符串
* 图表对于其他的格式有要求也可以在这里继续添加
* @param attrTooltipContent
*/
private void updateFormatsWithPaneWidth (AttrTooltipContent attrTooltipContent) {
int paneWidth = seriesNameFormatPane.getWidth();
if (paneWidth == 0) {
attrTooltipContent.getSeriesFormat().setEnable(false);
}
}
} }

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

@ -10,7 +10,6 @@ import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
@ -154,7 +153,7 @@ public abstract class VanChartUIListControlPane extends UIListControlPane implem
HyperDialog(JComponent pane) { HyperDialog(JComponent pane) {
super(DesignerContext.getDesignerFrame(), true); super(SwingUtilities.getWindowAncestor(VanChartUIListControlPane.this));
pane.setBorder(BorderFactory.createEmptyBorder(20, 10, 10, 10)); pane.setBorder(BorderFactory.createEmptyBorder(20, 10, 10, 10));
this.editPane = pane; this.editPane = pane;
JPanel editPaneWrapper = new JPanel(new BorderLayout()); JPanel editPaneWrapper = new JPanel(new BorderLayout());

14
designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderPane.java

@ -6,6 +6,7 @@ import com.fr.chart.chartglyph.GeneralInfo;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
@ -30,20 +31,18 @@ public class VanChartBorderPane extends BasicPane {
protected void initComponents() { protected void initComponents() {
currentLineCombo = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); currentLineCombo = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART);
currentLineColorPane = new ColorSelectBox(100); currentLineColorPane = new ColorSelectBox(100);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e}; double[] columnSize = {f, e};
double[] rowSize = {p, p, p, p};
Component[][] components = getUseComponent(); Component[][] components = getUseComponent();
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, getRowSize(), columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel,BorderLayout.CENTER); this.add(panel,BorderLayout.CENTER);
} }
protected Component[][] getUseComponent() { protected Component[][] getUseComponent() {
UILabel lineStyleLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")); UILabel lineStyleLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style"));
UILabel colorLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")); UILabel colorLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Color"));
return new Component[][]{ return new Component[][]{
new Component[]{null,null}, new Component[]{null,null},
@ -52,6 +51,11 @@ public class VanChartBorderPane extends BasicPane {
}; };
} }
protected double[] getRowSize() {
double p = TableLayout.PREFERRED;
return new double[]{p, p, p, p};
}
/** /**
* 标题 * 标题
* @return 标题 * @return 标题

12
designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithRadiusPane.java

@ -4,10 +4,10 @@ import com.fr.chart.base.AttrBorder;
import com.fr.chart.chartglyph.GeneralInfo; import com.fr.chart.chartglyph.GeneralInfo;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import javax.swing.JSeparator; import javax.swing.JSeparator;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
@ -19,6 +19,10 @@ public class VanChartBorderWithRadiusPane extends VanChartBorderPane {
private static final long serialVersionUID = -3937853702118283803L; private static final long serialVersionUID = -3937853702118283803L;
private UISpinner radius; private UISpinner radius;
public UISpinner getRadius() {
return radius;
}
@Override @Override
protected void initComponents() { protected void initComponents() {
radius = new UISpinner(0,1000,1,0); radius = new UISpinner(0,1000,1,0);
@ -31,11 +35,11 @@ public class VanChartBorderWithRadiusPane extends VanChartBorderPane {
return new Component[][]{ return new Component[][]{
new Component[]{null,null}, new Component[]{null,null},
new Component[]{ new Component[]{
FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")), FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")),
UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo) UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo)
}, },
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")),currentLineColorPane}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")),currentLineColorPane},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Radius")),radius} new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Radius")),radius}
} ; } ;
} }

210
designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java

@ -0,0 +1,210 @@
package com.fr.van.chart.designer.component.border;
import com.fr.chart.chartglyph.Marker;
import com.fr.chart.chartglyph.MarkerFactory;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.xcombox.MarkerComboBox;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.plugin.chart.base.AttrBorderWithShape;
import com.fr.plugin.chart.marker.type.MarkerType;
import com.fr.stable.Constants;
import com.fr.stable.CoreConstants;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class VanChartBorderWithShapePane extends BasicPane {
private static final int RECTANGULAR_INDEX = 0;
private static final int DIALOG_INDEX = 1;
private static final int AUTO_COLOR = 0;
private static final int CUSTOM_COLOR = 1;
private LineComboBox lineTypeBox;
private UIButtonGroup<Integer> lineColorButton;
private ColorSelectBox lineColorBox;
private MarkerComboBox borderShape;
private UISpinner borderRadius;
private JPanel detailPane;
private JPanel colorBoxPane;
public VanChartBorderWithShapePane() {
initComponents();
createBorderPane();
}
private void initComponents() {
lineTypeBox = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART);
lineColorButton = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Automatic"),
Toolkit.i18nText("Fine-Design_Chart_Custom")
});
lineColorBox = new ColorSelectBox(100);
borderShape = new MarkerComboBox(MarkerFactory.getLabelShapeMarkers());
borderRadius = new UISpinner(0, 1000, 1, 0);
}
private void createBorderPane() {
this.setLayout(new BorderLayout());
detailPane = createDetailPane();
this.add(createLineTypePane(), BorderLayout.CENTER);
this.add(detailPane, BorderLayout.SOUTH);
initLineTypeListener();
initLineColorListener();
initShapeListener();
}
private void initLineTypeListener() {
lineTypeBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkDetailPane();
}
});
}
private void checkDetailPane() {
detailPane.setVisible(lineTypeBox.getSelectedLineStyle() != Constants.LINE_NONE);
}
private void initLineColorListener() {
lineColorButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkColorPane();
}
});
}
private void checkColorPane() {
colorBoxPane.setVisible(lineColorButton.getSelectedIndex() == CUSTOM_COLOR);
}
private void initShapeListener() {
borderShape.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkRadiusPane();
}
});
}
private void checkRadiusPane() {
borderRadius.setEnabled(borderShape.getSelectedIndex() == RECTANGULAR_INDEX || borderShape.getSelectedIndex() == DIALOG_INDEX);
}
private JPanel createLineTypePane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")),
UIComponentUtils.wrapWithBorderLayoutPane(lineTypeBox)}};
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
}
private JPanel createDetailPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Shape")),
UIComponentUtils.wrapWithBorderLayoutPane(borderShape)},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Radius")), borderRadius}
};
JPanel center = createLineColorPane();
JPanel south = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
JPanel panel = new JPanel(new BorderLayout());
panel.add(center, BorderLayout.CENTER);
panel.add(south, BorderLayout.SOUTH);
return panel;
}
private JPanel createLineColorPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p};
Component[][] center = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), lineColorButton}
};
Component[][] south = new Component[][]{
new Component[]{null, null},
new Component[]{null, lineColorBox}
};
colorBoxPane = TableLayout4VanChartHelper.createGapTableLayoutPane(south, rowSize, columnSize);
JPanel panel = new JPanel(new BorderLayout());
panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(center, rowSize, columnSize), BorderLayout.CENTER);
panel.add(colorBoxPane, BorderLayout.SOUTH);
return panel;
}
protected String title4PopupWindow() {
return null;
}
public void populate(AttrBorderWithShape border) {
if (border == null) {
return;
}
lineTypeBox.setSelectedLineStyle(border.getBorderStyle());
lineColorButton.setSelectedIndex(border.isAutoColor() ? AUTO_COLOR : CUSTOM_COLOR);
lineColorBox.setSelectObject(border.getBorderColor());
borderShape.setSelectedMarker((Marker.createMarker(border.getShape())));
borderRadius.setValue(border.getRoundRadius());
checkDetailPane();
checkColorPane();
checkRadiusPane();
}
public void update(AttrBorderWithShape border) {
if (border == null) {
return;
}
border.setBorderStyle(lineTypeBox.getSelectedLineStyle());
border.setAutoColor(lineColorButton.getSelectedIndex() == AUTO_COLOR);
border.setBorderColor(lineColorBox.getSelectObject());
border.setShape(MarkerType.parse(borderShape.getSelectedMarkder().getMarkerType()));
border.setRoundRadius((int) borderRadius.getValue());
}
}

11
designer-chart/src/main/java/com/fr/van/chart/designer/component/label/GaugeLabelContentPane.java

@ -2,7 +2,7 @@ package com.fr.van.chart.designer.component.label;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.component.VanChartLabelContentPaneWithoutRichText; import com.fr.van.chart.designer.component.VanChartLabelContentPane;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -10,7 +10,7 @@ import javax.swing.JPanel;
/** /**
* Created by mengao on 2017/8/13. * Created by mengao on 2017/8/13.
*/ */
public class GaugeLabelContentPane extends VanChartLabelContentPaneWithoutRichText { public class GaugeLabelContentPane extends VanChartLabelContentPane {
public GaugeLabelContentPane(VanChartStylePane parent, JPanel showOnPane) { public GaugeLabelContentPane(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane); super(parent, showOnPane);
@ -24,4 +24,11 @@ public class GaugeLabelContentPane extends VanChartLabelContentPaneWithoutRichTe
return contentPane; return contentPane;
} }
protected boolean supportRichEditor() {
return false;
}
protected boolean hasTextStylePane() {
return false;
}
} }

4
designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/RefreshTooltipContentPaneWithOutSeries.java

@ -17,6 +17,10 @@ public class RefreshTooltipContentPaneWithOutSeries extends TooltipContentPaneWi
super(null, showOnPane); super(null, showOnPane);
} }
protected boolean supportRichEditor() {
return false;
}
@Override @Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initFormatPane(parent, showOnPane); super.initFormatPane(parent, showOnPane);

24
designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/TooltipContentPaneWithOutSeries.java

@ -1,6 +1,10 @@
package com.fr.van.chart.designer.component.tooltip; package com.fr.van.chart.designer.component.tooltip;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -36,4 +40,24 @@ public class TooltipContentPaneWithOutSeries extends VanChartTooltipContentPane
new Component[]{getRichTextPercentFormatPane(), null} new Component[]{getRichTextPercentFormatPane(), null}
}; };
} }
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{
getRichTextCategoryNameFormatPane(),
getRichTextValueFormatPane(),
getRichTextPercentFormatPane()
};
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
attrTooltipContent.getRichTextCategoryFormat(),
attrTooltipContent.getRichTextValueFormat(),
attrTooltipContent.getRichTextPercentFormat()
};
setRichTextAttr(new AttrTooltipRichText());
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
}
} }

2
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java

@ -22,7 +22,7 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe
} }
protected double[] getLabelPaneRowSize(Plot plot, double p) { protected double[] getLabelPaneRowSize(Plot plot, double p) {
if (hasLabelAlign(plot)) { if (hasLabelAlignPane()) {
return new double[]{p, p, p, p}; return new double[]{p, p, p, p};
} }

11
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java

@ -114,8 +114,9 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
}; };
} }
protected JPanel getLabelPositionPane(Component[][] comps, double[] row, double[] col) { // 仪表盘标签内无布局tab
return TableLayoutHelper.createTableLayoutPane(comps, row, col); protected JPanel getLabelLayoutPane(JPanel panel, String title) {
return panel;
} }
protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) { protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) {
@ -123,7 +124,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
} }
protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) { protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) {
if (hasLabelAlign(plot)) { if (hasLabelAlignPane()) {
return new Component[][]{ return new Component[][]{
new Component[]{getDataLabelContentPane(), null}, new Component[]{getDataLabelContentPane(), null},
@ -222,6 +223,10 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
return getGaugeStyle() == GaugeStyle.THERMOMETER && !((VanChartGaugePlot) plot).getGaugeDetailStyle().isHorizontalLayout(); return getGaugeStyle() == GaugeStyle.THERMOMETER && !((VanChartGaugePlot) plot).getGaugeDetailStyle().isHorizontalLayout();
} }
protected boolean hasLabelAlignPane() {
return getGaugeStyle() == GaugeStyle.THERMOMETER;
}
public void populate(AttrLabelDetail detail) { public void populate(AttrLabelDetail detail) {
super.populate(detail); super.populate(detail);

57
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java

@ -1,13 +1,15 @@
package com.fr.van.chart.designer.style.label; package com.fr.van.chart.designer.style.label;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.attr.GaugeDetailStyle;
import com.fr.plugin.chart.base.AttrLabel; import com.fr.plugin.chart.base.AttrLabel;
import com.fr.plugin.chart.base.AttrLabelDetail;
import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.type.GaugeStyle; import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.design.i18n.Toolkit;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -18,6 +20,9 @@ import java.awt.BorderLayout;
public class VanChartGaugePlotLabelPane extends VanChartPlotLabelPane { public class VanChartGaugePlotLabelPane extends VanChartPlotLabelPane {
private static final long serialVersionUID = -322148616244458359L; private static final long serialVersionUID = -322148616244458359L;
private UIButtonGroup<Integer> orientation;
private JPanel layoutPane;
private VanChartPlotLabelDetailPane gaugeValueLabelPane; private VanChartPlotLabelDetailPane gaugeValueLabelPane;
public VanChartGaugePlotLabelPane(Plot plot, VanChartStylePane parent) { public VanChartGaugePlotLabelPane(Plot plot, VanChartStylePane parent) {
@ -41,23 +46,65 @@ public class VanChartGaugePlotLabelPane extends VanChartPlotLabelPane {
} }
JPanel cateOrPercentPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(cateTitle, getLabelDetailPane()); JPanel cateOrPercentPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(cateTitle, getLabelDetailPane());
JPanel valuePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(valueTitle, gaugeValueLabelPane); JPanel valuePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(valueTitle, gaugeValueLabelPane);
layoutPane = createGaugeLabelLayoutPane();
getLabelPane().add(cateOrPercentPane, BorderLayout.NORTH); getLabelPane().add(cateOrPercentPane, BorderLayout.NORTH);
getLabelPane().add(valuePane, BorderLayout.SOUTH); getLabelPane().add(valuePane, BorderLayout.CENTER);
getLabelPane().add(layoutPane, BorderLayout.SOUTH);
checkLayoutPaneVisible();
}
private void checkLayoutPaneVisible() {
layoutPane.setVisible(showLayoutPane());
}
private boolean showLayoutPane() {
VanChartGaugePlot plot = (VanChartGaugePlot) this.getPlot();
GaugeDetailStyle gaugeDetailStyle = plot.getGaugeDetailStyle();
return plot.getGaugeStyle() == GaugeStyle.THERMOMETER && gaugeDetailStyle != null && gaugeDetailStyle.isHorizontalLayout();
}
// 试管仪表盘横行布局时,正常标签外增加布局tab,同时控制百分比和值标签的文本方向
private JPanel createGaugeLabelLayoutPane() {
orientation = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"),
Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical"),
});
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Text_Orientation"), orientation);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Form_Attr_Layout"), panel);
} }
public void populate(AttrLabel attr) { public void populate(AttrLabel attr) {
super.populate(attr); super.populate(attr);
if(gaugeValueLabelPane != null && attr != null){ if(gaugeValueLabelPane != null && attr != null){
gaugeValueLabelPane.populate(attr.getGaugeValueLabelDetail()); AttrLabelDetail labelDetail = attr.getGaugeValueLabelDetail();
gaugeValueLabelPane.populate(labelDetail);
orientation.setSelectedIndex(labelDetail.isHorizontal() ? 0 : 1);
checkLayoutPaneVisible();
} }
} }
public AttrLabel update() { public AttrLabel update() {
AttrLabel attrLabel = super.update(); AttrLabel attrLabel = super.update();
if(gaugeValueLabelPane != null && attrLabel != null){ if(gaugeValueLabelPane != null && attrLabel != null){
gaugeValueLabelPane.update(attrLabel.getGaugeValueLabelDetail()); AttrLabelDetail defaultLabelDetail = attrLabel.getAttrLabelDetail();
AttrLabelDetail valueLabelDetail = attrLabel.getGaugeValueLabelDetail();
gaugeValueLabelPane.update(valueLabelDetail);
boolean horizontal = orientation.getSelectedIndex() == 0;
defaultLabelDetail.setHorizontal(horizontal);
valueLabelDetail.setHorizontal(horizontal);
} }
return attrLabel; return attrLabel;
} }
} }

5
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartLabelPane.java

@ -64,11 +64,14 @@ public class VanChartLabelPane extends AbstractVanChartScrollPane<Chart> {
return; return;
} }
ConditionAttr attrList = chart.getPlot().getConditionCollection().getDefaultAttr(); ConditionAttr attrList = chart.getPlot().getConditionCollection().getDefaultAttr();
// labelPane中颜色选择器会触发listener.doChange(),导致style界面update两次,
// 为了避免递归updateBean时,remove与add不匹配,调整一下labelPane.update()的位置
AttrLabel attrLabel = labelPane.update();
DataSeriesCondition attr = ((VanChartPlot)chart.getPlot()).getAttrLabelFromConditionCollection(); DataSeriesCondition attr = ((VanChartPlot)chart.getPlot()).getAttrLabelFromConditionCollection();
if(attr != null) { if(attr != null) {
attrList.remove(attr); attrList.remove(attr);
} }
AttrLabel attrLabel = labelPane.update();
if (attrLabel != null) { if (attrLabel != null) {
attrList.addDataSeriesCondition(attrLabel); attrList.addDataSeriesCondition(attrLabel);
} }

129
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java

@ -7,12 +7,11 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.i18n.Toolkit;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.attr.plot.VanChartLabelPositionPlot; import com.fr.plugin.chart.attr.plot.VanChartLabelPositionPlot;
import com.fr.plugin.chart.base.AttrLabelDetail; import com.fr.plugin.chart.base.AttrLabelDetail;
@ -20,6 +19,8 @@ import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.van.chart.designer.PlotFactory; import com.fr.van.chart.designer.PlotFactory;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutImagePane;
import com.fr.van.chart.designer.component.border.VanChartBorderWithShapePane;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -28,9 +29,6 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/** /**
* Created by Mitisky on 15/12/7. * Created by Mitisky on 15/12/7.
@ -38,18 +36,26 @@ import java.awt.event.ActionListener;
public class VanChartPlotLabelDetailPane extends BasicPane { public class VanChartPlotLabelDetailPane extends BasicPane {
private static final long serialVersionUID = -22438250307946275L; private static final long serialVersionUID = -22438250307946275L;
public static final int HORIZONTAL_INDEX = 0;
private BasicBeanPane<AttrTooltipContent> dataLabelContentPane; private BasicBeanPane<AttrTooltipContent> dataLabelContentPane;
private UIButtonGroup<Integer> position; private UIButtonGroup<Integer> position;
private UIButtonGroup<Boolean> autoAdjust; private UIButtonGroup<Boolean> autoAdjust;
private UIButtonGroup<Integer> orientation;
private UIToggleButton tractionLine; private UIToggleButton tractionLine;
private ColorSelectBox backgroundColor; private ColorSelectBox backgroundColor;
private VanChartBorderWithShapePane borderPane;
private VanChartBackgroundWithOutImagePane backgroundPane;
private JPanel tractionLinePane; private JPanel tractionLinePane;
private JPanel positionPane; private JPanel positionPane;
private Integer[] oldPositionValues; private Integer[] oldPositionValues;
private JPanel borderPaneWithTitle;
private JPanel backgroundPaneWithTitle;
private VanChartStylePane parent; private VanChartStylePane parent;
private Plot plot; private Plot plot;
@ -82,6 +88,10 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
return plot; return plot;
} }
public UIButtonGroup<Integer> getOrientation() {
return orientation;
}
//默认从factory中取 //默认从factory中取
protected void initToolTipContentPane(Plot plot) { protected void initToolTipContentPane(Plot plot) {
dataLabelContentPane = PlotFactory.createPlotLabelContentPane(plot, parent, VanChartPlotLabelDetailPane.this); dataLabelContentPane = PlotFactory.createPlotLabelContentPane(plot, parent, VanChartPlotLabelDetailPane.this);
@ -100,15 +110,51 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) { protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) {
if(hasLabelPosition(plot)){ if(hasLabelPosition(plot)){
// 仅饼图、柱形图、条形图、折线图、面积图含有边框和背景
if (hasBorderAndBackground(plot)) {
return new Component[][]{
new Component[]{dataLabelContentPane,null},
new Component[]{createLabelPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), plot), null},
new Component[]{createLabelBorderPane(), null},
new Component[]{createLabelBackgroundPane(), null}
};
}
return new Component[][]{ return new Component[][]{
new Component[]{dataLabelContentPane,null}, new Component[]{dataLabelContentPane,null},
new Component[]{createLabelPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), plot), null} new Component[]{createLabelPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), plot), null}
}; };
} else { }
return new Component[][]{ return new Component[][]{
new Component[]{dataLabelContentPane,null} new Component[]{dataLabelContentPane,null}
}; };
} }
private JPanel createLabelBorderPane() {
borderPane = new VanChartBorderWithShapePane();
borderPaneWithTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane);
return borderPaneWithTitle;
}
private JPanel createLabelBackgroundPane() {
backgroundPane = new VanChartBackgroundWithOutImagePane(){
protected Component[][] getPaneComponents() {
return new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Fill")), typeComboBox},
new Component[]{null, centerPane},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Alpha")), transparent},
};
}
};
backgroundPaneWithTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane);
return backgroundPaneWithTitle;
} }
protected double[] getLabelStyleRowSize(double p) { protected double[] getLabelStyleRowSize(double p) {
@ -123,6 +169,10 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
return plot instanceof VanChartLabelPositionPlot; return plot instanceof VanChartLabelPositionPlot;
} }
private boolean hasBorderAndBackground(Plot plot) {
return PlotFactory.hasBorderAndBackgroundPlotLabel(plot);
}
protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) { protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) {
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel);
} }
@ -157,8 +207,11 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
positionPane = new JPanel(); positionPane = new JPanel();
checkPositionPane(title); checkPositionPane(title);
panel.add(positionPane, BorderLayout.CENTER); panel.add(positionPane, BorderLayout.NORTH);
if (hasLabelOrientationPane()) {
panel.add(createLabelOrientationPane(), BorderLayout.CENTER);
}
if (plot.isSupportLeadLine()) { if (plot.isSupportLeadLine()) {
tractionLine = new UIToggleButton(Toolkit.i18nText("Fine-Design_Chart_Show_Guideline")); tractionLine = new UIToggleButton(Toolkit.i18nText("Fine-Design_Chart_Show_Guideline"));
@ -168,7 +221,31 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
} else if (PlotFactory.plotAutoAdjustLabelPosition(plot)) { } else if (PlotFactory.plotAutoAdjustLabelPosition(plot)) {
panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Auto_Adjust"), autoAdjust), BorderLayout.SOUTH); panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Auto_Adjust"), autoAdjust), BorderLayout.SOUTH);
} }
return panel;
return getLabelLayoutPane(panel, Toolkit.i18nText("Fine-Design_Form_Attr_Layout"));
}
protected JPanel getLabelLayoutPane(JPanel panel, String title) {
return createTableLayoutPaneWithTitle(title, panel);
}
protected boolean hasLabelOrientationPane() {
return false;
}
private JPanel createLabelOrientationPane() {
orientation = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"),
Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical"),
});
orientation.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
checkOrientation();
}
});
return TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Text_Orientation"), orientation);
} }
protected void checkPositionPane(String title) { protected void checkPositionPane(String title) {
@ -205,13 +282,10 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
} }
} }
protected JPanel getLabelPositionPane (Component[][] comps, double[] row, double[] col){ protected JPanel getLabelPositionPane (Component[][] comps, double[] row, double[] col){
JPanel panel = TableLayoutHelper.createTableLayoutPane(comps,row,col); return TableLayoutHelper.createTableLayoutPane(comps, row, col);
return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Form_Attr_Layout"), panel);
} }
protected void initPositionListener() { protected void initPositionListener() {
position.addChangeListener(new ChangeListener() { position.addChangeListener(new ChangeListener() {
@Override @Override
@ -253,6 +327,16 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
tractionLine.setSelected(position.getSelectedItem() == Constants.OUTSIDE); tractionLine.setSelected(position.getSelectedItem() == Constants.OUTSIDE);
checkPositionEnabled(); checkPositionEnabled();
} }
private void checkOrientation() {
if (orientation != null && borderPaneWithTitle != null && backgroundPaneWithTitle != null) {
boolean horizontal = orientation.getSelectedIndex() == HORIZONTAL_INDEX;
borderPaneWithTitle.setVisible(horizontal);
backgroundPaneWithTitle.setVisible(horizontal);
}
}
private void checkPositionEnabled() { private void checkPositionEnabled() {
tractionLinePane.setVisible(position.getSelectedItem() == Constants.OUTSIDE); tractionLinePane.setVisible(position.getSelectedItem() == Constants.OUTSIDE);
} }
@ -267,18 +351,28 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
if(position != null){ if(position != null){
position.setSelectedItem(detail.getPosition()); position.setSelectedItem(detail.getPosition());
} }
if(orientation != null){
orientation.setSelectedIndex(detail.isHorizontal() ? 0 : 1);
}
if(tractionLine != null){ if(tractionLine != null){
tractionLine.setSelected(detail.isShowGuidLine()); tractionLine.setSelected(detail.isShowGuidLine());
} }
if(autoAdjust != null){ if(autoAdjust != null){
autoAdjust.setSelectedIndex(detail.isAutoAdjust() == true ? 0 : 1); autoAdjust.setSelectedIndex(detail.isAutoAdjust() ? 0 : 1);
} }
if(backgroundColor != null){ if(backgroundColor != null){
backgroundColor.setSelectObject(detail.getBackgroundColor()); backgroundColor.setSelectObject(detail.getBackgroundColor());
} }
if(borderPane != null){
borderPane.populate(detail.getBorder());
}
if(backgroundPane != null){
backgroundPane.populate(detail.getBackground());
}
checkAllUse(); checkAllUse();
checkOrientation();
} }
@ -294,12 +388,21 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
detail.setAutoAdjust(autoAdjust != null && autoAdjust.getSelectedItem()); detail.setAutoAdjust(autoAdjust != null && autoAdjust.getSelectedItem());
if(orientation != null){
detail.setHorizontal(orientation.getSelectedIndex() == 0);
}
if(tractionLine != null){ if(tractionLine != null){
detail.setShowGuidLine(tractionLine.isSelected() && detail.getPosition() == Constants.OUTSIDE); detail.setShowGuidLine(tractionLine.isSelected() && detail.getPosition() == Constants.OUTSIDE);
} }
if(backgroundColor != null){ if(backgroundColor != null){
detail.setBackgroundColor(backgroundColor.getSelectObject()); detail.setBackgroundColor(backgroundColor.getSelectObject());
} }
if(borderPane != null){
borderPane.update(detail.getBorder());
}
if(backgroundPane != null){
backgroundPane.update(detail.getBackground());
}
} }
} }

14
designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java

@ -1,13 +1,13 @@
package com.fr.van.chart.drillmap.designer.data.comp; package com.fr.van.chart.drillmap.designer.data.comp;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.map.designer.type.GEOJSONTreeHelper; import com.fr.plugin.chart.map.designer.type.GEOJSONTreeHelper;
import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; import com.fr.plugin.chart.map.server.ChartGEOJSONHelper;
import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper; import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JTree; import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeCellRenderer;
@ -15,7 +15,6 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeNode; import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.util.Enumeration; import java.util.Enumeration;
/** /**
@ -49,7 +48,7 @@ public class MapDataTree extends JTree {
if (children.hasMoreElements()) { if (children.hasMoreElements()) {
DefaultMutableTreeNode child = (DefaultMutableTreeNode) children.nextElement(); DefaultMutableTreeNode child = (DefaultMutableTreeNode) children.nextElement();
if(GEOJSONTreeHelper.getInstance().isSelectableTreeNode(child)){ if (GEOJSONTreeHelper.isSelectableTreeNode(child)) {
selectTreeNode(child, m_model); selectTreeNode(child, m_model);
} else { } else {
setFirstChildTreeNode(child, m_model); setFirstChildTreeNode(child, m_model);
@ -115,14 +114,7 @@ public class MapDataTree extends JTree {
DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) value; DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) value;
String name = getPresentName(treeNode); String name = getPresentName(treeNode);
this.setText(name); this.setText(name);
this.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));
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.setBackgroundNonSelectionColor(UIConstants.NORMAL_BACKGROUND); this.setBackgroundNonSelectionColor(UIConstants.NORMAL_BACKGROUND);
this.setForeground(UIConstants.FONT_COLOR); this.setForeground(UIConstants.FONT_COLOR);
this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE); this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE);

32
designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java

@ -1,15 +1,18 @@
package com.fr.van.chart.funnel.designer.style; package com.fr.van.chart.funnel.designer.style;
import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipNameFormat; import com.fr.plugin.chart.base.format.AttrTooltipNameFormat;
import com.fr.plugin.chart.type.TextAlign;
import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.VanChartLabelContentPane;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; 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.CategoryNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; 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.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -59,10 +62,35 @@ public class VanChartFunnelLabelContentPane extends VanChartLabelContentPane {
setRichTextPercentFormatPane(new FunnelPercentFormatPaneWithoutCheckBox(parent, showOnPane)); setRichTextPercentFormatPane(new FunnelPercentFormatPaneWithoutCheckBox(parent, showOnPane));
} }
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{
getRichTextSeriesNameFormatPane(),
getRichTextValueFormatPane(),
getRichTextPercentFormatPane()
};
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
attrTooltipContent.getRichTextSeriesFormat(),
attrTooltipContent.getRichTextValueFormat(),
attrTooltipContent.getRichTextPercentFormat()
};
setRichTextAttr(new AttrTooltipRichText());
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
}
protected AttrTooltipContent createAttrTooltip() { protected AttrTooltipContent createAttrTooltip() {
AttrTooltipContent attrTooltipContent = new AttrTooltipContent(); AttrTooltipContent attrTooltipContent = new AttrTooltipContent(TextAlign.CENTER);
attrTooltipContent.getCategoryFormat().setEnable(false); attrTooltipContent.getCategoryFormat().setEnable(false);
attrTooltipContent.getRichTextCategoryFormat().setEnable(false);
attrTooltipContent.setSeriesFormat(new AttrTooltipNameFormat()); attrTooltipContent.setSeriesFormat(new AttrTooltipNameFormat());
attrTooltipContent.setRichTextSeriesFormat(new AttrTooltipNameFormat());
return attrTooltipContent; return attrTooltipContent;
} }

5
designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRefreshTooltipContentPane.java

@ -16,6 +16,11 @@ public class VanChartFunnelRefreshTooltipContentPane extends VanChartFunnelToolt
public VanChartFunnelRefreshTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) { public VanChartFunnelRefreshTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) {
super(null, showOnPane); super(null, showOnPane);
} }
protected boolean supportRichEditor() {
return false;
}
@Override @Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initFormatPane(parent, showOnPane); super.initFormatPane(parent, showOnPane);

32
designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java

@ -1,6 +1,8 @@
package com.fr.van.chart.funnel.designer.style; package com.fr.van.chart.funnel.designer.style;
import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipNameFormat; import com.fr.plugin.chart.base.format.AttrTooltipNameFormat;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane; 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.CategoryNameFormatPaneWithCheckBox;
@ -9,6 +11,7 @@ import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckB
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -58,12 +61,39 @@ public class VanChartFunnelTooltipContentPane extends VanChartTooltipContentPane
setRichTextPercentFormatPane(new FunnelPercentFormatPaneWithoutCheckBox(parent, showOnPane)); setRichTextPercentFormatPane(new FunnelPercentFormatPaneWithoutCheckBox(parent, showOnPane));
} }
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{
getRichTextSeriesNameFormatPane(),
getRichTextValueFormatPane(),
getRichTextPercentFormatPane()
};
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
attrTooltipContent.getRichTextSeriesFormat(),
attrTooltipContent.getRichTextValueFormat(),
attrTooltipContent.getRichTextPercentFormat()
};
setRichTextAttr(new AttrTooltipRichText());
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
}
protected AttrTooltipContent createAttrTooltip() { protected AttrTooltipContent createAttrTooltip() {
AttrTooltipContent attrTooltipContent = new AttrTooltipContent(); AttrTooltipContent attrTooltipContent = new AttrTooltipContent();
attrTooltipContent.getCategoryFormat().setEnable(false);
attrTooltipContent.setSeriesFormat(new AttrTooltipNameFormat()); attrTooltipContent.setSeriesFormat(new AttrTooltipNameFormat());
attrTooltipContent.setRichTextSeriesFormat(new AttrTooltipNameFormat());
attrTooltipContent.getCategoryFormat().setEnable(false);
attrTooltipContent.getSeriesFormat().setEnable(true); attrTooltipContent.getSeriesFormat().setEnable(true);
attrTooltipContent.getValueFormat().setEnable(true); attrTooltipContent.getValueFormat().setEnable(true);
attrTooltipContent.getRichTextCategoryFormat().setEnable(false);
attrTooltipContent.getRichTextSeriesFormat().setEnable(true);
attrTooltipContent.getRichTextValueFormat().setEnable(true);
return attrTooltipContent; return attrTooltipContent;
} }
} }

4
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/other/VanChartGanttConditionPane.java

@ -13,11 +13,11 @@ import com.fr.plugin.chart.gantt.attr.AttrGanttTooltip;
import com.fr.plugin.chart.gantt.attr.AttrGanttTooltipContent; import com.fr.plugin.chart.gantt.attr.AttrGanttTooltipContent;
import com.fr.plugin.chart.type.ConditionKeyType; import com.fr.plugin.chart.type.ConditionKeyType;
import com.fr.van.chart.designer.PlotFactory; import com.fr.van.chart.designer.PlotFactory;
import com.fr.van.chart.designer.other.condition.item.VanChartLabelConditionPane;
import com.fr.van.chart.designer.other.condition.item.VanChartSeriesColorConditionPane; import com.fr.van.chart.designer.other.condition.item.VanChartSeriesColorConditionPane;
import com.fr.van.chart.designer.other.condition.item.VanChartTooltipConditionPane; import com.fr.van.chart.designer.other.condition.item.VanChartTooltipConditionPane;
import com.fr.van.chart.designer.style.tooltip.VanChartPlotTooltipNoCheckPane; import com.fr.van.chart.designer.style.tooltip.VanChartPlotTooltipNoCheckPane;
import com.fr.van.chart.designer.style.tooltip.VanChartPlotTooltipPane; import com.fr.van.chart.designer.style.tooltip.VanChartPlotTooltipPane;
import com.fr.van.chart.gantt.designer.style.label.VanChartGanttLabelConditionPane;
import java.awt.Dimension; import java.awt.Dimension;
@ -42,7 +42,7 @@ public class VanChartGanttConditionPane extends DataSeriesConditionPane {
classPaneMap.put(AttrBackground.class, new VanChartSeriesColorConditionPane(this)); classPaneMap.put(AttrBackground.class, new VanChartSeriesColorConditionPane(this));
classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this)); classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this));
if (!PlotFactory.largeDataModel(plot)) { if (!PlotFactory.largeDataModel(plot)) {
classPaneMap.put(AttrGanttLabel.class, new VanChartLabelConditionPane(this, plot)); classPaneMap.put(AttrGanttLabel.class, new VanChartGanttLabelConditionPane(this, plot));
} }
classPaneMap.put(AttrGanttTooltip.class, new VanChartTooltipConditionPane(this, plot) { classPaneMap.put(AttrGanttTooltip.class, new VanChartTooltipConditionPane(this, plot) {

17
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/label/VanChartGanttLabelConditionPane.java

@ -0,0 +1,17 @@
package com.fr.van.chart.gantt.designer.style.label;
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 VanChartGanttLabelConditionPane extends VanChartLabelConditionPane {
public VanChartGanttLabelConditionPane(ConditionAttributesPane conditionAttributesPane, Plot plot) {
super(conditionAttributesPane, plot);
}
protected VanChartPlotLabelPane createLabelPane() {
return new VanChartGanttPlotLabelNoCheckPane(getPlot(), null);
}
}

8
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/label/VanChartGanttLabelContentPane.java

@ -3,7 +3,7 @@ package com.fr.van.chart.gantt.designer.style.label;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.gantt.attr.AttrGanttTooltipContent; import com.fr.plugin.chart.gantt.attr.AttrGanttTooltipContent;
import com.fr.van.chart.designer.component.VanChartLabelContentPaneWithoutRichText; import com.fr.van.chart.designer.component.VanChartLabelContentPane;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
@ -16,7 +16,7 @@ import java.awt.Component;
/** /**
* Created by hufan on 2017/1/13. * Created by hufan on 2017/1/13.
*/ */
public class VanChartGanttLabelContentPane extends VanChartLabelContentPaneWithoutRichText { public class VanChartGanttLabelContentPane extends VanChartLabelContentPane {
private VanChartFormatPaneWithCheckBox processesFormatPane; private VanChartFormatPaneWithCheckBox processesFormatPane;
private VanChartDateFormatPaneWithCheckBox startTimeFormatPane; private VanChartDateFormatPaneWithCheckBox startTimeFormatPane;
@ -57,6 +57,10 @@ public class VanChartGanttLabelContentPane extends VanChartLabelContentPaneWitho
}; };
} }
protected boolean supportRichEditor() {
return false;
}
protected Component[][] getPaneComponents() { protected Component[][] getPaneComponents() {
return new Component[][]{ return new Component[][]{
new Component[]{processesFormatPane, null}, new Component[]{processesFormatPane, null},

25
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/label/VanChartGanttPlotLabelNoCheckPane.java

@ -0,0 +1,25 @@
package com.fr.van.chart.gantt.designer.style.label;
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 VanChartGanttPlotLabelNoCheckPane extends VanChartGanttPlotLabelPane {
public VanChartGanttPlotLabelNoCheckPane(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);
}
}

5
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java

@ -2,6 +2,7 @@ package com.fr.van.chart.gantt.designer.style.tooltip;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat; import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat;
import com.fr.plugin.chart.base.format.AttrTooltipEndTimeFormat; import com.fr.plugin.chart.base.format.AttrTooltipEndTimeFormat;
import com.fr.plugin.chart.base.format.AttrTooltipProcessesFormat; import com.fr.plugin.chart.base.format.AttrTooltipProcessesFormat;
@ -136,6 +137,8 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
if(attrTooltipContent instanceof AttrGanttTooltipContent){ if(attrTooltipContent instanceof AttrGanttTooltipContent){
setRichTextAttr(new AttrTooltipRichText());
AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent; AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent;
Map<String, String> params = getRichTextAttr().getParams(); Map<String, String> params = getRichTextAttr().getParams();
@ -164,6 +167,8 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane
richTextProgressFormatPane.updateFormatParams(params, progressFormat.getJs()); richTextProgressFormatPane.updateFormatParams(params, progressFormat.getJs());
populateRichText(attrTooltipContent.getRichTextAttr()); populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
} }
} }

8
designer-chart/src/main/java/com/fr/van/chart/map/designer/VanMapAreaPointAndLineGroupPane.java

@ -1,10 +1,7 @@
package com.fr.van.chart.map.designer; package com.fr.van.chart.map.designer;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.border.Border;
/** /**
* Created by Mitisky on 16/5/20. * Created by Mitisky on 16/5/20.
@ -19,9 +16,4 @@ public class VanMapAreaPointAndLineGroupPane extends VanChartGroupPane {
public VanMapAreaPointAndLineGroupPane(final JPanel areaPane, final JPanel pointPane, final JPanel linePane){ public VanMapAreaPointAndLineGroupPane(final JPanel areaPane, final JPanel pointPane, final JPanel linePane){
super(new String[]{AREA_MAP_STRING, POINT_MAP_STRING, LINE_MAP_STRING}, new JPanel[]{areaPane, pointPane, linePane}); super(new String[]{AREA_MAP_STRING, POINT_MAP_STRING, LINE_MAP_STRING}, new JPanel[]{areaPane, pointPane, linePane});
} }
@Override
protected Border getButtonGroupBorder () {
return BorderFactory.createEmptyBorder(0,8,0,18);
}
} }

5
designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java

@ -3,6 +3,7 @@ package com.fr.van.chart.map.designer.style.label;
import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat; import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat;
import com.fr.plugin.chart.base.format.AttrTooltipMapValueFormat; import com.fr.plugin.chart.base.format.AttrTooltipMapValueFormat;
import com.fr.plugin.chart.type.TextAlign;
import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.VanChartLabelContentPane;
import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithoutCheckBox;
@ -42,9 +43,11 @@ public class VanChartMapLabelContentPane extends VanChartLabelContentPane {
@Override @Override
protected AttrTooltipContent createAttrTooltip() { protected AttrTooltipContent createAttrTooltip() {
AttrTooltipContent content = new AttrTooltipContent(); AttrTooltipContent content = new AttrTooltipContent(TextAlign.CENTER);
content.setCategoryFormat(new AttrTooltipAreaNameFormat()); content.setCategoryFormat(new AttrTooltipAreaNameFormat());
content.setValueFormat(new AttrTooltipMapValueFormat()); content.setValueFormat(new AttrTooltipMapValueFormat());
content.setRichTextCategoryFormat(new AttrTooltipAreaNameFormat());
content.setRichTextValueFormat(new AttrTooltipMapValueFormat());
return content; return content;
} }
} }

4
designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapRefreshTooltipContentPane.java

@ -23,6 +23,10 @@ public class VanChartMapRefreshTooltipContentPane extends VanChartMapTooltipCont
return new double[]{p,p,p,p,p,p}; return new double[]{p,p,p,p,p,p};
} }
protected boolean supportRichEditor() {
return false;
}
@Override @Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initFormatPane(parent, showOnPane); super.initFormatPane(parent, showOnPane);

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

Loading…
Cancel
Save