Browse Source

Merge pull request #1618 in DESIGN/design from ~JEO/report-design:persist/10.0 to persist/10.0

* commit '7cb89b56c298384e9d37924392a4dc1609a8b467': (88 commits)
  REPORT-30467 检测时长延长 关闭与确定对调
  REPORT-29118 mac下屏蔽
  REPORT-29815   添加插件监听
  REPORT-29815  统一下报表和表单的移动端属性快捷键
  REPORT-30369 同步到final
  REPORT-30347 处理异常弹窗
  MOBILE-26189 同步到final
  MOBILE-26198 && MOBILE-26189 交互调整
  fix 漏交
  MOBILE-26198 && MOBILE-26189
  REPORT-29118 && REPORT-29117
  CHART-13559 大数据下动画特效和高亮的label也要变灰
  MOBILE-26174 && MOBILE-25651
  REPORT-29462 设计器菜单栏-模板-纸张背景-渐变色,滑动右边游标,确定后再次查看,位置回到初始位置
  代码调整
  代码修改
  REPORT-29882 8.0工程升级10.0后,模板web属性打不开
  代码修改
  REPORT-29536【打印设置-本地打印自定义纸张大小的custom比其他选项多出首行空格
  REPORT-29576 异常弹窗处理
  ...
persist/10.0
Kara 5 years ago
parent
commit
8588b977d1
  1. 20
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 4
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  3. 26
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  4. 10
      designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java
  5. 22
      designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java
  6. 72
      designer-base/src/main/java/com/fr/design/extra/PluginUtils.java
  7. 4
      designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java
  8. 3
      designer-base/src/main/java/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java
  9. 4
      designer-base/src/main/java/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java
  10. 10
      designer-base/src/main/java/com/fr/design/extra/exe/SearchOnlineExecutor.java
  11. 28
      designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java
  12. 57
      designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java
  13. 36
      designer-base/src/main/java/com/fr/design/fun/FormAdaptiveConfigUIProcessor.java
  14. 25
      designer-base/src/main/java/com/fr/design/fun/MobileTemplateStyleProvider.java
  15. 50
      designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java
  16. 39
      designer-base/src/main/java/com/fr/design/fun/ReportLengthUNITProvider.java
  17. 23
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormAdaptiveConfigUIProcessor.java
  18. 25
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileTemplateStyleProvider.java
  19. 31
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractPropertyItemPaneProvider.java
  20. 42
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java
  21. 13
      designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataConfigPane.java
  22. 16
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButton.java
  23. 121
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButtonUI.java
  24. 18
      designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java
  25. 8
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java
  26. 10
      designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java
  27. 73
      designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItem.java
  28. 81
      designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItemUI.java
  29. 2
      designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java
  30. 6
      designer-base/src/main/java/com/fr/design/i18n/DesignI18nImpl.java
  31. 3
      designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java
  32. 161
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  33. 17
      designer-base/src/main/java/com/fr/design/mainframe/PaneHolder.java
  34. 78
      designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java
  35. 45
      designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfo.java
  36. 57
      designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java
  37. 5
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java
  38. 74
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java
  39. 57
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java
  40. 2
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java
  41. 233
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java
  42. 20
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  43. 3
      designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java
  44. 44
      designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java
  45. 39
      designer-base/src/main/java/com/fr/design/menu/MenuDef.java
  46. 200
      designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java
  47. 31
      designer-base/src/main/java/com/fr/design/menu/SnapChatMenuItemUI.java
  48. 29
      designer-base/src/main/java/com/fr/design/menu/SnapChatMenuUI.java
  49. 79
      designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java
  50. 33
      designer-base/src/main/java/com/fr/design/menu/SnapChatUtil.java
  51. 35
      designer-base/src/main/java/com/fr/design/notification/SnapChat.java
  52. 38
      designer-base/src/main/java/com/fr/design/notification/SnapChatAllTypes.java
  53. 93
      designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java
  54. 9
      designer-base/src/main/java/com/fr/design/notification/SnapChatKey.java
  55. 67
      designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java
  56. 10
      designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java
  57. 5
      designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java
  58. 7
      designer-base/src/main/java/com/fr/design/present/dict/FormulaDictPane.java
  59. 33
      designer-base/src/main/java/com/fr/design/style/AbstractPopBox.java
  60. 5
      designer-base/src/main/java/com/fr/design/style/BorderPane.java
  61. 3
      designer-base/src/main/java/com/fr/design/style/background/BackgroundPane.java
  62. 4
      designer-base/src/main/java/com/fr/design/style/background/gradient/FixedGradientBar.java
  63. 99
      designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java
  64. 7
      designer-base/src/main/java/com/fr/design/style/color/ColorSelectDialog.java
  65. 15
      designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java
  66. 73
      designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java
  67. 32
      designer-base/src/main/java/com/fr/design/unit/impl/CMReportLengthUNIT.java
  68. 31
      designer-base/src/main/java/com/fr/design/unit/impl/INCHReportLengthUNIT.java
  69. 31
      designer-base/src/main/java/com/fr/design/unit/impl/MMReportLengthUNIT.java
  70. 31
      designer-base/src/main/java/com/fr/design/unit/impl/PTReportLengthUNIT.java
  71. 2
      designer-base/src/main/java/com/fr/design/upm/UpmFinder.java
  72. 9
      designer-base/src/main/java/com/fr/design/utils/DesignerPort.java
  73. 2
      designer-base/src/main/java/com/fr/exit/DesignerExiter.java
  74. 9
      designer-base/src/main/java/com/fr/start/BaseDesigner.java
  75. 106
      designer-base/src/test/java/com/fr/design/menu/SnapChatMenuDefTest.java
  76. 8
      designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java
  77. 2
      designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java
  78. 1
      designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java
  79. 28
      designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java
  80. 39
      designer-chart/src/main/java/com/fr/design/chartx/component/MatchResultTable.java
  81. 174
      designer-chart/src/main/java/com/fr/design/chartx/component/button/ColorButton.java
  82. 253
      designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java
  83. 6
      designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java
  84. 9
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java
  85. 235
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java
  86. 19
      designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java
  87. 28
      designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java
  88. 7
      designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java
  89. 3
      designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java
  90. 1
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java
  91. 5
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomSeriesPane.java
  92. 16
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java
  93. 221
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java
  94. 18
      designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java
  95. 9
      designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java
  96. 1
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartLegendPane.java
  97. 175
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java
  98. 39
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java
  99. 27
      designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java
  100. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java
  101. Some files were not shown because too many files have changed in this diff Show More

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

@ -18,6 +18,7 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.locale.impl.ProductImproveMark; import com.fr.design.locale.impl.ProductImproveMark;
import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.notification.SnapChatConfig;
import com.fr.design.update.push.DesignerPushUpdateConfigManager; import com.fr.design.update.push.DesignerPushUpdateConfigManager;
import com.fr.design.style.color.ColorSelectConfigManager; import com.fr.design.style.color.ColorSelectConfigManager;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
@ -162,6 +163,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
*/ */
private AlphaFineConfigManager alphaFineConfigManager = AlphaFineConfigManager.getInstance(); private AlphaFineConfigManager alphaFineConfigManager = AlphaFineConfigManager.getInstance();
/**
* 阅后即焚的配置项
*/
private SnapChatConfig snapChatConfig = SnapChatConfig.getInstance();
private DesignerPushUpdateConfigManager designerPushUpdateConfigManager = DesignerPushUpdateConfigManager.getInstance(); private DesignerPushUpdateConfigManager designerPushUpdateConfigManager = DesignerPushUpdateConfigManager.getInstance();
private VcsConfigManager vcsConfigManager = VcsConfigManager.getInstance(); private VcsConfigManager vcsConfigManager = VcsConfigManager.getInstance();
@ -1562,12 +1568,18 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
readVcsAttr(reader); readVcsAttr(reader);
} else if (DesignerPort.XML_TAG.equals(name)) { } else if (DesignerPort.XML_TAG.equals(name)) {
readDesignerPort(reader); readDesignerPort(reader);
}else if (name.equals(SnapChatConfig.XML_TAG)) {
readSnapChatConfig(reader);
} else { } else {
readLayout(reader, name); readLayout(reader, name);
} }
} }
} }
private void readSnapChatConfig(XMLableReader reader) {
reader.readXMLObject(this.snapChatConfig = SnapChatConfig.getInstance());
}
private void readAlphaFineAttr(XMLableReader reader) { private void readAlphaFineAttr(XMLableReader reader) {
reader.readXMLObject(this.alphaFineConfigManager = AlphaFineConfigManager.getInstance()); reader.readXMLObject(this.alphaFineConfigManager = AlphaFineConfigManager.getInstance());
} }
@ -1783,9 +1795,17 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
writeDesignerPushUpdateAttr(writer); writeDesignerPushUpdateAttr(writer);
writeVcsAttr(writer); writeVcsAttr(writer);
writeDesignerPort(writer); writeDesignerPort(writer);
writeSnapChatConfig(writer);
writer.end(); writer.end();
} }
private void writeSnapChatConfig(XMLPrintWriter writer) {
if (this.snapChatConfig != null) {
this.snapChatConfig.writeXML(writer);
}
}
private void writeAlphaFineAttr(XMLPrintWriter writer) { private void writeAlphaFineAttr(XMLPrintWriter writer) {
if (this.alphaFineConfigManager != null) { if (this.alphaFineConfigManager != null) {
this.alphaFineConfigManager.writeXML(writer); this.alphaFineConfigManager.writeXML(writer);

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

@ -404,6 +404,10 @@ public class EnvChangeEntrance {
* 处理异常 * 处理异常
*/ */
public void dealEvnExceptionWhenStartDesigner() { public void dealEvnExceptionWhenStartDesigner() {
ProcessEventPipe eventPipe = FineProcessContext.getParentPipe();
if (eventPipe != null) {
eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue()));
}
final EnvListPane envListPane = new EnvListPane(); final EnvListPane envListPane = new EnvListPane();
envListPane.populateEnvManager(currentEnvName); envListPane.populateEnvManager(currentEnvName);
BasicDialog envListDialog = envListPane.showWindow(SwingUtilities.getWindowAncestor(DesignerContext.getDesignerFrame())); BasicDialog envListDialog = envListPane.showWindow(SwingUtilities.getWindowAncestor(DesignerContext.getDesignerFrame()));

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

@ -28,6 +28,7 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.unit.UnitConvertUtil;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -149,9 +150,6 @@ public class PreferencePane extends BasicPane {
private UIColorButton paginationLineColorTBButton; private UIColorButton paginationLineColorTBButton;
private UICheckBox supportCellEditorDefCheckBox;
private UICheckBox isDragPermitedCheckBox;
private UITextField logExportDirectoryField; private UITextField logExportDirectoryField;
private UIComboBox logLevelComboBox, pageLengthComboBox, reportLengthComboBox; private UIComboBox logLevelComboBox, pageLengthComboBox, reportLengthComboBox;
@ -199,7 +197,6 @@ public class PreferencePane extends BasicPane {
createFunctionPane(generalPane); createFunctionPane(generalPane);
createEditPane(generalPane); createEditPane(generalPane);
createGuiOfGridPane(generalPane);
createColorSettingPane(generalPane); createColorSettingPane(generalPane);
createVcsSettingPane(generalPane); createVcsSettingPane(generalPane);
@ -447,18 +444,6 @@ public class PreferencePane extends BasicPane {
} }
private void createGuiOfGridPane(JPanel generalPane) {
// GridPane
JPanel guiOfGridPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Preference_Setting_Grid"));
generalPane.add(guiOfGridPane);
supportCellEditorDefCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Preference_Support_Cell_Editor_Definition"));
guiOfGridPane.add(supportCellEditorDefCheckBox);
isDragPermitedCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Preference_Is_Drag_Permited"));
guiOfGridPane.add(isDragPermitedCheckBox);
}
private void createColorSettingPane(JPanel generalPane) { private void createColorSettingPane(JPanel generalPane) {
// Color Setting Pane // Color Setting Pane
JPanel colorSettingPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Preference_Setting_Colors")); JPanel colorSettingPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Preference_Setting_Colors"));
@ -591,7 +576,7 @@ public class PreferencePane extends BasicPane {
pageLengthComboBox = new UIComboBox(new String[]{i18nText("Fine-Design_Basic_Page_Setup_MM"), i18nText("Fine-Design_Report_Unit_CM"), i18nText("Fine-Design_Report_Unit_INCH")}); pageLengthComboBox = new UIComboBox(new String[]{i18nText("Fine-Design_Basic_Page_Setup_MM"), i18nText("Fine-Design_Report_Unit_CM"), i18nText("Fine-Design_Report_Unit_INCH")});
pageLengthComboBox.setPreferredSize(new Dimension(80, 20)); pageLengthComboBox.setPreferredSize(new Dimension(80, 20));
pageLengthComboBox.setMinimumSize(new Dimension(80, 20)); pageLengthComboBox.setMinimumSize(new Dimension(80, 20));
reportLengthComboBox = new UIComboBox(new String[]{i18nText("Fine-Design_Basic_Page_Setup_MM"), i18nText("Fine-Design_Report_Unit_CM"), i18nText("Fine-Design_Report_Unit_INCH"), i18nText("Fine-Design_Report_Unit_PT_Duplicate")}); reportLengthComboBox = new UIComboBox(UnitConvertUtil.getUnitItems());
reportLengthComboBox.setPreferredSize(new Dimension(80, 20)); reportLengthComboBox.setPreferredSize(new Dimension(80, 20));
reportLengthComboBox.setMinimumSize(new Dimension(80, 20)); reportLengthComboBox.setMinimumSize(new Dimension(80, 20));
UILabel pagelengthLabel = new UILabel(i18nText("Fine-Design_Basic_Page_Setup_Scale_Units") + ":"); UILabel pagelengthLabel = new UILabel(i18nText("Fine-Design_Basic_Page_Setup_Scale_Units") + ":");
@ -696,9 +681,6 @@ public class PreferencePane extends BasicPane {
useIntervalCheckBox.setSelected(vcsConfigManager.isUseInterval()); useIntervalCheckBox.setSelected(vcsConfigManager.isUseInterval());
gcEnableCheckBox.setSelected(GcConfig.getInstance().isGcEnable()); gcEnableCheckBox.setSelected(GcConfig.getInstance().isGcEnable());
gcButton.setEnabled(gcEnableCheckBox.isSelected()); gcButton.setEnabled(gcEnableCheckBox.isSelected());
supportCellEditorDefCheckBox.setSelected(designerEnvManager.isSupportCellEditorDef());
isDragPermitedCheckBox.setSelected(designerEnvManager.isDragPermited());
gridLineColorTBButton.setColor(designerEnvManager.getGridLineColor()); gridLineColorTBButton.setColor(designerEnvManager.getGridLineColor());
paginationLineColorTBButton.setColor(designerEnvManager.getPaginationLineColor()); paginationLineColorTBButton.setColor(designerEnvManager.getPaginationLineColor());
@ -768,12 +750,8 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setDefaultStringToFormula(defaultStringToFormulaBox.isSelected()); designerEnvManager.setDefaultStringToFormula(defaultStringToFormulaBox.isSelected());
designerEnvManager.setSupportCellEditorDef(supportCellEditorDefCheckBox.isSelected());
designerEnvManager.setAutoCompleteShortcuts(shortCutKeyStore != null ? shortCutKeyStore.toString().replace(TYPE, DISPLAY_TYPE) : shortCutLabel.getText()); designerEnvManager.setAutoCompleteShortcuts(shortCutKeyStore != null ? shortCutKeyStore.toString().replace(TYPE, DISPLAY_TYPE) : shortCutLabel.getText());
designerEnvManager.setDragPermited(isDragPermitedCheckBox.isSelected());
designerEnvManager.setGridLineColor(gridLineColorTBButton.getColor()); designerEnvManager.setGridLineColor(gridLineColorTBButton.getColor());
designerEnvManager.setPaginationLineColor(paginationLineColorTBButton.getColor()); designerEnvManager.setPaginationLineColor(paginationLineColorTBButton.getColor());

10
designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java

@ -72,11 +72,11 @@ public class AboutPane extends JPanel {
addPhoneAndQQPane(contentPane); addPhoneAndQQPane(contentPane);
// 官网 // 官网
JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Official_Website"), CloudCenter.getInstance().acquireUrlByKind("website." + GeneralContext.getLocale(), ProductConstants.WEBSITE_URL)); JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Official_Website"), CloudCenter.getInstance().acquireConf("website." + GeneralContext.getLocale(), ProductConstants.WEBSITE_URL));
// 支持邮箱 // 支持邮箱
String defaultEmail = CloudCenter.getInstance().acquireUrlByKind("support.email", ProductConstants.SUPPORT_EMAIL); String defaultEmail = CloudCenter.getInstance().acquireConf("support.email", ProductConstants.SUPPORT_EMAIL);
JPanel emailPane = getEmailActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Support_Email"), CloudCenter.getInstance().acquireUrlByKind("support.email." + GeneralContext.getLocale(), defaultEmail)); JPanel emailPane = getEmailActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Support_Email"), CloudCenter.getInstance().acquireConf("support.email." + GeneralContext.getLocale(), defaultEmail));
contentPane.add(urlActionPane); contentPane.add(urlActionPane);
contentPane.add(emailPane); contentPane.add(emailPane);
@ -96,7 +96,7 @@ public class AboutPane extends JPanel {
if (GeneralContext.getLocale().equals(Locale.US)) { if (GeneralContext.getLocale().equals(Locale.US)) {
return; return;
} }
boxCenterAlignmentPane = new BoxCenterAligmentPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Service_Phone") + CloudCenter.getInstance().acquireUrlByKind("service.phone." + FRContext.getLocale(), COMPANY_TELEPHONE)); boxCenterAlignmentPane = new BoxCenterAligmentPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Service_Phone") + CloudCenter.getInstance().acquireConf("service.phone." + FRContext.getLocale(), COMPANY_TELEPHONE));
contentPane.add(boxCenterAlignmentPane); contentPane.add(boxCenterAlignmentPane);
// 繁体版不显示QQ // 繁体版不显示QQ
if (GeneralContext.getLocale().equals(Locale.TAIWAN)) { if (GeneralContext.getLocale().equals(Locale.TAIWAN)) {
@ -176,7 +176,7 @@ public class AboutPane extends JPanel {
private String getCopyRight() { private String getCopyRight() {
return append(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_About_CopyRight"), COPYRIGHT_LABEL, return append(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_About_CopyRight"), COPYRIGHT_LABEL,
ProductConstants.HISTORY, StringUtils.BLANK, CloudCenter.getInstance().acquireUrlByKind("company.name", ProductConstants.COMPANY_NAME)); ProductConstants.HISTORY, StringUtils.BLANK, CloudCenter.getInstance().acquireConf("company.name", ProductConstants.COMPANY_NAME));
} }
private String getBuildTitle() { private String getBuildTitle() {

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

@ -1,10 +1,10 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.exe.callback.InstallFromDiskCallback; import com.fr.design.extra.exe.callback.InstallFromDiskCallback;
import com.fr.design.extra.exe.callback.InstallOnlineCallback; import com.fr.design.extra.exe.callback.InstallOnlineCallback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.extra.exe.callback.ModifyStatusCallback; import com.fr.design.extra.exe.callback.ModifyStatusCallback;
import com.fr.design.extra.exe.callback.UninstallPluginCallback; import com.fr.design.extra.exe.callback.UninstallPluginCallback;
import com.fr.design.extra.exe.callback.UpdateFromDiskCallback; import com.fr.design.extra.exe.callback.UpdateFromDiskCallback;
@ -13,6 +13,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
@ -25,9 +26,9 @@ import com.fr.plugin.manage.control.PluginTaskResult;
import com.fr.plugin.view.PluginView; import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.JOptionPane; import javax.swing.*;
import javax.swing.SwingUtilities;
import java.io.File; import java.io.File;
import java.net.HttpURLConnection;
import java.util.List; import java.util.List;
@ -110,13 +111,18 @@ public class PluginOperateUtils {
public static String getRecommendPlugins() { public static String getRecommendPlugins() {
String plistUrl = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.feature"); String plistUrl = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.feature");
JSONArray resultArray = JSONArray.create(); JSONArray resultArray = JSONArray.create();
if (StringUtils.isBlank(plistUrl)) {
return resultArray.toString();
}
try { try {
HttpClient httpClient = new HttpClient(plistUrl); HttpClient httpClient = new HttpClient(plistUrl);
String result = httpClient.getResponseText(); if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
JSONArray jsonArray = new JSONArray(result); String result = httpClient.getResponseText();
resultArray = PluginUtils.filterPluginsFromVersion(jsonArray); JSONArray jsonArray = new JSONArray(result);
} catch (Exception e) { resultArray = PluginUtils.filterPluginsFromVersion(jsonArray);
FineLoggerFactory.getLogger().error(e.getMessage(), e); }
} catch (JSONException e) {
FineLoggerFactory.getLogger().info(e.getMessage(), e);
} }
return resultArray.toString(); return resultArray.toString();
} }

72
designer-base/src/main/java/com/fr/design/extra/PluginUtils.java

@ -2,6 +2,7 @@ package com.fr.design.extra;
import com.fr.base.TemplateUtils; import com.fr.base.TemplateUtils;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
@ -12,8 +13,8 @@ import com.fr.plugin.basic.version.Version;
import com.fr.plugin.basic.version.VersionIntervalFactory; import com.fr.plugin.basic.version.VersionIntervalFactory;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.error.PluginBaseErrorCode; import com.fr.plugin.error.PluginBaseErrorCode;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.view.PluginView; import com.fr.plugin.view.PluginView;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
@ -21,11 +22,12 @@ import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.JOptionPane; import javax.swing.*;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -46,8 +48,7 @@ public class PluginUtils {
public static PluginMarker createPluginMarker(String pluginInfo) { public static PluginMarker createPluginMarker(String pluginInfo) {
//todo 判空 //todo 判空
String[] plugin = pluginInfo.split("_"); String[] plugin = pluginInfo.split("_");
PluginMarker pluginMarker = PluginMarker.create(plugin[0], plugin[1]); return PluginMarker.create(plugin[0], plugin[1]);
return pluginMarker;
} }
public static JSONObject getLatestPluginInfo(String pluginID) throws Exception { public static JSONObject getLatestPluginInfo(String pluginID) throws Exception {
@ -90,7 +91,11 @@ public class PluginUtils {
InputStream reader = null; InputStream reader = null;
FileOutputStream writer = null; FileOutputStream writer = null;
try { try {
HttpClient httpClient = new HttpClient(getDownloadPath(id)); String downloadPath = getDownloadPath(id);
if (StringUtils.isBlank(downloadPath)) {
throw new PluginVerifyException(Toolkit.i18nText("Fine-Design_Basic_Plugin_Connect_Server_Error"));
}
HttpClient httpClient = new HttpClient(downloadPath);
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
int totalSize = httpClient.getContentLength(); int totalSize = httpClient.getContentLength();
reader = httpClient.getResponseStream(); reader = httpClient.getResponseStream();
@ -108,12 +113,12 @@ public class PluginUtils {
p.process(totalBytesRead / (double) totalSize); p.process(totalBytesRead / (double) totalSize);
} }
} else { } else {
throw new com.fr.plugin.PluginVerifyException(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Connect_Server_Error")); throw new PluginVerifyException(Toolkit.i18nText("Fine-Design_Basic_Plugin_Connect_Server_Error"));
} }
} catch (PluginVerifyException e) { } catch (PluginVerifyException e) {
FineJOptionPane.showMessageDialog(null, e.getMessage(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(null, e.getMessage(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
return false; return false;
} catch (Exception e) { } catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false; return false;
} finally { } finally {
@ -122,7 +127,7 @@ public class PluginUtils {
return true; return true;
} }
private static void closeStream(InputStream reader, FileOutputStream writer){ private static void closeStream(InputStream reader, FileOutputStream writer) {
try { try {
if (null != reader) { if (null != reader) {
reader.close(); reader.close();
@ -136,18 +141,26 @@ public class PluginUtils {
} }
} }
private static String getDownloadPath(String id) throws Exception { private static String getDownloadPath(String id) {
HashMap<String, String> map = new HashMap<String, String>(); String url = CloudCenter.getInstance().acquireUrlByKind("shop.script.download");
map.put("id", id); if (StringUtils.isBlank(url)) {
HttpClient httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("shop.script.download")+ "?" + FR_VERSION + "=" + ProductConstants.VERSION); return StringUtils.EMPTY;
}
HttpClient httpClient = new HttpClient(url + "?" + FR_VERSION + "=" + ProductConstants.VERSION);
httpClient.asGet(); httpClient.asGet();
String resText = httpClient.getResponseText(); if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
JSONObject resultJSONObject = new JSONObject(resText); String resText = httpClient.getResponseText();
String scriptUrl = resultJSONObject.optString("result"); JSONObject resultJSONObject = new JSONObject(resText);
String charSet = EncodeConstants.ENCODING_UTF_8; String scriptUrl = resultJSONObject.optString("result");
scriptUrl = URLDecoder.decode(URLDecoder.decode(scriptUrl, charSet), charSet); String charSet = EncodeConstants.ENCODING_UTF_8;
try {
return scriptUrl; scriptUrl = URLDecoder.decode(URLDecoder.decode(scriptUrl, charSet), charSet);
} catch (UnsupportedEncodingException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return scriptUrl;
}
return StringUtils.EMPTY;
} }
public static boolean isPluginMatch(PluginView pluginView, String text) { public static boolean isPluginMatch(PluginView pluginView, String text) {
@ -196,7 +209,7 @@ public class PluginUtils {
} }
public static String getMessageByErrorCode(PluginBaseErrorCode errorCode) { public static String getMessageByErrorCode(PluginBaseErrorCode errorCode) {
if(errorCode == PluginErrorCode.None){ if (errorCode == PluginErrorCode.None) {
return ""; return "";
} }
@ -205,7 +218,7 @@ public class PluginUtils {
private static String getInterKeyByErrorCode(PluginBaseErrorCode errorCode) { private static String getInterKeyByErrorCode(PluginBaseErrorCode errorCode) {
return errorCode.getDescription(); return errorCode.getDescription();
} }
public static PluginMarker getInstalledPluginMarkerByID(String pluginID) { public static PluginMarker getInstalledPluginMarkerByID(String pluginID) {
@ -219,29 +232,30 @@ public class PluginUtils {
/** /**
* 在不同设计器版本下展示不同插件 * 在不同设计器版本下展示不同插件
*
* @return 插件 * @return 插件
*/ */
public static JSONArray filterPluginsFromVersion(JSONArray oriJSONArray) throws Exception{ public static JSONArray filterPluginsFromVersion(JSONArray oriJSONArray) {
JSONArray resultJSONArray = JSONArray.create(); JSONArray resultJSONArray = JSONArray.create();
for(int i = 0; i < oriJSONArray.length(); i++){ for (int i = 0; i < oriJSONArray.length(); i++) {
JSONObject jo = oriJSONArray.getJSONObject(i); JSONObject jo = oriJSONArray.getJSONObject(i);
String envVersion = jo.optString("envversion"); String envVersion = jo.optString("envversion");
if(isCompatibleCurrentEnv(envVersion)){ if (isCompatibleCurrentEnv(envVersion)) {
resultJSONArray.put(jo); resultJSONArray.put(jo);
} }
} }
return resultJSONArray; return resultJSONArray;
} }
private static boolean isCompatibleCurrentEnv(String envVersion){ private static boolean isCompatibleCurrentEnv(String envVersion) {
return VersionIntervalFactory.create(envVersion).contain(Version.currentEnvVersion()); return VersionIntervalFactory.create(envVersion).contain(Version.currentEnvVersion());
} }
public static JSONArray transferStorePluginToJson(PluginContext [] pluginContexts){ public static JSONArray transferStorePluginToJson(PluginContext[] pluginContexts) {
JSONArray ja = JSONArray.create(); JSONArray ja = JSONArray.create();
try { try {
for(PluginContext pluginContext : pluginContexts){ for (PluginContext pluginContext : pluginContexts) {
JSONObject jo = JSONObject.create(); JSONObject jo = JSONObject.create();
jo.put("id", pluginContext.getID()); jo.put("id", pluginContext.getID());
jo.put("name", pluginContext.getName()); jo.put("name", pluginContext.getName());
@ -265,7 +279,7 @@ public class PluginUtils {
jo.put("switchedReason", pluginContext.getSwitchedReason()); jo.put("switchedReason", pluginContext.getSwitchedReason());
ja.put(jo); ja.put(jo);
} }
}catch (Exception e){ } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return ja; return ja;

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

@ -75,7 +75,7 @@ public class WebViewDlgHelper {
} }
return; return;
} }
String jar_version = PluginStoreConstants.getInstance().getProps(ENV_VERSION, StringUtils.EMPTY); String jar_version = PluginStoreConstants.getProps(ENV_VERSION, StringUtils.EMPTY);
if (ComparatorUtils.equals(jar_version, ProductConstants.VERSION)) { if (ComparatorUtils.equals(jar_version, ProductConstants.VERSION)) {
updateShopScripts(SHOP_SCRIPTS); updateShopScripts(SHOP_SCRIPTS);
showPluginDlg(); showPluginDlg();
@ -297,7 +297,7 @@ public class WebViewDlgHelper {
protected Void doInBackground() throws Exception { protected Void doInBackground() throws Exception {
String url = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.update"); String url = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.update");
if (url != null) { if (url != null) {
String text = HttpToolbox.get(url + "?" + PluginUtils.FR_VERSION + "=" + ProductConstants.VERSION + "&version=" + PluginStoreConstants.getInstance().getProps("VERSION")); String text = HttpToolbox.get(url + "?" + PluginUtils.FR_VERSION + "=" + ProductConstants.VERSION + "&version=" + PluginStoreConstants.getProps("VERSION"));
JSONObject resultJSONObject = new JSONObject(text); JSONObject resultJSONObject = new JSONObject(text);
String isLatest = resultJSONObject.optString("result"); String isLatest = resultJSONObject.optString("result");
if (!ComparatorUtils.equals(isLatest, LATEST)) { if (!ComparatorUtils.equals(isLatest, LATEST)) {

3
designer-base/src/main/java/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java

@ -4,6 +4,7 @@ import com.fr.design.extra.PluginConstants;
import com.fr.design.extra.Process; import com.fr.design.extra.Process;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.stable.StringUtils;
/** /**
* Created by vito on 16/5/16. * Created by vito on 16/5/16.
@ -28,7 +29,7 @@ public class GetPluginCategoriesExecutor implements Executor {
@Override @Override
public void run(Process<String> process) { public void run(Process<String> process) {
String url = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.category"); String url = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.category");
if (url != null) { if (StringUtils.isNotEmpty(url)) {
HttpClient httpClient = new HttpClient(url); HttpClient httpClient = new HttpClient(url);
result = httpClient.getResponseText(); result = httpClient.getResponseText();
} else { } else {

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

@ -52,7 +52,7 @@ public class GetPluginFromStoreExecutor implements Executor {
@Override @Override
public void run(Process<String> process) { public void run(Process<String> process) {
String plistUrl = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.plist") + "?"; String plistUrl = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.plist");
boolean getRecommend = StringUtils.isEmpty(category) && StringUtils.isEmpty(seller) && StringUtils.isEmpty(fee) && StringUtils.isEmpty(scope); boolean getRecommend = StringUtils.isEmpty(category) && StringUtils.isEmpty(seller) && StringUtils.isEmpty(fee) && StringUtils.isEmpty(scope);
if (getRecommend) { if (getRecommend) {
result = PluginOperateUtils.getRecommendPlugins(); result = PluginOperateUtils.getRecommendPlugins();
@ -61,7 +61,7 @@ public class GetPluginFromStoreExecutor implements Executor {
if (StringUtils.isNotBlank(plistUrl)) { if (StringUtils.isNotBlank(plistUrl)) {
StringBuilder url = new StringBuilder(); StringBuilder url = new StringBuilder();
url.append(plistUrl); url.append(plistUrl).append("?");
PluginOperateUtils.dealParams(url, category, seller, fee, scope); PluginOperateUtils.dealParams(url, category, seller, fee, scope);
try { try {
HttpClient httpClient = new HttpClient(url.toString()); HttpClient httpClient = new HttpClient(url.toString());

10
designer-base/src/main/java/com/fr/design/extra/exe/SearchOnlineExecutor.java

@ -14,8 +14,8 @@ import com.fr.stable.StringUtils;
* Created by vito on 16/4/18. * Created by vito on 16/4/18.
*/ */
public class SearchOnlineExecutor implements Executor { public class SearchOnlineExecutor implements Executor {
private String result = StringUtils.EMPTY; private String result = JSONArray.create().toString();
private String keyword; private final String keyword;
public SearchOnlineExecutor(String keyword) { public SearchOnlineExecutor(String keyword) {
this.keyword = keyword; this.keyword = keyword;
@ -42,7 +42,11 @@ public class SearchOnlineExecutor implements Executor {
result = PluginOperateUtils.getRecommendPlugins(); result = PluginOperateUtils.getRecommendPlugins();
return; return;
} }
HttpClient httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("shop.plugin.store") + "&keyword=" + keyword); String url = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.store");
if (StringUtils.isEmpty(url)) {
return;
}
HttpClient httpClient = new HttpClient(url + "&keyword=" + keyword);
httpClient.asGet(); httpClient.asGet();
String responseText = httpClient.getResponseText(); String responseText = httpClient.getResponseText();
JSONObject jsonObject = new JSONObject(responseText); JSONObject jsonObject = new JSONObject(responseText);

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

@ -220,8 +220,8 @@ public class JavaEditorPane extends BasicPane {
" }\n" + " }\n" +
"\n" + "\n" +
" /**\n" + " /**\n" +
" * 获取数据集的列数\n" + " * Get the number of columns in a dataset\n" +
" * @return 数据集的列\n" + " * @return Dataset columns\n" +
" * @throws TableDataException\n" + " * @throws TableDataException\n" +
" */\n" + " */\n" +
" public int getColumnCount() throws TableDataException {\n" + " public int getColumnCount() throws TableDataException {\n" +
@ -229,9 +229,9 @@ public class JavaEditorPane extends BasicPane {
" }\n" + " }\n" +
"\n" + "\n" +
" /**\n" + " /**\n" +
" * 获取数据集指定列的列名\n" + " * Get the column name of the specified column of the dataset\n" +
" * @param columnIndex 指定列的索引\n" + " * @param columnIndex The index of the specified column\n" +
" * @return 指定列的列名\n" + " * @return The column name of the specified column\n" +
" * @throws TableDataException\n" + " * @throws TableDataException\n" +
" */\n" + " */\n" +
" public String getColumnName(int columnIndex) throws TableDataException {\n" + " public String getColumnName(int columnIndex) throws TableDataException {\n" +
@ -239,8 +239,8 @@ public class JavaEditorPane extends BasicPane {
" }\n" + " }\n" +
"\n" + "\n" +
" /**\n" + " /**\n" +
" * 获取数据集的行数\n" + " * Get the number of rows in the dataset\n" +
" * @return 数据集数据行数\n" + " * @return Dataset rows\n" +
" * @throws TableDataException\n" + " * @throws TableDataException\n" +
" */\n" + " */\n" +
" public int getRowCount() throws TableDataException {\n" + " public int getRowCount() throws TableDataException {\n" +
@ -248,10 +248,10 @@ public class JavaEditorPane extends BasicPane {
" }\n" + " }\n" +
"\n" + "\n" +
" /**\n" + " /**\n" +
" * 获取数据集指定位置上的值\n" + " * Get the value at the specified position in the dataset\n" +
" * @param rowIndex 指定的行索引\n" + " * @param rowIndex The specified row index\n" +
" * @param columnIndex 指定的列索引\n" + " * @param columnIndex The specified column index\n" +
" * @return 指定位置的值\n" + " * @return The value of the specified location\n" +
" */\n" + " */\n" +
" public Object getValueAt(int rowIndex, int columnIndex) {\n" + " public Object getValueAt(int rowIndex, int columnIndex) {\n" +
" return null;\n" + " return null;\n" +
@ -263,12 +263,12 @@ public class JavaEditorPane extends BasicPane {
"import com.fr.script.AbstractFunction;\n" + "import com.fr.script.AbstractFunction;\n" +
"\n" + "\n" +
"/**\n" + "/**\n" +
" * 自定义函数\n" + " * Custom function\n" +
" */\n" + " */\n" +
"public class CustomFun extends AbstractFunction {\n" + "public class CustomFun extends AbstractFunction {\n" +
" /**\n" + " /**\n" +
" * @param args 函数的参数,是经过了算子处理了其中特殊参数的\n" + " * @param args The parameters of the function are processed by calculator with special parameters\n" +
" * @return 经过函数处理的值,用于参与最终计算\n" + " * @return The value processed by the function is used to participate in the final calculation\n" +
" */\n" + " */\n" +
" public Object run(Object[] args) {\n" + " public Object run(Object[] args) {\n" +
" return null;\n" + " return null;\n" +

57
designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java

@ -0,0 +1,57 @@
package com.fr.design.fun;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.mainframe.DockingView;
import com.fr.stable.fun.mark.Immutable;
import javax.swing.JPanel;
/**
* 组件库面板处理器
*
* created by Harrison on 2020/03/16
**/
public interface ComponentLibraryPaneProcessor extends Immutable {
String XML_TAG = "ComponentLibraryPaneProcessor";
int CURRENT_LEVEL = 1;
/**
* 创建展示面板
*
* @param isEdit 是否可以编辑
* @return 展示面板
*/
UIScrollPane createShowPanel(boolean isEdit);
/**
* 创建菜单的上部面板
*
* @return 面板
*/
JPanel createMenuNorthPane();
/**
* 创建复选框
*
* @return 复选框
*/
UIComboBox createMenuComBox();
void parentView(DockingView dockingView);
/**
* 父面板
*
* @param panel 面板
*/
void parentPane(JPanel panel);
/**
* 创建完成
*/
void complete();
}

36
designer-base/src/main/java/com/fr/design/fun/FormAdaptiveConfigUIProcessor.java

@ -0,0 +1,36 @@
package com.fr.design.fun;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.ShortCut;
import com.fr.stable.fun.mark.Immutable;
import javax.swing.JComponent;
import java.awt.Dimension;
import java.awt.image.BufferedImage;
/**
* Created by kerry on 2020-04-09
* 临时接口后续自适应内置后删除
*/
public interface FormAdaptiveConfigUIProcessor extends Immutable {
String MARK_STRING = "FormAdaptiveConfigUIProcessor";
int CURRENT_LEVEL = 1;
/**
* 获取表单自适应配置菜单
* @return 表单自适应配置菜单
*/
ShortCut getConfigShortCut(JTemplate jTemplate);
/**
* 绘制自适应下报表块在表单界面中显示图片
* @param size 绘制尺寸
* @param elementCasePane 报表块内容对象
* @return 自适应下报表块在表单界面中显示的图片
*/
BufferedImage paintFormElementCaseImage(Dimension size, JComponent elementCasePane);
}

25
designer-base/src/main/java/com/fr/design/fun/MobileTemplateStyleProvider.java

@ -0,0 +1,25 @@
package com.fr.design.fun;
import com.fr.design.beans.BasicBeanPane;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import com.fr.stable.fun.mark.Mutable;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/3/31
*/
public interface MobileTemplateStyleProvider extends Mutable {
String XML_TAG = "MobileTemplateStyleProvider";
int CURRENT_LEVEL = 1;
Class<? extends MobileTemplateStyle> classFroMobileTemplateStyle();
Class<? extends BasicBeanPane<MobileTemplateStyle>> classFroMobileTemplateStyleAppearance();
String displayName();
}

50
designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java

@ -0,0 +1,50 @@
package com.fr.design.fun;
import com.fr.design.mainframe.PaneHolder;
import com.fr.design.mainframe.PropertyItemBean;
import com.fr.stable.fun.mark.Mutable;
import org.jetbrains.annotations.Nullable;
/**
* created by Harrison on 2020/03/23
**/
public interface PropertyItemPaneProvider<T> extends Mutable {
int CURRENT_LEVEL = 1;
String XML_TAG = "PropertyItemPaneProvider";
int FIRST = 100;
int LAST = -100;
/**
* 独一无二的标志
*
* @return 标志
*/
String key();
/**
* 配置属性
*
* @return 熟悉
*/
PropertyItemBean getItem();
/**
* 面板持有者
*
* @param clazz 类型
* @return 持有者
*/
@Nullable
PaneHolder<T> getPaneHolder(Class<?> clazz);
/**
* 想要替代的类型
*
* @return 替代类型
*/
String replaceKey();
}

39
designer-base/src/main/java/com/fr/design/fun/ReportLengthUNITProvider.java

@ -0,0 +1,39 @@
package com.fr.design.fun;
import com.fr.stable.fun.mark.Mutable;
import com.fr.stable.unit.UNIT;
/**
* Created by kerry on 2020-04-09
*/
public interface ReportLengthUNITProvider extends Mutable {
String MARK_STRING = "ReportLengthUNITProvider";
int CURRENT_LEVEL = 1;
/**
* 标尺单位显示字符
* @return 标尺单位字符
*/
String unitText();
/**
* 标尺单位类型(之前是将int类型的值直接保存在数据库里面的)
* @return 返回标尺单位类型
*/
int unitType();
/**
* UNIT转标尺单位值
* @param value UNIT
* @return 标尺单位值
*/
float unit2Value4Scale(UNIT value);
/**
* 标尺单位值转UNIT
* @param value 标尺单位值
* @return UNIT
*/
UNIT float2UNIT(float value);
}

23
designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormAdaptiveConfigUIProcessor.java

@ -0,0 +1,23 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.FormAdaptiveConfigUIProcessor;
import com.fr.stable.fun.mark.API;
/**
* Created by kerry on 2020-04-09
*/
@API(level = FormAdaptiveConfigUIProcessor.CURRENT_LEVEL)
public abstract class AbstractFormAdaptiveConfigUIProcessor implements FormAdaptiveConfigUIProcessor {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public int layerIndex() {
return DEFAULT_LAYER_INDEX;
}
}

25
designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileTemplateStyleProvider.java

@ -0,0 +1,25 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.MobileTemplateStyleProvider;
import com.fr.design.fun.MobileWidgetStyleProvider;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/3/31
*/
@API(level = MobileWidgetStyleProvider.CURRENT_LEVEL)
public abstract class AbstractMobileTemplateStyleProvider extends AbstractProvider implements MobileTemplateStyleProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

31
designer-base/src/main/java/com/fr/design/fun/impl/AbstractPropertyItemPaneProvider.java

@ -0,0 +1,31 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.PropertyItemPaneProvider;
import com.fr.design.mainframe.PaneHolder;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* created by Harrison on 2020/03/23
**/
@API(level = PropertyItemPaneProvider.CURRENT_LEVEL)
public abstract class AbstractPropertyItemPaneProvider<T> extends AbstractProvider implements PropertyItemPaneProvider<T> {
@Override
public PaneHolder<T> getPaneHolder(Class<?> clazz) {
if (sign().equals(clazz)) {
return getPathHolder0();
}
return null;
}
protected abstract PaneHolder<T> getPathHolder0();
protected abstract Class<T> sign();
@Override
public int currentAPILevel() {
return PropertyItemPaneProvider.CURRENT_LEVEL;
}
}

42
designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java

@ -0,0 +1,42 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.ReportLengthUNITProvider;
import com.fr.stable.StringUtils;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
import com.fr.stable.unit.UNIT;
/**
* Created by kerry on 2020-04-09
*/
@API(level = ReportLengthUNITProvider.CURRENT_LEVEL)
public abstract class AbstractReportLengthUNITProvider extends AbstractProvider implements ReportLengthUNITProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String unitText() {
return StringUtils.EMPTY;
}
@Override
public int unitType() {
return 0;
}
@Override
public float unit2Value4Scale(UNIT value) {
return 0;
}
@Override
public UNIT float2UNIT(float value) {
return UNIT.ZERO;
}
}

13
designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataConfigPane.java

@ -7,6 +7,7 @@ import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.present.dict.TableDataDictPane; import com.fr.design.present.dict.TableDataDictPane;
import com.fr.form.ui.tree.LayerConfig; import com.fr.form.ui.tree.LayerConfig;
import com.fr.form.ui.tree.LayerDependence; import com.fr.form.ui.tree.LayerDependence;
import com.fr.stable.StringUtils;
import java.awt.*; import java.awt.*;
import java.util.*; import java.util.*;
@ -73,13 +74,19 @@ public class LayerDataConfigPane extends BasicBeanPane<LayerConfig> {
if (wrapper != null) { if (wrapper != null) {
columnNames = wrapper.calculateColumnNameList(); columnNames = wrapper.calculateColumnNameList();
} else { } else {
columnNames = new ArrayList<String>(); columnNames = new ArrayList<>();
} }
String viewColStr = tableDataDictPane.updateBean().getValueColumnName();
String modelColStr = tableDataDictPane.updateBean().getKeyColumnName();
TableDataDictionary dictionary = tableDataDictPane.updateBean(); TableDataDictionary dictionary = tableDataDictPane.updateBean();
String viewColStr = dictionary.getValueColumnName();
String modelColStr = dictionary.getKeyColumnName();
int viewCol = columnNames.indexOf(viewColStr); int viewCol = columnNames.indexOf(viewColStr);
int modelCol = columnNames.indexOf(modelColStr); int modelCol = columnNames.indexOf(modelColStr);
if (StringUtils.EMPTY.equals(viewColStr)) {
viewCol = dictionary.getValueColumnIndex();
}
if (StringUtils.EMPTY.equals(modelColStr)) {
modelCol = dictionary.getKeyColumnIndex();
}
//将数据设置到当前正在修改的layerData中 //将数据设置到当前正在修改的layerData中
this.layerConfig.setDictionary(dictionary); this.layerConfig.setDictionary(dictionary);
this.layerConfig.setModelColumn(modelCol); this.layerConfig.setModelColumn(modelCol);

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

@ -22,6 +22,8 @@ public class UIRadioButton extends JRadioButton implements UIObserver, GlobalNam
private GlobalNameListener globalNameListener = null; private GlobalNameListener globalNameListener = null;
private String radioButtonName = StringUtils.EMPTY; private String radioButtonName = StringUtils.EMPTY;
private boolean markMnemonic = true;
public UIRadioButton() { public UIRadioButton() {
super(); super();
initListener(); initListener();
@ -58,6 +60,13 @@ public class UIRadioButton extends JRadioButton implements UIObserver, GlobalNam
initComponent(); initComponent();
} }
public UIRadioButton(String text, boolean selected, boolean markMnemonic) {
super(text, selected);
initListener();
initComponent();
this.markMnemonic = markMnemonic;
}
public UIRadioButton(String text, Icon icon) { public UIRadioButton(String text, Icon icon) {
super(text, icon); super(text, icon);
initListener(); initListener();
@ -70,6 +79,13 @@ public class UIRadioButton extends JRadioButton implements UIObserver, GlobalNam
initListener(); initListener();
} }
public void setMnemonic(char mnemonic) {
super.setMnemonic(mnemonic);
if (!markMnemonic) {
setDisplayedMnemonicIndex(-1);
}
}
private void initListener() { private void initListener() {
if (shouldResponseChangeListener()) { if (shouldResponseChangeListener()) {
this.addItemListener(new ItemListener() { this.addItemListener(new ItemListener() {

121
designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButtonUI.java

@ -5,9 +5,12 @@ import com.fr.design.utils.ThemeUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicHTML;
import javax.swing.plaf.metal.MetalRadioButtonUI; import javax.swing.plaf.metal.MetalRadioButtonUI;
import java.awt.*; import java.awt.*;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import javax.swing.text.View;
import sun.swing.SwingUtilities2;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
@ -84,6 +87,124 @@ public class UIRadioButtonUI extends MetalRadioButtonUI {
return radioButton; return radioButton;
} }
// ********************************
// Paint Methods
// ********************************
public synchronized void paint(Graphics g, JComponent c) {
AbstractButton b = (AbstractButton) c;
ButtonModel model = b.getModel();
Dimension size = c.getSize();
int w = size.width;
int h = size.height;
Font f = c.getFont();
g.setFont(f);
FontMetrics fm = SwingUtilities2.getFontMetrics(c, g, f);
Rectangle viewRect = new Rectangle(size);
Rectangle iconRect = new Rectangle();
Rectangle textRect = new Rectangle();
Insets i = c.getInsets();
viewRect.x += i.left;
viewRect.y += i.top;
viewRect.width -= (i.right + viewRect.x);
viewRect.height -= (i.bottom + viewRect.y);
Icon altIcon = b.getIcon();
Icon selectedIcon = null;
Icon disabledIcon = null;
String text = SwingUtilities.layoutCompoundLabel(
c, fm, b.getText(), altIcon != null ? altIcon : getDefaultIcon(),
b.getVerticalAlignment(), b.getHorizontalAlignment(),
b.getVerticalTextPosition(), b.getHorizontalTextPosition(),
viewRect, iconRect, textRect, b.getIconTextGap());
// fill background
if (c.isOpaque()) {
g.setColor(b.getBackground());
g.fillRect(0, 0, size.width, size.height);
}
// Paint the radio button
if (altIcon != null) {
if (!model.isEnabled()) {
if (model.isSelected()) {
altIcon = b.getDisabledSelectedIcon();
} else {
altIcon = b.getDisabledIcon();
}
} else if (model.isPressed() && model.isArmed()) {
altIcon = b.getPressedIcon();
if (altIcon == null) {
// Use selected icon
altIcon = b.getSelectedIcon();
}
} else if (model.isSelected()) {
if (b.isRolloverEnabled() && model.isRollover()) {
altIcon = b.getRolloverSelectedIcon();
if (altIcon == null) {
altIcon = b.getSelectedIcon();
}
} else {
altIcon = b.getSelectedIcon();
}
} else if (b.isRolloverEnabled() && model.isRollover()) {
altIcon = b.getRolloverIcon();
}
if (altIcon == null) {
altIcon = b.getIcon();
}
altIcon.paintIcon(c, g, iconRect.x, iconRect.y);
} else {
getDefaultIcon().paintIcon(c, g, iconRect.x, iconRect.y);
}
// Draw the Text
if (text != null) {
View v = (View) c.getClientProperty(BasicHTML.propertyKey);
if (v != null) {
v.paint(g, textRect);
} else {
int mnemIndex = b.getDisplayedMnemonicIndex();
if (model.isEnabled()) {
// *** paint the text normally
g.setColor(b.getForeground());
} else {
// *** paint the text disabled
g.setColor(getDisabledTextColor());
}
if (markMnemonic(text, mnemIndex)) {
SwingUtilities2.drawStringUnderlineCharAt(c, g, text,
mnemIndex, textRect.x, textRect.y + fm.getAscent());
} else {
SwingUtilities2.drawString(c, g, text, textRect.x, textRect.y + fm.getAscent());
}
}
if (b.hasFocus() && b.isFocusPainted() &&
textRect.width > 0 && textRect.height > 0) {
paintFocus(g, textRect, size);
}
}
}
/**
* @param text
* @param mnemIndex 助记符在text中的索引
* @return true:需要给助记符画一个下划线
*/
private boolean markMnemonic(String text, int mnemIndex) {
return mnemIndex > 0 && text != null && text.length() > 0 && text.length() > mnemIndex;
}
/** /**
* Paints the focus for the radiobutton * Paints the focus for the radiobutton

18
designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java

@ -34,6 +34,7 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
private UIObserverListener uiObserverListener; private UIObserverListener uiObserverListener;
private GlobalNameListener globalNameListener = null; private GlobalNameListener globalNameListener = null;
private String checkboxName = ""; private String checkboxName = "";
private boolean markMnemonic = true;
public UICheckBox(String string) { public UICheckBox(String string) {
super(string); super(string);
@ -53,6 +54,13 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
initListener(); initListener();
} }
public UICheckBox(String locText, boolean b, boolean markMnemonic) {
super(locText, b);
setUI(new UICheckBoxUI());
initListener();
this.markMnemonic=markMnemonic;
}
public UICheckBox(String text, Icon icon) { public UICheckBox(String text, Icon icon) {
super(text, icon); super(text, icon);
setUI(new UICheckBoxUI()); setUI(new UICheckBoxUI());
@ -189,14 +197,18 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
if (v != null) { if (v != null) {
v.paint(g, textRect); v.paint(g, textRect);
} else { } else {
int mnemIndex = b.getDisplayedMnemonicIndex();
if (model.isEnabled()) { if (model.isEnabled()) {
g.setColor(b.getForeground()); g.setColor(b.getForeground());
} else { } else {
g.setColor(getDisabledTextColor()); g.setColor(getDisabledTextColor());
} }
SwingUtilities2.drawStringUnderlineCharAt(c, g, text, if (markMnemonic) {
mnemIndex, textRect.x, textRect.y + fm.getAscent()); SwingUtilities2.drawStringUnderlineCharAt(c, g, text,
b.getDisplayedMnemonicIndex(), textRect.x, textRect.y + fm.getAscent());
} else {
SwingUtilities2.drawString(c, g, text, textRect.x, textRect.y + fm.getAscent());
}
} }
} }
} }

8
designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java

@ -360,6 +360,14 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
popup.setSelectedValue(map); popup.setSelectedValue(map);
} }
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
this.popup.setEnabled(enabled);
this.editor.setEnabled(enabled);
this.arrowButton.setEnabled(enabled);
}
/** /**
* 简单的测试demo * 简单的测试demo
* @param args * @param args

10
designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java

@ -91,10 +91,10 @@ public class TableViewList extends UIList {
if (refreshList != null) { if (refreshList != null) {
refreshList.cancel(true); refreshList.cancel(true);
} }
refreshList = new SwingWorker<Void, Void>() { refreshList = new SwingWorker<DefaultListModel, Void>() {
@Override @Override
protected Void doInBackground() throws Exception { protected DefaultListModel doInBackground() throws Exception {
Connection datasource = ConnectionConfig.getInstance().getConnection(databaseName); Connection datasource = ConnectionConfig.getInstance().getConnection(databaseName);
boolean status = false; boolean status = false;
int count = 3; int count = 3;
@ -106,13 +106,13 @@ public class TableViewList extends UIList {
if (!status) { if (!status) {
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed")); throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
} }
TableViewList.this.setModel(processDataInAnotherThread(databaseName, searchFilter, typesFilter)); return processDataInAnotherThread(databaseName, searchFilter, typesFilter);
return null;
} }
@Override
public void done() { public void done() {
try { try {
get(); TableViewList.this.setModel(get());
} catch (Exception e) { } catch (Exception e) {
if (!(e instanceof InterruptedException) && !(e instanceof CancellationException)) { if (!(e instanceof InterruptedException) && !(e instanceof CancellationException)) {
TableViewList.this.setModel(failed); TableViewList.this.setModel(failed);

73
designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItem.java

@ -1,15 +1,11 @@
package com.fr.design.gui.imenu; package com.fr.design.gui.imenu;
import java.awt.*;
import javax.swing.*;
import javax.swing.plaf.basic.BasicMenuItemUI;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.design.utils.gui.GUIPaintUtils;
import sun.swing.SwingUtilities2; import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JMenuItem;
public class UIMenuItem extends JMenuItem{ public class UIMenuItem extends JMenuItem{
public UIMenuItem() { public UIMenuItem() {
@ -43,65 +39,4 @@ public class UIMenuItem extends JMenuItem{
return StringUtils.BLANK + super.getText(); return StringUtils.BLANK + super.getText();
} }
private class UIMenuItemUI extends BasicMenuItemUI {
@Override
protected void paintBackground(Graphics g, JMenuItem menuItem,Color bgColor) {
if(menuItem.getIcon() == null) {
super.paintBackground(g, menuItem, bgColor);
return;
}
ButtonModel model = menuItem.getModel();
Color oldColor = g.getColor();
int menuWidth = menuItem.getWidth();
int menuHeight = menuItem.getHeight();
g.setColor(UIConstants.NORMAL_BACKGROUND);
g.fillRect(0, 0, menuWidth, menuHeight);
if(menuItem.isOpaque()) {
if (model.isArmed()|| (menuItem instanceof JMenu && model.isSelected())) {
GUIPaintUtils.fillPaint((Graphics2D)g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7);
} else {
GUIPaintUtils.fillPaint((Graphics2D)g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, menuItem.getBackground(), 7);
}
g.setColor(oldColor);
}
else if (model.isArmed() || (menuItem instanceof JMenu &&
model.isSelected())) {
GUIPaintUtils.fillPaint((Graphics2D)g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7);
g.setColor(oldColor);
}
}
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) {
ButtonModel model = menuItem.getModel();
FontMetrics fm = SwingUtilities2.getFontMetrics(menuItem, g);
int mnemIndex = menuItem.getDisplayedMnemonicIndex();
if(!model.isEnabled()) {
// *** paint the text disabled
if ( UIManager.get("MenuItem.disabledForeground") instanceof Color ) {
g.setColor( UIManager.getColor("MenuItem.disabledForeground") );
SwingUtilities2.drawStringUnderlineCharAt(menuItem, g,text,
-1, textRect.x, textRect.y + fm.getAscent());
} else {
g.setColor(menuItem.getBackground().brighter());
SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text,
-1, textRect.x, textRect.y + fm.getAscent());
g.setColor(menuItem.getBackground().darker());
SwingUtilities2.drawStringUnderlineCharAt(menuItem, g,text,
-1, textRect.x - 1, textRect.y +
fm.getAscent() - 1);
}
} else {
// *** paint the text normally
if (model.isArmed()|| (menuItem instanceof JMenu && model.isSelected())) {
g.setColor(Color.WHITE); // Uses protected field.
}
SwingUtilities2.drawStringUnderlineCharAt(menuItem, g,text,
-1, textRect.x, textRect.y + fm.getAscent());
}
}
}
} }

81
designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItemUI.java

@ -0,0 +1,81 @@
package com.fr.design.gui.imenu;
import com.fr.design.constants.UIConstants;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.stable.Constants;
import sun.swing.SwingUtilities2;
import javax.swing.ButtonModel;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicMenuItemUI;
import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
/**
* created by Harrison on 2020/03/22
**/
public class UIMenuItemUI extends BasicMenuItemUI {
@Override
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) {
if (menuItem.getIcon() == null) {
super.paintBackground(g, menuItem, bgColor);
return;
}
ButtonModel model = menuItem.getModel();
Color oldColor = g.getColor();
int menuWidth = menuItem.getWidth();
int menuHeight = menuItem.getHeight();
g.setColor(UIConstants.NORMAL_BACKGROUND);
g.fillRect(0, 0, menuWidth, menuHeight);
if (menuItem.isOpaque()) {
if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) {
GUIPaintUtils.fillPaint((Graphics2D) g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7);
} else {
GUIPaintUtils.fillPaint((Graphics2D) g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, menuItem.getBackground(), 7);
}
g.setColor(oldColor);
} else if (model.isArmed() || (menuItem instanceof JMenu &&
model.isSelected())) {
GUIPaintUtils.fillPaint((Graphics2D) g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7);
g.setColor(oldColor);
}
}
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) {
ButtonModel model = menuItem.getModel();
FontMetrics fm = SwingUtilities2.getFontMetrics(menuItem, g);
int mnemIndex = menuItem.getDisplayedMnemonicIndex();
if (!model.isEnabled()) {
// *** paint the text disabled
if (UIManager.get("MenuItem.disabledForeground") instanceof Color) {
g.setColor(UIManager.getColor("MenuItem.disabledForeground"));
SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text,
-1, textRect.x, textRect.y + fm.getAscent());
} else {
g.setColor(menuItem.getBackground().brighter());
SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text,
-1, textRect.x, textRect.y + fm.getAscent());
g.setColor(menuItem.getBackground().darker());
SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text,
-1, textRect.x - 1, textRect.y +
fm.getAscent() - 1);
}
} else {
// *** paint the text normally
if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) {
g.setColor(Color.WHITE); // Uses protected field.
}
SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text,
-1, textRect.x, textRect.y + fm.getAscent());
}
}
}

2
designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java

@ -235,7 +235,7 @@ public abstract class UITableModelAdapter<T extends Object> extends AbstractTabl
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
int[] selectedRow = table.getSelectedRows(); int[] selectedRow = table.getSelectedRows();
if (ismultiSelected()) { if (ismultiSelected()) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Multiple_Select_Warn_Text")); FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Multiple_Select_Warn_Text"));
return; return;
} }
if (table.getCellEditor() != null) { if (table.getCellEditor() != null) {

6
designer-base/src/main/java/com/fr/design/i18n/DesignI18nImpl.java

@ -1,5 +1,6 @@
package com.fr.design.i18n; package com.fr.design.i18n;
import com.fr.design.DesignerEnvManager;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.log.MessageFormatter; import com.fr.general.log.MessageFormatter;
import com.fr.locale.DesignI18nProvider; import com.fr.locale.DesignI18nProvider;
@ -14,6 +15,11 @@ import java.util.Locale;
public class DesignI18nImpl implements DesignI18nProvider { public class DesignI18nImpl implements DesignI18nProvider {
static {
// GeneralContext上下文 存储本次启动的语言环境 直接使用DesignerEnvManager 会在设置语言环境后 不重启 立即生效 存在问题
GeneralContext.setLocale(DesignerEnvManager.getEnvManager().getLanguage());
}
private static DesignI18nImpl instance = new DesignI18nImpl(); private static DesignI18nImpl instance = new DesignI18nImpl();
public static DesignI18nImpl getInstance() { public static DesignI18nImpl getInstance() {

3
designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java

@ -2,6 +2,7 @@ package com.fr.design.javascript;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.design.data.tabledata.tabledatapane.OneListTableModel; import com.fr.design.data.tabledata.tabledatapane.OneListTableModel;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.frpane.ReportletParameterViewPane; import com.fr.design.gui.frpane.ReportletParameterViewPane;
import com.fr.design.gui.itableeditorpane.ParameterTableModel; import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.design.gui.itableeditorpane.UITableEditAction; import com.fr.design.gui.itableeditorpane.UITableEditAction;
@ -62,7 +63,7 @@ public class JavaScriptImplPane extends AbstractHyperLinkPane<JavaScriptImpl> {
} }
if (tempSet.contains(list.get(i).toString())) { if (tempSet.contains(list.get(i).toString())) {
list.remove(i); list.remove(i);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter_Duplicate_Name") + "!"); FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter_Duplicate_Name") + "!");
parameterChanger(list); parameterChanger(list);
return; return;
} }

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

@ -3,7 +3,9 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.fun.PropertyItemPaneProvider;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.gui.icontainer.UIEastResizableContainer; import com.fr.design.gui.icontainer.UIEastResizableContainer;
@ -12,12 +14,38 @@ import com.fr.design.layout.VerticalFlowLayout;
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;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
import com.fr.plugin.observer.PluginListenerRegistration;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsEnvironment;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
@ -26,6 +54,7 @@ import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener; import java.awt.event.MouseMotionListener;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -101,9 +130,102 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
defaultAuthorityPane = getDefaultPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Not_Support_Authority_Edit")); defaultAuthorityPane = getDefaultPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Not_Support_Authority_Edit"));
switchMode(PropertyMode.REPORT); switchMode(PropertyMode.REPORT);
setContainerWidth(CONTAINER_WIDTH); setContainerWidth(CONTAINER_WIDTH);
initPluginPane();
listenPlugin();
}
private void listenPlugin() {
PluginFilter filter = new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PropertyItemPaneProvider.XML_TAG);
}
};
PluginListenerRegistration.getInstance().listen(
PluginEventType.AfterRun,
new PluginEventListener(PropertyItemPaneProvider.FIRST) {
@Override
public void on(PluginEvent event) {
PluginContext context = event.getContext();
PluginRuntime runtime = context.getRuntime();
Set<PropertyItemPaneProvider> providers = runtime.get(PropertyItemPaneProvider.XML_TAG);
for (PropertyItemPaneProvider provider : providers) {
addPropertyItem(provider);
}
updateAllPropertyPane();
}
}, filter);
PluginListenerRegistration.getInstance().listen(
PluginEventType.BeforeStop,
new PluginEventListener(PropertyItemPaneProvider.FIRST) {
@Override
public void on(PluginEvent event) {
PluginContext context = event.getContext();
PluginRuntime runtime = context.getRuntime();
Set<PropertyItemPaneProvider> providers = runtime.get(PropertyItemPaneProvider.XML_TAG);
for (PropertyItemPaneProvider provider : providers) {
removePropertyItem(provider);
}
updateAllPropertyPane();
}
}, filter);
}
private void removePropertyItem(PropertyItemPaneProvider provider) {
propertyItemMap.remove(provider.key());
String replaceKey = provider.replaceKey();
if (replaceKey == null) {
return;
}
PropertyItem replaceItem = propertyItemMap.get(replaceKey);
if (replaceItem != null) {
replaceItem.setReplace(false);
}
}
private void initPluginPane() {
ExtraDesignClassManager classManager = PluginModule.getAgent(PluginModule.ExtraDesign);
Set<PropertyItemPaneProvider> providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG);
for (PropertyItemPaneProvider provider : providers) {
addPropertyItem(provider);
}
}
private void addPropertyItem(PropertyItemPaneProvider provider) {
String key = provider.key();
PropertyItemBean itemBean = provider.getItem();
PropertyItem propertyItem = new PropertyItem(itemBean.getName(),
itemBean.getTitle(),
itemBean.getBtnIconName(),
itemBean.getBtnIconBaseDir(),
itemBean.getVisibleModes(),
itemBean.getEnableModes());
UIButton button = propertyItem.getButton();
List<ActionListener> buttonListeners = itemBean.getButtonListeners();
for (ActionListener buttonListener : buttonListeners) {
button.addActionListener(buttonListener);
}
propertyItemMap.put(key, propertyItem);
String replaceKey = provider.replaceKey();
if (replaceKey == null) {
return;
}
PropertyItem replaceItem = propertyItemMap.get(replaceKey);
if (replaceItem != null) {
replaceItem.setReplace(true);
}
} }
private void initPropertyItemList() { private void initPropertyItemList() {
propertyItemMap = new LinkedHashMap<>(); // 有序map propertyItemMap = new LinkedHashMap<>(); // 有序map
// 单元格元素 // 单元格元素
PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Element"), PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Element"),
@ -361,6 +483,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
propertyItemMap.get(KEY_CONFIGURED_ROLES).replaceContentPane(pane); propertyItemMap.get(KEY_CONFIGURED_ROLES).replaceContentPane(pane);
} }
public void replaceKeyPane(String key, JComponent pane) {
propertyItemMap.get(key).replaceContentPane(pane);
}
public JComponent getConfiguredRolesPane() { public JComponent getConfiguredRolesPane() {
return propertyItemMap.get(KEY_CONFIGURED_ROLES).getContentPane(); return propertyItemMap.get(KEY_CONFIGURED_ROLES).getContentPane();
} }
@ -511,6 +638,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private PopupDialog popupDialog; // 弹出框 private PopupDialog popupDialog; // 弹出框
private boolean isPoppedOut = false; // 是否弹出 private boolean isPoppedOut = false; // 是否弹出
private boolean isVisible = true; // 是否可见 private boolean isVisible = true; // 是否可见
private boolean replace = false; // 是否被替代
private boolean isEnabled = true; // 是否可用 private boolean isEnabled = true; // 是否可用
private Set<PropertyMode> visibleModes; private Set<PropertyMode> visibleModes;
private Set<PropertyMode> enableModes; private Set<PropertyMode> enableModes;
@ -521,14 +649,21 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private static final String ICON_SUFFIX_DISABLED = "_disabled.png"; private static final String ICON_SUFFIX_DISABLED = "_disabled.png";
private static final String ICON_SUFFIX_SELECTED = "_selected.png"; private static final String ICON_SUFFIX_SELECTED = "_selected.png";
private String btnIconName; private String btnIconName;
private String iconBaseDir;
private String iconSuffix = ICON_SUFFIX_NORMAL; // normal, diabled, selected, 三者之一 private String iconSuffix = ICON_SUFFIX_NORMAL; // normal, diabled, selected, 三者之一
private final Color selectedBtnBackground = new Color(0xF5F5F7); private final Color selectedBtnBackground = new Color(0xF5F5F7);
private Color originBtnBackground; private Color originBtnBackground;
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);
}
public PropertyItem(String name, String title, String btnIconName, String iconBaseDir, PropertyMode[] visibleModes, PropertyMode[] enableModes) {
this.name = name; this.name = name;
this.title = title; this.title = title;
this.btnIconName = btnIconName; this.btnIconName = btnIconName;
this.iconBaseDir = iconBaseDir;
initButton(); initButton();
initPropertyPanel(); initPropertyPanel();
initModes(visibleModes, enableModes); initModes(visibleModes, enableModes);
@ -563,13 +698,19 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} }
public boolean isVisible() { public boolean isVisible() {
return isVisible; // 取决于可见且未替代
return isVisible && !replace;
} }
public void setVisible(boolean isVisible) { public void setVisible(boolean isVisible) {
this.isVisible = isVisible; this.isVisible = isVisible;
} }
public void setReplace(boolean replace) {
this.replace = replace;
}
public boolean isEnabled() { public boolean isEnabled() {
return isEnabled; return isEnabled;
} }
@ -580,6 +721,15 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
button.setEnabled(isEnabled); button.setEnabled(isEnabled);
} }
public void setIconBaseDir(String iconBaseDir) {
this.iconBaseDir = iconBaseDir;
}
private String getIconBaseDir() {
return StringUtils.isEmpty(iconBaseDir) ? ICON_BASE_DIR : iconBaseDir;
}
private void initPropertyPanel() { private void initPropertyPanel() {
propertyPanel = new JPanel(); propertyPanel = new JPanel();
propertyPanel.setBackground(Color.pink); propertyPanel.setBackground(Color.pink);
@ -660,7 +810,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} }
private String getBtnIconUrl() { private String getBtnIconUrl() {
return ICON_BASE_DIR + btnIconName + iconSuffix;
return getIconBaseDir() + btnIconName + iconSuffix;
} }
public void resetButtonIcon() { public void resetButtonIcon() {

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

@ -0,0 +1,17 @@
package com.fr.design.mainframe;
import javax.swing.JPanel;
/**
* created by Harrison on 2020/03/23
**/
public interface PaneHolder<T> {
/**
* 得到 Pane
*
* @param arg 参数
* @return 面板
*/
JPanel getInstance(T arg);
}

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

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

45
designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfo.java

@ -30,6 +30,7 @@ public class ChartInfo extends AbstractPointInfo {
private static final String XML_CHART_CONSUMING_MAP = "chartConsumingMap"; private static final String XML_CHART_CONSUMING_MAP = "chartConsumingMap";
private static final String ATTR_TEST_TEMPLATE = "testTemplate"; private static final String ATTR_TEST_TEMPLATE = "testTemplate";
private static final String ATTR_TEST_CHART = "testChart";
private static final String ATTR_DAY_COUNT = "day_count"; private static final String ATTR_DAY_COUNT = "day_count";
private static final String ATTR_USERNAME = "username"; private static final String ATTR_USERNAME = "username";
private static final String ATTR_UUID = "uuid"; private static final String ATTR_UUID = "uuid";
@ -44,6 +45,11 @@ public class ChartInfo extends AbstractPointInfo {
private static final String ATTR_CHART_PROPERTY_END_TIME = "chartPropertyEndTime"; private static final String ATTR_CHART_PROPERTY_END_TIME = "chartPropertyEndTime";
private static final String ATTR_JAR_TIME = "jarTime"; private static final String ATTR_JAR_TIME = "jarTime";
private static final String ATTR_VERSION = "version"; private static final String ATTR_VERSION = "version";
private static final String ATTR_USER_ID = "userId";
private static final String ATTR_FIRST_CHART_TYPE = "firstChartType";
private static final String ATTR_OVER_CHART_TYPE_COUNT = "overChartTypeCount";
private static final String ATTR_IS_NEW = "isNew";
private static final String ATTR_IS_REUSE = "isReuse";
private static final int COMPLETE_DAY_COUNT = 3; // 判断图表是否可以上传的天数 private static final int COMPLETE_DAY_COUNT = 3; // 判断图表是否可以上传的天数
@ -57,6 +63,8 @@ public class ChartInfo extends AbstractPointInfo {
private boolean testTemplate; private boolean testTemplate;
private boolean testChart;
private ChartInfo() { private ChartInfo() {
} }
@ -64,6 +72,7 @@ public class ChartInfo extends AbstractPointInfo {
this.chartId = chartId; this.chartId = chartId;
this.templateId = templateId; this.templateId = templateId;
this.book = book; this.book = book;
this.testChart = true;
} }
public String getChartId() { public String getChartId() {
@ -91,13 +100,17 @@ public class ChartInfo extends AbstractPointInfo {
@Override @Override
public boolean isTestTemplate() { public boolean isTestTemplate() {
return testTemplate; return testTemplate || testChart;
} }
public void setTestTemplate(boolean testTemplate) { public void setTestTemplate(boolean testTemplate) {
this.testTemplate = testTemplate; this.testTemplate = testTemplate;
} }
public void setTestChart(boolean testChart) {
this.testChart = testChart;
}
static ChartInfo newInstanceByRead(XMLableReader reader) { static ChartInfo newInstanceByRead(XMLableReader reader) {
ChartInfo chartInfo = new ChartInfo(); ChartInfo chartInfo = new ChartInfo();
reader.readXMLObject(chartInfo); reader.readXMLObject(chartInfo);
@ -105,13 +118,14 @@ public class ChartInfo extends AbstractPointInfo {
} }
public static ChartInfo newInstance(String chartId, String chartType) { public static ChartInfo newInstance(String chartId, String chartType) {
return newInstance(chartId, chartType, null); return newInstance(chartId, chartType, null, false, false);
} }
public static ChartInfo newInstance(String chartId, String chartType, String createTime) { public static ChartInfo newInstance(String chartId, String chartType, String createTime, boolean isNew, boolean isReuse) {
HashMap<String, String> chartConsumingMap = new HashMap<>(); HashMap<String, String> chartConsumingMap = new HashMap<>();
String username = MarketConfig.getInstance().getBbsUsername(); String username = MarketConfig.getInstance().getBbsUsername();
String userId = String.valueOf(MarketConfig.getInstance().getBbsUid());
String uuid = DesignerEnvManager.getEnvManager().getUUID(); String uuid = DesignerEnvManager.getEnvManager().getUUID();
String activityKey = DesignerEnvManager.getEnvManager().getActivationKey(); String activityKey = DesignerEnvManager.getEnvManager().getActivationKey();
@ -138,6 +152,11 @@ public class ChartInfo extends AbstractPointInfo {
chartConsumingMap.put(ATTR_CHART_PROPERTY_END_TIME, ""); chartConsumingMap.put(ATTR_CHART_PROPERTY_END_TIME, "");
chartConsumingMap.put(ATTR_JAR_TIME, jarTime); chartConsumingMap.put(ATTR_JAR_TIME, jarTime);
chartConsumingMap.put(ATTR_VERSION, version); chartConsumingMap.put(ATTR_VERSION, version);
chartConsumingMap.put(ATTR_USER_ID, userId);
chartConsumingMap.put(ATTR_FIRST_CHART_TYPE, chartType);
chartConsumingMap.put(ATTR_OVER_CHART_TYPE_COUNT, "0");
chartConsumingMap.put(ATTR_IS_NEW, String.valueOf(isNew));
chartConsumingMap.put(ATTR_IS_REUSE, String.valueOf(isReuse));
ChartInfo chartInfo = new ChartInfo(chartId, templateId, book); ChartInfo chartInfo = new ChartInfo(chartId, templateId, book);
chartInfo.chartConsumingMap = chartConsumingMap; chartInfo.chartConsumingMap = chartConsumingMap;
@ -158,6 +177,7 @@ public class ChartInfo extends AbstractPointInfo {
writer.attr(ATTR_DAY_COUNT, this.idleDayCount); writer.attr(ATTR_DAY_COUNT, this.idleDayCount);
} }
writer.attr(ATTR_TEST_TEMPLATE, this.testTemplate); writer.attr(ATTR_TEST_TEMPLATE, this.testTemplate);
writer.attr(ATTR_TEST_CHART, this.testChart);
writer.startTAG(XML_CHART_CONSUMING_MAP); writer.startTAG(XML_CHART_CONSUMING_MAP);
writer.attr(ATTR_USERNAME, chartConsumingMap.get(ATTR_USERNAME)); writer.attr(ATTR_USERNAME, chartConsumingMap.get(ATTR_USERNAME));
writer.attr(ATTR_UUID, chartConsumingMap.get(ATTR_UUID)); writer.attr(ATTR_UUID, chartConsumingMap.get(ATTR_UUID));
@ -170,6 +190,11 @@ public class ChartInfo extends AbstractPointInfo {
writer.attr(ATTR_CHART_PROPERTY_END_TIME, chartConsumingMap.get(ATTR_CHART_PROPERTY_END_TIME)); writer.attr(ATTR_CHART_PROPERTY_END_TIME, chartConsumingMap.get(ATTR_CHART_PROPERTY_END_TIME));
writer.attr(ATTR_JAR_TIME, chartConsumingMap.get(ATTR_JAR_TIME)); writer.attr(ATTR_JAR_TIME, chartConsumingMap.get(ATTR_JAR_TIME));
writer.attr(ATTR_VERSION, chartConsumingMap.get(ATTR_VERSION)); writer.attr(ATTR_VERSION, chartConsumingMap.get(ATTR_VERSION));
writer.attr(ATTR_USER_ID, chartConsumingMap.get(ATTR_USER_ID));
writer.attr(ATTR_FIRST_CHART_TYPE, chartConsumingMap.get(ATTR_FIRST_CHART_TYPE));
writer.attr(ATTR_OVER_CHART_TYPE_COUNT, chartConsumingMap.get(ATTR_OVER_CHART_TYPE_COUNT));
writer.attr(ATTR_IS_NEW, chartConsumingMap.get(ATTR_IS_NEW));
writer.attr(ATTR_IS_REUSE, chartConsumingMap.get(ATTR_IS_REUSE));
writer.end(); writer.end();
writer.end(); writer.end();
} }
@ -182,6 +207,7 @@ public class ChartInfo extends AbstractPointInfo {
chartId = reader.getAttrAsString(ATTR_CHART_ID, StringUtils.EMPTY); chartId = reader.getAttrAsString(ATTR_CHART_ID, StringUtils.EMPTY);
templateId = reader.getAttrAsString(ATTR_TEMPLATE_ID, StringUtils.EMPTY); templateId = reader.getAttrAsString(ATTR_TEMPLATE_ID, StringUtils.EMPTY);
testTemplate = reader.getAttrAsBoolean(ATTR_TEST_TEMPLATE, true); testTemplate = reader.getAttrAsBoolean(ATTR_TEST_TEMPLATE, true);
testChart = reader.getAttrAsBoolean(ATTR_TEST_CHART, false);
} else { } else {
String name = reader.getTagName(); String name = reader.getTagName();
if (XML_CHART_CONSUMING_MAP.equals(name)) { if (XML_CHART_CONSUMING_MAP.equals(name)) {
@ -198,6 +224,11 @@ public class ChartInfo extends AbstractPointInfo {
chartConsumingMap.put(ATTR_CHART_PROPERTY_END_TIME, reader.getAttrAsString(ATTR_CHART_PROPERTY_END_TIME, StringUtils.EMPTY)); chartConsumingMap.put(ATTR_CHART_PROPERTY_END_TIME, reader.getAttrAsString(ATTR_CHART_PROPERTY_END_TIME, StringUtils.EMPTY));
chartConsumingMap.put(ATTR_JAR_TIME, reader.getAttrAsString(ATTR_JAR_TIME, StringUtils.EMPTY)); chartConsumingMap.put(ATTR_JAR_TIME, reader.getAttrAsString(ATTR_JAR_TIME, StringUtils.EMPTY));
chartConsumingMap.put(ATTR_VERSION, reader.getAttrAsString(ATTR_VERSION, "8.0")); chartConsumingMap.put(ATTR_VERSION, reader.getAttrAsString(ATTR_VERSION, "8.0"));
chartConsumingMap.put(ATTR_USER_ID, reader.getAttrAsString(ATTR_USER_ID, StringUtils.EMPTY));
chartConsumingMap.put(ATTR_FIRST_CHART_TYPE, reader.getAttrAsString(ATTR_FIRST_CHART_TYPE, StringUtils.EMPTY));
chartConsumingMap.put(ATTR_OVER_CHART_TYPE_COUNT, reader.getAttrAsString(ATTR_OVER_CHART_TYPE_COUNT, "0"));
chartConsumingMap.put(ATTR_IS_NEW, reader.getAttrAsString(ATTR_IS_NEW, StringUtils.EMPTY));
chartConsumingMap.put(ATTR_IS_REUSE, reader.getAttrAsString(ATTR_IS_REUSE, StringUtils.EMPTY));
} }
} }
} }
@ -231,8 +262,16 @@ public class ChartInfo extends AbstractPointInfo {
chartConsumingMap.put(ATTR_CHART_TYPE, chartType); chartConsumingMap.put(ATTR_CHART_TYPE, chartType);
chartConsumingMap.put(ATTR_CHART_PROPERTY_FIRST_TIME, ""); chartConsumingMap.put(ATTR_CHART_PROPERTY_FIRST_TIME, "");
chartConsumingMap.put(ATTR_CHART_PROPERTY_END_TIME, ""); chartConsumingMap.put(ATTR_CHART_PROPERTY_END_TIME, "");
String count = chartConsumingMap.get(ATTR_OVER_CHART_TYPE_COUNT);
count = StringUtils.isEmpty(count) ? "1" : String.valueOf(Integer.parseInt(count) + 1);
chartConsumingMap.put(ATTR_OVER_CHART_TYPE_COUNT, count);
} }
public void updateFirstType(String chartType) {
chartConsumingMap.put(ATTR_FIRST_CHART_TYPE, chartType);
}
@Override @Override
public ChartInfo clone() { public ChartInfo clone() {
ChartInfo chartInfo = new ChartInfo(); ChartInfo chartInfo = new ChartInfo();

57
designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java

@ -7,7 +7,6 @@ import com.fr.design.mainframe.template.info.TemplateInfo;
import com.fr.design.mainframe.template.info.TemplateProcessInfo; import com.fr.design.mainframe.template.info.TemplateProcessInfo;
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.vanchart.VanChart;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -53,39 +52,36 @@ public class ChartInfoCollector extends AbstractPointCollector<ChartInfo> {
} }
public void collection(ChartProvider chartProvider, String createTime) { public void collection(ChartProvider chartProvider, String createTime) {
if (chartProvider instanceof VanChart) { collection(chartProvider, createTime, false);
VanChart vanChart = (VanChart) chartProvider; }
collection(vanChart.getUuid(), vanChart.getID(), createTime);
} public void collection(ChartProvider chartProvider, String createTime, boolean isReuse) {
collection(chartProvider.getChartUuid(), chartProvider.getID(), createTime, isReuse);
} }
/** /**
* 新建图表保存状态 * 新建图表保存状态
*/ */
public void collection(String chartId, String chartType, String createTime) { public void collection(String chartId, String chartType, String createTime, boolean isReuse) {
if (!shouldCollectInfo()) { if (!shouldCollectInfo() || StringUtils.isEmpty(chartId)) {
return; return;
} }
ChartInfo chartInfo = ChartInfo.newInstance(chartId, chartType, createTime, true, isReuse);
ChartInfo chartInfo = ChartInfo.newInstance(chartId, chartType, createTime);
chartInfoCacheMap.put(chartId, chartInfo); chartInfoCacheMap.put(chartId, chartInfo);
} }
public void updateChartPropertyTime(ChartProvider chartProvider) { public void updateChartPropertyTime(ChartProvider chartProvider) {
if (chartProvider instanceof VanChart) { updateChartPropertyTime(chartProvider.getChartUuid(), chartProvider.getID());
VanChart vanChart = (VanChart) chartProvider;
updateChartPropertyTime(vanChart.getUuid(), vanChart.getID());
}
} }
/** /**
* 图表编辑更新编辑时间 * 图表编辑更新编辑时间
*/ */
public void updateChartPropertyTime(String chartId, String chartType) { public void updateChartPropertyTime(String chartId, String chartType) {
if (!shouldCollectInfo()) { if (!shouldCollectInfo() || StringUtils.isEmpty(chartId)) {
return; return;
} }
ChartInfo chartInfo = getOrCreateChartInfo(chartId, chartType); ChartInfo chartInfo = getOrCreateChartInfo(chartId, chartType, null);
//更新编辑时间 //更新编辑时间
chartInfo.updatePropertyTime(); chartInfo.updatePropertyTime();
@ -94,22 +90,19 @@ public class ChartInfoCollector extends AbstractPointCollector<ChartInfo> {
chartInfo.resetIdleDayCount(); chartInfo.resetIdleDayCount();
} }
public void updateChartTypeTime(ChartProvider chartProvider) { public void updateChartTypeTime(ChartProvider chartProvider, String oldType) {
if (chartProvider instanceof VanChart) { updateChartTypeTime(chartProvider.getChartUuid(), chartProvider.getID(), oldType);
VanChart vanChart = (VanChart) chartProvider;
updateChartTypeTime(vanChart.getUuid(), vanChart.getID());
}
} }
/** /**
* 图表类型变化更新类型和类型确认时间 * 图表类型变化更新类型和类型确认时间
*/ */
public void updateChartTypeTime(String chartId, String chartType) { public void updateChartTypeTime(String chartId, String chartType, String oldType) {
if (!shouldCollectInfo()) { if (!shouldCollectInfo() || StringUtils.isEmpty(chartId)) {
return; return;
} }
ChartInfo chartInfo = getOrCreateChartInfo(chartId, chartType); ChartInfo chartInfo = getOrCreateChartInfo(chartId, chartType, oldType);
//更新类型确认时间和类型 //更新类型确认时间和类型
chartInfo.updateChartType(chartType); chartInfo.updateChartType(chartType);
@ -118,7 +111,7 @@ public class ChartInfoCollector extends AbstractPointCollector<ChartInfo> {
chartInfo.resetIdleDayCount(); chartInfo.resetIdleDayCount();
} }
private ChartInfo getOrCreateChartInfo(String chartId, String chartType) { private ChartInfo getOrCreateChartInfo(String chartId, String chartType, String oldType) {
//缓存中有从缓存中拿 //缓存中有从缓存中拿
if (chartInfoCacheMap.containsKey(chartId)) { if (chartInfoCacheMap.containsKey(chartId)) {
return chartInfoCacheMap.get(chartId); return chartInfoCacheMap.get(chartId);
@ -129,12 +122,26 @@ public class ChartInfoCollector extends AbstractPointCollector<ChartInfo> {
chartInfoCacheMap.put(chartId, chartInfo); chartInfoCacheMap.put(chartId, chartInfo);
return chartInfo; return chartInfo;
} }
//都有的话创建一个并加入到缓存中 //都有的话创建一个并加入到缓存中
ChartInfo chartInfo = ChartInfo.newInstance(chartId, chartType); ChartInfo chartInfo = ChartInfo.newInstance(chartId, chartType);
if (StringUtils.isNotEmpty(oldType)) {
chartInfo.updateFirstType(oldType);
}
chartInfoCacheMap.put(chartId, chartInfo); chartInfoCacheMap.put(chartId, chartInfo);
return chartInfo; return chartInfo;
} }
public void checkTestChart(ChartProvider chartProvider) {
if (!shouldCollectInfo()) {
return;
}
ChartInfo chartInfo = chartInfoCacheMap.get(chartProvider.getChartUuid());
if (chartInfo != null) {
boolean testChart = chartProvider.isTestChart();
chartInfo.setTestChart(testChart);
}
}
/** /**
* 保存模板的时候将该模板中的图表埋点信息保存 * 保存模板的时候将该模板中的图表埋点信息保存
*/ */

5
designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java

@ -12,6 +12,9 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
public class LogMessageBar extends JPanel { public class LogMessageBar extends JPanel {
private static final String LOG_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Log");
private UILabel messageLabel; private UILabel messageLabel;
private int width = 600; private int width = 600;
private static volatile LogMessageBar THIS; private static volatile LogMessageBar THIS;
@ -56,7 +59,7 @@ public class LogMessageBar extends JPanel {
if (message == null) { if (message == null) {
return; return;
} }
messageLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Log") + " | " + message); messageLabel.setText(LOG_MARK + " | " + message);
repaint(); repaint();
} }

74
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java

@ -63,14 +63,16 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane<Mobile
protected void init() { protected void init() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
previewPane = createPreviewPane(); previewPane = createPreviewPane();
previewPane.setPreferredSize(new Dimension(500, 60)); if (previewPane != null) {
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); previewPane.setPreferredSize(new Dimension(500, 60));
TitledBorder titledBorder = GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"), null); JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
titledBorder.setTitleFont(FRFont.getInstance("PingFangSC-Regular", Font.PLAIN, 9, Color.BLUE)); TitledBorder titledBorder = GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"), null);
northPane.setBorder(titledBorder); titledBorder.setTitleFont(FRFont.getInstance("PingFangSC-Regular", Font.PLAIN, 9, Color.BLUE));
northPane.setPreferredSize(new Dimension(500, 83)); northPane.setBorder(titledBorder);
northPane.add(previewPane, BorderLayout.CENTER); northPane.setPreferredSize(new Dimension(500, 83));
this.add(northPane, BorderLayout.NORTH); northPane.add(previewPane, BorderLayout.CENTER);
this.add(northPane, BorderLayout.NORTH);
}
createConfigPane(); createConfigPane();
} }
@ -111,18 +113,7 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane<Mobile
outPanel.add(jPanel); outPanel.add(jPanel);
scrollPanel.add(outPanel, BorderLayout.NORTH); scrollPanel.add(outPanel, BorderLayout.NORTH);
UITitleSplitLine backgroundSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), 520); createBuiltinConfPane(centerPane);
backgroundSplit.setPreferredSize(new Dimension(520, 20));
centerPane.add(backgroundSplit);
centerPane.add(createBackgroundConfPane());
UITitleSplitLine fontSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Char"), 520);
fontSplit.setPreferredSize(new Dimension(520, 20));
centerPane.add(fontSplit);
centerPane.add(createFontConfPane());
createExtraConfPane(centerPane); createExtraConfPane(centerPane);
scrollPanel.add(centerPane, BorderLayout.CENTER); scrollPanel.add(centerPane, BorderLayout.CENTER);
@ -169,6 +160,19 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane<Mobile
return jPanel3; return jPanel3;
} }
protected void createBuiltinConfPane(JPanel centerPane) {
UITitleSplitLine backgroundSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), 520);
backgroundSplit.setPreferredSize(new Dimension(520, 20));
centerPane.add(backgroundSplit);
centerPane.add(createBackgroundConfPane());
UITitleSplitLine fontSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Char"), 520);
fontSplit.setPreferredSize(new Dimension(520, 20));
centerPane.add(fontSplit);
centerPane.add(createFontConfPane());
}
protected void createExtraConfPane(JPanel centerPane) { protected void createExtraConfPane(JPanel centerPane) {
@ -184,8 +188,12 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane<Mobile
populateSubStyle(ob); populateSubStyle(ob);
custom.setSelectedItem(!ob.isCustom() ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default") : custom.setSelectedItem(!ob.isCustom() ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default") :
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Custom")); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Custom"));
initialColorBox.setSelectObject(ob.getInitialColor()); if (initialColorBox != null) {
fontConfPane.populate(ob.getTabFontConfig().getFont()); initialColorBox.setSelectObject(ob.getInitialColor());
}
if (fontConfPane != null) {
fontConfPane.populate(ob.getTabFontConfig().getFont());
}
updatePreviewPane(); updatePreviewPane();
} }
@ -207,20 +215,26 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane<Mobile
} }
MobileTemplateStyle ob = updateSubStyle(); MobileTemplateStyle ob = updateSubStyle();
ob.setCustom(custom.getSelectedIndex() == 1); ob.setCustom(custom.getSelectedIndex() == 1);
ob.setInitialColor(initialColorBox.getSelectObject()); if (initialColorBox != null) {
TabFontConfig config = new TabFontConfig(); ob.setInitialColor(initialColorBox.getSelectObject());
config.setSelectColor(ob.getTabFontConfig().getSelectColor()); }
config.setFont(fontConfPane.update()); if (fontConfPane != null) {
ob.setTabFontConfig(config); TabFontConfig config = new TabFontConfig();
config.setSelectColor(ob.getTabFontConfig().getSelectColor());
config.setFont(fontConfPane.update());
ob.setTabFontConfig(config);
}
return ob; return ob;
} }
protected abstract MobileTemplateStyle getDefaultTemplateStyle(); protected abstract MobileTemplateStyle getDefaultTemplateStyle();
public void updatePreviewPane() { public void updatePreviewPane() {
previewPane.populateConfig(updateConfig()); if (previewPane != null) {
previewPane.setBackground(previewPane.getInitialColor()); previewPane.populateConfig(updateConfig());
previewPane.repaint(); previewPane.setBackground(previewPane.getInitialColor());
previewPane.repaint();
}
} }
public abstract void populateSubStyle(MobileTemplateStyle ob); public abstract void populateSubStyle(MobileTemplateStyle ob);

57
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe.mobile.ui;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.AttrScrollPane;
import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.icombobox.LineComboBox;
@ -34,6 +35,7 @@ import java.awt.*;
public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<MobileBookMarkStyle> { public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<MobileBookMarkStyle> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final int COLUMN_HEIGHT = 20;
private static final int COLUMN_WIDTH = 160; private static final int COLUMN_WIDTH = 160;
private UnsignedIntUISpinner buttonWidthSpinner; private UnsignedIntUISpinner buttonWidthSpinner;
@ -73,9 +75,20 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); this.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
this.add(this.createNavButtonStylePanel()); final JPanel contentPanel = FRGUIPaneFactory.createYBoxEmptyBorderPane();
this.add(this.createNormalStateStylePanel());
this.add(this.createSelectedStateStylePanel()); contentPanel.add(this.createNavButtonStylePanel());
contentPanel.add(this.createNormalStateStylePanel());
contentPanel.add(this.createSelectedStateStylePanel());
JPanel scrollPanel = new AttrScrollPane() {
@Override
protected JPanel createContentPane() {
return contentPanel;
}
};
scrollPanel.setPreferredSize(new Dimension(-2, -2));
this.add(scrollPanel, BorderLayout.CENTER);
} }
private JPanel createNavButtonStylePanel() { private JPanel createNavButtonStylePanel() {
@ -87,11 +100,11 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
UILabel sizeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Size") + ":", UILabel sizeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Size") + ":",
SwingConstants.RIGHT); SwingConstants.RIGHT);
JPanel sizePane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 5, 0); JPanel sizePane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 4, 0);
sizePane.add(buttonWidthSpinner); sizePane.add(buttonWidthSpinner);
sizePane.add(buttonHeightSpinner); sizePane.add(buttonHeightSpinner);
JPanel sizeTipsPane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 5, 0); JPanel sizeTipsPane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 4, 0);
sizeTipsPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Width"), sizeTipsPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Width"),
SwingConstants.CENTER)); SwingConstants.CENTER));
sizeTipsPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Height"), sizeTipsPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Height"),
@ -103,7 +116,7 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
SwingConstants.RIGHT); SwingConstants.RIGHT);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p}; double[] rowSize = {COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT};
double[] columnSize = {p, COLUMN_WIDTH}; double[] columnSize = {p, COLUMN_WIDTH};
double[] verticalGaps = {0, 10, 10}; double[] verticalGaps = {0, 10, 10};
@ -145,7 +158,7 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
} }
}); });
normalBorderWidthComBox = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY); normalBorderWidthComBox = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY);
normalBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getBorderWidth()); normalBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getBorderLineStyle());
normalBorderColorBox = new ColorSelectBox(COLUMN_WIDTH); normalBorderColorBox = new ColorSelectBox(COLUMN_WIDTH);
normalBorderColorBox.setSelectObject(DEFAULT_STYLE.getBorderColor()); normalBorderColorBox.setSelectObject(DEFAULT_STYLE.getBorderColor());
normalFontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); normalFontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
@ -167,12 +180,12 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
JPanel fontExtraPane = TableLayoutHelper.createGapTableLayoutPane( JPanel fontExtraPane = TableLayoutHelper.createGapTableLayoutPane(
new JComponent[][]{{normalFontSizeComboBox, normalFontColorButton, normalFontItalicButton, normalFontBoldButton}}, new JComponent[][]{{normalFontSizeComboBox, normalFontColorButton, normalFontItalicButton, normalFontBoldButton}},
new double[]{p}, new double[]{COLUMN_HEIGHT},
new double[]{p, p, p, p}, new double[]{p, p, p, p},
0, 5 7, 0
); );
double[] rowSize = {p, p, p, p, p}; double[] rowSize = {COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT};
double[] columnSize = {p, COLUMN_WIDTH, p}; double[] columnSize = {p, COLUMN_WIDTH, p};
JPanel normalStateStyleSettingsPanel = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ JPanel normalStateStyleSettingsPanel = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{
@ -232,7 +245,7 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
} }
}); });
selectedBorderWidthComBox = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY); selectedBorderWidthComBox = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY);
selectedBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getSelectedBorderWidth()); selectedBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getSelectedBorderLineStyle());
selectedBorderColorBox = new ColorSelectBox(COLUMN_WIDTH); selectedBorderColorBox = new ColorSelectBox(COLUMN_WIDTH);
selectedBorderColorBox.setSelectObject(DEFAULT_STYLE.getSelectedBorderColor()); selectedBorderColorBox.setSelectObject(DEFAULT_STYLE.getSelectedBorderColor());
selectedFontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); selectedFontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
@ -254,12 +267,12 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
JPanel fontExtraPane = TableLayoutHelper.createGapTableLayoutPane( JPanel fontExtraPane = TableLayoutHelper.createGapTableLayoutPane(
new JComponent[][]{{selectedFontSizeComboBox, selectedFontColorButton, selectedFontItalicButton, selectedFontBoldButton}}, new JComponent[][]{{selectedFontSizeComboBox, selectedFontColorButton, selectedFontItalicButton, selectedFontBoldButton}},
new double[]{p}, new double[]{COLUMN_HEIGHT},
new double[]{p, p, p, p}, new double[]{p, p, p, p},
0, 5 7, 0
); );
double[] rowSize = {p, p, p, p, p}; double[] rowSize = {COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT};
double[] columnSize = {p, COLUMN_WIDTH, p}; double[] columnSize = {p, COLUMN_WIDTH, p};
JPanel selectedStateStyleSettingsPanel = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ JPanel selectedStateStyleSettingsPanel = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{
@ -316,7 +329,7 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
normalBackgroundColorBox.setSelectObject(style.getBackgroundColor()); normalBackgroundColorBox.setSelectObject(style.getBackgroundColor());
normalOpacityDragBar.setValue(style.getOpacity()); normalOpacityDragBar.setValue(style.getOpacity());
normalOpacitySpinner.setValue(style.getOpacity()); normalOpacitySpinner.setValue(style.getOpacity());
normalBorderWidthComBox.setSelectedLineStyle(style.getBorderWidth()); normalBorderWidthComBox.setSelectedLineStyle(style.getBorderLineStyle());
normalBorderColorBox.setSelectObject(style.getBorderColor()); normalBorderColorBox.setSelectObject(style.getBorderColor());
normalFontNameComboBox.setSelectedItem(style.getFontFamily()); normalFontNameComboBox.setSelectedItem(style.getFontFamily());
normalFontSizeComboBox.setSelectedItem(style.getFontSize()); normalFontSizeComboBox.setSelectedItem(style.getFontSize());
@ -327,7 +340,7 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
selectedBackgroundColorBox.setSelectObject(style.getSelectedBackgroundColor()); selectedBackgroundColorBox.setSelectObject(style.getSelectedBackgroundColor());
selectedOpacityDragBar.setValue(style.getSelectedOpacity()); selectedOpacityDragBar.setValue(style.getSelectedOpacity());
selectedOpacitySpinner.setValue(style.getSelectedOpacity()); selectedOpacitySpinner.setValue(style.getSelectedOpacity());
selectedBorderWidthComBox.setSelectedLineStyle(style.getSelectedBorderWidth()); selectedBorderWidthComBox.setSelectedLineStyle(style.getSelectedBorderLineStyle());
selectedBorderColorBox.setSelectObject(style.getSelectedBorderColor()); selectedBorderColorBox.setSelectObject(style.getSelectedBorderColor());
selectedFontNameComboBox.setSelectedItem(style.getSelectedFontFamily()); selectedFontNameComboBox.setSelectedItem(style.getSelectedFontFamily());
selectedFontSizeComboBox.setSelectedItem(style.getSelectedFontSize()); selectedFontSizeComboBox.setSelectedItem(style.getSelectedFontSize());
@ -345,11 +358,9 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
style.setGap((int) buttonGapSpinner.getValue()); style.setGap((int) buttonGapSpinner.getValue());
style.setBorderRadius((int) buttonBorderRadiusSpinner.getValue()); style.setBorderRadius((int) buttonBorderRadiusSpinner.getValue());
if (normalBackgroundColorBox.getSelectObject() != null) { style.setBackgroundColor(normalBackgroundColorBox.getSelectObject());
style.setBackgroundColor(normalBackgroundColorBox.getSelectObject());
}
style.setOpacity((int) normalOpacitySpinner.getValue()); style.setOpacity((int) normalOpacitySpinner.getValue());
style.setBorderWidth(normalBorderWidthComBox.getSelectedLineStyle()); style.setBorderLineStyle(normalBorderWidthComBox.getSelectedLineStyle());
style.setBorderColor(normalBorderColorBox.getSelectObject()); style.setBorderColor(normalBorderColorBox.getSelectObject());
if (normalFontNameComboBox.getSelectedItem() != null) { if (normalFontNameComboBox.getSelectedItem() != null) {
style.setFontFamily((String) normalFontNameComboBox.getSelectedItem()); style.setFontFamily((String) normalFontNameComboBox.getSelectedItem());
@ -361,11 +372,9 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
style.setFontItalic(normalFontItalicButton.isSelected()); style.setFontItalic(normalFontItalicButton.isSelected());
style.setFontBold(normalFontBoldButton.isSelected()); style.setFontBold(normalFontBoldButton.isSelected());
if (selectedBackgroundColorBox.getSelectObject() != null) { style.setSelectedBackgroundColor(selectedBackgroundColorBox.getSelectObject());
style.setSelectedBackgroundColor(selectedBackgroundColorBox.getSelectObject());
}
style.setSelectedOpacity((int) selectedOpacitySpinner.getValue()); style.setSelectedOpacity((int) selectedOpacitySpinner.getValue());
style.setSelectedBorderWidth(selectedBorderWidthComBox.getSelectedLineStyle()); style.setSelectedBorderLineStyle(selectedBorderWidthComBox.getSelectedLineStyle());
style.setSelectedBorderColor(selectedBorderColorBox.getSelectObject()); style.setSelectedBorderColor(selectedBorderColorBox.getSelectObject());
if (selectedFontNameComboBox.getSelectedItem() != null) { if (selectedFontNameComboBox.getSelectedItem() != null) {
style.setSelectedFontFamily((String) selectedFontNameComboBox.getSelectedItem()); style.setSelectedFontFamily((String) selectedFontNameComboBox.getSelectedItem());

2
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java

@ -7,6 +7,7 @@ import com.fr.general.cardtag.mobile.DownMenuStyle;
import com.fr.general.cardtag.mobile.MobileTemplateStyle; import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import com.fr.general.cardtag.mobile.SliderStyle; import com.fr.general.cardtag.mobile.SliderStyle;
import com.fr.general.cardtag.mobile.UpMenuStyle; import com.fr.general.cardtag.mobile.UpMenuStyle;
import com.fr.general.cardtag.mobile.UniteStyle;
import com.fr.invoke.Reflect; import com.fr.invoke.Reflect;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import java.util.HashMap; import java.util.HashMap;
@ -20,6 +21,7 @@ public class TemplateStyleDefinePaneFactory {
defineMap.put(UpMenuStyle.STYLE_NAME, new StyleDefinePaneUI(UpMenuStyleDefinePane.class)); defineMap.put(UpMenuStyle.STYLE_NAME, new StyleDefinePaneUI(UpMenuStyleDefinePane.class));
defineMap.put(DownMenuStyle.STYLE_NAME, new StyleDefinePaneUI(DownMenuStyleDefinePane.class)); defineMap.put(DownMenuStyle.STYLE_NAME, new StyleDefinePaneUI(DownMenuStyleDefinePane.class));
defineMap.put(SliderStyle.STYLE_NAME, new StyleDefinePaneUI(SliderStyleDefinePane.class)); defineMap.put(SliderStyle.STYLE_NAME, new StyleDefinePaneUI(SliderStyleDefinePane.class));
defineMap.put(UniteStyle.STYLE_NAME, new StyleDefinePaneUI(UniteStyleDefinePane.class));
} }
public static BasicBeanPane<MobileTemplateStyle> createDefinePane(String style, WCardTagLayout tagLayout) { public static BasicBeanPane<MobileTemplateStyle> createDefinePane(String style, WCardTagLayout tagLayout) {

233
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java

@ -0,0 +1,233 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UnsignedIntUISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.MobileTabFontConfPane;
import com.fr.design.mainframe.widget.UITitleSplitLine;
import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import com.fr.general.cardtag.mobile.TabFontConfig;
import com.fr.general.cardtag.mobile.UniteStyle;
import com.fr.stable.CoreConstants;
import javax.swing.*;
import java.awt.*;
public class UniteStyleDefinePane extends MobileTemplateStyleDefinePane {
private static final int SPLIT_LINE_WIDTH = 520;
private static final int SPLIT_LINE_HEIGHT = 20;
private static final int TOGGLE_BUTTON_WIDTH = 20;
private static final int LABEL_WIDTH = 75;
private static final int LINE_COMPONENT_WIDTH = 157;
private static final int LINE_COMPONENT_HEIGHT = 20;
private UnsignedIntUISpinner paddingLeftSpinner;
private UnsignedIntUISpinner paddingRightSpinner;
private NewColorSelectBox initialBackgroundColorBox;
private NewColorSelectBox selectedBackgroundColorBox;
private LineComboBox borderWidthComboBox;
private ColorSelectBox borderColorBox;
private UnsignedIntUISpinner borderRadiusSpinner;
private MobileTabFontConfPane tabFontConfPane;
private UIColorButton selectedFontColorButton;
public UniteStyleDefinePane(WCardTagLayout tagLayout) {
super(tagLayout);
}
@Override
protected void createBuiltinConfPane(JPanel centerPane) {
// ignore builtin conf pane
}
@Override
protected void createExtraConfPane(JPanel centerPane) {
UITitleSplitLine paddingSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Button_Padding"), SPLIT_LINE_WIDTH);
paddingSplit.setPreferredSize(new Dimension(SPLIT_LINE_WIDTH, SPLIT_LINE_HEIGHT));
centerPane.add(paddingSplit);
centerPane.add(this.createPaddingConfPane());
UITitleSplitLine backgroundSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Button_Background"), SPLIT_LINE_WIDTH);
backgroundSplit.setPreferredSize(new Dimension(SPLIT_LINE_WIDTH, SPLIT_LINE_HEIGHT));
centerPane.add(backgroundSplit);
centerPane.add(this.createBackgroundColorConfPanel());
UITitleSplitLine borderSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Border"), SPLIT_LINE_WIDTH);
borderSplit.setPreferredSize(new Dimension(SPLIT_LINE_WIDTH, SPLIT_LINE_HEIGHT));
centerPane.add(borderSplit);
centerPane.add(this.createBorderConfPanel());
UITitleSplitLine fontSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Char"), SPLIT_LINE_WIDTH);
fontSplit.setPreferredSize(new Dimension(SPLIT_LINE_WIDTH, SPLIT_LINE_HEIGHT));
centerPane.add(fontSplit);
centerPane.add(this.createFontConfPanel());
}
private JPanel createPaddingConfPane() {
this.paddingLeftSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, UniteStyle.DEFAULT_PADDING_LEFT);
this.paddingLeftSpinner.setPreferredSize(new Dimension(62, LINE_COMPONENT_HEIGHT));
this.paddingRightSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, UniteStyle.DEFAULT_PADDING_RIGHT);
this.paddingRightSpinner.setPreferredSize(new Dimension(62, LINE_COMPONENT_HEIGHT));
UILabel paddingLeftLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Left") + ":", SwingConstants.RIGHT);
paddingLeftLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT));
UILabel paddingRightLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Right") + ":", SwingConstants.RIGHT);
paddingLeftLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT));
JPanel paddingPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{
paddingLeftLabel, paddingLeftSpinner, paddingRightLabel,paddingRightSpinner
}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
paddingPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 20));
return paddingPanel;
}
private JPanel createBackgroundColorConfPanel() {
this.initialBackgroundColorBox = new NewColorSelectBox(LINE_COMPONENT_WIDTH);
this.initialBackgroundColorBox.setPreferredSize(new Dimension(LINE_COMPONENT_WIDTH, LINE_COMPONENT_HEIGHT));
this.selectedBackgroundColorBox = new NewColorSelectBox(LINE_COMPONENT_WIDTH);
this.selectedBackgroundColorBox.setPreferredSize(new Dimension(LINE_COMPONENT_WIDTH, LINE_COMPONENT_HEIGHT));
UILabel initialBackgroundColorLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Init_Fill") + ":", SwingConstants.RIGHT);
initialBackgroundColorLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT));
UILabel selectedBackgroundColorLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Select_Fill") + ":", SwingConstants.RIGHT);
selectedBackgroundColorLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT));
JPanel backgroundColorPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[]{ initialBackgroundColorLabel, initialBackgroundColorBox },
new Component[]{ selectedBackgroundColorLabel, selectedBackgroundColorBox }
}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
backgroundColorPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 20));
return backgroundColorPanel;
}
private JPanel createBorderConfPanel() {
this.borderWidthComboBox = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY);
this.borderWidthComboBox.setPreferredSize(new Dimension(LINE_COMPONENT_WIDTH, LINE_COMPONENT_HEIGHT));
this.borderColorBox = new ColorSelectBox(LINE_COMPONENT_WIDTH);
this.borderColorBox.setPreferredSize(new Dimension(LINE_COMPONENT_WIDTH, LINE_COMPONENT_HEIGHT));
this.borderRadiusSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, UniteStyle.DEFAULT_BORDER_RADIUS);
this.borderRadiusSpinner.setPreferredSize(new Dimension(LINE_COMPONENT_WIDTH, LINE_COMPONENT_HEIGHT));
UILabel borderSizeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Line_Style") + ":", SwingConstants.RIGHT);
borderSizeLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT));
UILabel borderColorLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Colors") + ":", SwingConstants.RIGHT);
borderColorLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT));
UILabel borderRadiusLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Radius") + ":", SwingConstants.RIGHT);
borderRadiusLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT));
JPanel borderPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[]{ borderSizeLabel, borderWidthComboBox},
new Component[]{ borderColorLabel, borderColorBox },
new Component[]{ borderRadiusLabel, borderRadiusSpinner }
}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
borderPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 20));
return borderPanel;
}
private JPanel createFontConfPanel() {
this.tabFontConfPane = new MobileTabFontConfPane();
this.selectedFontColorButton = new UIColorButton();
this.selectedFontColorButton.setPreferredSize(new Dimension(TOGGLE_BUTTON_WIDTH, LINE_COMPONENT_HEIGHT));
JPanel selectedFontColorPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
selectedFontColorPanel.add(this.selectedFontColorButton);
UILabel initialFontLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Init_Char") + ":", SwingConstants.RIGHT);
initialFontLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT));
UILabel selectedFontLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Select_Char") + ":", SwingConstants.RIGHT);
selectedFontLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT));
JPanel fontPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[]{ initialFontLabel, tabFontConfPane },
new Component[]{ selectedFontLabel, selectedFontColorPanel }
}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
fontPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 20));
return fontPanel;
}
@Override
protected void initDefaultConfig() {
this.paddingLeftSpinner.setValue(UniteStyle.DEFAULT_PADDING_LEFT);
this.paddingRightSpinner.setValue(UniteStyle.DEFAULT_PADDING_RIGHT);
this.initialBackgroundColorBox.setSelectObject(UniteStyle.DEFAULT_INITIAL_BACKGROUND_COLOR);
this.selectedBackgroundColorBox.setSelectObject(UniteStyle.DEFAULT_SELECTED_BACKGROUND_COLOR);
this.borderWidthComboBox.setSelectedLineStyle(UniteStyle.DEFAULT_BORDER_LINE.getLineStyle());
this.borderColorBox.setSelectObject(UniteStyle.DEFAULT_BORDER_LINE.getColor());
this.borderRadiusSpinner.setValue(UniteStyle.DEFAULT_BORDER_RADIUS);
this.tabFontConfPane.populate(UniteStyle.DEFAULT_TAB_FONT.getFont());
this.selectedFontColorButton.setColor(UniteStyle.DEFAULT_TAB_FONT.getSelectColor());
}
@Override
protected MobileTemplatePreviewPane createPreviewPane() {
return null;
}
@Override
protected MobileTemplateStyle getDefaultTemplateStyle() {
return new UniteStyle();
}
@Override
public void populateSubStyle(MobileTemplateStyle ob) {
UniteStyle style = (UniteStyle) ob;
this.paddingLeftSpinner.setValue(style.getPaddingLeft());
this.paddingRightSpinner.setValue(style.getPaddingRight());
this.initialBackgroundColorBox.setSelectObject(style.getInitialColor());
this.selectedBackgroundColorBox.setSelectObject(style.getSelectColor());
this.borderWidthComboBox.setSelectedLineStyle(style.getBorderLineStyle());
this.borderColorBox.setSelectObject(style.getBorderColor());
this.borderRadiusSpinner.setValue(style.getBorderRadius());
this.tabFontConfPane.populate(style.getTabFontConfig().getFont());
this.selectedFontColorButton.setColor(style.getTabFontConfig().getSelectColor());
}
@Override
public MobileTemplateStyle updateSubStyle() {
UniteStyle style = new UniteStyle();
style.setPaddingLeft((int) this.paddingLeftSpinner.getValue());
style.setPaddingRight((int) this.paddingRightSpinner.getValue());
style.setInitialColor(this.initialBackgroundColorBox.getSelectObject());
style.setSelectColor(this.selectedBackgroundColorBox.getSelectObject());
style.setBorderLineStyle(this.borderWidthComboBox.getSelectedLineStyle());
style.setBorderColor(this.borderColorBox.getSelectObject());
style.setBorderRadius((int) this.borderRadiusSpinner.getValue());
TabFontConfig config = new TabFontConfig();
config.setFont(this.tabFontConfPane.update());
config.setSelectColor(this.selectedFontColorButton.getColor());
style.setTabFontConfig(config);
return style;
}
@Override
protected String title4PopupWindow() {
return null;
}
}

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

@ -12,7 +12,6 @@ import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.community.BBSAction; import com.fr.design.actions.community.BBSAction;
import com.fr.design.actions.community.BugAction; import com.fr.design.actions.community.BugAction;
import com.fr.design.actions.community.CenterAction; import com.fr.design.actions.community.CenterAction;
import com.fr.design.actions.community.CusDemandAction;
import com.fr.design.actions.community.FacebookFansAction; import com.fr.design.actions.community.FacebookFansAction;
import com.fr.design.actions.community.NeedAction; import com.fr.design.actions.community.NeedAction;
import com.fr.design.actions.community.QuestionAction; import com.fr.design.actions.community.QuestionAction;
@ -53,7 +52,9 @@ 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;
@ -563,15 +564,24 @@ public abstract class ToolBarMenuDock {
* @return 社区菜单的子菜单 * @return 社区菜单的子菜单
*/ */
public ShortCut[] createCommunityShortCuts() { public ShortCut[] createCommunityShortCuts() {
final java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>(); final java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>();
shortCuts.add(new BBSAction()); shortCuts.add(new BBSAction());
shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new VideoAction()); shortCuts.add(new VideoAction());
shortCuts.add(new TutorialAction()); shortCuts.add(new TutorialAction());
shortCuts.add(new QuestionAction()); shortCuts.add(new QuestionAction());
shortCuts.add(new TechSolutionAction()); shortCuts.add(new TechSolutionAction());
shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new BugAction()); shortCuts.add(new BugAction());
shortCuts.add(new NeedAction()); shortCuts.add(new NeedAction());
shortCuts.add(new CusDemandAction());
shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new CenterAction()); shortCuts.add(new CenterAction());
shortCuts.add(new SignAction()); shortCuts.add(new SignAction());
LocaleCenter.buildAction(new LocaleAction() { LocaleCenter.buildAction(new LocaleAction() {
@ -594,7 +604,11 @@ public abstract class ToolBarMenuDock {
} }
public MenuDef createCommunityMenuDef() { public MenuDef createCommunityMenuDef() {
MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community"), 'C');
MenuDef menuDef = new SnapChatMenuDef(
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);

3
designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java

@ -12,6 +12,7 @@ import java.util.ArrayList;
import javax.swing.*; import javax.swing.*;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
@ -222,7 +223,7 @@ public class BaseAccessibleEditor extends BasicPane implements AccessibleEditor
} }
public static void showMessage(String message, Component editorComponent) { public static void showMessage(String message, Component editorComponent) {
JOptionPane.showMessageDialog(editorComponent, message, "Validation Error", JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(editorComponent, message, "Validation Error", JOptionPane.ERROR_MESSAGE);
} }

44
designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java

@ -1,11 +1,14 @@
package com.fr.design.mainframe.widget.accessibles; package com.fr.design.mainframe.widget.accessibles;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.fun.MobileTemplateStyleProvider;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.mobile.ui.TemplateStyleDefinePaneFactory; import com.fr.design.mainframe.mobile.ui.TemplateStyleDefinePaneFactory;
import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.cardtag.mobile.MobileTemplateStyle; import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import com.fr.general.cardtag.mobile.MobileTemplateStyleType; import com.fr.general.cardtag.mobile.MobileTemplateStyleType;
import com.fr.invoke.Reflect;
import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel; import javax.swing.DefaultListModel;
import javax.swing.JList; import javax.swing.JList;
@ -18,9 +21,12 @@ import java.awt.Dimension;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
public class MobileTemplateStylePane extends AbstractTemplateStylePane<MobileTemplateStyle> { public class MobileTemplateStylePane extends AbstractTemplateStylePane<MobileTemplateStyle> {
private static final List<MobileTemplateStyleType> STYLE_LIST = new ArrayList<MobileTemplateStyleType>(); private static final List<MobileTemplateStyleType> STYLE_LIST = new ArrayList<MobileTemplateStyleType>();
@ -29,6 +35,7 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane<MobileTem
STYLE_LIST.add(MobileTemplateStyleType.UP_MENU_STYLE); STYLE_LIST.add(MobileTemplateStyleType.UP_MENU_STYLE);
STYLE_LIST.add(MobileTemplateStyleType.DOWN_MENU_STYLE); STYLE_LIST.add(MobileTemplateStyleType.DOWN_MENU_STYLE);
STYLE_LIST.add(MobileTemplateStyleType.SLIDER_STYLE); STYLE_LIST.add(MobileTemplateStyleType.SLIDER_STYLE);
STYLE_LIST.add(MobileTemplateStyleType.UNITE_STYLE);
} }
private DefaultListModel listModel; private DefaultListModel listModel;
@ -36,6 +43,7 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane<MobileTem
private Map<String, BasicBeanPane<MobileTemplateStyle>> map = new HashMap<>(); private Map<String, BasicBeanPane<MobileTemplateStyle>> map = new HashMap<>();
private JPanel right; private JPanel right;
private CardLayout card; private CardLayout card;
private Set<Class<? extends MobileTemplateStyle>> extraStyle = new HashSet<>();
public MobileTemplateStylePane(WCardTagLayout tagLayout){ public MobileTemplateStylePane(WCardTagLayout tagLayout){
init(tagLayout); init(tagLayout);
} }
@ -52,6 +60,7 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane<MobileTem
map.put(style.getDisplayName(), styleBasicBeanPane); map.put(style.getDisplayName(), styleBasicBeanPane);
right.add(style.getDisplayName(), styleBasicBeanPane); right.add(style.getDisplayName(), styleBasicBeanPane);
} }
initExtra();
styleList = new JList(listModel); styleList = new JList(listModel);
styleList.setCellRenderer(render); styleList.setCellRenderer(render);
@ -74,6 +83,20 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane<MobileTem
this.add(westPane, BorderLayout.WEST); this.add(westPane, BorderLayout.WEST);
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
} }
private void initExtra() {
List<MobileTemplateStyleProvider> list = getMobileTemplateStyleProvider();
for (MobileTemplateStyleProvider provider : list) {
String displayName = provider.displayName();
Class<? extends BasicBeanPane<MobileTemplateStyle>> clazz = provider.classFroMobileTemplateStyleAppearance();
BasicBeanPane<MobileTemplateStyle> styleBasicBeanPane = Reflect.on(clazz).create().get();
listModel.addElement(displayName);
map.put(displayName, styleBasicBeanPane);
right.add(displayName, styleBasicBeanPane);
extraStyle.add(provider.classFroMobileTemplateStyle());
}
}
public static ListCellRenderer render = new DefaultListCellRenderer() { public static ListCellRenderer render = new DefaultListCellRenderer() {
@Override @Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
@ -97,16 +120,31 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane<MobileTem
String style = templateStyle.getStyle(); String style = templateStyle.getStyle();
MobileTemplateStyleType templateStyleType = MobileTemplateStyleType.parse(style); MobileTemplateStyleType templateStyleType = MobileTemplateStyleType.parse(style);
if((listModel.getElementAt(i)).equals(templateStyleType.getDisplayName())){ if((listModel.getElementAt(i)).equals(templateStyleType.getDisplayName())){
styleList.setSelectedIndex(i); populateStyle(templateStyle, i);
map.get(templateStyle.toString()).populateBean(templateStyle); return;
card.show(right, templateStyle.toString()); }
if (extraStyle.contains(templateStyle.getClass())) {
populateStyle(templateStyle, i);
return; return;
} }
} }
styleList.setSelectedIndex(0); styleList.setSelectedIndex(0);
} }
private void populateStyle(MobileTemplateStyle templateStyle, int index) {
styleList.setSelectedIndex(index);
map.get(templateStyle.toString()).populateBean(templateStyle);
card.show(right, templateStyle.toString());
}
public MobileTemplateStyle update() { public MobileTemplateStyle update() {
return map.get(styleList.getSelectedValue()).updateBean(); return map.get(styleList.getSelectedValue()).updateBean();
} }
private List<MobileTemplateStyleProvider> getMobileTemplateStyleProvider() {
List<MobileTemplateStyleProvider> list = new ArrayList<>();
Set<MobileTemplateStyleProvider> sets = ExtraDesignClassManager.getInstance().getArray(MobileTemplateStyleProvider.XML_TAG);
list.addAll(sets);
return Collections.unmodifiableList(list);
}
} }

39
designer-base/src/main/java/com/fr/design/menu/MenuDef.java

@ -38,8 +38,8 @@ public class MenuDef extends ShortCut {
protected UIMenu createdJMenu; protected UIMenu createdJMenu;
protected UIButton createdButton; protected UIButton createdButton;
protected JPopupMenu popupMenu; protected JPopupMenu popupMenu;
private boolean hasScrollSubMenu; protected boolean hasScrollSubMenu;
private boolean isHeadMenu; protected boolean isHeadMenu;
private String anchor; private String anchor;
@ -138,10 +138,14 @@ public class MenuDef extends ShortCut {
*/ */
public void addShortCut(ShortCut... shortcut) { public void addShortCut(ShortCut... shortcut) {
for (ShortCut i : shortcut) { for (ShortCut i : shortcut) {
this.shortcutList.add(i); addShortCut(i);
} }
} }
public void addShortCut(ShortCut shortCut) {
this.shortcutList.add(shortCut);
}
public void removeShortCut(ShortCut shortCut) { public void removeShortCut(ShortCut shortCut) {
this.shortcutList.remove(shortCut); this.shortcutList.remove(shortCut);
@ -187,18 +191,13 @@ public class MenuDef extends ShortCut {
*/ */
public UIMenu createJMenu() { public UIMenu createJMenu() {
if (createdJMenu == null) { if (createdJMenu == null) {
if (hasScrollSubMenu) { createdJMenu = createJMenu0();
createdJMenu = new UIScrollMenu(this.getName());
} else if (isHeadMenu){
createdJMenu = new UIHeadMenu(this.getName());
} else {
createdJMenu = new UIMenu(this.getName());
}
createdJMenu.setMnemonic(this.getMnemonic()); createdJMenu.setMnemonic(this.getMnemonic());
if (this.iconPath != null) { if (this.iconPath != null) {
createdJMenu.setIcon(BaseUtils.readIcon(this.iconPath)); createdJMenu.setIcon(BaseUtils.readIcon(this.iconPath));
} }
createdJMenu.addMenuListener(menuDefListener); MenuListener menuListener = createMenuListener();
createdJMenu.addMenuListener(menuListener);
ContainerListener listener = getContainerListener(); ContainerListener listener = getContainerListener();
if (listener != null) { if (listener != null) {
createdJMenu.getPopupMenu().addContainerListener(listener); createdJMenu.getPopupMenu().addContainerListener(listener);
@ -208,6 +207,19 @@ public class MenuDef extends ShortCut {
return createdJMenu; return createdJMenu;
} }
protected UIMenu createJMenu0() {
UIMenu createdJMenu;
if (hasScrollSubMenu) {
createdJMenu = new UIScrollMenu(this.getName());
} else if (isHeadMenu){
createdJMenu = new UIHeadMenu(this.getName());
} else {
createdJMenu = new UIMenu(this.getName());
}
return createdJMenu;
}
protected ContainerListener getContainerListener() { protected ContainerListener getContainerListener() {
return null; return null;
} }
@ -378,6 +390,11 @@ public class MenuDef extends ShortCut {
toolBar.add(this.createUIButton()); toolBar.add(this.createUIButton());
} }
protected MenuListener createMenuListener() {
return menuDefListener;
}
private MenuListener menuDefListener = new MenuListener() { private MenuListener menuDefListener = new MenuListener() {
@Override @Override

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

@ -0,0 +1,200 @@
package com.fr.design.menu;
import com.fr.design.gui.imenu.UIMenu;
import com.fr.design.gui.imenu.UIScrollMenu;
import com.fr.design.notification.SnapChat;
import com.fr.design.notification.SnapChatConfig;
import com.fr.design.notification.SnapChatKey;
import javax.swing.JMenu;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.geom.Ellipse2D;
import java.awt.image.BufferedImage;
/**
* created by Harrison on 2020/03/16
**/
public class SnapChatMenuDef extends MenuDef implements SnapChat {
private SnapChatKey uniqueKey;
private SnapChatMenuUI menuUI = new SnapChatMenuUI(this);
public SnapChatMenuDef(String name, SnapChatKey uniqueKey) {
super(name);
this.uniqueKey = uniqueKey;
}
public SnapChatMenuDef(Boolean rePaint, SnapChatKey uniqueKey) {
super(rePaint);
this.uniqueKey = uniqueKey;
}
public SnapChatMenuDef(String name, char mnemonic, SnapChatKey uniqueKey) {
super(name, mnemonic);
this.uniqueKey = uniqueKey;
}
@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);
}
@Override
public boolean defaultStatus() {
return true;
}
@Override
public void addShortCut(ShortCut shortCut) {
addSnapChatNotification(shortCut);
super.addShortCut(shortCut);
}
@Override
public void insertShortCut(int index, ShortCut shortCut) {
addSnapChatNotification(shortCut);
super.insertShortCut(index, shortCut);
}
@Override
public SnapChatKey key() {
return this.uniqueKey;
}
@Override
protected MenuListener createMenuListener() {
return new SnapChatMenuListener();
}
/**
* 添加提醒
*
* @param shortCut 快捷方式
*/
private void addSnapChatNotification(ShortCut shortCut) {
if (shortCut instanceof SnapChatUpdateAction) {
SnapChatUpdateAction action = (SnapChatUpdateAction) shortCut;
if (!action.hasRead()) {
String calcKey = calcKey();
SnapChatConfig.getInstance().resetRead(calcKey);
}
}
}
private String calcKey() {
return key().calc();
}
@Override
protected UIMenu createJMenu0() {
UIMenu createdJMenu;
if (hasScrollSubMenu) {
createdJMenu = new SnapChatUIScrollMenu(this.getName());
} else if (isHeadMenu){
createdJMenu = new SnapChatUIHeadMenu(this.getName());
} else {
createdJMenu = new SnapChatUIMenu(this.getName());
}
return createdJMenu;
}
private class SnapChatMenuListener implements MenuListener {
@Override
public void menuSelected(MenuEvent e) {
markRead();
Object source = e.getSource();
if (!(source instanceof JMenu)) {
return;
}
updateMenu();
}
@Override
public void menuDeselected(MenuEvent e) {
}
@Override
public void menuCanceled(MenuEvent e) {
}
}
private class SnapChatUIScrollMenu extends UIScrollMenu {
public SnapChatUIScrollMenu(String s) {
super(s);
}
@Override
public void updateUI() {
setUI(menuUI);
}
}
private class SnapChatUIMenu extends UIMenu {
public SnapChatUIMenu(String name) {
super(name);
}
@Override
public void updateUI() {
setUI(menuUI);
}
}
private class SnapChatUIHeadMenu extends UIMenu {
public SnapChatUIHeadMenu(String name) {
super(name);
}
@Override
public void updateUI() {
setUI(menuUI);
}
}
public static void main(String[] args) {
BufferedImage image = new BufferedImage(16, 16, Image.SCALE_DEFAULT);
Graphics2D g2d = image.createGraphics();
g2d.setColor(Color.green);
Ellipse2D.Double shape =
new Ellipse2D.Double(2, 2, 1, 1);
g2d.fill(shape);
g2d.draw(shape);
System.out.println();
}
}

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

@ -0,0 +1,31 @@
package com.fr.design.menu;
import com.fr.design.gui.imenu.UIMenuItemUI;
import javax.swing.JMenuItem;
import java.awt.Graphics;
import java.awt.Rectangle;
/**
* created by Harrison on 2020/03/22
**/
class SnapChatMenuItemUI extends UIMenuItemUI {
private final SnapChatUpdateAction snapChatUpdateAction;
public SnapChatMenuItemUI(SnapChatUpdateAction snapChatUpdateAction) {
this.snapChatUpdateAction = snapChatUpdateAction;
}
@Override
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) {
super.paintText(g, menuItem, textRect, text);
if (!snapChatUpdateAction.hasRead()) {
SnapChatUtil.paintSnapChat(g, textRect);
}
}
}

29
designer-base/src/main/java/com/fr/design/menu/SnapChatMenuUI.java

@ -0,0 +1,29 @@
package com.fr.design.menu;
import com.fr.design.gui.imenu.UIMenuUI;
import javax.swing.JMenuItem;
import java.awt.Graphics;
import java.awt.Rectangle;
/**
* created by Harrison on 2020/03/22
**/
public class SnapChatMenuUI extends UIMenuUI {
private SnapChatMenuDef menuDef;
public SnapChatMenuUI(SnapChatMenuDef menuDef) {
this.menuDef = menuDef;
}
@Override
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) {
super.paintText(g, menuItem, textRect, text);
if (!menuDef.hasRead()) {
SnapChatUtil.paintSnapChat(g, textRect);
}
}
}

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

@ -0,0 +1,79 @@
package com.fr.design.menu;
import com.fr.design.actions.UpdateAction;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.notification.SnapChat;
import com.fr.design.notification.SnapChatConfig;
import com.fr.design.notification.SnapChatKey;
import java.awt.event.ActionEvent;
/**
* created by Harrison on 2020/03/22
**/
public abstract class SnapChatUpdateAction extends UpdateAction implements SnapChat {
private SnapChatKey uniqueKey;
public SnapChatUpdateAction(SnapChatKey uniqueKey) {
this.uniqueKey = uniqueKey;
}
@Override
public final void actionPerformed(ActionEvent e) {
markRead();
actionPerformed0(e);
}
protected abstract void actionPerformed0(ActionEvent e);
@Override
public boolean hasRead() {
String calcKey = calcKey();
Boolean val = SnapChatConfig.getInstance().hasRead(calcKey);
return val == null ? defaultStatus() : val;
}
@Override
public void markRead() {
String calcKey = calcKey();
SnapChatConfig.getInstance().markRead(calcKey);
}
@Override
public boolean defaultStatus() {
return false;
}
@Override
public SnapChatKey key() {
return this.uniqueKey;
}
private String calcKey() {
return key().calc();
}
@Override
public UIMenuItem createMenuItem() {
Object object = this.getValue(UIMenuItem.class.getName());
if (object == null && !(object instanceof UIMenuItem)) {
UIMenuItem menuItem = new UIMenuItem(this);
// 设置名字用作单元测
menuItem.setName(getName());
menuItem.setUI(new SnapChatMenuItemUI(this));
object = menuItem;
this.putValue(UIMenuItem.class.getName(), object);
}
return (UIMenuItem) object;
}
}

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

@ -0,0 +1,33 @@
package com.fr.design.menu;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.geom.Ellipse2D;
/**
* created by Harrison on 2020/03/22
**/
public class SnapChatUtil {
public static void paintSnapChat(Graphics g, Rectangle textRect) {
Color oldColor = g.getColor();
double x = textRect.getWidth();
x += textRect.getX();
x += 2;
double y = textRect.getY();
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(Color.red);
Ellipse2D.Double shape =
new Ellipse2D.Double(x, y, 4, 4);
g2d.fill(shape);
g2d.draw(shape);
g2d.setColor(oldColor);
}
}

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

@ -0,0 +1,35 @@
package com.fr.design.notification;
/**
* 阅后即焚的消息提醒
*
* created by Harrison on 2020/03/16
**/
public interface SnapChat {
/**
* 默认状态
*
* @return 默认状态
*/
boolean defaultStatus();
/**
* 已读
*
* @return 是否为已读
*/
boolean hasRead();
/**
* 标记为已读
*/
void markRead();
/**
* 独一无二的标志
*
* @return 字符标志
*/
SnapChatKey key();
}

38
designer-base/src/main/java/com/fr/design/notification/SnapChatAllTypes.java

@ -0,0 +1,38 @@
package com.fr.design.notification;
import com.fr.stable.CommonUtils;
/**
* created by Harrison on 2020/03/16
**/
public abstract class SnapChatAllTypes {
public enum Menu implements SnapChatKey {
/**
* 社区按钮
*/
BBS("BBS");
private static final String SIGN = "0001";
private String key;
Menu(String key) {
this.key = key;
}
public String getKey() {
return key;
}
@Override
public String calc() {
return CommonUtils.join(
new String[]{SIGN, getKey()}, "-"
);
}
}
}

93
designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java

@ -0,0 +1,93 @@
package com.fr.design.notification;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLable;
import com.fr.stable.xml.XMLableReader;
import java.util.HashMap;
import java.util.Map;
/**
* created by Harrison on 2020/03/16
**/
@SuppressWarnings("unchecked")
public class SnapChatConfig implements XMLable {
public static final String XML_TAG = "SnapChatConfig";
/**
* 已经阅读过的属性
*/
private Map<String, Boolean> markReadMap = new HashMap<>(8);
private static final SnapChatConfig INSTANCE = new SnapChatConfig();
public static SnapChatConfig getInstance() {
return INSTANCE;
}
public Boolean hasRead(String key) {
Map<String, Boolean> map = markReadMap;
return map.get(key);
}
public void markRead(String key) {
markReadMap.put(key, Boolean.TRUE);
}
public void resetRead(String key) {
markReadMap.put(key, Boolean.FALSE);
}
@Override
public void readXML(XMLableReader reader) {
if (reader.isChildNode()) {
if ("item".equals(reader.getTagName())) {
String tmpVal = reader.getElementValue();
Boolean markRead = Boolean.valueOf(tmpVal);
markReadMap.put(reader.getAttrAsString("key", StringUtils.EMPTY), markRead);
}
}
}
@Override
public void writeXML(XMLPrintWriter writer) {
writer.startTAG(XML_TAG);
writeMarkReadMapXML(writer);
writer.end();
}
private void readMarkReadMapXML(XMLableReader reader) {
reader.readXMLObject(new XMLReadable() {
@Override
public void readXML(XMLableReader reader) {
}
});
}
/**
* 写入map
*/
private void writeMarkReadMapXML(XMLPrintWriter writer) {
writer.startTAG("MarkReadMap");
for (Map.Entry<String, Boolean> item : markReadMap.entrySet()) {
writer.startTAG("item").attr("key", item.getKey()).textNode(item.getValue().toString()).end();
}
writer.end();
}
@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
}

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

@ -0,0 +1,9 @@
package com.fr.design.notification;
/**
* created by Harrison on 2020/03/16
**/
public interface SnapChatKey {
String calc();
}

67
designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java

@ -1,7 +1,10 @@
package com.fr.design.os.impl; package com.fr.design.os.impl;
import com.fr.design.actions.help.AboutDialog;
import com.fr.design.actions.help.AboutPane;
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.general.ComparatorUtils;
import com.fr.invoke.Reflect; import com.fr.invoke.Reflect;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSBasedAction;
@ -21,25 +24,55 @@ public class MacOsAddListenerAction implements OSBasedAction {
public void execute(final Object... objects) { public void execute(final Object... objects) {
try { try {
Class app = Class.forName("com.apple.eawt.Application"); Class app = Class.forName("com.apple.eawt.Application");
Class handler = Class.forName("com.apple.eawt.QuitHandler"); Class quitHandler = Class.forName("com.apple.eawt.QuitHandler");
Object instance = Proxy.newProxyInstance(handler.getClassLoader(), new Class[]{handler}, Object quitInstance = getProxy(quitHandler, "handleQuitRequestWith", new QuitAction());
new InvocationHandler() { Class aboutHandler = Class.forName("com.apple.eawt.AboutHandler");
@Override Object aboutInstance = getProxy(aboutHandler, "handleAbout", new AboutAction());
public Object invoke(Object proxy, Method method, Reflect.on(Reflect.on(app).call("getApplication").get()).call("setQuitHandler", quitInstance)
Object[] args) throws Throwable { .call("setAboutHandler", aboutInstance);
if ("handleQuitRequestWith".equals(method.getName())) {
if (DesignerContext.getDesignerFrame() != null && DesignerContext.getDesignerFrame().isShowing()) {
DesignerContext.getDesignerFrame().exit();
} else {
DesignerExiter.getInstance().execute();
}
}
return null;
}
});
Reflect.on(Reflect.on(app).call("getApplication").get()).call("setQuitHandler", instance);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
private Object getProxy(Class clazz, final String methodName, final Action action) {
return Proxy.newProxyInstance(clazz.getClassLoader(), new Class[]{clazz},
new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method,
Object[] args) throws Throwable {
if (ComparatorUtils.equals(methodName, method.getName())) {
action.execute();
}
return null;
}
});
}
interface Action {
void execute();
}
private class QuitAction implements Action {
@Override
public void execute() {
if (DesignerContext.getDesignerFrame() != null && DesignerContext.getDesignerFrame().isShowing()) {
DesignerContext.getDesignerFrame().exit();
} else {
DesignerExiter.getInstance().execute();
}
}
}
private class AboutAction implements Action {
@Override
public void execute() {
AboutPane aboutPane = new AboutPane();
AboutDialog aboutDialog = new AboutDialog(DesignerContext.getDesignerFrame(), aboutPane);
aboutDialog.setVisible(true);
}
}
} }

10
designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java

@ -88,7 +88,7 @@ public enum SupportOSImpl implements SupportOS {
NON_GUARDIAN_START { NON_GUARDIAN_START {
@Override @Override
public boolean support() { public boolean support() {
return OperatingSystem.isLinux() || Arch.getArch() == Arch.ARM; return OperatingSystem.isLinux() || Arch.getArch() == Arch.ARM || OperatingSystem.isMacos();
} }
}, },
@ -97,6 +97,14 @@ public enum SupportOSImpl implements SupportOS {
public boolean support() { public boolean support() {
return OperatingSystem.isMacos(); return OperatingSystem.isMacos();
} }
},
VM_OPTIONS_ADAPTER {
@Override
public boolean support() {
return OperatingSystem.isWindows();
}
} }
} }

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

@ -2,6 +2,7 @@ package com.fr.design.parameter;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.ParameterConfig; import com.fr.base.ParameterConfig;
import com.fr.design.dialog.FineJOptionPane;
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.controlpane.NameableSelfCreator; import com.fr.design.gui.controlpane.NameableSelfCreator;
@ -36,14 +37,14 @@ public class ParameterArrayPane extends JListControlPane {
String tempName = getEditingName(); String tempName = getEditingName();
if (StringUtils.isEmpty(tempName)) { if (StringUtils.isEmpty(tempName)) {
nameableList.stopEditing(); nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Empty_Parameter_Name")); FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Empty_Parameter_Name"));
setIllegalIndex(editingIndex); setIllegalIndex(editingIndex);
return; return;
} }
if (!ComparatorUtils.equals(tempName, selectedName) if (!ComparatorUtils.equals(tempName, selectedName)
&& isNameRepeated(new List[]{Arrays.asList(parameters), Arrays.asList(allListNames)}, tempName)) { && isNameRepeated(new List[]{Arrays.asList(parameters), Arrays.asList(allListNames)}, tempName)) {
nameableList.stopEditing(); nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Duplicate_Parameter_Name")); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Duplicate_Parameter_Name"));
setIllegalIndex(editingIndex); setIllegalIndex(editingIndex);
} }

7
designer-base/src/main/java/com/fr/design/present/dict/FormulaDictPane.java

@ -10,6 +10,7 @@ import com.fr.design.gui.ilable.UILabel;
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.widget.FRWidgetFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
@ -20,6 +21,7 @@ public class FormulaDictPane extends FurtherBasicBeanPane<FormulaDictionary> {
private static final int EDITOR_COLUMN = 15; private static final int EDITOR_COLUMN = 15;
private static final int LEFT_BORDER = 5; private static final int LEFT_BORDER = 5;
private static final int MAX_WIDTH = 30;
private FormulaEditor keyFormulaEditor; private FormulaEditor keyFormulaEditor;
private FormulaEditor valueFormulaEditor; private FormulaEditor valueFormulaEditor;
@ -61,10 +63,9 @@ public class FormulaDictPane extends FurtherBasicBeanPane<FormulaDictionary> {
valueFormulaContainer.add(new JLabel(icon)); valueFormulaContainer.add(new JLabel(icon));
valueFormulaContainer.add(valueFormulaEditor); valueFormulaContainer.add(valueFormulaEditor);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Actual_Value"), UILabel.LEFT), keyFormulaContainer}, new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Actual_Value"), MAX_WIDTH, UILabel.LEFT), keyFormulaContainer},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Display_Value"), UILabel.LEFT), valueFormulaContainer}, new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Display_Value"), MAX_WIDTH, UILabel.LEFT), valueFormulaContainer},
new Component[]{tag, null} new Component[]{tag, null}
}; };
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE);

33
designer-base/src/main/java/com/fr/design/style/AbstractPopBox.java

@ -5,15 +5,22 @@ import com.fr.design.style.background.BackgroundJComponent;
import com.fr.design.style.background.gradient.GradientBackgroundPane; import com.fr.design.style.background.gradient.GradientBackgroundPane;
import com.fr.general.Background; import com.fr.general.Background;
import javax.swing.*; import javax.swing.JPanel;
import javax.swing.JWindow;
import javax.swing.SwingUtilities;
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.util.ArrayList;
import java.util.List;
import java.awt.AWTEvent;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.AWTEventListener; import java.awt.event.AWTEventListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
/** /**
* @author kunsnat E-mail:kunsnat@gmail.com * @author kunsnat E-mail:kunsnat@gmail.com
@ -50,7 +57,7 @@ public abstract class AbstractPopBox extends JPanel {
} }
}; };
private void showPopupMenu() { protected void showPopupMenu() {
if (selectPopupWindow != null && selectPopupWindow.isVisible()) { if (selectPopupWindow != null && selectPopupWindow.isVisible()) {
hidePopupMenu(); hidePopupMenu();
return; return;
@ -98,12 +105,16 @@ public abstract class AbstractPopBox extends JPanel {
private void mouseClick(MouseEvent evt) { private void mouseClick(MouseEvent evt) {
Point point = new Point((int) (evt.getLocationOnScreen().getX()), (int) evt.getLocationOnScreen().getY()); Point point = new Point((int) (evt.getLocationOnScreen().getX()), (int) evt.getLocationOnScreen().getY());
Dimension popBoxD = AbstractPopBox.this.getSize(); Dimension popBoxD = AbstractPopBox.this.getSize();
Point popBoxP = AbstractPopBox.this.getLocationOnScreen(); try {
Dimension popMenuD = this.getControlWindow().getSize(); Point popBoxP = AbstractPopBox.this.getLocationOnScreen();
Point popMenuP = this.getControlWindow().getLocation(); Dimension popMenuD = this.getControlWindow().getSize();
Rectangle popBoxRect = new Rectangle(popBoxP, popBoxD); Point popMenuP = this.getControlWindow().getLocation();
Rectangle popMenuRect = new Rectangle(popMenuP, popMenuD); Rectangle popBoxRect = new Rectangle(popBoxP, popBoxD);
if (!popBoxRect.contains(point) && !popMenuRect.contains(point)) { Rectangle popMenuRect = new Rectangle(popMenuP, popMenuD);
if (!popBoxRect.contains(point) && !popMenuRect.contains(point)) {
this.hidePopupMenu();
}
} catch (Exception ignore){
this.hidePopupMenu(); this.hidePopupMenu();
} }
} }

5
designer-base/src/main/java/com/fr/design/style/BorderPane.java

@ -14,6 +14,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants; import com.fr.stable.Constants;
@ -69,7 +70,7 @@ public class BorderPane extends BasicPane {
private JToggleButton rightToggleButton; private JToggleButton rightToggleButton;
private LineComboBox currentLineCombo; private LineComboBox currentLineCombo;
private ColorSelectBox currentLineColorPane; private NewColorSelectBox currentLineColorPane;
private UIButton insidebutton; private UIButton insidebutton;
@ -88,7 +89,7 @@ public class BorderPane extends BasicPane {
verticalToggleButton = new ToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/vertical.png"), BorderPane.VERTICAL_BORDER); verticalToggleButton = new ToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/vertical.png"), BorderPane.VERTICAL_BORDER);
rightToggleButton = new ToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/right.png"), BorderPane.RIGHT_BORDER); rightToggleButton = new ToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/right.png"), BorderPane.RIGHT_BORDER);
this.currentLineCombo = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY); this.currentLineCombo = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY);
this.currentLineColorPane = new ColorSelectBox(100); this.currentLineColorPane = new NewColorSelectBox(100);
this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());

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

@ -118,6 +118,9 @@ public class BackgroundPane extends BasicPane {
*/ */
public void populate(Background background) { public void populate(Background background) {
BackgroundUIWrapper wrapper = getBackgroundUIWrapper(background); BackgroundUIWrapper wrapper = getBackgroundUIWrapper(background);
if (wrapper == null) {
return;
}
int index = wrapper.getIndex(); int index = wrapper.getIndex();
BackgroundDetailPane quickPane = getTabItemPane(background, index); BackgroundDetailPane quickPane = getTabItemPane(background, index);
quickPane.populate(background); quickPane.populate(background);

4
designer-base/src/main/java/com/fr/design/style/background/gradient/FixedGradientBar.java

@ -1,6 +1,6 @@
package com.fr.design.style.background.gradient; package com.fr.design.style.background.gradient;
import com.fr.design.style.background.gradient.GradientBar; import java.awt.Color;
/** /**
* 这个bar不能拖拽滑动 * 这个bar不能拖拽滑动
@ -8,6 +8,8 @@ import com.fr.design.style.background.gradient.GradientBar;
public class FixedGradientBar extends GradientBar { public class FixedGradientBar extends GradientBar {
private static final long serialVersionUID = 2787525421995954889L; private static final long serialVersionUID = 2787525421995954889L;
public static final Color NEW_CHARACTER = new Color(99, 178, 238);
public FixedGradientBar(int minvalue, int maxvalue) { public FixedGradientBar(int minvalue, int maxvalue) {
super(minvalue, maxvalue); super(minvalue, maxvalue);
} }

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

@ -1,40 +1,38 @@
package com.fr.design.style.background.gradient; package com.fr.design.style.background.gradient;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.LinearGradientPaint;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.swing.JComponent;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.style.color.ColorCell; import com.fr.design.style.color.ColorCell;
import com.fr.design.style.color.ColorSelectConfigManager;
import com.fr.design.style.color.ColorSelectDetailPane; import com.fr.design.style.color.ColorSelectDetailPane;
import com.fr.design.style.color.ColorSelectDialog; import com.fr.design.style.color.ColorSelectDialog;
import com.fr.design.style.color.ColorSelectable; import com.fr.design.style.color.ColorSelectable;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import javax.swing.JComponent;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.LinearGradientPaint;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;
/** /**
* TODO:面板缩放的功能没有考虑就是尾值过大导致超过界面显示的情况原来的那个实现完全是个BUG要缩放的情况也比较少就干脆以后弄吧 * TODO:面板缩放的功能没有考虑就是尾值过大导致超过界面显示的情况原来的那个实现完全是个BUG要缩放的情况也比较少就干脆以后弄吧
*/ */
public class GradientBar extends JComponent implements UIObserver,ColorSelectable{ public class GradientBar extends JComponent implements UIObserver, ColorSelectable {
/** /**
* *
@ -54,7 +52,7 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
private UINumberField endLabel; private UINumberField endLabel;
private ChangeListener changeListener = null; private ChangeListener changeListener = null;
private UIObserverListener uiObserverListener; private List<UIObserverListener> uiObserverListener;
private static final int MOUSE_OFFSET = 4; private static final int MOUSE_OFFSET = 4;
@ -89,6 +87,11 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
iniListener(); iniListener();
} }
public void updateColor(Color begin, Color end) {
p1.setColorInner(begin);
p2.setColorInner(end);
}
protected void addMouseClickListener() { protected void addMouseClickListener() {
this.addMouseListener(new MouseAdapter() { this.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
@ -142,14 +145,14 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
} }
private void iniListener() { private void iniListener() {
uiObserverListener = new ArrayList<>();
if (shouldResponseChangeListener()) { if (shouldResponseChangeListener()) {
this.addChangeListener(new ChangeListener() { this.addChangeListener(new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
if (uiObserverListener == null) { for (UIObserverListener observerListener : uiObserverListener) {
return; observerListener.doChange();
} }
uiObserverListener.doChange();
} }
}); });
} }
@ -199,7 +202,7 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
* 状态改变 * 状态改变
*/ */
public void stateChanged() { public void stateChanged() {
if (changeListener != null) { if (changeListener != null) {
changeListener.stateChanged(null); changeListener.stateChanged(null);
} }
} }
@ -215,14 +218,14 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
/** /**
* 如果左右两个按钮还在初始位置就为true * 如果左右两个按钮还在初始位置就为true
* @return 同上 *
* @return 同上
*/ */
public boolean isOriginalPlace() { public boolean isOriginalPlace() {
return AssistUtils.equals(startLabel.getValue(), min) && AssistUtils.equals(endLabel.getValue(), max); return AssistUtils.equals(startLabel.getValue(), min) && AssistUtils.equals(endLabel.getValue(), max);
} }
/** /**
*
* @return * @return
*/ */
public double getStartValue() { public double getStartValue() {
@ -230,7 +233,6 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
} }
/** /**
*
* @return * @return
*/ */
public double getEndValue() { public double getEndValue() {
@ -238,23 +240,22 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
} }
/** /**
*
* @param startValue * @param startValue
*/ */
public void setStartValue(double startValue) { public void setStartValue(double startValue) {
startLabel.setValue(startValue); startLabel.setValue(startValue);
p1.setX(startValue);
} }
/** /**
*
* @param endValue * @param endValue
*/ */
public void setEndValue(double endValue) { public void setEndValue(double endValue) {
endLabel.setValue(endValue); endLabel.setValue(endValue);
p2.setX(endValue);
} }
/** /**
*
* @return * @return
*/ */
public SelectColorPointBtn getSelectColorPointBtnP1() { public SelectColorPointBtn getSelectColorPointBtnP1() {
@ -262,7 +263,6 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
} }
/** /**
*
* @return * @return
*/ */
public SelectColorPointBtn getSelectColorPointBtnP2() { public SelectColorPointBtn getSelectColorPointBtnP2() {
@ -276,7 +276,7 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
* *
*/ */
public void registerChangeListener(UIObserverListener listener) { public void registerChangeListener(UIObserverListener listener) {
uiObserverListener = listener; uiObserverListener.add(listener);
} }
@Override @Override
@ -288,22 +288,23 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
return true; return true;
} }
@Override @Override
public void setColor(Color color) { public void setColor(Color color) {
this.color = color; this.color = color;
} }
@Override @Override
public Color getColor() { public Color getColor() {
return this.color; return this.color;
} }
/** /**
* 选中颜色 * 选中颜色
* @param ColorCell 颜色单元格 *
*/ * @param ColorCell 颜色单元格
@Override */
public void colorSetted(ColorCell colorCell) { @Override
public void colorSetted(ColorCell colorCell) {
} }
} }

7
designer-base/src/main/java/com/fr/design/style/color/ColorSelectDialog.java

@ -6,6 +6,7 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.io.Serializable;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Dialog; import java.awt.Dialog;
@ -13,7 +14,6 @@ import java.awt.FlowLayout;
import java.awt.Frame; import java.awt.Frame;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.Serializable;
/** /**
@ -136,8 +136,13 @@ public class ColorSelectDialog extends MiddleChartDialog{
* void * void
*/ */
public static void showDialog(Frame owner,ColorSelectDetailPane pane,Color initialColor,ColorSelectable selectePane){ public static void showDialog(Frame owner,ColorSelectDetailPane pane,Color initialColor,ColorSelectable selectePane){
showDialog(owner,pane,initialColor,selectePane,false);
}
public static void showDialog(Frame owner,ColorSelectDetailPane pane,Color initialColor,ColorSelectable selectePane, boolean alwaysOnTop){
ColorTracker okListener = new ColorTracker(pane); ColorTracker okListener = new ColorTracker(pane);
ColorSelectDialog dialog = new ColorSelectDialog(owner,pane,initialColor,okListener,selectePane); ColorSelectDialog dialog = new ColorSelectDialog(owner,pane,initialColor,okListener,selectePane);
dialog.setAlwaysOnTop(alwaysOnTop);
dialog.setModal(true); dialog.setModal(true);
dialog.show(); dialog.show();
} }

15
designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java

@ -11,16 +11,21 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.BorderFactory;
import javax.swing.*; import javax.swing.Box;
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.util.ArrayList;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList;
/** /**
* The pane used to select color * The pane used to select color
@ -196,6 +201,6 @@ public class ColorSelectPane extends TransparentPane implements ColorSelectable
@Override @Override
public void customButtonPressed() { public void customButtonPressed() {
pane = new ColorSelectDetailPane(Color.WHITE); pane = new ColorSelectDetailPane(Color.WHITE);
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, this); ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, this, true);
} }
} }

73
designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java

@ -0,0 +1,73 @@
package com.fr.design.unit;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.ReportLengthUNITProvider;
import com.fr.design.unit.impl.CMReportLengthUNIT;
import com.fr.design.unit.impl.INCHReportLengthUNIT;
import com.fr.design.unit.impl.MMReportLengthUNIT;
import com.fr.design.unit.impl.PTReportLengthUNIT;
import com.fr.general.GeneralContext;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* Created by kerry on 2020-04-09
*/
public class UnitConvertUtil {
private static List<ReportLengthUNITProvider> lengthUNITList = new ArrayList<ReportLengthUNITProvider>();
static {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent pluginEvent) {
initSupportedReportLengthUNIT();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext pluginContext) {
return pluginContext.contain(ReportLengthUNITProvider.MARK_STRING);
}
});
initSupportedReportLengthUNIT();
}
private static void initSupportedReportLengthUNIT(){
lengthUNITList.clear();
lengthUNITList.add(new MMReportLengthUNIT());
lengthUNITList.add(new CMReportLengthUNIT());
lengthUNITList.add(new INCHReportLengthUNIT());
lengthUNITList.add(new PTReportLengthUNIT());
Set<ReportLengthUNITProvider> providers = ExtraDesignClassManager.getInstance().getArray(ReportLengthUNITProvider.MARK_STRING);
for (ReportLengthUNITProvider provider : providers) {
lengthUNITList.add(provider);
}
}
private UnitConvertUtil() {
}
public static ReportLengthUNITProvider parseLengthUNIT(int unitType) {
for (ReportLengthUNITProvider lengthUNIT : lengthUNITList) {
if (unitType == lengthUNIT.unitType()) {
return lengthUNIT;
}
}
return new MMReportLengthUNIT();
}
public static String[] getUnitItems() {
String[] unitItems = new String[lengthUNITList.size()];
for (int i = 0; i < lengthUNITList.size(); i++) {
unitItems[i] = lengthUNITList.get(i).unitText();
}
return unitItems;
}
}

32
designer-base/src/main/java/com/fr/design/unit/impl/CMReportLengthUNIT.java

@ -0,0 +1,32 @@
package com.fr.design.unit.impl;
import com.fr.design.fun.impl.AbstractReportLengthUNITProvider;
import com.fr.stable.Constants;
import com.fr.stable.unit.CM;
import com.fr.stable.unit.UNIT;
/**
* Created by kerry on 2020-04-09
*/
public class CMReportLengthUNIT extends AbstractReportLengthUNITProvider {
@Override
public String unitText() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_CM");
}
@Override
public int unitType() {
return Constants.UNIT_CM;
}
@Override
public float unit2Value4Scale(UNIT value) {
return value.toCMValue4Scale2();
}
@Override
public UNIT float2UNIT(float value) {
return new CM(value);
}
}

31
designer-base/src/main/java/com/fr/design/unit/impl/INCHReportLengthUNIT.java

@ -0,0 +1,31 @@
package com.fr.design.unit.impl;
import com.fr.design.fun.impl.AbstractReportLengthUNITProvider;
import com.fr.stable.Constants;
import com.fr.stable.unit.INCH;
import com.fr.stable.unit.UNIT;
/**
* Created by kerry on 2020-04-09
*/
public class INCHReportLengthUNIT extends AbstractReportLengthUNITProvider {
@Override
public String unitText() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_INCH");
}
@Override
public int unitType() {
return Constants.UNIT_INCH;
}
@Override
public float unit2Value4Scale(UNIT value) {
return value.toINCHValue4Scale3();
}
@Override
public UNIT float2UNIT(float value) {
return new INCH(value);
}
}

31
designer-base/src/main/java/com/fr/design/unit/impl/MMReportLengthUNIT.java

@ -0,0 +1,31 @@
package com.fr.design.unit.impl;
import com.fr.design.fun.impl.AbstractReportLengthUNITProvider;
import com.fr.stable.Constants;
import com.fr.stable.unit.MM;
import com.fr.stable.unit.UNIT;
/**
* Created by kerry on 2020-04-09
*/
public class MMReportLengthUNIT extends AbstractReportLengthUNITProvider {
@Override
public String unitText() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_MM");
}
@Override
public int unitType() {
return Constants.UNIT_MM;
}
@Override
public float unit2Value4Scale(UNIT value) {
return value.toMMValue4Scale2();
}
@Override
public UNIT float2UNIT(float value) {
return new MM(value);
}
}

31
designer-base/src/main/java/com/fr/design/unit/impl/PTReportLengthUNIT.java

@ -0,0 +1,31 @@
package com.fr.design.unit.impl;
import com.fr.design.fun.impl.AbstractReportLengthUNITProvider;
import com.fr.stable.Constants;
import com.fr.stable.unit.PT;
import com.fr.stable.unit.UNIT;
/**
* Created by kerry on 2020-04-09
*/
public class PTReportLengthUNIT extends AbstractReportLengthUNITProvider {
@Override
public String unitText() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_PT_Duplicate");
}
@Override
public int unitType() {
return Constants.UNIT_PT;
}
@Override
public float unit2Value4Scale(UNIT value) {
return value.toPTValue4Scale2();
}
@Override
public UNIT float2UNIT(float value) {
return new PT(value);
}
}

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

@ -88,7 +88,7 @@ public class UpmFinder {
dialog.setVisible(true); dialog.setVisible(true);
} }
} else { } else {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message")); FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message"));
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame()); UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.setAutoUpdateAfterInit(); dialog.setAutoUpdateAfterInit();
dialog.showDialog(); dialog.showDialog();

9
designer-base/src/main/java/com/fr/design/utils/DesignerPort.java

@ -1,5 +1,6 @@
package com.fr.design.utils; package com.fr.design.utils;
import com.fr.common.report.ReportState;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.dialog.TipDialog; import com.fr.design.dialog.TipDialog;
@ -12,6 +13,9 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.exit.DesignerExiter; import com.fr.exit.DesignerExiter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.process.ProcessEventPipe;
import com.fr.process.engine.core.CarryMessageEvent;
import com.fr.process.engine.core.FineProcessContext;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable; import com.fr.stable.xml.XMLReadable;
@ -86,7 +90,10 @@ public class DesignerPort implements XMLReadable, XMLWriter {
} }
public void resetPort() { public void resetPort() {
ProcessEventPipe eventPipe = FineProcessContext.getParentPipe();
if (eventPipe != null) {
eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue()));
}
TipDialog dialog = new TipDialog(null, TipDialog dialog = new TipDialog(null,
StringUtils.EMPTY, StringUtils.EMPTY,
Toolkit.i18nText("Fine-Design_Port_Found_Port_Conflict"), Toolkit.i18nText("Fine-Design_Port_Found_Port_Conflict"),

2
designer-base/src/main/java/com/fr/exit/DesignerExiter.java

@ -22,7 +22,7 @@ public class DesignerExiter {
public void execute() { public void execute() {
beforeExit(); beforeExit();
if (FineProcessContext.getParentPipe() != null) { if (FineProcessContext.getParentPipe() != null) {
FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY); FineProcessContext.getParentPipe().syncFire(FineProcessEngineEvent.DESTROY);
} }
System.exit(0); System.exit(0);
} }

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

@ -3,6 +3,7 @@
*/ */
package com.fr.start; package com.fr.start;
import com.fr.common.report.ReportState;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.constants.DesignerLaunchStatus; import com.fr.design.constants.DesignerLaunchStatus;
@ -24,6 +25,9 @@ import com.fr.file.FILEFactory;
import com.fr.file.FileFILE; import com.fr.file.FileFILE;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.process.ProcessEventPipe;
import com.fr.process.engine.core.CarryMessageEvent;
import com.fr.process.engine.core.FineProcessContext;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import java.awt.Window; import java.awt.Window;
@ -75,6 +79,11 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
@Override @Override
public void on(Event event, Null param) { public void on(Event event, Null param) {
EventDispatcher.stopListen(this); EventDispatcher.stopListen(this);
// 启动完成 停止监听
ProcessEventPipe eventPipe = FineProcessContext.getParentPipe();
if (eventPipe != null) {
eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue()));
}
collectUserInformation(); collectUserInformation();
} }
}); });

106
designer-base/src/test/java/com/fr/design/menu/SnapChatMenuDefTest.java

@ -0,0 +1,106 @@
package com.fr.design.menu;
import com.fr.config.dao.DaoContext;
import com.fr.config.dao.impl.LocalClassHelperDao;
import com.fr.config.dao.impl.LocalEntityDao;
import com.fr.config.dao.impl.LocalXmlEntityDao;
import com.fr.design.actions.UpdateAction;
import com.fr.design.notification.SnapChatAllTypes;
import com.fr.design.notification.SnapChatConfig;
import com.fr.stable.xml.XMLableReader;
import com.fr.store.StateHubManager;
import com.fr.store.impl.MemoryLock;
import com.fr.store.impl.MemoryStore;
import com.fr.transaction.Configurations;
import com.fr.transaction.LocalConfigurationHelper;
import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.easymock.PowerMock;
import org.powermock.api.support.membermodification.MemberMatcher;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.Whitebox;
import java.awt.event.ActionEvent;
import java.util.HashMap;
@RunWith(PowerMockRunner.class)
@PrepareForTest({SnapChatConfig.class, SnapChatUpdateAction.class})
@PowerMockIgnore({"javax.crypto.*","javax.net.ssl.*","sun.security.ssl.*","com.sun.*"})
public class SnapChatMenuDefTest {
@Before
public void before() throws Exception {
DaoContext.setXmlEntityDao(new LocalXmlEntityDao());
DaoContext.setClassHelperDao(new LocalClassHelperDao());
DaoContext.setEntityDao(new LocalEntityDao());
StateHubManager.setLock(new MemoryLock());
StateHubManager.setStorage(new MemoryStore());
Configurations.setHelper(new LocalConfigurationHelper());
}
@Test
public void testAddShortCut() throws Exception {
PowerMock.suppress(MemberMatcher.constructor(UpdateAction.class));
SnapChatConfig snapChatConfig = EasyMock.partialMockBuilder(SnapChatConfig.class)
.addMockedMethod("readXML")
.createMock();
Whitebox.setInternalState(snapChatConfig, "markReadMap", new HashMap());
snapChatConfig.readXML(EasyMock.anyObject(XMLableReader.class));
EasyMock.expectLastCall().anyTimes();
EasyMock.replay(snapChatConfig);
PowerMock.mockStatic(SnapChatConfig.class);
EasyMock.expect(SnapChatConfig.getInstance()).andReturn(snapChatConfig).anyTimes();
PowerMock.replayAll();
SnapChatMenuDef menuDef = new SnapChatMenuDef("test", SnapChatAllTypes.Menu.BBS);
ShortCut action = new SnapChatUpdateAction(SnapChatAllTypes.Menu.BBS) {
@Override
protected void actionPerformed0(ActionEvent e) {
}
};
Assert.assertTrue(menuDef.hasRead());
menuDef.addShortCut(action);
Assert.assertFalse(menuDef.hasRead());
}
@Test
public void testInsertShortCut() throws Exception {
PowerMock.suppress(MemberMatcher.constructor(UpdateAction.class));
SnapChatConfig snapChatConfig = EasyMock.partialMockBuilder(SnapChatConfig.class)
.addMockedMethod("readXML")
.createMock();
Whitebox.setInternalState(snapChatConfig, "markReadMap", new HashMap());
snapChatConfig.readXML(EasyMock.anyObject(XMLableReader.class));
EasyMock.expectLastCall().anyTimes();
EasyMock.replay(snapChatConfig);
PowerMock.mockStatic(SnapChatConfig.class);
EasyMock.expect(SnapChatConfig.getInstance()).andReturn(snapChatConfig).anyTimes();
PowerMock.replayAll();
SnapChatMenuDef menuDef = new SnapChatMenuDef("test", SnapChatAllTypes.Menu.BBS);
ShortCut action = new SnapChatUpdateAction(SnapChatAllTypes.Menu.BBS) {
@Override
protected void actionPerformed0(ActionEvent e) {
}
};
Assert.assertTrue(menuDef.hasRead());
menuDef.insertShortCut(0, action);
Assert.assertFalse(menuDef.hasRead());
}
}

8
designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java

@ -4,7 +4,7 @@ import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.chart.gui.ChartComponent; import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.mainframe.ChartPropertyPane; import com.fr.design.mainframe.ChartPropertyPane;
import com.fr.design.module.ChartEmptyDataStyleAction; import com.fr.design.module.ChartEmptyDataStyleAction;
import com.fr.design.module.ChartHyperlinkGroup; import com.fr.design.module.ChartHyperlinkGroup;
@ -16,7 +16,7 @@ import com.fr.locale.LocaleMarker;
import com.fr.locale.LocaleScope; import com.fr.locale.LocaleScope;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.module.extension.Prepare; import com.fr.module.extension.Prepare;
import com.fr.plugin.chart.vanchart.imgevent.design.DesignImageEvent; import com.fr.plugin.chart.vanchart.export.ImagePainter;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider;
import com.fr.van.chart.DownloadOnlineSourcesHelper; import com.fr.van.chart.DownloadOnlineSourcesHelper;
@ -50,8 +50,8 @@ public class ChartDesignerActivator extends Activator implements Prepare {
DesignModuleFactory.registerExtraWidgetOptions(ChartTypeInterfaceManager.initWidgetOption()); DesignModuleFactory.registerExtraWidgetOptions(ChartTypeInterfaceManager.initWidgetOption());
DesignImageEvent.registerDefaultCallbackEvent(HistoryTemplateListPane.getInstance()); ImagePainter.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper());
DesignImageEvent.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); ImagePainter.registerDefaultCallbackEvent(HistoryTemplateListCache.getInstance());
ChartTypeInterfaceManager.addPluginChangedListener(); ChartTypeInterfaceManager.addPluginChangedListener();
} }

2
designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java

@ -257,7 +257,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
if (resolution == 0){ if (resolution == 0){
resolution = ScreenResolution.getScreenResolution(); resolution = ScreenResolution.getScreenResolution();
} }
painter.paint(g2d, chartWidth, chartHeight, resolution, null, this); painter.paint(g2d, chartWidth, chartHeight, resolution, null,this);
} }
} }

1
designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java

@ -118,6 +118,7 @@ public class MapAreaMatchPane extends BasicBeanPane<MapMatchResult> {
matchAreaTable.setItems(treeNodeAndItems.getSecond()); matchAreaTable.setItems(treeNodeAndItems.getSecond());
matchResultTable = new MatchResultTable(new Object[0][3], HEADER_WITH_EMPTY); matchResultTable = new MatchResultTable(new Object[0][3], HEADER_WITH_EMPTY);
matchResultTable.setItems(treeNodeAndItems.getSecond());
DefaultTableModel model = new DefaultTableModel(new Object[0][3], HEADER_WITH_EMPTY); DefaultTableModel model = new DefaultTableModel(new Object[0][3], HEADER_WITH_EMPTY);
matchResultTable.setModel(model); matchResultTable.setModel(model);

28
designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java

@ -1,6 +1,5 @@
package com.fr.design.chartx.component; package com.fr.design.chartx.component;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; import com.fr.plugin.chart.map.server.ChartGEOJSONHelper;
@ -63,6 +62,16 @@ public class MatchAreaTable extends JTable {
this.areaNameIndex = areaNameIndex; this.areaNameIndex = areaNameIndex;
} }
@Override
public boolean isCellEditable(int row, int column) {
//第一列不可编辑
int col = convertColumnIndexToModel(column);
if (col == 0) {
return false;
}
return true;
}
public void setModel(TableModel dataModel) { public void setModel(TableModel dataModel) {
super.setModel(dataModel); super.setModel(dataModel);
@ -70,7 +79,6 @@ public class MatchAreaTable extends JTable {
items = new HashSet<>(); items = new HashSet<>();
} }
TableColumnModel columnModel = getColumnModel(); TableColumnModel columnModel = getColumnModel();
columnModel.getColumn(0).setCellEditor(new UILabelEditor());
columnModel.getColumn(1).setCellEditor(new UIComboBoxRenderAndEditor()); columnModel.getColumn(1).setCellEditor(new UIComboBoxRenderAndEditor());
columnModel.getColumn(1).setCellRenderer(new UIComboBoxRenderAndEditor()); columnModel.getColumn(1).setCellRenderer(new UIComboBoxRenderAndEditor());
} }
@ -131,20 +139,4 @@ public class MatchAreaTable extends JTable {
return comboBox.getSelectedItem(); return comboBox.getSelectedItem();
} }
} }
public static class UILabelEditor extends AbstractCellEditor implements TableCellEditor {
UILabel uiLabel;
public Component getTableCellEditorComponent(JTable table, Object value,
boolean isSelected,
int row, int column) {
uiLabel = new UILabel(GeneralUtils.objectToString(value));
return uiLabel;
}
public Object getCellEditorValue() {
return uiLabel.getText();
}
}
} }

39
designer-chart/src/main/java/com/fr/design/chartx/component/MatchResultTable.java

@ -3,8 +3,10 @@ package com.fr.design.chartx.component;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.plugin.chart.map.data.MapMatchResult; import com.fr.plugin.chart.map.data.MapMatchResult;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -18,7 +20,9 @@ import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel; import javax.swing.table.TableModel;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.Vector; import java.util.Vector;
import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
@ -32,6 +36,8 @@ public class MatchResultTable extends JTable {
private MatchAreaTable matchAreaTable; private MatchAreaTable matchAreaTable;
private Set<String> items;
public MatchResultTable(Object[][] data, Object[] header) { public MatchResultTable(Object[][] data, Object[] header) {
super(data, header); super(data, header);
this.getTableHeader().setReorderingAllowed(false); this.getTableHeader().setReorderingAllowed(false);
@ -41,12 +47,26 @@ public class MatchResultTable extends JTable {
this.matchAreaTable = matchAreaTable; this.matchAreaTable = matchAreaTable;
} }
public void setItems(Set<String> items) {
this.items = items;
}
@Override
public boolean isCellEditable(int row, int column) {
//第一列和第二列不可编辑
int col = convertColumnIndexToModel(column);
if (col == 0 || col == 1) {
return false;
}
return true;
}
public void setModel(TableModel dataModel) { public void setModel(TableModel dataModel) {
super.setModel(dataModel); super.setModel(dataModel);
TableColumnModel columnModel = getColumnModel(); TableColumnModel columnModel = getColumnModel();
columnModel.getColumn(0).setCellEditor(new MatchAreaTable.UILabelEditor()); columnModel.getColumn(1).setCellRenderer(new UILabelEditorAndRender());
columnModel.getColumn(1).setCellEditor(new MatchAreaTable.UILabelEditor());
columnModel.getColumn(2).setCellEditor(new UIButtonEditorAndRender()); columnModel.getColumn(2).setCellEditor(new UIButtonEditorAndRender());
columnModel.getColumn(2).setCellRenderer(new UIButtonEditorAndRender()); columnModel.getColumn(2).setCellRenderer(new UIButtonEditorAndRender());
columnModel.getColumn(2).setMaxWidth(20); columnModel.getColumn(2).setMaxWidth(20);
@ -56,7 +76,6 @@ public class MatchResultTable extends JTable {
int rowCount = this.getRowCount(); int rowCount = this.getRowCount();
for (int i = 0; i < rowCount; i++) { for (int i = 0; i < rowCount; i++) {
if (ComparatorUtils.equals(this.getValueAt(i, 0), areaName)) { if (ComparatorUtils.equals(this.getValueAt(i, 0), areaName)) {
getColumnModel().getColumn(1).getCellEditor().stopCellEditing();
this.setValueAt(result, i, 1); this.setValueAt(result, i, 1);
return; return;
} }
@ -143,4 +162,18 @@ public class MatchResultTable extends JTable {
} }
} }
public class UILabelEditorAndRender implements TableCellRenderer {
UILabel uiLabel;
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
uiLabel = new UILabel(GeneralUtils.objectToString(value));
if (!items.contains(value)) {
uiLabel.setForeground(Color.GRAY);
uiLabel.setText(value + Toolkit.i18nText("Fine-Design_Chart_Lost_Data"));
}
return uiLabel;
}
}
} }

174
designer-chart/src/main/java/com/fr/design/chartx/component/button/ColorButton.java

@ -0,0 +1,174 @@
package com.fr.design.chartx.component.button;
import com.fr.base.BaseUtils;
import com.fr.base.background.ColorBackground;
import com.fr.design.style.AbstractSelectBox;
import com.fr.design.style.color.ColorSelectPane;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-03-06
*/
public class ColorButton extends AbstractSelectBox<Color> {
private static final double DEL_WIDTH = 7;
public static final int WIDTH = 18;
private BufferedImage closeIcon = BaseUtils.readImageWithCache("com/fr/design/images/toolbarbtn/chartChangeClose.png");
private Color color;
private boolean isMoveOn = false;
private ColorSelectPane colorPane;
private boolean lastButton;
private ChangeListener changeListener;
public ColorButton(Color color) {
this.color = color;
addMouseListener(getMouseListener());
}
public Dimension getPreferredSize() {
return new Dimension(WIDTH, WIDTH);
}
private void paintDeleteButton(Graphics g2d) {
Rectangle2D bounds = this.getBounds();
int x = (int) (bounds.getWidth() - DEL_WIDTH);
int y = 1;
g2d.drawImage(closeIcon, x, y, closeIcon.getWidth(), closeIcon.getHeight(), null);
}
public void setLastButton(boolean lastButton) {
this.lastButton = lastButton;
}
@Override
public void paint(Graphics g) {
this.setSize(WIDTH, WIDTH);
Graphics2D g2d = (Graphics2D) g;
g2d.setPaint(color);
Rectangle2D rec = new Rectangle2D.Double(0, 0, WIDTH + 1, WIDTH + 1);
g2d.fill(rec);
if (isMoveOn && !lastButton) {
paintDeleteButton(g);
}
}
protected void deleteButton() {
}
private void checkMoveOn(boolean moveOn) {
this.isMoveOn = moveOn;
repaint();
}
protected MouseListener getMouseListener() {
return new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
mouseClick(e);
}
public void mouseEntered(MouseEvent e) {
checkMoveOn(true);
}
public void mouseExited(MouseEvent e) {
checkMoveOn(false);
}
};
}
public void mouseClick(MouseEvent e) {
if (!lastButton) {
Rectangle2D bounds = this.getBounds();
if (bounds == null) {
return;
}
if (e.getX() >= bounds.getWidth() - DEL_WIDTH && e.getY() <= DEL_WIDTH) {
deleteButton();
hidePopupMenu();
return;
}
}
//打开颜色选择面板
showPopupMenu();
}
public JPanel initWindowPane(double preferredWidth) {
// 下拉的时候重新生成面板,刷新最近使用颜色
colorPane = new ColorSelectPane(false) {
@Override
public void setVisible(boolean b) {
super.setVisible(b);
}
};
colorPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
hidePopupMenu();
color = ((ColorSelectPane) e.getSource()).getColor();
fireDisplayComponent(ColorBackground.getInstance(color));
ColorButton.this.stateChanged();
}
});
return colorPane;
}
public void stateChanged() {
if (changeListener != null) {
changeListener.stateChanged(null);
}
}
public void addChangeListener(ChangeListener changeListener) {
this.changeListener = changeListener;
}
/**
* 获取当前选中的颜色
*
* @return 当前选中的颜色
*/
public Color getSelectObject() {
return this.color;
}
/**
* 设置选中的颜色
*
* @param color 颜色
*/
public void setSelectObject(Color color) {
this.color = color;
colorPane.setColor(color);
fireDisplayComponent(ColorBackground.getInstance(color));
}
}

253
designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java

@ -0,0 +1,253 @@
package com.fr.design.chartx.component.combobox;
import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.i18n.Toolkit;
import com.fr.general.GeneralUtils;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JLabel;
import javax.swing.JList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.LinearGradientPaint;
import java.awt.geom.Rectangle2D;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-03-05
* 一个带颜色展示的配色选择下拉框
*/
public class ColorSchemeComboBox extends UIComboBox {
private Map<String, ColorInfo> colorSchemes;
public ColorSchemeComboBox() {
this(null);
}
public ColorSchemeComboBox(Map<String, ColorInfo> colorSchemes) {
//通过配色方案的集合初始化下拉控件,如果参数为null,从配置中读取配色方案。
if (colorSchemes == null) {
colorSchemes = getColorSchemesFromConfig();
}
this.colorSchemes = colorSchemes;
this.setModel(new DefaultComboBoxModel(colorSchemes.keySet().toArray()));
this.setRenderer(new ColorSchemeCellRenderer());
}
private Map<String, ColorInfo> getColorSchemesFromConfig() {
Map<String, ColorInfo> colorSchemes = new LinkedHashMap<>();
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
//所有的样式名称
Iterator names = config.names();
//添加默认的方案和第一个方案
String defaultName = config.getCurrentStyle();
ChartColorMatching defaultStyle = (ChartColorMatching) config.getPreStyle(defaultName);
Object firstName = names.next();
ChartColorMatching firstStyle = (ChartColorMatching) config.getPreStyle(firstName);
if (defaultStyle == null) {
defaultStyle = firstStyle;
}
colorSchemes.put(Toolkit.i18nText("Fine-Design_Report_Default"), colorMatchingToColorInfo(defaultStyle));
colorSchemes.put(firstStyle.getId(), colorMatchingToColorInfo(firstStyle));
//添加其他的配色方案
while (names.hasNext()) {
Object key = names.next();
ChartColorMatching colorMatching = (ChartColorMatching) config.getPreStyle(key);
colorSchemes.put(colorMatching.getId(), colorMatchingToColorInfo(colorMatching));
}
//添加自定义组合色和自定义渐变色
colorSchemes.put(Toolkit.i18nText("Fine-Design_Chart_Custom_Combination_Color"), null);
colorSchemes.put(Toolkit.i18nText("Fine-Design_Chart_Custom_Gradient"), null);
return colorSchemes;
}
public ColorInfo getSelectColorInfo() {
String selectedItem = (String) getSelectedItem();
return colorSchemes.get(selectedItem);
}
private ColorInfo colorMatchingToColorInfo(ChartColorMatching colorMatching) {
ColorInfo colorInfo = new ColorInfo();
colorInfo.setGradient(colorMatching.getGradient());
colorInfo.setColors(colorMatching.getColorList());
return colorInfo;
}
public SelectType getSelectType() {
int selectedIndex = this.getSelectedIndex();
int itemCount = this.getItemCount();
if (selectedIndex == itemCount - 1) {
return SelectType.GRADATION_COLOR;
}
if (selectedIndex == itemCount - 2) {
return SelectType.COMBINATION_COLOR;
}
if (selectedIndex == 0) {
return SelectType.DEFAULT;
}
return SelectType.NORMAL;
}
public void setSelectType(SelectType selectType) {
int itemCount = this.getItemCount();
switch (selectType) {
case DEFAULT:
setSelectedIndex(0);
break;
case GRADATION_COLOR:
setSelectedIndex(itemCount - 1);
break;
case COMBINATION_COLOR:
setSelectedIndex(itemCount - 2);
break;
}
}
public enum SelectType {
DEFAULT,
COMBINATION_COLOR,
GRADATION_COLOR,
NORMAL
}
public Set<String> getItems() {
return colorSchemes.keySet();
}
public class ColorInfo {
private List<Color> colors;
private boolean gradient;
public List<Color> getColors() {
return colors;
}
public void setColors(List<Color> colors) {
this.colors = colors;
}
public boolean isGradient() {
return gradient;
}
public void setGradient(boolean gradient) {
this.gradient = gradient;
}
}
/**
* CellRenderer.
*/
class ColorSchemeCellRenderer extends UIComboBoxRenderer {
private String schemeName = Toolkit.i18nText("Fine-Design_Report_Default");
//左边距
private static final double X = 4d;
//上边距
private static final double Y = 4d;
private static final String BLANK_SPACE = " ";
private static final int HEIGHT = 20;
private static final int MAX_COUNT = 5;
private static final int BLANK = 1;
@Override
public Dimension getPreferredSize() {
Dimension preferredSize = super.getPreferredSize();
preferredSize.setSize(super.getPreferredSize().getWidth(), HEIGHT);
return preferredSize;
}
@Override
public Dimension getMinimumSize() {
return getPreferredSize();
}
public Component getListCellRendererComponent(
JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel comp = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
this.schemeName = GeneralUtils.objectToString(value);
ColorInfo colorInfo = colorSchemes.get(schemeName);
if (colorInfo == null) {
comp.setText(BLANK_SPACE + schemeName);
} else {
FontMetrics fontMetrics = comp.getFontMetrics(comp.getFont());
//宽度是5倍的高加上4倍的留白
double width = (HEIGHT - 2 * Y) * MAX_COUNT + BLANK * (MAX_COUNT - 1);
String fill = BLANK_SPACE;
//图形和文字之间留的宽度大于3倍的X
while (fontMetrics.stringWidth(fill) < width + 3 * X) {
fill += BLANK_SPACE;
}
comp.setText(fill + schemeName);
}
comp.setToolTipText(schemeName);
return comp;
}
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2d = (Graphics2D) g;
ColorInfo colorInfo = colorSchemes.get(schemeName);
if (colorInfo != null) {
if (colorInfo.isGradient()) {
drawGradient(g2d, colorInfo.getColors());
} else {
drawCombineColor(g2d, colorInfo.getColors());
}
}
}
private void drawGradient(Graphics2D g2d, List<Color> colors) {
//上下留4px,宽度等于5倍高
double height = HEIGHT - 2 * Y;
double width = height * MAX_COUNT + BLANK * (MAX_COUNT - 1);
LinearGradientPaint linearGradientPaint = new LinearGradientPaint((float) X, (float) Y, (float) (X + width), (float) Y, new float[]{0f, 1f}, colors.toArray(new Color[colors.size()]));
g2d.setPaint(linearGradientPaint);
Rectangle2D rec = new Rectangle2D.Double(X, Y, width, height);
g2d.fill(rec);
}
private void drawCombineColor(Graphics2D g2d, List<Color> colors) {
int size = Math.min(colors.size(), MAX_COUNT);
double height = HEIGHT - 2 * Y;
//加上1px留白
double width = ((height + BLANK) * MAX_COUNT - size) / size;
for (int i = 0; i < size; i++) {
g2d.setPaint(colors.get(i));
Rectangle2D rec = new Rectangle2D.Double(X + (width + BLANK) * i, Y, width, height);
g2d.fill(rec);
}
}
}
}

6
designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java

@ -6,7 +6,6 @@ import com.fr.chart.chartattr.ChartCollection;
import com.fr.chartx.attr.ChartProvider; import com.fr.chartx.attr.ChartProvider;
import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.data.tabledata.Prepare4DataSourceChange;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
@ -115,14 +114,13 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare
selectedPane.update(collection); selectedPane.update(collection);
if (!ComparatorUtils.equals(collection, lastCollection)) { if (!ComparatorUtils.equals(collection, lastCollection)) {
VanChart vanChart = collection.getSelectedChartProvider(VanChart.class); VanChart vanChart = collection.getSelectedChartProvider(VanChart.class);
if (vanChart != null) { if (vanChart != null) {
//此处画图 //此处画图
vanChart.demoImgEvent(true); vanChart.attrChange();
} }
try { try {
ChartInfoCollector.getInstance().checkTestChart(collection.getSelectedChartProvider(ChartProvider.class));
lastCollection = collection.clone(); lastCollection = collection.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("error in clone ChartEditPane"); FineLoggerFactory.getLogger().error("error in clone ChartEditPane");

9
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java

@ -9,10 +9,12 @@ import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -59,11 +61,16 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
this.add(cardPane, BorderLayout.CENTER); this.add(cardPane, BorderLayout.CENTER);
dataScreeningPane = new ChartDataFilterPane(this.initplot, parent); dataScreeningPane = new ChartDataFilterPane(this.initplot, parent);
JPanel panel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), 290, 24, dataScreeningPane); JPanel panel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), 290, 24, dataScreeningPane);
panel.setBorder(BorderFactory.createEmptyBorder(0,10,0,10)); panel.setBorder(BorderFactory.createEmptyBorder(0,5,0,5));
dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(10,5,0,5)); dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(10,5,0,5));
this.add(panel, BorderLayout.SOUTH); this.add(panel, BorderLayout.SOUTH);
} }
protected UIComboBox createComboBox() {
UIComboBox uiComboBox = new UIComboBox();
UIComponentUtils.setPreferedWidth(uiComboBox, 100);
return uiComboBox;
}
/** /**
* 检查box 是否使用, hasUse, 表示上层已经使用, 否则, 则此界面都可使用 * 检查box 是否使用, hasUse, 表示上层已经使用, 否则, 则此界面都可使用
* @param hasUse 是否使用 * @param hasUse 是否使用

235
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java

@ -0,0 +1,235 @@
package com.fr.design.mainframe.chart.gui.style;
import com.fr.base.BaseUtils;
import com.fr.base.background.ColorBackground;
import com.fr.design.chartx.component.button.ColorButton;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.style.AbstractSelectBox;
import com.fr.design.style.color.ColorSelectPane;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.util.ArrayList;
import java.util.List;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
/**
* 配色方案选择组合色之后可以调整颜色的组件
*
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-03-25
*/
public class ChartColorAdjustPane extends JPanel implements UIObserver {
public static final Color[] DEFAULT_COLORS = {
new Color(99, 178, 238),
new Color(118, 218, 145),
new Color(248, 203, 127),
new Color(248, 149, 136),
new Color(124, 214, 207),
new Color(145, 146, 171),
new Color(120, 152, 225),
new Color(239, 166, 102),
new Color(237, 221, 134),
new Color(153, 135, 206),
};
private static final int COUNT_OF_ROW = 8;
private static final int MAX_BUTTON = 40;
private List<ColorButton> colorButtons = new ArrayList<>();
private List<UIObserverListener> uiObserverListener;
private ChangeListener changeListener;
public ChartColorAdjustPane() {
this(DEFAULT_COLORS);
}
public ChartColorAdjustPane(Color[] colors) {
iniListener();
createColorButton(colors);
createContentPane();
}
public void updateColor(Color[] colors) {
createColorButton(colors);
relayout();
}
public Color[] getColors() {
int size = colorButtons.size();
Color[] colors = new Color[size];
for (int i = 0; i < size; i++) {
colors[i] = colorButtons.get(i).getSelectObject();
}
return colors;
}
private void relayout() {
this.removeAll();
createContentPane();
this.validate();
this.repaint();
}
private void createContentPane() {
VerticalFlowLayout layout = new VerticalFlowLayout(0, 0, 0);
layout.setAlignLeft(true);
this.setLayout(layout);
for (int i = 0, size = colorButtons.size(); i < size; i += COUNT_OF_ROW) {
JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
int count = i + COUNT_OF_ROW > colorButtons.size() ? colorButtons.size() : i + COUNT_OF_ROW;
for (int j = i; j < count; j++) {
colorButtons.get(j).setLastButton(false);
panel.add(colorButtons.get(j));
}
if (i + COUNT_OF_ROW > colorButtons.size()) {
panel.add(new AddColorButton());
this.add(panel);
} else if (i + COUNT_OF_ROW == colorButtons.size() && colorButtons.size() != MAX_BUTTON) {
this.add(panel);
this.add(new AddColorButton());
} else {
this.add(panel);
}
}
if (colorButtons.size() == 1) {
colorButtons.get(0).setLastButton(true);
}
}
private void createColorButton(Color[] colors) {
colorButtons.clear();
int size = Math.min(colors.length, MAX_BUTTON);
for (int i = 0; i < size; i++) {
colorButtons.add(createColorButton(colors[i]));
}
}
private ColorButton createColorButton(Color color) {
ColorButton colorButton = new ColorButton(color) {
@Override
protected void deleteButton() {
colorButtons.remove(this);
stateChanged();
relayout();
}
};
colorButton.addChangeListener(changeListener);
return colorButton;
}
private void iniListener() {
uiObserverListener = new ArrayList<>();
if (shouldResponseChangeListener()) {
this.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
for (UIObserverListener observerListener : uiObserverListener) {
observerListener.doChange();
}
}
});
}
}
public void stateChanged() {
if (changeListener != null) {
changeListener.stateChanged(null);
}
}
public void addChangeListener(ChangeListener changeListener) {
this.changeListener = changeListener;
}
public void registerChangeListener(UIObserverListener listener) {
uiObserverListener.add(listener);
}
public boolean shouldResponseChangeListener() {
return true;
}
private class AddColorButton extends AbstractSelectBox<Color> {
BufferedImage image = BaseUtils.readImageWithCache("/com/fr/design/images/buttonicon/add.png");
public AddColorButton() {
addMouseListener(getMouseListener());
}
@Override
public void paint(Graphics g) {
this.setSize(ColorButton.WIDTH, ColorButton.WIDTH);
Graphics2D g2d = (Graphics2D) g;
g2d.setPaint(Color.WHITE);
Rectangle2D rec = new Rectangle2D.Double(0, 0, ColorButton.WIDTH + 1, ColorButton.WIDTH + 1);
g2d.fill(rec);
g2d.drawImage(image, 0, 0, ColorButton.WIDTH + 1, ColorButton.WIDTH + 1, null);
}
public Dimension getPreferredSize() {
return new Dimension(ColorButton.WIDTH, ColorButton.WIDTH);
}
protected MouseListener getMouseListener() {
return new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
showPopupMenu();
}
};
}
public JPanel initWindowPane(double preferredWidth) {
// 下拉的时候重新生成面板,刷新最近使用颜色
ColorSelectPane colorPane = new ColorSelectPane(false) {
public void setVisible(boolean b) {
super.setVisible(b);
}
};
colorPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
hidePopupMenu();
Color color = ((ColorSelectPane) e.getSource()).getColor();
fireDisplayComponent(ColorBackground.getInstance(color));
if(colorButtons.size() < MAX_BUTTON) {
colorButtons.add(createColorButton(color));
}
ChartColorAdjustPane.this.stateChanged();
relayout();
}
});
return colorPane;
}
public Color getSelectObject() {
return null;
}
public void setSelectObject(Color color) {
}
}
}

19
designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java

@ -7,11 +7,12 @@ 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.design.mainframe.chart.gui.style.ChartAccColorPane; import com.fr.design.mainframe.chart.gui.style.ChartColorAdjustPane;
import com.fr.design.style.background.gradient.FixedGradientBar; import com.fr.design.style.background.gradient.FixedGradientBar;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Color; import java.awt.Color;
@ -20,8 +21,6 @@ import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
/** /**
@ -37,7 +36,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
private UIButton accButton; private UIButton accButton;
private UIButton gradientButton; private UIButton gradientButton;
private ChartAccColorPane colorAcc; private ChartColorAdjustPane colorAdjustPane;
private FixedGradientBar colorGradient; private FixedGradientBar colorGradient;
public ChartPreFillStylePane() { public ChartPreFillStylePane() {
@ -53,13 +52,13 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
JPanel buttonPane = new JPanel(); JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.LEFT)); buttonPane.setLayout(new FlowLayout(FlowLayout.LEFT));
buttonPane.add(accButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Acc_Set"))); buttonPane.add(accButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Color")));
buttonPane.add(gradientButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gradient_Color"))); buttonPane.add(gradientButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gradient_Color")));
customPane.add(buttonPane, BorderLayout.NORTH); customPane.add(buttonPane, BorderLayout.NORTH);
changeColorSetPane = new JPanel(cardLayout = new CardLayout()); changeColorSetPane = new JPanel(cardLayout = new CardLayout());
changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 130), "gradient"); changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 130), "gradient");
changeColorSetPane.add(colorAcc = new ChartAccColorPane(), "acc"); changeColorSetPane.add(colorAdjustPane = new ChartColorAdjustPane(), "acc");
cardLayout.show(changeColorSetPane, "acc"); cardLayout.show(changeColorSetPane, "acc");
customPane.add(changeColorSetPane, BorderLayout.CENTER); customPane.add(changeColorSetPane, BorderLayout.CENTER);
@ -68,7 +67,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
customPane.setPreferredSize(new Dimension(200, 200)); customPane.setPreferredSize(new Dimension(200, 200));
colorGradient.setPreferredSize(new Dimension(120, 30)); colorGradient.setPreferredSize(new Dimension(120, 30));
colorGradient.getSelectColorPointBtnP1().setColorInner(Color.WHITE); colorGradient.getSelectColorPointBtnP1().setColorInner(Color.WHITE);
colorGradient.getSelectColorPointBtnP2().setColorInner(Color.black); colorGradient.getSelectColorPointBtnP2().setColorInner(FixedGradientBar.NEW_CHARACTER);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] columnSize = {p, p}; double[] columnSize = {p, p};
@ -131,7 +130,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
cardLayout.show(changeColorSetPane, "acc"); cardLayout.show(changeColorSetPane, "acc");
if (colorList.size() > 0) { if (colorList.size() > 0) {
colorAcc.populateBean(colorList.toArray(new Color[colorList.size()])); colorAdjustPane.updateColor(colorList.toArray(new Color[colorList.size()]));
} }
} }
} }
@ -152,7 +151,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
} else { } else {
chartColorMatching.setGradient(false); chartColorMatching.setGradient(false);
Color[] colors = colorAcc.updateBean(); Color[] colors = colorAdjustPane.getColors();
for(Color color : colors) { for(Color color : colors) {
colorList.add(color); colorList.add(color);
} }

28
designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java

@ -6,26 +6,32 @@ import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginConstants; import com.fr.design.extra.PluginConstants;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.IOUtils;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.plugin.chart.DownloadSourcesEvent; import com.fr.plugin.chart.DownloadSourcesEvent;
import com.fr.stable.CommonUtils; import com.fr.stable.CommonUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.*; import javax.swing.ImageIcon;
import java.awt.*; import javax.swing.JDialog;
import java.awt.event.WindowAdapter; import javax.swing.JFrame;
import java.awt.event.WindowEvent; import javax.swing.JOptionPane;
import java.awt.image.BufferedImage; import javax.swing.JPanel;
import javax.swing.JProgressBar;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.InputStream; import java.io.InputStream;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Rectangle;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
/** /**
* Created by shine on 2017/8/21. * Created by shine on 2017/8/21.
@ -51,13 +57,6 @@ public class DownloadOnlineSourcesHelper implements DownloadSourcesEvent {
//总共字节数 //总共字节数
private double totalBytes = 0; private double totalBytes = 0;
private static final double PHANTOM_MB = 96.1 * 1024 * 1024;
public void addPhantomSiteInfo() {
this.addSiteInfo("plugin.phantomjs", ChartConstants.PHANTOMJS_URL, PHANTOM_MB);
}
private static final double MAP_JSON_MB = 4.5 * 1024 * 1024; private static final double MAP_JSON_MB = 4.5 * 1024 * 1024;
public void addMapJSONSiteInfo() { public void addMapJSONSiteInfo() {
@ -219,7 +218,6 @@ public class DownloadOnlineSourcesHelper implements DownloadSourcesEvent {
@Override @Override
public void downloadSources() { public void downloadSources() {
this.addMapJSONSiteInfo(); this.addMapJSONSiteInfo();
this.addPhantomSiteInfo();
this.installOnline(); this.installOnline();
} }

7
designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java

@ -6,6 +6,7 @@ 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.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.van.chart.column.VanChartCustomStackAndAxisConditionPane; import com.fr.van.chart.column.VanChartCustomStackAndAxisConditionPane;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.line.VanChartLineSeriesPane; import com.fr.van.chart.line.VanChartLineSeriesPane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -27,7 +28,6 @@ public class VanChartAreaSeriesPane extends VanChartLineSeriesPane {
double[] col = {f}; double[] col = {f};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{getColorPane()},
new Component[]{createLineTypePane()}, new Component[]{createLineTypePane()},
new Component[]{createMarkerPane()}, new Component[]{createMarkerPane()},
new Component[]{createAreaFillColorPane()}, new Component[]{createAreaFillColorPane()},
@ -44,4 +44,9 @@ public class VanChartAreaSeriesPane extends VanChartLineSeriesPane {
protected Class<? extends BasicBeanPane> getStackAndAxisPaneClass() { protected Class<? extends BasicBeanPane> getStackAndAxisPaneClass() {
return VanChartCustomStackAndAxisConditionPane.class; return VanChartCustomStackAndAxisConditionPane.class;
} }
//风格
protected VanChartBeautyPane createStylePane() {
return new VanChartBeautyPane();
}
} }

3
designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java

@ -37,14 +37,13 @@ public class VanChartBubbleSeriesPane extends VanChartAbstractPlotSeriesPane {
double[] col = {f}; double[] col = {f};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{getColorPane()},
new Component[]{createBubblePane()}, new Component[]{createBubblePane()},
new Component[]{createStackedAndAxisPane()}, new Component[]{createStackedAndAxisPane()},
new Component[]{null} new Component[]{null}
}; };
if (!((VanChartBubblePlot) plot).isForceBubble()) { if (!((VanChartBubblePlot) plot).isForceBubble()) {
components[3] = new Component[]{createLargeDataModelPane()}; components[2] = new Component[]{createLargeDataModelPane()};
} }
contentPane = TableLayoutHelper.createTableLayoutPane(components, row, col); contentPane = TableLayoutHelper.createTableLayoutPane(components, row, col);

1
designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java

@ -53,7 +53,6 @@ public class VanChartColumnSeriesPane extends VanChartAbstractPlotSeriesPane {
double[] columnSize = {f}; double[] columnSize = {f};
double[] rowSize = {p,p,p,p,p,p,p,p,p,p}; double[] rowSize = {p,p,p,p,p,p,p,p,p,p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{getColorPane()},
new Component[]{createSeriesStylePane(new double[]{p,p}, new double[]{f,e})}, new Component[]{createSeriesStylePane(new double[]{p,p}, new double[]{f,e})},
new Component[]{createBorderPane()}, new Component[]{createBorderPane()},
new Component[]{createStackedAndAxisPane()}, new Component[]{createStackedAndAxisPane()},

5
designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomSeriesPane.java

@ -4,7 +4,6 @@ import com.fr.chart.chartattr.Chart;
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.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane;
import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane; import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.custom.VanChartCustomPlot; import com.fr.plugin.chart.custom.VanChartCustomPlot;
@ -24,7 +23,7 @@ public class VanChartCustomSeriesPane extends ChartSeriesPane {
private JPanel seriesPane; private JPanel seriesPane;
protected VanChartCustomPlotSeriesTabPane plotSeriesPane; protected VanChartCustomPlotSeriesTabPane plotSeriesPane;
private ChartFillStylePane fillStylePane;//配色 private VanChartFillStylePane fillStylePane;//配色
private VanChartBeautyPane stylePane;//风格 private VanChartBeautyPane stylePane;//风格
@ -81,7 +80,7 @@ public class VanChartCustomSeriesPane extends ChartSeriesPane {
}; };
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col);
panel.setBorder(BorderFactory.createEmptyBorder(10,10,0,15)); panel.setBorder(BorderFactory.createEmptyBorder(5,5,0,5));
return panel; return panel;
} }

16
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java

@ -29,7 +29,7 @@ public class VanChartBeautyPane extends BasicBeanPane<Integer> {
double[] columnSize = {f, e}; double[] columnSize = {f, e};
double[] rowSize = {p}; double[] rowSize = {p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style")), styleBox}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Gradient_Style")), styleBox},
} ; } ;
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
@ -37,17 +37,17 @@ public class VanChartBeautyPane extends BasicBeanPane<Integer> {
} }
protected String[] getNameArray(){ protected String[] getNameArray(){
return new String[]{Toolkit.i18nText("Fine-Design_Chart_Default_Name"), return new String[]{Toolkit.i18nText("Fine-Design_Chart_On"),
Toolkit.i18nText("Fine-Design_Chart_Style_TopDownShade") Toolkit.i18nText("Fine-Design_Chart_Off")
}; };
} }
@Override @Override
public void populateBean(Integer ob) { public void populateBean(Integer ob) {
int finalIndex; int finalIndex;
switch (ob){ switch (ob){
case ChartConstants.STYLE_NONE: finalIndex = 0; break; case ChartConstants.STYLE_NONE: finalIndex = 1; break;
case ChartConstants.STYLE_SHADE: finalIndex = 1; break; case ChartConstants.STYLE_SHADE: finalIndex = 0; break;
default: finalIndex = 0; default: finalIndex = 1;
} }
styleBox.setSelectedIndex(finalIndex); styleBox.setSelectedIndex(finalIndex);
} }
@ -57,8 +57,8 @@ public class VanChartBeautyPane extends BasicBeanPane<Integer> {
int index = styleBox.getSelectedIndex(); int index = styleBox.getSelectedIndex();
int style; int style;
switch (index){ switch (index){
case 0: style = ChartConstants.STYLE_NONE; break; case 0: style = ChartConstants.STYLE_SHADE; break;
case 1: style = ChartConstants.STYLE_SHADE; break; case 1: style = ChartConstants.STYLE_NONE; break;
default: style = ChartConstants.STYLE_NONE; default: style = ChartConstants.STYLE_NONE;
} }
return style; return style;

221
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java

@ -1,42 +1,237 @@
package com.fr.van.chart.designer.component; package com.fr.van.chart.designer.component;
import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig;
import com.fr.base.Utils;
import com.fr.chart.base.AttrFillStyle;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.base.ChartUtils;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chartx.component.combobox.ColorSchemeComboBox;
import com.fr.design.event.UIObserverListener;
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.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane; import com.fr.design.mainframe.chart.gui.style.ChartColorAdjustPane;
import com.fr.design.style.background.gradient.FixedGradientBar;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/** /**
* Created by mengao on 2017/8/17. * Created by mengao on 2017/8/17.
*/ */
public class VanChartFillStylePane extends ChartFillStylePane { public class VanChartFillStylePane extends BasicBeanPane<AttrFillStyle> {
@Override
protected JPanel getContentPane () { protected ColorSchemeComboBox styleSelectBox;
protected JPanel customPane;
protected JPanel changeColorSetPane;
protected FixedGradientBar colorGradient;
protected CardLayout cardLayout;
protected ChartColorAdjustPane colorAdjustPane;
private Color[] gradientColors;
private Color[] accColors;
private boolean gradientSelect = false;
public VanChartFillStylePane() {
this.setLayout(new BorderLayout());
styleSelectBox = new ColorSchemeComboBox();
customPane = new JPanel(FRGUIPaneFactory.createBorderLayout()) {
@Override
public Dimension getPreferredSize() {
if (!gradientSelect) {
return colorAdjustPane.getPreferredSize();
}
return colorGradient.getPreferredSize();
}
};
changeColorSetPane = new JPanel(cardLayout = new CardLayout());
changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 130), "gradient");
gradientColors = new Color[]{Color.WHITE, FixedGradientBar.NEW_CHARACTER};
changeColorSetPane.add(colorAdjustPane = new ChartColorAdjustPane(), "acc");
accColors = ChartColorAdjustPane.DEFAULT_COLORS;
cardLayout.show(changeColorSetPane, "acc");
customPane.add(changeColorSetPane, BorderLayout.CENTER);
initListener();
initLayout();
}
private void initListener() {
colorAdjustPane.registerChangeListener(new UIObserverListener() {
@Override
public void doChange() {
accColors = colorAdjustPane.getColors();
if (styleSelectBox.getSelectType() != ColorSchemeComboBox.SelectType.COMBINATION_COLOR) {
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.COMBINATION_COLOR);
}
VanChartFillStylePane.this.revalidate();
}
});
colorGradient.registerChangeListener(new UIObserverListener() {
@Override
public void doChange() {
gradientColors[0] = colorGradient.getSelectColorPointBtnP1().getColorInner();
gradientColors[1] = colorGradient.getSelectColorPointBtnP2().getColorInner();
if (styleSelectBox.getSelectType() != ColorSchemeComboBox.SelectType.GRADATION_COLOR) {
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.GRADATION_COLOR);
}
}
});
styleSelectBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
switch (styleSelectBox.getSelectType()) {
case COMBINATION_COLOR:
colorAdjustPane.updateColor(accColors);
cardLayout.show(changeColorSetPane, "acc");
gradientSelect = false;
break;
case GRADATION_COLOR:
colorGradient.updateColor(gradientColors[0], gradientColors[1]);
cardLayout.show(changeColorSetPane, "gradient");
gradientSelect = true;
break;
default:
ColorSchemeComboBox.ColorInfo selectColorInfo = styleSelectBox.getSelectColorInfo();
if (selectColorInfo.isGradient()) {
colorGradient.updateColor(selectColorInfo.getColors().get(0), selectColorInfo.getColors().get(1));
cardLayout.show(changeColorSetPane, "gradient");
gradientSelect = true;
} else {
colorAdjustPane.updateColor(selectColorInfo.getColors().toArray(new Color[]{}));
cardLayout.show(changeColorSetPane, "acc");
gradientSelect = false;
}
break;
}
VanChartFillStylePane.this.revalidate();
}
});
}
protected void initLayout() {
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
this.setLayout(new BorderLayout());
this.add(getContentPane(), BorderLayout.CENTER);
}
protected JPanel getContentPane() {
double p = TableLayout.PREFERRED; 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}; double[] rowSize = {p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color_Match")),styleSelectBox}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Match_Color_Scheme")), styleSelectBox},
new Component[]{null,customPane}, new Component[]{null, customPane},
}; };
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
panel.setBorder(BorderFactory.createEmptyBorder(5,5,0,0)); panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
return panel; return panel;
} }
@Override @Override
public Dimension getPreferredSize() { protected String title4PopupWindow() {
if(styleSelectBox.getSelectedIndex() != styleSelectBox.getItemCount() - 1) { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color");
return new Dimension(styleSelectBox.getPreferredSize().width, 30); }
@Override
public void populateBean(AttrFillStyle condition) {
String fillStyleName = condition == null ? "" : condition.getFillStyleName();
if (StringUtils.isBlank(fillStyleName) || !styleSelectBox.getItems().contains(fillStyleName)) {//兼容处理
if (condition == null || condition.getColorStyle() == ChartConstants.COLOR_DEFAULT) {
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.DEFAULT);//默认
} else {
int colorStyle = condition.getColorStyle();
if (colorStyle == ChartConstants.COLOR_GRADIENT) {
gradientColors[0] = condition.getColorIndex(0);
gradientColors[1] = condition.getColorIndex(1);
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.GRADATION_COLOR);
} else {
int colorSize = condition.getColorSize();
accColors = new Color[colorSize];
for (int i = 0; i < colorSize; i++) {
accColors[i] = condition.getColorIndex(i);
}
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.COMBINATION_COLOR);
}
}
} else {
styleSelectBox.setSelectedItem(fillStyleName);
}
}
@Override
public AttrFillStyle updateBean() {
switch (styleSelectBox.getSelectType()) {
case COMBINATION_COLOR:
return updateCombinationColor();
case GRADATION_COLOR:
return updateGradationColor();
case DEFAULT:
return updateDefaultColor();
default:
return updateNormalColor();
}
}
private AttrFillStyle updateCombinationColor() {
AttrFillStyle condition = new AttrFillStyle();
condition.clearColors();
condition.setColorStyle(ChartConstants.COLOR_ACC);
for (int i = 0, length = accColors.length; i < length; i++) {
condition.addFillColor(accColors[i]);
}
condition.setCustomFillStyle(true);
return condition;
}
private AttrFillStyle updateGradationColor() {
AttrFillStyle condition = new AttrFillStyle();
condition.clearColors();
condition.setColorStyle(ChartConstants.COLOR_GRADIENT);
Color start = gradientColors[0];
Color end = gradientColors[1];
condition.addFillColor(start);
condition.addFillColor(end);
condition.setCustomFillStyle(true);
return condition;
}
private AttrFillStyle updateDefaultColor() {
AttrFillStyle condition = new AttrFillStyle();
condition.clearColors();
condition.setColorStyle(ChartConstants.COLOR_DEFAULT);
return condition;
}
private AttrFillStyle updateNormalColor() {
ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance();
Object preStyle = manager.getPreStyle(styleSelectBox.getSelectedItem());
if (preStyle instanceof ChartColorMatching) {
AttrFillStyle def = ChartUtils.chartColorMatching2AttrFillStyle((ChartColorMatching) preStyle);
def.setFillStyleName(Utils.objectToString(styleSelectBox.getSelectedItem()));
return def;
} else {
return updateDefaultColor();
} }
return super.getPreferredSize();
} }
} }

18
designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java

@ -14,6 +14,7 @@ import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
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.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartAxis;
@ -60,6 +61,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
private UIComboBox largeDataMode; private UIComboBox largeDataMode;
private UISpinner largeModeThresholdNumber; private UISpinner largeModeThresholdNumber;
protected UILabel chartAnimationLabel;
protected UIButtonGroup isChartAnimation; protected UIButtonGroup isChartAnimation;
//坐标轴翻转属性 //坐标轴翻转属性
@ -371,7 +373,17 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
protected JPanel createAnimationPane() { protected JPanel createAnimationPane() {
isChartAnimation = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); isChartAnimation = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")});
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Animation_Effects"), isChartAnimation); chartAnimationLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Animation_Effects"));
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[]{chartAnimationLabel,isChartAnimation}
};
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Animation"), panel); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Animation"), panel);
} }
@ -499,7 +511,9 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
private void populateChartAnimate(Chart chart, Plot plot) { private void populateChartAnimate(Chart chart, Plot plot) {
if (plot.isSupportAnimate()) { if (plot.isSupportAnimate()) {
isChartAnimation.setSelectedIndex(chart.isJSDraw() ? 0 : 1); isChartAnimation.setSelectedIndex(chart.isJSDraw() ? 0 : 1);
isChartAnimation.setEnabled(!largeModel(plot)); boolean largeModel = largeModel(plot);
isChartAnimation.setEnabled(!largeModel);
chartAnimationLabel.setEnabled(!largeModel);
} }
} }

9
designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java

@ -3,6 +3,7 @@ package com.fr.van.chart.designer.style;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.i18n.Toolkit;
import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent; import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent;
import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula; import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula;
@ -38,8 +39,8 @@ public class HeatMapRangeLegendPane extends VanChartRangeLegendPane {
@Override @Override
protected UIButtonGroup<LegendType> createLegendTypeButton(){ protected UIButtonGroup<LegendType> createLegendTypeButton(){
return new UIButtonGroup<LegendType>(new String[]{ return new UIButtonGroup<LegendType>(new String[]{
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"), Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Section") Toolkit.i18nText("Fine-Design_Chart_Legend_Section")
}, new LegendType[]{LegendType.GRADUAL, LegendType.SECTION}); }, new LegendType[]{LegendType.GRADUAL, LegendType.SECTION});
} }
@ -53,7 +54,7 @@ public class HeatMapRangeLegendPane extends VanChartRangeLegendPane {
protected Component[][] getPaneComponents(MinMaxValuePaneWithOutTick minMaxValuePane, ColorSelectBoxWithOutTransparent colorSelectBox, UINumberDragPane numberDragPane, LegendGradientBar legendGradientBar) { protected Component[][] getPaneComponents(MinMaxValuePaneWithOutTick minMaxValuePane, ColorSelectBoxWithOutTransparent colorSelectBox, UINumberDragPane numberDragPane, LegendGradientBar legendGradientBar) {
return new Component[][]{ return new Component[][]{
new Component[]{minMaxValuePane, null}, new Component[]{minMaxValuePane, null},
new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Divided_Stage")), numberDragPane}, new Component[]{new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Value_Divided_Stage")), numberDragPane},
new Component[]{null, legendGradientBar} new Component[]{null, legendGradientBar}
}; };
} }
@ -64,7 +65,7 @@ public class HeatMapRangeLegendPane extends VanChartRangeLegendPane {
@Override @Override
protected SectionLegendPane createSectionLegendPane() { protected SectionLegendPane createSectionLegendPane() {
return new SectionLegendPane(this.parent) { return new SectionLegendPane(this.getLegendPaneParent()) {
@Override @Override
protected MapColorPickerPaneWithFormula createSectionIntervalConfigPane(AbstractAttrNoScrollPane parent) { protected MapColorPickerPaneWithFormula createSectionIntervalConfigPane(AbstractAttrNoScrollPane parent) {
return new SectionIntervalConfigPaneWithOutNum(parent); return new SectionIntervalConfigPaneWithOutNum(parent);

1
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartLegendPane.java

@ -68,6 +68,7 @@ public class VanChartLegendPane extends AbstractVanChartScrollPane<VanChart> {
if (plot == null) { if (plot == null) {
return; return;
} }
legendContent.setPlot(plot);
VanChartLegend legend = (VanChartLegend) plot.getLegend(); VanChartLegend legend = (VanChartLegend) plot.getLegend();
if (legendContent != null) { if (legendContent != null) {
legendContent.populateBean(legend); legendContent.populateBean(legend);

175
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java

@ -2,6 +2,7 @@ package com.fr.van.chart.designer.style;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.chart.chartattr.Plot;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.UIBubbleFloatPane; import com.fr.design.gui.frpane.UIBubbleFloatPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
@ -9,13 +10,16 @@ import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
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.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.plugin.chart.attr.VanChartLegend; import com.fr.plugin.chart.attr.VanChartLegend;
import com.fr.plugin.chart.type.LayoutType;
import com.fr.stable.Constants; import com.fr.stable.Constants;
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.VanChartFloatPositionPane; import com.fr.van.chart.designer.component.VanChartFloatPositionPane;
import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutImagePane; import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutImagePane;
@ -44,32 +48,33 @@ public class VanChartPlotLegendPane extends BasicPane {
private static final int HEIGHT = 100; private static final int HEIGHT = 100;
private static final int GAP = 20; private static final int GAP = 20;
protected UICheckBox isLegendVisible; private Plot plot;
protected JPanel legendPane; private UICheckBox isLegendVisible;
private JPanel legendPane;
protected ChartTextAttrPane textAttrPane; private ChartTextAttrPane textAttrPane;
protected VanChartBorderWithRadiusPane borderPane; private VanChartBorderWithRadiusPane borderPane;
protected VanChartBackgroundWithOutImagePane backgroundPane; private VanChartBackgroundWithOutImagePane backgroundPane;
protected UIButtonGroup<Integer> location; private UIButtonGroup<Integer> location;
protected UIToggleButton customFloatPositionButton; private UIToggleButton customFloatPositionButton;
protected VanChartFloatPositionPane customFloatPositionPane; private UIButtonGroup<LayoutType> layoutButton;
private JPanel layoutPane;
private VanChartFloatPositionPane customFloatPositionPane;
//区域显示策略 恢复用注释。下面4行删除。 //区域显示策略 恢复用注释。下面4行删除。
protected UIButtonGroup<Integer> limitSize; private UIButtonGroup<Integer> customSize;
protected UISpinner maxProportion; private UISpinner maxProportion;
private UILabel limitSizeTitle;
private JPanel maxProportionPane; private JPanel maxProportionPane;
//区域显示策略 恢复用注释。取消注释。 //区域显示策略 恢复用注释。取消注释。
//private LimitPane limitPane; //private LimitPane limitPane;
//高亮显示的按钮 //高亮显示的按钮
protected UIButtonGroup<Boolean> highlightButton; private UILabel highlightLabel;
protected JPanel highlightPane; private UIButtonGroup<Boolean> highlightButton;
private JPanel highlightPane;
protected VanChartStylePane parent;
private VanChartStylePane parent;
public VanChartPlotLegendPane() { public VanChartPlotLegendPane() {
initComponents(); initComponents();
@ -80,8 +85,28 @@ public class VanChartPlotLegendPane extends BasicPane {
initComponents(); initComponents();
} }
protected void initComponents(){ public void setPlot(Plot plot) {
isLegendVisible = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Visible")); this.plot = plot;
}
public JPanel getHighlightPane() {
return highlightPane;
}
public VanChartStylePane getLegendPaneParent() {
return parent;
}
public UIButtonGroup<Integer> getLegendLocation() {
return location;
}
public UIToggleButton getCustomFloatPositionButton() {
return customFloatPositionButton;
}
private void initComponents() {
isLegendVisible = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Legend_Visible"));
legendPane = createLegendPane(); legendPane = createLegendPane();
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
@ -100,7 +125,7 @@ public class VanChartPlotLegendPane extends BasicPane {
addLegendListener(); addLegendListener();
} }
protected void addLegendListener(){ private void addLegendListener() {
isLegendVisible.addActionListener(new ActionListener() { isLegendVisible.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
checkBoxUse(); checkBoxUse();
@ -121,9 +146,9 @@ public class VanChartPlotLegendPane extends BasicPane {
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{createTitlePositionPane(new double[]{p,p,p},columnSize),null}, new Component[]{createTitlePositionPane(new double[]{p,p,p},columnSize),null},
new Component[]{createTitleStylePane(),null} , new Component[]{createTitleStylePane(),null} ,
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), createDisplayStrategy()),null} new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), createDisplayStrategy()),null}
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
@ -146,18 +171,26 @@ public class VanChartPlotLegendPane extends BasicPane {
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{createTitlePositionPane(new double[]{p,p,p},columnSize),null}, new Component[]{createTitlePositionPane(new double[]{p,p,p},columnSize),null},
new Component[]{createTitleStylePane(),null} , new Component[]{createTitleStylePane(),null} ,
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel),null},
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
protected JPanel createTitlePositionPane(double[] row, double[] col){ private JPanel createTitlePositionPane(double[] row, double[] col) {
String[] textArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Top"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Bottom"), String[] textArray = {
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Left"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Right"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Right_Top")}; Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Top"),
Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Bottom"),
Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Left"),
Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Right"),
Toolkit.i18nText("Fine-Design_Chart_Right_Top")
};
Integer[] valueArray = {Constants.TOP, Constants.BOTTOM, Constants.LEFT, Constants.RIGHT, Constants.RIGHT_TOP}; Integer[] valueArray = {Constants.TOP, Constants.BOTTOM, Constants.LEFT, Constants.RIGHT, Constants.RIGHT_TOP};
Icon[] iconArray = {BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_top.png"),
Icon[] iconArray = {
BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_top.png"),
BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_bottom.png"), BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_bottom.png"),
BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_left.png"), BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_left.png"),
BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_right.png"), BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_right.png"),
@ -167,22 +200,45 @@ public class VanChartPlotLegendPane extends BasicPane {
location = new UIButtonGroup<Integer>(iconArray, valueArray); location = new UIButtonGroup<Integer>(iconArray, valueArray);
location.setAllToolTips(textArray); location.setAllToolTips(textArray);
customFloatPositionButton = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Float_Position")); customFloatPositionButton = new UIToggleButton(Toolkit.i18nText("Fine-Design_Chart_Custom_Float_Position"));
UIComponentUtils.setLineWrap(customFloatPositionButton); UIComponentUtils.setLineWrap(customFloatPositionButton);
customFloatPositionButton.setEventBannded(true); customFloatPositionButton.setEventBannded(true);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,null}, new Component[]{null,null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position")),location}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Layout_Position")),location},
new Component[]{null,customFloatPositionButton} new Component[]{null,customFloatPositionButton}
}; };
customFloatPositionPane = new VanChartFloatPositionPane(); customFloatPositionPane = new VanChartFloatPositionPane();
layoutPane = createLayoutPane();
initPositionListener(); initPositionListener();
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,row,col); JPanel positionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel);
JPanel panel = new JPanel(new BorderLayout());
panel.add(positionPane, BorderLayout.NORTH);
panel.add(layoutPane, BorderLayout.CENTER);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel);
}
private JPanel createLayoutPane() {
layoutButton = new UIButtonGroup<>(
new String[]{Toolkit.i18nText("Fine-Design_Chart_Layout_Flow"), Toolkit.i18nText("Fine-Design_Chart_Layout_Aligned")},
new LayoutType[]{LayoutType.FLOW, LayoutType.ALIGNED});
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Arrange")), layoutButton}
};
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{f, e});
} }
private void initPositionListener(){ private void initPositionListener(){
@ -191,6 +247,7 @@ public class VanChartPlotLegendPane extends BasicPane {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
customFloatPositionButton.setSelected(false); customFloatPositionButton.setSelected(false);
checkLayoutPaneVisible();
checkDisplayStrategyUse(); checkDisplayStrategyUse();
} }
}); });
@ -200,6 +257,7 @@ public class VanChartPlotLegendPane extends BasicPane {
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if(!customFloatPositionButton.isSelected()){ if(!customFloatPositionButton.isSelected()){
customFloatPositionButton.setSelected(true); customFloatPositionButton.setSelected(true);
checkLayoutPaneVisible();
checkDisplayStrategyUse(); checkDisplayStrategyUse();
} }
} }
@ -228,26 +286,24 @@ public class VanChartPlotLegendPane extends BasicPane {
}); });
} }
protected JPanel createTitleStylePane(){ private JPanel createTitleStylePane() {
textAttrPane = new ChartTextAttrPane(); textAttrPane = new ChartTextAttrPane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane);
} }
protected JPanel createDisplayStrategy(){ private JPanel createDisplayStrategy() {
//区域显示策略 恢复用注释。开始删除。 //区域显示策略 恢复用注释。开始删除。
maxProportion = new UISpinner(0, 100, 1, 30); maxProportion = new UISpinner(0, 100, 1, 30);
limitSize = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); customSize = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"), Toolkit.i18nText("Fine-Design_Chart_Custom")});
limitSizeTitle = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"));
JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Area_Size"), customSize);
JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"), limitSize); maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"), maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH);
maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"), maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH);
maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0));
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
panel.add(limitSizePane, BorderLayout.NORTH); panel.add(limitSizePane, BorderLayout.NORTH);
panel.add(maxProportionPane, BorderLayout.CENTER); panel.add(maxProportionPane, BorderLayout.CENTER);
limitSize.addActionListener(new ActionListener() { customSize.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
checkMaxProPortionUse(); checkMaxProPortionUse();
@ -262,8 +318,8 @@ public class VanChartPlotLegendPane extends BasicPane {
} }
private JPanel createHighlightPane(){ private JPanel createHighlightPane(){
highlightButton = new UIButtonGroup<Boolean>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_On"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); highlightButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_On"), Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false});
highlightLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Highlight"));
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
@ -271,21 +327,36 @@ public class VanChartPlotLegendPane extends BasicPane {
double[] rowSize = {p,p}; double[] rowSize = {p,p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,null}, new Component[]{null,null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Highlight")),highlightButton} new Component[]{highlightLabel, highlightButton}
}; };
return TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); return TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize);
} }
protected void checkAllUse() { protected void checkAllUse() {
checkBoxUse(); checkBoxUse();
checkLayoutPaneVisible();
checkDisplayStrategyUse(); checkDisplayStrategyUse();
this.repaint(); this.repaint();
} }
protected void checkLayoutPaneVisible() {
layoutPane.setVisible(isVisibleLayoutPane());
}
protected boolean isVisibleLayoutPane() {
if (customFloatPositionButton.isSelected()) {
return false;
}
int locationIntValue = getLegendLocation().getSelectedItem();
return locationIntValue == Constants.TOP || locationIntValue == Constants.BOTTOM;
}
//检查显示策略界面是否可用 //检查显示策略界面是否可用
protected void checkDisplayStrategyUse() { protected void checkDisplayStrategyUse() {
//区域显示策略 恢复用注释。下面2行删除。 //区域显示策略 恢复用注释。下面2行删除。
limitSize.setEnabled(!customFloatPositionButton.isSelected()); customSize.setEnabled(!customFloatPositionButton.isSelected());
checkMaxProPortionUse(); checkMaxProPortionUse();
//区域显示策略 恢复用注释。取消注释。 //区域显示策略 恢复用注释。取消注释。
// GUICoreUtils.setEnabled(limitPane, !customFloatPositionButton.isSelected()); // GUICoreUtils.setEnabled(limitPane, !customFloatPositionButton.isSelected());
@ -295,8 +366,7 @@ public class VanChartPlotLegendPane extends BasicPane {
//区域显示策略 恢复用注释。删除下面方法。 //区域显示策略 恢复用注释。删除下面方法。
//检查最大显示占比是否可用 //检查最大显示占比是否可用
private void checkMaxProPortionUse() { private void checkMaxProPortionUse() {
maxProportion.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled()); maxProportionPane.setVisible(customSize.getSelectedIndex() == 1 && customSize.isEnabled());
maxProportionPane.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled());
} }
protected void checkBoxUse() { protected void checkBoxUse() {
@ -327,8 +397,9 @@ public class VanChartPlotLegendPane extends BasicPane {
legend.setPosition(-1); legend.setPosition(-1);
} }
legend.setFloating(customFloatPositionButton.isSelected()); legend.setFloating(customFloatPositionButton.isSelected());
legend.setLayout(layoutButton.getSelectedItem());
//区域显示策略 恢复用注释。下面2行删除。 //区域显示策略 恢复用注释。下面2行删除。
legend.setLimitSize(limitSize.getSelectedIndex() == 0); legend.setCustomSize(customSize.getSelectedIndex() == 1);
legend.setMaxHeight(maxProportion.getValue()); legend.setMaxHeight(maxProportion.getValue());
//区域显示策略 恢复用注释。取消注释。 //区域显示策略 恢复用注释。取消注释。
//legend.setLimitAttribute(limitPane.updateBean()); //legend.setLimitAttribute(limitPane.updateBean());
@ -351,13 +422,17 @@ public class VanChartPlotLegendPane extends BasicPane {
customFloatPositionButton.setSelected(legend.isFloating()); customFloatPositionButton.setSelected(legend.isFloating());
customFloatPositionPane.setFloatPosition_x(legend.getFloatPercentX()); customFloatPositionPane.setFloatPosition_x(legend.getFloatPercentX());
customFloatPositionPane.setFloatPosition_y(legend.getFloatPercentY()); customFloatPositionPane.setFloatPosition_y(legend.getFloatPercentY());
layoutButton.setSelectedItem(legend.getLayout());
//区域显示策略 恢复用注释。下面2行删除。 //区域显示策略 恢复用注释。下面2行删除。
limitSize.setSelectedIndex(legend.isLimitSize() ? 0 : 1); customSize.setSelectedIndex(legend.isCustomSize() ? 1 : 0);
maxProportion.setValue(legend.getMaxHeight()); maxProportion.setValue(legend.getMaxHeight());
//区域显示策略 恢复用注释。取消注释。 //区域显示策略 恢复用注释。取消注释。
//limitPane.populateBean(legend.getLimitAttribute()); //limitPane.populateBean(legend.getLimitAttribute());
if(highlightButton != null){ if(highlightButton != null){
highlightButton.setSelectedItem(legend.isHighlight()); highlightButton.setSelectedItem(legend.isHighlight());
boolean largeDataModel = PlotFactory.largeDataModel(plot);
highlightButton.setEnabled(!largeDataModel);
highlightLabel.setEnabled(!largeDataModel);
} }
} }

39
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java

@ -3,6 +3,7 @@ package com.fr.van.chart.designer.style;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.plugin.chart.attr.VanChartLegend; import com.fr.plugin.chart.attr.VanChartLegend;
import com.fr.plugin.chart.range.VanChartRangeLegend; import com.fr.plugin.chart.range.VanChartRangeLegend;
@ -49,10 +50,10 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
ordinaryLegendPane = new JPanel(); ordinaryLegendPane = new JPanel();
//渐变色图例面板 //渐变色图例面板
gradualLegendPane = createGradualLegendPane(); gradualLegendPane = createGradualLegendPane();
gradualLegendPane.setParentPane(parent); gradualLegendPane.setParentPane(this.getLegendPaneParent());
//区域段图例面板 //区域段图例面板
sectionLegendPane = createSectionLegendPane(); sectionLegendPane = createSectionLegendPane();
sectionLegendPane.setParentPane(parent); sectionLegendPane.setParentPane(this.getLegendPaneParent());
JPanel panel = new JPanel(new CardLayout()){ JPanel panel = new JPanel(new CardLayout()){
@Override @Override
@ -79,7 +80,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
} }
protected SectionLegendPane createSectionLegendPane() { protected SectionLegendPane createSectionLegendPane() {
return new SectionLegendPane(this.parent); return new SectionLegendPane(this.getLegendPaneParent());
} }
private JPanel createTableLayoutPaneWithTitle(String title, Component component) { private JPanel createTableLayoutPaneWithTitle(String title, Component component) {
@ -88,9 +89,9 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
protected UIButtonGroup<LegendType> createLegendTypeButton(){ protected UIButtonGroup<LegendType> createLegendTypeButton(){
return new UIButtonGroup<LegendType>(new String[]{ return new UIButtonGroup<LegendType>(new String[]{
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Ordinary"), Toolkit.i18nText("Fine-Design_Chart_Legend_Ordinary"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"), Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Section") Toolkit.i18nText("Fine-Design_Chart_Legend_Section")
}, new LegendType[]{LegendType.ORDINARY, LegendType.GRADUAL, LegendType.SECTION}); }, new LegendType[]{LegendType.ORDINARY, LegendType.GRADUAL, LegendType.SECTION});
} }
@ -104,7 +105,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
initLegendTypeButtonListener(); initLegendTypeButtonListener();
JPanel legendTypeButtonWithTilePane = createTableLayoutPaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Form"),legendTypeButton); JPanel legendTypeButtonWithTilePane = createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Legend_Form"), legendTypeButton);
legendTypeButtonWithTilePane.setBorder(BorderFactory.createEmptyBorder(0,5,0,0)); legendTypeButtonWithTilePane.setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
rangeLegendPane = createRangeLegendPane(); rangeLegendPane = createRangeLegendPane();
@ -129,6 +130,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
checkCardPane(); checkCardPane();
checkLayoutPaneVisible();
} }
}); });
} }
@ -138,33 +140,26 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
cardLayout.show(rangeLegendPane, legendTypeButton.getSelectedItem().getStringType()); cardLayout.show(rangeLegendPane, legendTypeButton.getSelectedItem().getStringType());
} }
@Override
protected void addLegendListener(){
isLegendVisible.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkBoxUse();
}
});
}
@Override @Override
protected void checkAllUse() { protected void checkAllUse() {
checkBoxUse(); checkBoxUse();
checkLayoutPaneVisible();
checkDisplayStrategyUse(); checkDisplayStrategyUse();
checkCardPane(); checkCardPane();
this.repaint(); this.repaint();
} }
@Override protected boolean isVisibleLayoutPane() {
protected void checkBoxUse() {
isLegendVisible.setEnabled(true); return super.isVisibleLayoutPane() && legendTypeButton.getSelectedItem() != LegendType.GRADUAL;
legendPane.setVisible(isLegendVisible.isSelected());
} }
private void checkHighlightVisible(){ private void checkHighlightVisible(){
if(this.highlightPane != null){ JPanel highlightPane = this.getHighlightPane();
if (highlightPane != null) {
LegendType legendType = legendTypeButton.getSelectedItem(); LegendType legendType = legendTypeButton.getSelectedItem();
this.highlightPane.setVisible(legendType != LegendType.GRADUAL); highlightPane.setVisible(legendType != LegendType.GRADUAL);
} }
} }

27
designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java

@ -10,8 +10,8 @@ import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane;
import com.fr.design.mainframe.chart.gui.style.series.AbstractPlotSeriesPane; import com.fr.design.mainframe.chart.gui.style.series.AbstractPlotSeriesPane;
import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.VanChartAttrHelper;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
@ -23,7 +23,6 @@ import com.fr.plugin.chart.base.VanChartAttrLine;
import com.fr.plugin.chart.base.VanChartAttrMarker; import com.fr.plugin.chart.base.VanChartAttrMarker;
import com.fr.plugin.chart.base.VanChartAttrTrendLine; import com.fr.plugin.chart.base.VanChartAttrTrendLine;
import com.fr.van.chart.custom.style.VanChartCustomStylePane; import com.fr.van.chart.custom.style.VanChartCustomStylePane;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartAreaSeriesFillColorPane; import com.fr.van.chart.designer.component.VanChartAreaSeriesFillColorPane;
import com.fr.van.chart.designer.component.VanChartBeautyPane; import com.fr.van.chart.designer.component.VanChartBeautyPane;
@ -62,6 +61,8 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
private VanChartBorderPane borderPane;//边框 private VanChartBorderPane borderPane;//边框
protected VanChartFillStylePane vanChartFillStylePane;//配色
private UINumberDragPane transparent;//不透明度 private UINumberDragPane transparent;//不透明度
protected VanChartStackedAndAxisListControlPane stackAndAxisEditPane;//堆積和坐標軸 protected VanChartStackedAndAxisListControlPane stackAndAxisEditPane;//堆積和坐標軸
@ -86,18 +87,18 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
} }
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
if (fillStylePane != null) { JPanel colorPane = getColorPane();
panel.add(fillStylePane, BorderLayout.NORTH); if(colorPane != null) {
panel.add(colorPane, BorderLayout.NORTH);
} }
panel.add(getContentInPlotType(), BorderLayout.CENTER); panel.add(getContentInPlotType(), BorderLayout.CENTER);
return panel; return panel;
} }
@Override
/** /**
* 返回 填充界面. * 返回 填充界面.
*/ */
protected ChartFillStylePane getFillStylePane() { protected VanChartFillStylePane getVanChartFillStylePane() {
//如果是自定義組合圖,則不創建填充界面 //如果是自定義組合圖,則不創建填充界面
return parentPane instanceof VanChartCustomStylePane ? null : new VanChartFillStylePane(); return parentPane instanceof VanChartCustomStylePane ? null : new VanChartFillStylePane();
} }
@ -111,9 +112,13 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
protected JPanel getColorPane() { protected JPanel getColorPane() {
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
stylePane = createStylePane(); stylePane = createStylePane();
vanChartFillStylePane = getVanChartFillStylePane();
if (vanChartFillStylePane != null) {
panel.add(vanChartFillStylePane, BorderLayout.NORTH);
}
setColorPaneContent(panel); setColorPaneContent(panel);
JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel); JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel);
panel.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0));
return panel.getComponentCount() == 0 ? null : colorPane; return panel.getComponentCount() == 0 ? null : colorPane;
} }
@ -266,7 +271,9 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
checkoutMapType(plot); checkoutMapType(plot);
super.populateBean(plot);//配色 if(vanChartFillStylePane != null) { //配色
vanChartFillStylePane.populateBean(plot.getPlotFillStyle());
}
if (stylePane != null) {//风格 if (stylePane != null) {//风格
stylePane.populateBean(plot.getPlotStyle()); stylePane.populateBean(plot.getPlotStyle());
@ -323,7 +330,9 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
//更新之前先更新界面的map类型属性 //更新之前先更新界面的map类型属性
checkoutMapType(plot); checkoutMapType(plot);
super.updateBean(plot);//配色 if(vanChartFillStylePane != null) {//配色
plot.setPlotFillStyle(vanChartFillStylePane.updateBean());
}
if (stylePane != null) {//风格 if (stylePane != null) {//风格
plot.setPlotStyle(stylePane.updateBean()); plot.setPlotStyle(stylePane.updateBean());

2
designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java

@ -111,7 +111,7 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Cha
//切换图表时,数据配置不变,分类个数也不变 //切换图表时,数据配置不变,分类个数也不变
newPlot.setCategoryNum(oldPlot.getCategoryNum()); newPlot.setCategoryNum(oldPlot.getCategoryNum());
//切换类型埋点 //切换类型埋点
ChartInfoCollector.getInstance().updateChartTypeTime(chart); ChartInfoCollector.getInstance().updateChartTypeTime(chart, oldPlot.getPlotID());
} }
if(chart instanceof VanChart if(chart instanceof VanChart

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

Loading…
Cancel
Save