Browse Source

Merge pull request #2139 in DESIGN/design from final/10.0 to persist/10.0

* commit '76ece4fff3d233814590be4f99fccefb52617e8a': (192 commits)
  调整check的位置
  CHART-15175 调整结果数据的数据点提示
  还原
  布局
  REPORT-37821  frm绝对布局框选多个组件有问题
  CHART-15216 release→final
  REPORT-37588 final传一份
  REPORT-24268 增强公式编辑器插件问题 回滚代码, 现有逻辑不支持功能
  CHART-14983 根据数据类型调整箱型图数据点提示面板内容
  REPORT-37289  处理下npe
  CHART-15112 刻度单位调整
  CHART-15056 使用LinkedHashMap保证条件属性顺序
  REPORT-37289 【10.0.9冒烟】frm模板tab,在设计器内进行多次来回点击切换,发现会偶然的点击失效或卡顿
  CHART-15112 时间轴英文环境少单位
  REPORT-37460 && REPORT-37526 【frm设计界面支持缩放】模板放大后,点击报表块编辑,双击才能生效,缩小模板100%,单击就可以
  REPORT-37487 && REPORT-37484 1、回复 result 默认为 $$$ 。 2、和产品沟通,将两个面板分别默认展示 = 和不展示 = 3、恢复数据的联动
  CHART-14800 图表的模块加载慢导致了服务菜单第一次点击缺少图表菜单
  CHART-15096 注解
  CHART-15096 条件属性数据表样式问题
  CHART-15054 调整数据面板标签宽度
  ...
persist/10.0 10.0.9.2020.08.20
superman 4 years ago
parent
commit
87a042c43f
  1. 2
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 5
      designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java
  3. 8
      designer-base/src/main/java/com/fr/design/actions/UpdateAction.java
  4. 48
      designer-base/src/main/java/com/fr/design/actions/community/BugNeedAction.java
  5. 49
      designer-base/src/main/java/com/fr/design/actions/community/TechSupportAction.java
  6. 9
      designer-base/src/main/java/com/fr/design/actions/file/OpenRecentReportMenuDef.java
  7. 6
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  8. 33
      designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java
  9. 7
      designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java
  10. 23
      designer-base/src/main/java/com/fr/design/cell/AbstractCellElementPropertyPane.java
  11. 34
      designer-base/src/main/java/com/fr/design/cell/CellElementPropertyComponent.java
  12. 5
      designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java
  13. 18
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  14. 28
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataCreatorProducer.java
  15. 18
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java
  16. 2
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  17. 8
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  18. 13
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java
  19. 108
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java
  20. 2
      designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java
  21. 9
      designer-base/src/main/java/com/fr/design/event/StateChangeListener.java
  22. 9
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  23. 245
      designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java
  24. 2
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  25. 20
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  26. 2
      designer-base/src/main/java/com/fr/design/fun/CellAttributeProvider.java
  27. 18
      designer-base/src/main/java/com/fr/design/fun/CellPropertyPaneProvider.java
  28. 15
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractCellPropertyPaneProvider.java
  29. 4
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java
  30. 4
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java
  31. 552
      designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java
  32. 21
      designer-base/src/main/java/com/fr/design/gui/ipasswordfield/UIPassWordField.java
  33. 7
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java
  34. 7
      designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java
  35. 33
      designer-base/src/main/java/com/fr/design/gui/itextfield/UITextField.java
  36. 20
      designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/TristateCheckBox.java
  37. 2
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java
  38. 4
      designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java
  39. 3
      designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java
  40. 16
      designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java
  41. 31
      designer-base/src/main/java/com/fr/design/layout/VerticalFlowLayout.java
  42. 29
      designer-base/src/main/java/com/fr/design/locale/impl/BugNeedMark.java
  43. 118
      designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java
  44. 30
      designer-base/src/main/java/com/fr/design/locale/impl/TechSupportMark.java
  45. 9
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  46. 37
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  47. 393
      designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java
  48. 6
      designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java
  49. 25
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  50. 67
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  51. 3
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java
  52. 39
      designer-base/src/main/java/com/fr/design/os/impl/PopupDialogSaveAction.java
  53. 7
      designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java
  54. 12
      designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java
  55. 4
      designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java
  56. 11
      designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java
  57. 5
      designer-base/src/main/java/com/fr/design/update/actions/RecoverForDesigner.java
  58. 2
      designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateDialog.java
  59. 33
      designer-base/src/main/java/com/fr/design/update/push/DesignerUpdateInfo.java
  60. 8
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  61. 61
      designer-base/src/main/java/com/fr/design/utils/ParameterUtils.java
  62. 7
      designer-base/src/main/java/com/fr/env/CheckServiceDialog.java
  63. 38
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  64. 3
      designer-base/src/main/java/com/fr/file/FileFILE.java
  65. 3
      designer-base/src/main/java/com/fr/file/FileNodeFILE.java
  66. 22
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java
  67. BIN
      designer-base/src/main/resources/com/fr/design/images/bbs/support.png
  68. 2
      designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.css
  69. 8
      designer-base/src/test/java/com/fr/design/formula/FormulaPaneTest.java
  70. 39
      designer-base/src/test/java/com/fr/design/mainframe/JFormSliderPaneTest.java
  71. 38
      designer-base/src/test/java/com/fr/design/utils/ParameterUtilsTest.java
  72. 3
      designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java
  73. 66
      designer-chart/src/main/java/com/fr/design/chart/AutoChartIcon.java
  74. 7
      designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java
  75. 89
      designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java
  76. 30
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  77. 31
      designer-chart/src/main/java/com/fr/design/chart/auto/AutoTypeCalculate.java
  78. 121
      designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java
  79. 12
      designer-chart/src/main/java/com/fr/design/chartx/component/SeriesValueFieldComboBoxPane.java
  80. 13
      designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java
  81. 69
      designer-chart/src/main/java/com/fr/design/chartx/data/DataLayoutHelper.java
  82. 15
      designer-chart/src/main/java/com/fr/design/chartx/data/map/AbstractAreaLngLatPane.java
  83. 1
      designer-chart/src/main/java/com/fr/design/chartx/data/map/MapChartDataPane.java
  84. 15
      designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractCellDataFieldsPane.java
  85. 15
      designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractDataSetFieldsPane.java
  86. 7
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MapDataSetFieldsPane.java
  87. 2
      designer-chart/src/main/java/com/fr/design/chartx/single/CellDataPane.java
  88. 30
      designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java
  89. 22
      designer-chart/src/main/java/com/fr/design/chartx/single/SingleDataPane.java
  90. 59
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/ChartDataFilterPane.java
  91. 25
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java
  92. 29
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java
  93. 25
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/DataPaneHelper.java
  94. 36
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java
  95. 72
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java
  96. 137
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java
  97. 12
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java
  98. 18
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java
  99. 55
      designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java
  100. 142
      designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java
  101. Some files were not shown because too many files have changed in this diff Show More

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

@ -236,7 +236,7 @@ public class EnvChangeEntrance {
//说明版本一致,仅做日志记录 //说明版本一致,仅做日志记录
FineLoggerFactory.getLogger().info("Remote Designer version consistency"); FineLoggerFactory.getLogger().info("Remote Designer version consistency");
} else { } else {
localBranch = formatBranch(localBranch); localBranch = GeneralUtils.getVersion();
remoteBranch = formatBranch(remoteBranch); remoteBranch = formatBranch(remoteBranch);
Set<Class> noExistServiceSet = getNoExistServiceSet(connectionInfo); Set<Class> noExistServiceSet = getNoExistServiceSet(connectionInfo);
StringBuilder textBuilder = new StringBuilder(); StringBuilder textBuilder = new StringBuilder();

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

@ -15,6 +15,7 @@ import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.Map; import java.util.Map;
/* /*
@ -51,6 +52,10 @@ public class TableDataSourceAction extends TemplateComponentAction<JTemplate<?,
reportTableDataDialog.setDoOKSucceed(false); reportTableDataDialog.setDoOKSucceed(false);
return; return;
} }
Iterator<String> iterator = tds.getTableDataNameIterator();
while (iterator.hasNext()) {
DesignTableDataManager.removeSelectedColumnNames(iterator.next());
}
DesignModelAdapter.getCurrentModelAdapter().renameTableData(tableDataPane.getDsNameChangedMap()); DesignModelAdapter.getCurrentModelAdapter().renameTableData(tableDataPane.getDsNameChangedMap());
tableDataPane.update(tds); tableDataPane.update(tds);
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());

8
designer-base/src/main/java/com/fr/design/actions/UpdateAction.java

@ -17,6 +17,7 @@ import com.fr.design.mainframe.toolbar.UpdateActionManager;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.selection.SelectionListener; import com.fr.design.selection.SelectionListener;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.pinyin.PinyinFormat; import com.fr.stable.pinyin.PinyinFormat;
import com.fr.stable.pinyin.PinyinHelper; import com.fr.stable.pinyin.PinyinHelper;
@ -562,7 +563,12 @@ public abstract class UpdateAction extends ShortCut implements Action {
for (int i = 0; i < component.getTabCount(); i++) { for (int i = 0; i < component.getTabCount(); i++) {
String title = component.getTitleAt(i); String title = component.getTitleAt(i);
handleSearchText(separator, text, pinyin, shortPinyin, title); handleSearchText(separator, text, pinyin, shortPinyin, title);
Component tabComponent = component.getComponentAt(i); Component tabComponent = null;
try {
tabComponent = component.getComponentAt(i);
} catch (Exception ignore) {
FineLoggerFactory.getLogger().info("AlphaFine index tabPane end");
}
if (tabComponent instanceof JPanel) { if (tabComponent instanceof JPanel) {
getComponentTexts((JPanel) tabComponent, separator, text, pinyin, shortPinyin); getComponentTexts((JPanel) tabComponent, separator, text, pinyin, shortPinyin);
} else if (tabComponent instanceof JTabbedPane) { } else if (tabComponent instanceof JTabbedPane) {

48
designer-base/src/main/java/com/fr/design/actions/community/BugNeedAction.java

@ -0,0 +1,48 @@
package com.fr.design.actions.community;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.locale.impl.BugNeedMark;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import javax.swing.*;
import java.awt.event.ActionEvent;
/**
* @Author: Yuan.Wang
* @Date: 2020/7/28
*/
public class BugNeedAction extends UpdateAction {
public BugNeedAction() {
this.setMenuKeySet(BugAndNeed);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/need.png"));
}
@Override
public void actionPerformed(ActionEvent e) {
LocaleMark<String> localeMark = LocaleCenter.getMark(BugNeedMark.class);
BrowseUtils.browser(localeMark.getValue());
}
public static final MenuKeySet BugAndNeed = new MenuKeySet() {
@Override
public char getMnemonic() {
return 0;
}
@Override
public String getMenuName() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_BugAndNeed");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
}

49
designer-base/src/main/java/com/fr/design/actions/community/TechSupportAction.java

@ -0,0 +1,49 @@
package com.fr.design.actions.community;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.locale.impl.TechSupportMark;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import javax.swing.*;
import java.awt.event.ActionEvent;
/**
* @Author: Yuan.Wang
* @Date: 2020/7/28
*/
public class TechSupportAction extends UpdateAction {
public TechSupportAction() {
this.setMenuKeySet(TechSupport);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/support.png"));
}
@Override
public void actionPerformed(ActionEvent e) {
LocaleMark<String> localeMark = LocaleCenter.getMark(TechSupportMark.class);
String str=localeMark.getValue();
BrowseUtils.browser(localeMark.getValue());
}
public static final MenuKeySet TechSupport = new MenuKeySet() {
@Override
public char getMnemonic() {
return 0;
}
@Override
public String getMenuName() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_TechSupport");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
}

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

@ -1,6 +1,7 @@
package com.fr.design.actions.file; package com.fr.design.actions.file;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.File;
import java.util.List; import java.util.List;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
@ -11,6 +12,7 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.file.FILEFactory; import com.fr.file.FILEFactory;
import com.fr.file.FileFILE;
/** /**
* Open Resent MenuDef. * Open Resent MenuDef.
@ -68,7 +70,12 @@ public class OpenRecentReportMenuDef extends MenuDef {
* @param e 事件 * @param e 事件
*/ */
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
DesignerContext.getDesignerFrame().openTemplate(FILEFactory.createFILE(this.getPath())); File file = new File(this.getPath());
if (file.exists()) {
DesignerContext.getDesignerFrame().openTemplate(new FileFILE(file));
} else {
DesignerContext.getDesignerFrame().openTemplate(FILEFactory.createFILE(this.getPath()));
}
} }
public String getPath() { public String getPath() {

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

@ -256,7 +256,7 @@ public class PreferencePane extends BasicPane {
} }
private void createVcsSettingPane(JPanel generalPane) { private void createVcsSettingPane(JPanel generalPane) {
JPanel vcsPane = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Vcs_Title")); JPanel vcsPane = FRGUIPaneFactory.createTopVerticalTitledBorderPane(i18nText("Fine-Design_Vcs_Title"));
generalPane.add(vcsPane); generalPane.add(vcsPane);
remindVcsLabel = new UILabel(i18nText("Fine-Design_Vcs_Remind")); remindVcsLabel = new UILabel(i18nText("Fine-Design_Vcs_Remind"));
remindVcsLabel.setVisible(!VcsHelper.getInstance().needInit()); remindVcsLabel.setVisible(!VcsHelper.getInstance().needInit());
@ -449,10 +449,6 @@ public class PreferencePane extends BasicPane {
JPanel colorSettingPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Preference_Setting_Colors")); JPanel colorSettingPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Preference_Setting_Colors"));
generalPane.add(colorSettingPane); generalPane.add(colorSettingPane);
new UILabel(i18nText("Fine-Design_Basic_Preference_Grid_Line_Color"));
new UILabel(i18nText("Fine-Design_Basic_Preference_Pagination_Line_Color"));
gridLineColorTBButton = new UIColorButton(IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png")); gridLineColorTBButton = new UIColorButton(IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png"));
gridLineColorTBButton.setEnabled(this.isEnabled()); gridLineColorTBButton.setEnabled(this.isEnabled());

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

@ -11,8 +11,10 @@ import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.locale.InterProviderFactory;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
@ -36,14 +38,16 @@ public class AboutPane extends JPanel {
private static final String BUILD_PREFIX = " "; private static final String BUILD_PREFIX = " ";
private static final String COMPANY_TELEPHONE = CloudCenter.getInstance().acquireUrlByKind("help.compNo"); private static final String COMPANY_TELEPHONE = CloudCenter.getInstance().acquireUrlByKind("help.compNo");
private static final String PRESIDENT_PHONE = CloudCenter.getInstance().acquireUrlByKind("help.PNo"); private static final String PRESIDENT_PHONE = CloudCenter.getInstance().acquireUrlByKind("help.PNo");
private static final String LEFT_BRACKET = "(";
private static final String RIGHT_BRACKET = ")";
private int maxWidth; private int maxWidth;
public AboutPane() { public AboutPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.maxWidth = GraphHelper.getWidth(getBuildTitle() + GeneralUtils.readFullBuildNO() + this.maxWidth = GraphHelper.getWidth(getBuildTitle() + getVersionBuildNO() +
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy_Build_NO") + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy_Build_NO") +
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy_Build_NO_OK")); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy_Build_NO_OK"));
//center panel //center panel
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
@ -51,9 +55,10 @@ public class AboutPane extends JPanel {
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
centerPane.add(contentPane, BorderLayout.NORTH); centerPane.add(contentPane, BorderLayout.NORTH);
contentPane.add(new BoxCenterAligmentPane(getBuildTitle()));
BoxCenterAlignmentCopyablePane buildCopyPane = new BoxCenterAlignmentCopyablePane( BoxCenterAlignmentCopyablePane buildCopyPane = new BoxCenterAlignmentCopyablePane(
getBuildTitle(), StringUtils.EMPTY,
GeneralUtils.readFullBuildNO(), getVersionBuildNO(),
new String[]{ new String[]{
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy_Build_NO"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy_Build_NO"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy_Build_NO_OK") com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy_Build_NO_OK")
@ -95,6 +100,15 @@ public class AboutPane extends JPanel {
} }
} }
public String getVersionBuildNO() {
String version = GeneralUtils.getVersion();
String build = GeneralUtils.readFullBuildNO();
String notInstalledVersion = InterProviderFactory.getProvider().getLocText("Fine-Core_Basic_About_No_Build");
if (ComparatorUtils.equals(notInstalledVersion, build))
return notInstalledVersion;
return version + LEFT_BRACKET + build + RIGHT_BRACKET;
}
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(this.maxWidth, super.getPreferredSize().height); return new Dimension(this.maxWidth, super.getPreferredSize().height);
@ -191,7 +205,7 @@ public class AboutPane extends JPanel {
private String getBuildTitle() { private String getBuildTitle() {
return append(ProductConstants.APP_NAME, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_About_Version"), return append(ProductConstants.APP_NAME, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_About_Version"),
StringUtils.BLANK, ProductConstants.RELEASE_VERSION, BUILD_PREFIX); StringUtils.BLANK, ProductConstants.VERSION, BUILD_PREFIX);
} }
private JPanel getEmailActionPane(final String desc, final String mailTo) { private JPanel getEmailActionPane(final String desc, final String mailTo) {
@ -289,12 +303,13 @@ public class AboutPane extends JPanel {
public BoxCenterAlignmentCopyablePane(String title, String copyText, final String[] descriptions) { public BoxCenterAlignmentCopyablePane(String title, String copyText, final String[] descriptions) {
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
this.label = new UILabel(title); if (StringUtils.isNotEmpty(title)) {
this.label = new UILabel(title);
centerPane.add(label);
}
this.textField = new UILabel(copyText); this.textField = new UILabel(copyText);
textField.setBackground(null); textField.setBackground(null);
textField.setBorder(null); textField.setBorder(null);
centerPane.add(label);
centerPane.add(textField); centerPane.add(textField);
textField.addMouseListener(new MouseAdapter() { textField.addMouseListener(new MouseAdapter() {
@Override @Override

7
designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java

@ -5,7 +5,6 @@ package com.fr.design.actions.server;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.config.Configuration;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
@ -18,12 +17,10 @@ import com.fr.design.gui.NameInspector;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.file.ProcedureConfig;
import com.fr.file.TableDataConfig; import com.fr.file.TableDataConfig;
import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
import com.fr.transaction.WorkerFacade; import com.fr.transaction.WorkerFacade;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
@ -95,6 +92,10 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
} }
DesignTableDataManager.clearGlobalDs(); DesignTableDataManager.clearGlobalDs();
// 保存时 移除服务器数据集列名缓存
for (String name : tableDataConfig.getTableDatas().keySet()) {
DesignTableDataManager.removeSelectedColumnNames(name);
}
Configurations.modify(new WorkerFacade(TableDataConfig.class) { Configurations.modify(new WorkerFacade(TableDataConfig.class) {
@Override @Override

23
designer-base/src/main/java/com/fr/design/cell/AbstractCellElementPropertyPane.java

@ -0,0 +1,23 @@
package com.fr.design.cell;
import com.fr.design.designer.TargetComponent;
import com.fr.design.dialog.BasicPane;
import javax.swing.JPanel;
/**
* @author zack
* @version 10.0
* Created by zack on 2020/7/14
*/
public abstract class AbstractCellElementPropertyPane extends BasicPane implements CellElementPropertyComponent {
@Override
public JPanel toPanel() {
return this;
}
@Override
public boolean accept(TargetComponent tc) {
return true;
}
}

34
designer-base/src/main/java/com/fr/design/cell/CellElementPropertyComponent.java

@ -0,0 +1,34 @@
package com.fr.design.cell;
import com.fr.design.designer.TargetComponent;
import javax.swing.JPanel;
/**
* 单元格属性配置面板接口
* @author zack
* @version 10.0
* Created by zack on 2020/7/14
*/
public interface CellElementPropertyComponent {
/**
* 判断当前编辑的对象是否显示当前实现
* @param tc
* @return
*/
boolean accept(TargetComponent tc);
/**
* 加载数据
* @param tc
*/
void populate(TargetComponent tc);
/**
* 返回当前属性面板,默认返回this
* @return
*/
JPanel toPanel();
}

5
designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java

@ -15,8 +15,9 @@ import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import java.awt.Dimension; import java.awt.Dimension;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map;
import java.util.LinkedHashMap;
@Open @Open
public abstract class ConditionAttributesPane<T> extends BasicBeanPane<T> { public abstract class ConditionAttributesPane<T> extends BasicBeanPane<T> {
@ -27,7 +28,7 @@ public abstract class ConditionAttributesPane<T> extends BasicBeanPane<T> {
protected LiteConditionPane liteConditionPane; protected LiteConditionPane liteConditionPane;
protected java.util.Map<Class, ConditionAttrSingleConditionPane> classPaneMap = new HashMap<Class, ConditionAttrSingleConditionPane>(); protected Map<Class, ConditionAttrSingleConditionPane> classPaneMap = new LinkedHashMap<>();
//可用的Actions. //可用的Actions.
protected java.util.List<UpdateAction> useAbleActionList = new java.util.ArrayList<UpdateAction>(); protected java.util.List<UpdateAction> useAbleActionList = new java.util.ArrayList<UpdateAction>();

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

@ -439,9 +439,14 @@ public abstract class DesignTableDataManager {
* @throws Exception 异常 * @throws Exception 异常
*/ */
public static EmbeddedTableData previewTableDataNeedInputParameters(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception { public static EmbeddedTableData previewTableDataNeedInputParameters(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception {
return previewTableData(tableDataSource, tabledata, rowCount, true, needLoadingBar); return previewTableDataNeedInputParameters(tableDataSource, tabledata, rowCount, needLoadingBar, null);
} }
public static EmbeddedTableData previewTableDataNeedInputParameters(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean needLoadingBar, AutoProgressBar progressBar) throws Exception {
return previewTableData(tableDataSource, tabledata, rowCount, true, needLoadingBar, progressBar);
}
/** /**
* 预览不需要参数的数据集 * 预览不需要参数的数据集
* *
@ -478,7 +483,16 @@ public abstract class DesignTableDataManager {
* @return * @return
*/ */
private static EmbeddedTableData previewTableData(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean isMustInputParameters, boolean needLoadingBar) throws Exception { private static EmbeddedTableData previewTableData(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean isMustInputParameters, boolean needLoadingBar) throws Exception {
final AutoProgressBar loadingBar = PreviewTablePane.getInstance().getProgressBar(); return previewTableData(tableDataSource, tabledata, rowCount, isMustInputParameters, needLoadingBar, null);
}
private static EmbeddedTableData previewTableData(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean isMustInputParameters, boolean needLoadingBar, AutoProgressBar progressBar) throws Exception {
final AutoProgressBar loadingBar;
if (progressBar == null) {
loadingBar = PreviewTablePane.getInstance().getProgressBar();
} else {
loadingBar = progressBar;
}
ParameterProvider[] parameters = DataOperator.getInstance().getTableDataParameters(tabledata); ParameterProvider[] parameters = DataOperator.getInstance().getTableDataParameters(tabledata);
if (ArrayUtils.isEmpty(parameters)) { if (ArrayUtils.isEmpty(parameters)) {
parameters = tabledata.getParameters(Calculator.createCalculator()); parameters = tabledata.getParameters(Calculator.createCalculator());

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

@ -71,28 +71,42 @@ public class TableDataCreatorProducer {
} }
public TableDataNameObjectCreator[] createServerTableDataCreator() { public TableDataNameObjectCreator[] createServerTableDataCreator() {
TableDataNameObjectCreator dataBase = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Database_Query"), "/com/fr/design/images/data/dock/serverdatabase.png", DBTableData.class, TableDataNameObjectCreator dataBase = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Database_Query"),
"ds",
"/com/fr/design/images/data/dock/serverdatabase.png", DBTableData.class,
DBTableDataPane.class); DBTableDataPane.class);
TableDataNameObjectCreator ds_Class = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Class"), "/com/fr/design/images/data/dock/serverclasstabledata.png", ClassTableData.class, TableDataNameObjectCreator ds_Class = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Class"),
"Class",
"/com/fr/design/images/data/dock/serverclasstabledata.png", ClassTableData.class,
ClassTableDataPane.class); ClassTableDataPane.class);
TableDataNameObjectCreator table = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Embedded"), "/com/fr/design/images/data/dock/serverdatatable.png", EmbeddedTableData.class, TableDataNameObjectCreator table = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Embedded"),
"Embedded",
"/com/fr/design/images/data/dock/serverdatatable.png", EmbeddedTableData.class,
EmbeddedTableDataPane.class); EmbeddedTableDataPane.class);
TableDataNameObjectCreator fileTable = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_File"), "/com/fr/design/images/data/file.png", FileTableData.class, TableDataNameObjectCreator fileTable = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_File"),
"File",
"/com/fr/design/images/data/file.png", FileTableData.class,
FileTableDataSmallPane.class); FileTableDataSmallPane.class);
TableDataNameObjectCreator treeTable = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Tree"), "/com/fr/design/images/data/tree.png", TableDataNameObjectCreator treeTable = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Tree"),
"Tree",
"/com/fr/design/images/data/tree.png",
RecursionTableData.class, GlobalTreeTableDataPane.class) { RecursionTableData.class, GlobalTreeTableDataPane.class) {
public boolean isNeedParameterWhenPopulateJControlPane() { public boolean isNeedParameterWhenPopulateJControlPane() {
return true; return true;
} }
}; };
TableDataNameObjectCreator multiTable = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Relation"), "/com/fr/design/images/data/multi.png", TableDataNameObjectCreator multiTable = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Relation"),
"Multi",
"/com/fr/design/images/data/multi.png",
ConditionTableData.class, GlobalMultiTDTableDataPane.class) { ConditionTableData.class, GlobalMultiTDTableDataPane.class) {
public boolean isNeedParameterWhenPopulateJControlPane() { public boolean isNeedParameterWhenPopulateJControlPane() {
return true; return true;
} }
}; };
TableDataNameObjectCreator storeProcedure = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Stored_Procedure"), "/com/fr/design/images/data/store_procedure.png", TableDataNameObjectCreator storeProcedure = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Stored_Procedure"),
"Proc",
"/com/fr/design/images/data/store_procedure.png",
StoreProcedure.class, ProcedureDataPane.class) { StoreProcedure.class, ProcedureDataPane.class) {
@Override @Override
public boolean shouldInsertSeparator() { public boolean shouldInsertSeparator() {

18
designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java

@ -17,6 +17,10 @@ import javax.swing.table.AbstractTableModel;
* 这个TableModel主要是预览数据的. 字段TableData必须转化为内置的 * 这个TableModel主要是预览数据的. 字段TableData必须转化为内置的
*/ */
public class PreviewTableModel extends AbstractTableModel { public class PreviewTableModel extends AbstractTableModel {
private static final int LEN_LIMIT = 1000;
private static final String THREE_DOT = "...";
private DataModel dataModel; private DataModel dataModel;
private String erroMessage = null; private String erroMessage = null;
@ -127,11 +131,21 @@ public class PreviewTableModel extends AbstractTableModel {
public Object getValueAt(int row, int column) { public Object getValueAt(int row, int column) {
try { try {
return dataModel.getValueAt(row, column); Object value = dataModel.getValueAt(row, column);
if (value != null) {
String strValue = value.toString();
// 字符长度过长 swing会卡住一会
// 同时设计器内预览展示也不需要展示太长的字符
if (strValue.length() > LEN_LIMIT) {
strValue = strValue.substring(0, LEN_LIMIT) + THREE_DOT;
return strValue;
}
}
return value;
} catch (TableDataException e) { } catch (TableDataException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
DesignUtils.errorMessage(e.getMessage()); DesignUtils.errorMessage(e.getMessage());
return ""; return StringUtils.EMPTY;
} }
} }

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

@ -372,7 +372,7 @@ public class PreviewTablePane extends BasicPane {
connectionBar.close(); connectionBar.close();
} }
TableDataSource dataSource = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getTarget(); TableDataSource dataSource = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getTarget();
previewTableData = DesignTableDataManager.previewTableDataNeedInputParameters(dataSource, tableData, (int) maxPreviewNumberField.getValue(), true); previewTableData = DesignTableDataManager.previewTableDataNeedInputParameters(dataSource, tableData, (int) maxPreviewNumberField.getValue(), true, progressBar);
// parameterInputDialog // parameterInputDialog
// update之后的parameters,转成一个parameterMap,用于预览TableData // update之后的parameters,转成一个parameterMap,用于预览TableData
PreviewTableModel previewModel = new PreviewTableModel(previewTableData.createDataModel(null), (int) maxPreviewNumberField.getValue()); PreviewTableModel previewModel = new PreviewTableModel(previewTableData.createDataModel(null), (int) maxPreviewNumberField.getValue());

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

@ -29,10 +29,10 @@ import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
import com.fr.design.gui.syntax.ui.rtextarea.RTextScrollPane; import com.fr.design.gui.syntax.ui.rtextarea.RTextScrollPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.ParameterUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.sql.SqlUtils; import com.fr.general.sql.SqlUtils;
@ -219,8 +219,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
paramTexts[1] = SqlUtils.tryPureSqlText(pageQuery); paramTexts[1] = SqlUtils.tryPureSqlText(pageQuery);
List<ParameterProvider> existParameterList = editorPane.update(); List<ParameterProvider> existParameterList = editorPane.update();
Parameter[] ps = existParameterList == null ? new Parameter[0] : existParameterList.toArray(new Parameter[existParameterList.size()]); Parameter[] ps = existParameterList == null ? new Parameter[0] : existParameterList.toArray(new Parameter[existParameterList.size()]);
editorPane.populate(ParameterUtils.analyzeAndUnionParameters(paramTexts, ps));
editorPane.populate(ParameterHelper.analyzeAndUnionSameParameters(paramTexts, ps));
} }
private JToolBar createToolBar() { private JToolBar createToolBar() {
@ -316,7 +315,8 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
// com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + "."); // com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + ".");
} }
} }
// 保存前 刷新下参数列表 保证获取到最新的参数
refresh();
List<ParameterProvider> parameterList = editorPane.update(); List<ParameterProvider> parameterList = editorPane.update();
Parameter[] parameters = parameterList.toArray(new Parameter[parameterList.size()]); Parameter[] parameters = parameterList.toArray(new Parameter[parameterList.size()]);

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

@ -1,5 +1,6 @@
package com.fr.design.data.tabledata.tabledatapane; package com.fr.design.data.tabledata.tabledatapane;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -11,6 +12,8 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.StringUtils;
public class MaxMemRowCountPanel extends UIToolbar { public class MaxMemRowCountPanel extends UIToolbar {
@ -19,7 +22,7 @@ public class MaxMemRowCountPanel extends UIToolbar {
private static final String[] CACHE_LIST = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Save_All_Records_In_Memory"), private static final String[] CACHE_LIST = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Save_All_Records_In_Memory"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Max_Mem_Row_Count") }; com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Max_Mem_Row_Count") };
private static final int MAX_WIDTH = getMaxComBoBoxWidth() > 200 ? 350 : 250; private static final int MAX_WIDTH = getMaxComBoBoxWidth() > 200 ? 350 : 250;
private static final int MAX_COMPONENT_COUNT_OF_MAX_MEMORY = 4;
private static int getMaxComBoBoxWidth() { private static int getMaxComBoBoxWidth() {
int maxWidth = GraphHelper.getWidth(CACHE_LIST[0]); int maxWidth = GraphHelper.getWidth(CACHE_LIST[0]);
for (int i = 1; i < CACHE_LIST.length; i++) { for (int i = 1; i < CACHE_LIST.length; i++) {
@ -86,9 +89,13 @@ public class MaxMemRowCountPanel extends UIToolbar {
this.removeAll(); this.removeAll();
this.add(switchCache); this.add(switchCache);
switchCache.setSelectedIndex(MAX_IN_MEMORY); switchCache.setSelectedIndex(MAX_IN_MEMORY);
this.add(new UILabel(" ")); if (this.getComponentCount() == MAX_COMPONENT_COUNT_OF_MAX_MEMORY) {
//此处因为switchCache的setSelectedIndex可能会造成双层调用,然后因为重复添加组件产生bug,故而定义这个工具栏的正常最大组件数,做个判断
return;
}
this.add(new UILabel(StringUtils.BLANK));
this.add(numberSpinner); this.add(numberSpinner);
this.add(new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Row"))); this.add(new UILabel(StringUtils.BLANK + Toolkit.i18nText("Fine-Design_Basic_Row")));
this.validate(); this.validate();
this.repaint(); this.repaint();
} }

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

@ -19,6 +19,7 @@ import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -95,9 +96,8 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
centerPanel.setLayout(new GridLayout(len < MIN_BAR_NUMBER ? MIN_BAR_NUMBER : len + 1, 1)); centerPanel.setLayout(new GridLayout(len < MIN_BAR_NUMBER ? MIN_BAR_NUMBER : len + 1, 1));
centerPanel.add(headLabel); centerPanel.add(headLabel);
Iterator<Entry<String, TableDataWrapper>> entryIt = resMap.entrySet().iterator(); for (Entry<String, TableDataWrapper> stringTableDataWrapperEntry : resMap.entrySet()) {
while (entryIt.hasNext()) { TableDataWrapper tableDataWrappe = stringTableDataWrapperEntry.getValue();
TableDataWrapper tableDataWrappe = entryIt.next().getValue();
String tmp = tableDataWrappe.getTableDataName(); String tmp = tableDataWrappe.getTableDataName();
if (!ComparatorUtils.equals(tableDataWrappe.getTableDataName(), multiName)) { if (!ComparatorUtils.equals(tableDataWrappe.getTableDataName(), multiName)) {
centerPanel.add(new BarPanel(tmp, tableDataWrappe.getIcon())); centerPanel.add(new BarPanel(tmp, tableDataWrappe.getIcon()));
@ -111,13 +111,10 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
} }
private ActionListener getPreviewActionListener() { private ActionListener getPreviewActionListener() {
return new ActionListener() { return e -> {
MultiTDTableData td = MultiTDTableDataPane.this.updateBean();
public void actionPerformed(ActionEvent e) { td.setTableDataSource(DesignTableDataManager.getEditingTableDataSource());
MultiTDTableData td = MultiTDTableDataPane.this.updateBean(); new TemplateTableDataWrapper(td).previewData();
td.setTableDataSource(DesignTableDataManager.getEditingTableDataSource());
new TemplateTableDataWrapper(td).previewData();
}
}; };
} }
@ -126,12 +123,12 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
jpanel.setPreferredSize(new Dimension(-1, 150)); jpanel.setPreferredSize(new Dimension(-1, 150));
jpanel.setLayout(new BorderLayout()); jpanel.setLayout(new BorderLayout());
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel() { editorPane = new UITableEditorPane<>(new ParameterTableModel() {
@Override @Override
public UITableEditAction[] createAction() { public UITableEditAction[] createAction() {
return new UITableEditAction[]{new RefreshAction()}; return new UITableEditAction[]{new RefreshAction()};
} }
}, " " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Default_Parameter")); }, StringUtils.BLANK + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Default_Parameter"));
jpanel.add(editorPane, BorderLayout.CENTER); jpanel.add(editorPane, BorderLayout.CENTER);
@ -162,29 +159,32 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
paramTexts[i] = (String) object[i]; paramTexts[i] = (String) object[i];
} }
List<ParameterProvider> existParameterList = new ArrayList<ParameterProvider>(); List<ParameterProvider> existParameterList = new ArrayList<>();
Iterator<Entry<String, String>> dataItera = choosenTableData.entrySet().iterator(); List<String> parameterName = new ArrayList<>();
List<String> parameterName = new ArrayList<String>(); for (Entry<String, String> entry : choosenTableData.entrySet()) {
while (dataItera.hasNext()) { TableData td = resMap.get(entry.getKey()).getTableData();
Entry<String, String> entry = dataItera.next(); ParameterProvider[] currentParameters = td.getParameters(Calculator.createCalculator());
TableData td = resMap.get(entry.getKey()).getTableData(); for (ParameterProvider currentParameter : currentParameters) {
ParameterProvider[] currentparameters = td.getParameters(Calculator.createCalculator()); if (parameterName.contains(currentParameter.getName())) {
for (int i=0; i<currentparameters.length; i++){ continue;
if (parameterName.contains(currentparameters[i].getName())){ }
continue; parameterName.add(currentParameter.getName());
} try {
parameterName.add(currentparameters[i].getName()); //采用给新的界面刷新参数时,clone一个值过去,不然会出现联动修改
existParameterList.add(currentparameters[i]); existParameterList.add((ParameterProvider) currentParameter.clone());
} } catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
} }
ParameterProvider[] texts = ParameterHelper.analyze4Parameters(paramTexts, true); ParameterProvider[] texts = ParameterHelper.analyze4Parameters(paramTexts, true);
for (int i=0; i<texts.length; i++) { for (ParameterProvider text : texts) {
if (parameterName.contains(texts[i].getName())){ if (parameterName.contains(text.getName())) {
continue; continue;
} }
existParameterList.add(texts[i]); existParameterList.add(text);
} }
Parameter[] ps = existParameterList.toArray(new Parameter[existParameterList.size()]); ParameterProvider[] ps = existParameterList.toArray(new ParameterProvider[0]);
editorPane.populate(ps); editorPane.populate(ps);
existParameterList.clear(); existParameterList.clear();
parameterName.clear(); parameterName.clear();
@ -217,7 +217,7 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
String name; String name;
for (int i = 0; i < ob.getTableDataCount(); i++) { for (int i = 0; i < ob.getTableDataCount(); i++) {
name = ob.getTableDataName(i); name = ob.getTableDataName(i);
choosenTableData.put(name, ""); choosenTableData.put(name, StringUtils.EMPTY);
} }
} }
} }
@ -236,15 +236,13 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
@Override @Override
public MultiTDTableData updateBean() { public MultiTDTableData updateBean() {
ConditionTableData td = new ConditionTableData(); ConditionTableData td = new ConditionTableData();
Iterator<Entry<String, String>> it = choosenTableData.entrySet().iterator(); for (Entry<String, String> entry : choosenTableData.entrySet()) {
while (it.hasNext()) {
Entry<String, String> entry = it.next();
td.addTableData(entry.getKey(), entry.getValue()); td.addTableData(entry.getKey(), entry.getValue());
} }
List<ParameterProvider> paramList = editorPane.update(); List<ParameterProvider> paramList = editorPane.update();
if (paramList != null) { if (paramList != null) {
td.setDefineParameters(paramList.toArray(new Parameter[paramList.size()])); td.setDefineParameters(paramList.toArray(new Parameter[0]));
} }
return td; return td;
@ -348,9 +346,7 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
chekbox.setSelected(false); chekbox.setSelected(false);
formulaContentTextField.setEnabled(false); formulaContentTextField.setEnabled(false);
formulaButton.setEnabled(false); formulaButton.setEnabled(false);
if (choosenTableData.containsKey(name)) { choosenTableData.remove(name);
choosenTableData.remove(name);
}
} else { } else {
formulaButton.setEnabled(true); formulaButton.setEnabled(true);
formulaContentTextField.setEnabled(true); formulaContentTextField.setEnabled(true);
@ -372,9 +368,7 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
} else { } else {
formulaButton.setEnabled(false); formulaButton.setEnabled(false);
formulaContentTextField.setEnabled(false); formulaContentTextField.setEnabled(false);
if (choosenTableData.containsKey(name)) { choosenTableData.remove(name);
choosenTableData.remove(name);
}
} }
} }
@ -388,22 +382,20 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
} }
private ActionListener getFormulaActionListener() { private ActionListener getFormulaActionListener() {
return new ActionListener() { return e -> {
public void actionPerformed(ActionEvent e) { final UIFormula formulaPane = FormulaFactory.createFormulaPane();
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); formulaPane.populate(BaseFormula.createFormulaBuilder().build(formulaContentTextField.getText()));
formulaPane.populate(BaseFormula.createFormulaBuilder().build(formulaContentTextField.getText())); formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(MultiTDTableDataPane.this), new DialogActionAdapter() {
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(MultiTDTableDataPane.this), new DialogActionAdapter() { public void doOk() {
public void doOk() { BaseFormula formula = formulaPane.update();
BaseFormula formula = formulaPane.update(); if (formula == null) {
if (formula == null) { formulaContentTextField.setText(StringUtils.EMPTY);
formulaContentTextField.setText(""); } else {
} else { formulaContentTextField.setText(formula.getContent().substring(1));
formulaContentTextField.setText(formula.getContent().substring(1));
}
MultiTDTableDataPane.this.refresh();
} }
}).setVisible(true); MultiTDTableDataPane.this.refresh();
} }
}).setVisible(true);
}; };
} }
} }

2
designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java vendored

@ -1,6 +1,6 @@
package com.fr.design.env; package com.fr.design.env;
import com.fr.cluster.engine.remote.ClusterOperator; import com.fr.cluster.engine.rpc.remote.ClusterOperator;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.base.operator.common.CommonOperator; import com.fr.base.operator.common.CommonOperator;
import com.fr.rpc.ExceptionHandler; import com.fr.rpc.ExceptionHandler;

9
designer-base/src/main/java/com/fr/design/event/StateChangeListener.java

@ -0,0 +1,9 @@
package com.fr.design.event;
/**
* @Author: Yuan.Wang
* @Date: 2020/7/29
*/
public interface StateChangeListener {
public void stateChange();
}

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

@ -370,6 +370,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
*/ */
public void load() { public void load() {
FineLoggerFactory.getLogger().info("Env Change Template Loading..."); FineLoggerFactory.getLogger().info("Env Change Template Loading...");
JTemplate currentTemplate = null;
if (stashFILEMap != null && stashFILEMap.size() != 0) { if (stashFILEMap != null && stashFILEMap.size() != 0) {
int size = historyList.size(); int size = historyList.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
@ -385,20 +386,24 @@ public class HistoryTemplateListCache implements CallbackEvent {
historyList.set(i, template); historyList.set(i, template);
// 替换当前正在编辑的模板,使用添加并激活的方式,以便使用统一的入口来处理监听事件 // 替换当前正在编辑的模板,使用添加并激活的方式,以便使用统一的入口来处理监听事件
if (isCurrentEditingFile(template.getPath())) { if (isCurrentEditingFile(template.getPath())) {
loadCurrentTemplate(template); currentTemplate = template;
} }
} else { } else {
// 当模板为空时 说明是一个新建的未保存模板 但是内存中保存了该模板 可以从中获取 // 当模板为空时 说明是一个新建的未保存模板 但是内存中保存了该模板 可以从中获取
JTemplate jt = historyList.get(i); JTemplate jt = historyList.get(i);
// 另外如果该模板是正在编辑的模板,需要要激活 // 另外如果该模板是正在编辑的模板,需要要激活
if (jt != null && isCurrentEditingFile(jt.getPath())) { if (jt != null && isCurrentEditingFile(jt.getPath())) {
loadCurrentTemplate(jt); currentTemplate = jt;
} }
} }
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
// 最后加载当前正在编辑的模板 以保证数据集刷新正常
if (currentTemplate != null) {
loadCurrentTemplate(currentTemplate);
}
stashFILEMap.clear(); stashFILEMap.clear();
MutilTempalteTabPane.getInstance().refreshOpenedTemplate(historyList); MutilTempalteTabPane.getInstance().refreshOpenedTemplate(historyList);
MutilTempalteTabPane.getInstance().repaint(); MutilTempalteTabPane.getInstance().repaint();

245
designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java

File diff suppressed because one or more lines are too long

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

@ -226,6 +226,8 @@ public class TemplateTreePane extends JPanel implements FileOperations {
*/ */
@Override @Override
public void refresh() { public void refresh() {
// 刷新远程文件夹权限
NodeAuthProcessor.getInstance().refresh();
reportletsTree.refresh(); reportletsTree.refresh();
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_File_Tree_Refresh_Successfully") + "!"); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_File_Tree_Refresh_Successfully") + "!");
} }

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

@ -1008,15 +1008,23 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
this.searchKey = searchKey.toLowerCase(); this.searchKey = searchKey.toLowerCase();
} }
/**
* 把以关键词开头的和不以关键词开头的分别按照字母表顺序排序
* @param o1 待比较对象1
* @param o2 待比较对象2
* @return 比较结果1表示 o1 > o2, -1表示 o1 < o2, 0表示 o1 = o2
*/
@Override @Override
public int compare(String o1, String o2) { public int compare(String o1, String o2) {
if (o1.toLowerCase().startsWith(searchKey)) { int result;
return -1; boolean o1StartWith = o1.toLowerCase().startsWith(searchKey);
} boolean o2StartWith = o2.toLowerCase().startsWith(searchKey);
if (o2.toLowerCase().startsWith(searchKey)) { if (o1StartWith) {
return 1; result = o2StartWith ? o1.compareTo(o2) : -1;
} else {
result = o2StartWith ? 1 : o1.compareTo(o2);
} }
return o2.compareTo(o1); return result;
} }
} }

2
designer-base/src/main/java/com/fr/design/fun/CellAttributeProvider.java

@ -4,8 +4,10 @@ import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.stable.fun.mark.Immutable; import com.fr.stable.fun.mark.Immutable;
/** /**
* 单元格属性面板扩展接口,接口基本逻辑不通且不符合接口设计规范,单元格属性扩展可以使用CellPropertyPaneProvider
* Created by zhouping on 2015/11/11. * Created by zhouping on 2015/11/11.
*/ */
@Deprecated
public interface CellAttributeProvider extends Immutable{ public interface CellAttributeProvider extends Immutable{
String MARK_STRING = "CellAttributeProvider"; String MARK_STRING = "CellAttributeProvider";

18
designer-base/src/main/java/com/fr/design/fun/CellPropertyPaneProvider.java

@ -0,0 +1,18 @@
package com.fr.design.fun;
import com.fr.design.cell.CellElementPropertyComponent;
/**
* 单元格设置(属性)扩展接口
* @author zack
* @version 10.0
* Created by zack on 2020/7/14
*/
public interface CellPropertyPaneProvider extends PropertyItemPaneProvider {
/**
* 构造单元格属性面板,面板实现需要使用单例模式实现
* @return 面板类
*/
CellElementPropertyComponent getSingletonCelPropertyPane();
}

15
designer-base/src/main/java/com/fr/design/fun/impl/AbstractCellPropertyPaneProvider.java

@ -0,0 +1,15 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.CellPropertyPaneProvider;
import com.fr.stable.fun.mark.API;
/**
* Created by zhouping on 2015/11/11.
*/
@API(level = CellPropertyPaneProvider.CURRENT_LEVEL)
public abstract class AbstractCellPropertyPaneProvider extends AbstractPropertyItemPaneProvider implements CellPropertyPaneProvider {
public int currentAPILevel() {
return CellPropertyPaneProvider.CURRENT_LEVEL;
}
}

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

@ -9,12 +9,14 @@ import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.os.impl.PopupDialogSaveAction;
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.invoke.Reflect; import com.fr.invoke.Reflect;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSSupportCenter;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JComponent; import javax.swing.JComponent;
@ -273,6 +275,8 @@ abstract class UIControlPane extends JControlPane {
} }
saveSettings(); saveSettings();
setVisible(false); setVisible(false);
PopupDialogSaveAction saveAction = OSSupportCenter.getAction(PopupDialogSaveAction.class);
saveAction.unregister();
} }
private void initListener() { private void initListener() {

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

@ -7,9 +7,11 @@ import com.fr.design.gui.ilist.JNameEdList;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.gui.ilist.UINameEdList; import com.fr.design.gui.ilist.UINameEdList;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.PopupDialogSaveAction;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.stable.os.support.OSSupportCenter;
import javax.swing.DefaultListModel; import javax.swing.DefaultListModel;
import javax.swing.JList; import javax.swing.JList;
@ -216,6 +218,8 @@ public abstract class UIListControlPane extends UIControlPane implements ListCon
((PopupEditDialog)popupEditDialog).setTitle(getSelectedName()); ((PopupEditDialog)popupEditDialog).setTitle(getSelectedName());
} }
popupEditDialog.setVisible(true); popupEditDialog.setVisible(true);
PopupDialogSaveAction osBasedAction = OSSupportCenter.getAction(PopupDialogSaveAction.class);
osBasedAction.register(this, popupEditDialog);
} }
} }

552
designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java

@ -9,14 +9,17 @@ import com.fr.stable.Constants;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.border.Border;
import java.awt.AWTEvent; import java.awt.AWTEvent;
import java.awt.BasicStroke; import java.awt.BasicStroke;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component;
import java.awt.Dialog; import java.awt.Dialog;
import java.awt.Frame; import java.awt.Frame;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Point; import java.awt.Point;
import java.awt.Polygon; import java.awt.Polygon;
import java.awt.Rectangle; import java.awt.Rectangle;
@ -29,303 +32,312 @@ import java.awt.event.MouseEvent;
/** /**
* @author Jerry * @author Jerry
* 非模态悬浮对话框气泡形状 * 非模态悬浮对话框气泡形状
*/ */
public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> { public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> {
private static final long serialVersionUID = -6386018511442190959L; private static final long serialVersionUID = -6386018511442190959L;
private static int OFF_LEFT = 10; private static int OFF_LEFT = 10;
private static final int ARROR_PARALLEL = 30; private static final int ARROR_PARALLEL = 30;
private static final int ARROR_VERTICAL = 20; private static final int ARROR_VERTICAL = 20;
private static final int TITLE_HEIGHT = 60; private static final int TITLE_HEIGHT = 60;
private static final double TIME_DEFAULT = 0.5; private static final double TIME_DEFAULT = 0.5;
private static final double TIME_GAP = 0.1; private static final double TIME_GAP = 0.1;
private BasicBeanPane<T> contentPane; private BasicBeanPane<T> contentPane;
private Rectangle bounds; private Rectangle bounds;
private int arrowPosition; private int arrowPosition;
private double time = 0.5; private double time = 0.5;
private UIDialog showDialog; private UIDialog showDialog;
/** /**
* @param arrowPosition 箭头的位置上下左右暂时只处理了左边后面用到了再说 TODO * @param arrowPosition 箭头的位置上下左右暂时只处理了左边后面用到了再说 TODO
* @param arrowPoint 箭头的坐标点 * @param arrowPoint 箭头的坐标点
* @param contentPane 对话框中的Panel * @param contentPane 对话框中的Panel
*/ */
public UIBubbleFloatPane(int arrowPosition, Point arrowPoint, BasicBeanPane<T> contentPane) { public UIBubbleFloatPane(int arrowPosition, Point arrowPoint, BasicBeanPane<T> contentPane) {
this(arrowPosition, arrowPoint, contentPane, contentPane.getPreferredSize().width, contentPane.getPreferredSize().height); this(arrowPosition, arrowPoint, contentPane, contentPane.getPreferredSize().width, contentPane.getPreferredSize().height);
} }
/** /**
* 这个方法主要用于那些宽度和高度有变化的面板因为显然外面的气泡要固定大小不然忽大忽小体验太差了 * 这个方法主要用于那些宽度和高度有变化的面板因为显然外面的气泡要固定大小不然忽大忽小体验太差了
* *
* @param arrowPosition 箭头的位置上下左右暂时只处理了左边后面用到了再说 TODO * @param arrowPosition 箭头的位置上下左右暂时只处理了左边后面用到了再说 TODO
* @param arrowPoint 箭头的坐标点 * @param arrowPoint 箭头的坐标点
* @param contentPane 对话框中的Panel * @param contentPane 对话框中的Panel
* @param width 对话框中的Panel的宽度写死了 * @param width 对话框中的Panel的宽度写死了
* @param height 对话框中的Panel的高度写死了 * @param height 对话框中的Panel的高度写死了
*/ */
public UIBubbleFloatPane(int arrowPosition, Point arrowPoint, BasicBeanPane<T> contentPane, int width, int height) { public UIBubbleFloatPane(int arrowPosition, Point arrowPoint, BasicBeanPane<T> contentPane, int width, int height) {
this.contentPane = contentPane; this.contentPane = contentPane;
this.arrowPosition = arrowPosition; this.arrowPosition = arrowPosition;
this.time = initBoundsTime(arrowPosition, arrowPoint, width, height); this.time = initBoundsTime(arrowPosition, arrowPoint, width, height);
if (arrowPosition == Constants.LEFT) { if (arrowPosition == Constants.LEFT) {
this.bounds = new Rectangle(arrowPoint.x - width, (int) (arrowPoint.y - height * time), width, height); this.bounds = new Rectangle(arrowPoint.x - width, (int) (arrowPoint.y - height * time), width, height);
} else if (arrowPosition == Constants.TOP) { } else if (arrowPosition == Constants.TOP) {
this.bounds = new Rectangle((int) (arrowPoint.x - width * time), arrowPoint.y , width, height); this.bounds = new Rectangle((int) (arrowPoint.x - width * time), arrowPoint.y, width, height);
} else if (arrowPosition == Constants.RIGHT) { } else if (arrowPosition == Constants.RIGHT) {
this.bounds = new Rectangle(arrowPoint.x - OFF_LEFT * 2 - width, (int) (arrowPoint.y - height * time), width, height); this.bounds = new Rectangle(arrowPoint.x - OFF_LEFT * 2 - width, (int) (arrowPoint.y - height * time), width, height);
} }
initComponents(); initComponents();
} }
/** /**
* show对话框 * show对话框
*
* @param fatherPane 上一层界面 parentPane * @param fatherPane 上一层界面 parentPane
* @param ob 传入的内容在show之前populate * @param ob 传入的内容在show之前populate
*/
public void show(JComponent fatherPane, T ob) {
populateBean(ob);
if (showDialog == null) {
showDialog = showUnsizedWindow(SwingUtilities.getWindowAncestor(fatherPane));
}
Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK);
showDialog.setVisible(true);
}
/**
* 数据展现
*/
public void populateBean(T ob) {
contentPane.populateBean(ob);
}
/**
* 停止编辑, 更新至最新的面板到属性保存
*/
public T updateBean() {
updateContentPane();
return contentPane.updateBean();
}
/**
* 需要实现更新内容将updateBean传值给对象即可在窗口消失的时候会被调用
*/ */
public void show(JComponent fatherPane, T ob) { protected abstract void updateContentPane();
populateBean(ob);
UIDialog dialog = showUnsizedWindow(SwingUtilities.getWindowAncestor(fatherPane)); /**
showDialog = dialog; * 以对话框的形式弹出
Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); *
dialog.setVisible(true); * @param window 窗口
} * @return 对话框
*/
/** public UIDialog showUnsizedWindow(Window window) {
* 数据展现 CustomShapedDialog dg = null;
*/ if (window instanceof Frame) {
public void populateBean(T ob) { dg = new CustomShapedDialog((Frame) window);
contentPane.populateBean(ob); } else {
} dg = new CustomShapedDialog((Dialog) window);
}
/** if (arrowPosition == Constants.LEFT || arrowPosition == Constants.RIGHT) {
* 停止编辑, 更新至最新的面板到属性保存 dg.setSize(bounds.width + ARROR_PARALLEL, bounds.height + ARROR_VERTICAL);
*/ } else {
public T updateBean() { dg.setSize(bounds.width + ARROR_VERTICAL, bounds.height + ARROR_PARALLEL);
updateContentPane(); }
return contentPane.updateBean();
} dg.setLocation(bounds.x, bounds.y);
dg.setBackground(Color.blue);
/** dg.setResizable(false);
* 需要实现更新内容将updateBean传值给对象即可在窗口消失的时候会被调用 return dg;
*/ }
protected abstract void updateContentPane();
@Override
/** protected String title4PopupWindow() {
* 以对话框的形式弹出 return null;
* }
* @param window 窗口
* @return 对话框 private double initBoundsTime(int arrowPosition, Point arrowPoint, int width, int height) {
*/ int x = arrowPoint.x;
public UIDialog showUnsizedWindow(Window window) { int y = arrowPoint.y;
CustomShapedDialog dg = null; int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width;
if (window instanceof Frame) { int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height - TITLE_HEIGHT;
dg = new CustomShapedDialog((Frame) window); double time = TIME_DEFAULT;
} else {
dg = new CustomShapedDialog((Dialog) window); if (arrowPosition == Constants.LEFT || arrowPosition == Constants.RIGHT) {
} while (y + time * height > screenHeight && time > 0) {
if (arrowPosition == Constants.LEFT || arrowPosition == Constants.RIGHT) { time -= TIME_GAP;
dg.setSize(bounds.width + ARROR_PARALLEL, bounds.height + ARROR_VERTICAL); }
} else {
dg.setSize(bounds.width + ARROR_VERTICAL, bounds.height + ARROR_PARALLEL); while (y - (1 - time) * height < 0 && time < 1) {
} time += TIME_GAP;
}
dg.setLocation(bounds.x, bounds.y); } else if (arrowPosition == Constants.TOP) {
dg.setBackground(Color.blue); while (x + time * width > screenWidth && time > 0) {
dg.setResizable(false); time -= TIME_GAP;
return dg; }
}
while (x - (1 - time) * width < 0 && time < 1) {
@Override time += TIME_GAP;
protected String title4PopupWindow() { }
return null; }
} return 1 - time;
}
private double initBoundsTime(int arrowPosition, Point arrowPoint, int width, int height) {
int x = arrowPoint.x; private AWTEventListener awt = new AWTEventListener() {
int y = arrowPoint.y; public void eventDispatched(AWTEvent event) {
int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width; doSomeInAll(event);
int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height - TITLE_HEIGHT; }
double time = TIME_DEFAULT; };
if (arrowPosition == Constants.LEFT || arrowPosition == Constants.RIGHT) { private void doSomeInAll(AWTEvent event) {
while (y + time * height > screenHeight && time > 0) { if (event instanceof MouseEvent) {
time -= TIME_GAP; MouseEvent mv = (MouseEvent) event;
} if (mv.getClickCount() > 0) {
Point point = new Point((int) (mv.getLocationOnScreen().getX()) - 2 * OFF_LEFT, (int) mv.getLocationOnScreen().getY());
while (y - (1 - time) * height < 0 && time < 1) { // 判断鼠标点击是否在边界内
time += TIME_GAP; if (!containsPoint(point) && showDialog != null) {
} updateContentPane();
} else if (arrowPosition == Constants.TOP) { showDialog.setVisible(false);
while (x + time * width > screenWidth && time > 0) { Toolkit.getDefaultToolkit().removeAWTEventListener(awt);
time -= TIME_GAP; }
} }
}
while (x - (1 - time) * width < 0 && time < 1) { }
time += TIME_GAP;
}
}
return 1 - time;
}
private AWTEventListener awt = new AWTEventListener() {
public void eventDispatched(AWTEvent event) {
doSomeInAll(event);
}
};
private void doSomeInAll(AWTEvent event) {
if (event instanceof MouseEvent) {
MouseEvent mv = (MouseEvent) event;
if (mv.getClickCount() > 0) {
Point point = new Point((int) (mv.getLocationOnScreen().getX()) - 2 * OFF_LEFT, (int) mv.getLocationOnScreen().getY());
// 判断鼠标点击是否在边界内
if (!containsPoint(point) && showDialog != null) {
updateContentPane();
showDialog.setVisible(false);
Toolkit.getDefaultToolkit().removeAWTEventListener(awt);
}
}
}
}
private boolean containsPoint(Point point) { private boolean containsPoint(Point point) {
if(arrowPosition == Constants.TOP){ if (arrowPosition == Constants.TOP) {
//箭头和按钮也算在pane内 //箭头和按钮也算在pane内
Rectangle judgedBounds = new Rectangle(bounds.x, bounds.y - OFF_LEFT * 2, bounds.width, bounds.height + OFF_LEFT * 2 + OFF_LEFT); Rectangle judgedBounds = new Rectangle(bounds.x, bounds.y - OFF_LEFT * 2, bounds.width, bounds.height + OFF_LEFT * 2 + OFF_LEFT);
return judgedBounds.contains(point); return judgedBounds.contains(point);
} }
return bounds.contains(point); return bounds.contains(point);
} }
private void initComponents() { private void initComponents() {
if(arrowPosition == Constants.LEFT || arrowPosition == Constants.RIGHT) { if (arrowPosition == Constants.LEFT || arrowPosition == Constants.RIGHT) {
this.setBounds(20, 10, bounds.width, bounds.height); this.setBounds(20, 10, bounds.width, bounds.height);
} else { } else {
this.setBounds(10, 10, bounds.width, bounds.height); this.setBounds(10, 10, bounds.width, bounds.height);
} }
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(contentPane, BorderLayout.CENTER); this.add(contentPane, BorderLayout.CENTER);
} }
private class CustomShapedDialog extends UIDialog { private class CustomShapedDialog extends UIDialog {
private static final int GAP_SMALL = 10; private static final int GAP_SMALL = 10;
private static final int GAP = 20; private static final int GAP = 20;
private static final int GAP_BIG = 30; private static final int GAP_BIG = 30;
public CustomShapedDialog(Frame parent) { public CustomShapedDialog(Frame parent) {
super(parent); super(parent);
this.initComponents(); this.initComponents();
} }
public CustomShapedDialog(Dialog parent) { public CustomShapedDialog(Dialog parent) {
super(parent); super(parent);
this.initComponents(); this.initComponents();
} }
private Shape getCustomShap() { private Shape getCustomShap() {
Polygon polygon = new Polygon(); Polygon polygon = new Polygon();
if (arrowPosition == Constants.LEFT) { if (arrowPosition == Constants.LEFT) {
polygon.addPoint(GAP_SMALL, 0); polygon.addPoint(GAP_SMALL, 0);
polygon.addPoint(bounds.width + GAP_BIG, 0); polygon.addPoint(bounds.width + GAP_BIG, 0);
polygon.addPoint(bounds.width + GAP_BIG, bounds.height + GAP); polygon.addPoint(bounds.width + GAP_BIG, bounds.height + GAP);
polygon.addPoint(GAP_SMALL, bounds.height + GAP); polygon.addPoint(GAP_SMALL, bounds.height + GAP);
polygon.addPoint(GAP_SMALL, (int) ((bounds.height + GAP) * time) - GAP_SMALL); polygon.addPoint(GAP_SMALL, (int) ((bounds.height + GAP) * time) - GAP_SMALL);
polygon.addPoint(0, (int) ((bounds.height + GAP) * time - GAP)); polygon.addPoint(0, (int) ((bounds.height + GAP) * time - GAP));
polygon.addPoint(GAP_SMALL, (int) ((bounds.height + GAP) * time - GAP_BIG)); polygon.addPoint(GAP_SMALL, (int) ((bounds.height + GAP) * time - GAP_BIG));
polygon.addPoint(GAP_SMALL, 0); polygon.addPoint(GAP_SMALL, 0);
} else if (arrowPosition == Constants.TOP) { } else if (arrowPosition == Constants.TOP) {
polygon.addPoint(0, GAP_SMALL); polygon.addPoint(0, GAP_SMALL - 2);
polygon.addPoint((int) (bounds.width * time + GAP_SMALL), GAP_SMALL); polygon.addPoint((int) (bounds.width * time + GAP_SMALL), GAP_SMALL - 2);
polygon.addPoint((int) (bounds.width * time + GAP), 0); polygon.addPoint((int) (bounds.width * time + GAP), 0);
polygon.addPoint((int) (bounds.getWidth() * time + GAP_BIG), GAP_SMALL); polygon.addPoint((int) (bounds.getWidth() * time + GAP_BIG), GAP_SMALL - 2);
polygon.addPoint(bounds.width + GAP, GAP_SMALL); polygon.addPoint(bounds.width + GAP, GAP_SMALL - 2);
polygon.addPoint(bounds.width + GAP, bounds.height + GAP_BIG); polygon.addPoint(bounds.width + GAP, bounds.height + GAP_BIG);
polygon.addPoint(0, bounds.height + GAP_BIG); polygon.addPoint(0, bounds.height + GAP_BIG);
polygon.addPoint(0, GAP_SMALL); polygon.addPoint(0, GAP_SMALL - 2);
} else if (arrowPosition == Constants.RIGHT) { } else if (arrowPosition == Constants.RIGHT) {
polygon.addPoint(0, 0); polygon.addPoint(0, 0);
polygon.addPoint(bounds.width + GAP, 0); polygon.addPoint(bounds.width + GAP, 0);
polygon.addPoint(bounds.width + GAP, (int) ((bounds.height + GAP) * time) - GAP_BIG); polygon.addPoint(bounds.width + GAP, (int) ((bounds.height + GAP) * time) - GAP_BIG);
polygon.addPoint(bounds.width + GAP_BIG, (int) ((bounds.height + GAP) * time) - GAP); polygon.addPoint(bounds.width + GAP_BIG, (int) ((bounds.height + GAP) * time) - GAP);
polygon.addPoint(bounds.width + GAP, (int) ((bounds.height + GAP) * time) - GAP_SMALL); polygon.addPoint(bounds.width + GAP, (int) ((bounds.height + GAP) * time) - GAP_SMALL);
polygon.addPoint(bounds.width + GAP, bounds.height + GAP); polygon.addPoint(bounds.width + GAP, bounds.height + GAP);
polygon.addPoint(0, bounds.height + GAP); polygon.addPoint(0, bounds.height + GAP);
polygon.addPoint(0, 0); polygon.addPoint(0, 0);
} }
return polygon; return polygon;
} }
private Shape getShape4Board() { private Shape getShape4Board() {
Polygon polygon = new Polygon(); Polygon polygon = new Polygon();
if (arrowPosition == Constants.LEFT) { if (arrowPosition == Constants.LEFT) {
polygon.addPoint(GAP_SMALL, 1); polygon.addPoint(GAP_SMALL, 1);
polygon.addPoint(bounds.width + GAP_BIG - 1, 1); polygon.addPoint(bounds.width + GAP_BIG - 1, 1);
polygon.addPoint(bounds.width + GAP_BIG - 1, bounds.height + GAP - 1); polygon.addPoint(bounds.width + GAP_BIG - 1, bounds.height + GAP - 1);
polygon.addPoint(GAP_SMALL + 1, bounds.height + GAP - 1); polygon.addPoint(GAP_SMALL + 1, bounds.height + GAP - 1);
polygon.addPoint(GAP_SMALL + 1, (int) ((bounds.height + GAP) * time) - GAP_SMALL); polygon.addPoint(GAP_SMALL + 1, (int) ((bounds.height + GAP) * time) - GAP_SMALL);
polygon.addPoint(1, (int) ((bounds.height + GAP) * time - GAP)); polygon.addPoint(1, (int) ((bounds.height + GAP) * time - GAP));
polygon.addPoint(GAP_SMALL + 1, (int) ((bounds.height + GAP) * time - GAP_BIG)); polygon.addPoint(GAP_SMALL + 1, (int) ((bounds.height + GAP) * time - GAP_BIG));
polygon.addPoint(GAP_SMALL + 1, 1); polygon.addPoint(GAP_SMALL + 1, 1);
} else if (arrowPosition == Constants.TOP) { } else if (arrowPosition == Constants.TOP) {
polygon.addPoint(1, GAP_SMALL + 1); polygon.addPoint(1, GAP_SMALL - 1);
polygon.addPoint((int) (bounds.width * time + GAP_SMALL), GAP_SMALL + 1); polygon.addPoint((int) (bounds.width * time + GAP_SMALL), GAP_SMALL - 1);
polygon.addPoint((int) (bounds.width * time + GAP), 1); polygon.addPoint((int) (bounds.width * time + GAP), 1);
polygon.addPoint((int) (bounds.getWidth() * time + GAP_BIG), GAP_SMALL + 1); polygon.addPoint((int) (bounds.getWidth() * time + GAP_BIG), GAP_SMALL - 1);
polygon.addPoint(bounds.width + GAP - 1, GAP_SMALL + 1); polygon.addPoint(bounds.width + GAP - 1, GAP_SMALL - 1);
polygon.addPoint(bounds.width + GAP - 1, bounds.height + GAP_BIG - 1); polygon.addPoint(bounds.width + GAP - 1, bounds.height + GAP_BIG - 1);
polygon.addPoint(1, bounds.height + GAP_BIG - 1); polygon.addPoint(1, bounds.height + GAP_BIG - 1);
polygon.addPoint(1, GAP_SMALL + 1); polygon.addPoint(1, GAP_SMALL - 1);
} else if(arrowPosition == Constants.RIGHT) { } else if (arrowPosition == Constants.RIGHT) {
polygon.addPoint(1, 1); polygon.addPoint(1, 1);
polygon.addPoint(bounds.width + GAP - 1, 1); polygon.addPoint(bounds.width + GAP - 1, 1);
polygon.addPoint(bounds.width + GAP - 1, (int) ((bounds.height + GAP) * time) - GAP_BIG); polygon.addPoint(bounds.width + GAP - 1, (int) ((bounds.height + GAP) * time) - GAP_BIG);
polygon.addPoint(bounds.width + GAP_BIG - 1, (int) ((bounds.height + GAP) * time) - GAP); polygon.addPoint(bounds.width + GAP_BIG - 1, (int) ((bounds.height + GAP) * time) - GAP);
polygon.addPoint(bounds.width + GAP - 1, (int) ((bounds.height + GAP) * time) - GAP_SMALL); polygon.addPoint(bounds.width + GAP - 1, (int) ((bounds.height + GAP) * time) - GAP_SMALL);
polygon.addPoint(bounds.width + GAP - 1, bounds.height + GAP - 1); polygon.addPoint(bounds.width + GAP - 1, bounds.height + GAP - 1);
polygon.addPoint(1, bounds.height + GAP - 1); polygon.addPoint(1, bounds.height + GAP - 1);
polygon.addPoint(1, 0); polygon.addPoint(1, 0);
} }
return polygon; return polygon;
} }
/** protected void initComponents() {
* 画出界面的样式, 边框等. setUndecorated(true);
*/ try {
public void paint(Graphics g) { AWTUtilities.setWindowShape(CustomShapedDialog.this, this.getCustomShap());
super.paint(g); } catch (UnsupportedOperationException e) {
Graphics2D g2d = (Graphics2D) g;
Stroke oldStroke = g2d.getStroke();
g2d.setStroke(new BasicStroke(2, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND));
g2d.setColor(new Color(51, 51, 51));
g2d.drawPolygon((Polygon) getShape4Board());
g2d.setStroke(oldStroke);
}
protected void initComponents() {
setUndecorated(true);
try {
AWTUtilities.setWindowShape(CustomShapedDialog.this, this.getCustomShap());
} catch (UnsupportedOperationException e) {
FineLoggerFactory.getLogger().info("Not support"); FineLoggerFactory.getLogger().info("Not support");
} }
final JPanel contentPane = (JPanel) this.getContentPane(); final JPanel contentPane = (JPanel) this.getContentPane();
this.setLayout(null); this.setLayout(null);
contentPane.add(UIBubbleFloatPane.this); contentPane.add(UIBubbleFloatPane.this);
setVisible(true); contentPane.setBorder(new Border() {
} @Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
/** Graphics2D g2d = (Graphics2D) g;
* 检查 Stroke oldStroke = g2d.getStroke();
*/ g2d.setStroke(new BasicStroke(2, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND));
public void checkValid() throws Exception { g2d.setColor(new Color(51, 51, 51));
g2d.drawPolygon((Polygon) getShape4Board());
} g2d.setStroke(oldStroke);
} }
@Override
public Insets getBorderInsets(Component c) {
return null;
}
@Override
public boolean isBorderOpaque() {
return false;
}
});
}
/**
* 检查
*/
public void checkValid() throws Exception {
}
}
} }

21
designer-base/src/main/java/com/fr/design/gui/ipasswordfield/UIPassWordField.java

@ -1,11 +1,12 @@
package com.fr.design.gui.ipasswordfield; package com.fr.design.gui.ipasswordfield;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import javax.swing.*; import javax.swing.JPasswordField;
import javax.swing.text.Document; import javax.swing.text.Document;
import java.awt.*; import java.awt.Graphics;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
@ -21,26 +22,34 @@ public class UIPassWordField extends JPasswordField {
public UIPassWordField() { public UIPassWordField() {
super(); super();
addRollOverListener(); init();
} }
public UIPassWordField(String text) { public UIPassWordField(String text) {
super(text); super(text);
addRollOverListener(); init();
} }
public UIPassWordField(int columns) { public UIPassWordField(int columns) {
super(columns); super(columns);
addRollOverListener(); init();
} }
public UIPassWordField(String text, int columns) { public UIPassWordField(String text, int columns) {
super(text, columns); super(text, columns);
addRollOverListener(); init();
} }
public UIPassWordField(Document doc, String txt, int columns) { public UIPassWordField(Document doc, String txt, int columns) {
super(doc, txt, columns); super(doc, txt, columns);
init();
}
/**
* 每个构造方法里都需要做的一些操作
*/
public void init() {
InputEventBaseOnOS.addBasicEditInputMap(this);
addRollOverListener(); addRollOverListener();
} }

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

@ -96,4 +96,11 @@ public class ProgressDialog extends UIDialog {
public void updateLoadingText(String text) { public void updateLoadingText(String text) {
this.text.setText(text); this.text.setText(text);
} }
public void updateLoadingText(String text, FRFont font) {
if (font != null) {
this.text.setFont(font);
}
this.text.setText(text);
}
} }

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

@ -23,7 +23,7 @@ import java.util.List;
* @editor zhou * @editor zhou
* @since 2012-3-28下午3:07:44 * @since 2012-3-28下午3:07:44
*/ */
public abstract class UITableModelAdapter<T extends Object> extends AbstractTableModel implements UITableEditorLoader { public abstract class UITableModelAdapter<T> extends AbstractTableModel implements UITableEditorLoader {
/** /**
* *
@ -37,7 +37,6 @@ public abstract class UITableModelAdapter<T extends Object> extends AbstractTabl
// list里放的是一行数据 // list里放的是一行数据
private List<T> list = new ArrayList<T>(); private List<T> list = new ArrayList<T>();
@SuppressWarnings({ "unchecked", "rawtypes" })
protected UITableModelAdapter(String[] columnNames) { protected UITableModelAdapter(String[] columnNames) {
this.columnNames = columnNames; this.columnNames = columnNames;
table = new JTable(this); table = new JTable(this);
@ -101,8 +100,8 @@ public abstract class UITableModelAdapter<T extends Object> extends AbstractTabl
} }
} }
public void setRowAt(T value, int rowIndwx) { public void setRowAt(T value, int rowIndex) {
this.list.set(rowIndwx, value); this.list.set(rowIndex, value);
} }
/** /**

33
designer-base/src/main/java/com/fr/design/gui/itextfield/UITextField.java

@ -9,11 +9,20 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import javax.swing.text.Document; import javax.swing.text.Document;
import java.awt.*; import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.RenderingHints;
/** /**
* @author Jerry * @author Jerry
@ -33,31 +42,33 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs
public UITextField() { public UITextField() {
super(); super();
InputEventBaseOnOS.addBasicEditInputMap(this); init();
initListener();
} }
public UITextField(int columns) { public UITextField(int columns) {
super(columns); super(columns);
InputEventBaseOnOS.addBasicEditInputMap(this); init();
initListener();
} }
public UITextField(String text, int columns) { public UITextField(String text, int columns) {
super(text, columns); super(text, columns);
InputEventBaseOnOS.addBasicEditInputMap(this); init();
initListener();
} }
public UITextField(String text) { public UITextField(String text) {
super(text); super(text);
InputEventBaseOnOS.addBasicEditInputMap(this); init();
initListener();
} }
public UITextField(Document doc, String text, int columns) { public UITextField(Document doc, String text, int columns) {
super(doc, text, columns); super(doc, text, columns);
init();
}
/**
* 每个构造方法里都需要做的一些操作
*/
public void init() {
InputEventBaseOnOS.addBasicEditInputMap(this); InputEventBaseOnOS.addBasicEditInputMap(this);
initListener(); initListener();
} }

20
designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/TristateCheckBox.java

@ -1,6 +1,7 @@
package com.fr.design.gui.itree.checkboxtree; package com.fr.design.gui.itree.checkboxtree;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.event.StateChangeListener;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
@ -75,6 +76,8 @@ public class TristateCheckBox extends UICheckBox {
private final TristateDecorator model; private final TristateDecorator model;
public StateChangeListener stateChangeListener;
public TristateCheckBox(String text, Icon icon, State initial) { public TristateCheckBox(String text, Icon icon, State initial) {
super(text, icon); super(text, icon);
setUI(new TristateCheckBoxUI()); setUI(new TristateCheckBoxUI());
@ -83,7 +86,7 @@ public class TristateCheckBox extends UICheckBox {
@Override @Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
grabFocus(); grabFocus();
model.setState(getNextState(model.getState())); setState(getNextState(model.getState()));
} }
}); });
// Reset the keyboard action map // Reset the keyboard action map
@ -92,7 +95,7 @@ public class TristateCheckBox extends UICheckBox {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
grabFocus(); grabFocus();
model.setState(getNextState(model.getState())); setState(getNextState(model.getState()));
} }
}); });
map.put("released", null); map.put("released", null);
@ -125,12 +128,20 @@ public class TristateCheckBox extends UICheckBox {
public void addMouseListener(MouseListener l) { public void addMouseListener(MouseListener l) {
} }
public void addStateChangeListener(StateChangeListener stateChangeListener) {
this.stateChangeListener=stateChangeListener;
}
/** /**
* Set the new state to either SELECTED, NOT_SELECTED or * Set the new state to either SELECTED, NOT_SELECTED or
* DO_NOT_CARE. If state == null, it is treated as DO_NOT_CARE. * DO_NOT_CARE. If state == null, it is treated as DO_NOT_CARE.
*/ */
public void setState(State state) { public void setState(State state) {
State old = getState();
model.setState(state); model.setState(state);
if (old != state) {
fireBoxStateChanged();
}
} }
/** /**
@ -141,6 +152,11 @@ public class TristateCheckBox extends UICheckBox {
return model.getState(); return model.getState();
} }
public void fireBoxStateChanged() {
if (stateChangeListener != null) {
stateChangeListener.stateChange();
}
}
/** /**
* Exactly which Design Pattern is this? Is it an Adapter, * Exactly which Design Pattern is this? Is it an Adapter,

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

@ -25,6 +25,7 @@ import javax.swing.JTextArea;
import javax.swing.event.CaretEvent; import javax.swing.event.CaretEvent;
import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.TextUI; import javax.swing.plaf.TextUI;
import javax.swing.plaf.basic.BasicBorders;
import javax.swing.text.AbstractDocument; import javax.swing.text.AbstractDocument;
import javax.swing.text.BadLocationException; import javax.swing.text.BadLocationException;
import javax.swing.text.Caret; import javax.swing.text.Caret;
@ -645,6 +646,7 @@ int currentCaretY; // Used to know when to rehighlight current line.
setTabsEmulated(false); setTabsEmulated(false);
// Stuff needed by the caret listener below. // Stuff needed by the caret listener below.
setBorder(new BasicBorders.MarginBorder());
previousCaretY = currentCaretY = getInsets().top; previousCaretY = currentCaretY = getInsets().top;
// Stuff to highlight the current line. // Stuff to highlight the current line.

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

@ -395,7 +395,7 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane<ReportletHyp
// 自定义 // 自定义
custom = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Custom")); custom = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Custom"));
custom.setBorder(BorderFactory.createEmptyBorder(4, 20, 4, 5)); custom.setBorder(BorderFactory.createEmptyBorder(4, 15, 4, 5));
ButtonGroup group = new ButtonGroup(); ButtonGroup group = new ButtonGroup();
group.setSelected(center.getModel(), true); group.setSelected(center.getModel(), true);
group.add(center); group.add(center);
@ -405,7 +405,7 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane<ReportletHyp
// 位置 距左 // 位置 距左
final UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Left")); final UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Left"));
leftLabel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 10)); leftLabel.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 10));
leftLocation = new UINumberField(); leftLocation = new UINumberField();
leftLocation.setMinValue(0); leftLocation.setMinValue(0);
leftLocation.setPreferredSize(new Dimension(40, 20)); leftLocation.setPreferredSize(new Dimension(40, 20));

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

@ -31,6 +31,7 @@ public class JSContentPane extends BasicPane {
private RSyntaxTextArea contentTextArea; private RSyntaxTextArea contentTextArea;
private UILabel funNameLabel; private UILabel funNameLabel;
private AutoCompletion ac; private AutoCompletion ac;
private static final Dimension FUNCTION_NAME_LABEL_SIZE = new Dimension(300, 80);
private int titleWidth = 180; private int titleWidth = 180;
@ -68,7 +69,7 @@ public class JSContentPane extends BasicPane {
JPanel jsParaPane = new JPanel(new BorderLayout(4, 4)); JPanel jsParaPane = new JPanel(new BorderLayout(4, 4));
jsParaPane.setPreferredSize(new Dimension(300, 80)); jsParaPane.setPreferredSize(new Dimension(300, 80));
UIScrollPane scrollPane = new UIScrollPane(funNameLabel); UIScrollPane scrollPane = new UIScrollPane(funNameLabel);
scrollPane.setPreferredSize(new Dimension(400, 80)); scrollPane.setPreferredSize(FUNCTION_NAME_LABEL_SIZE);
scrollPane.setBorder(new UIRoundedBorder(UIConstants.TITLED_BORDER_COLOR, 1, UIConstants.ARC)); scrollPane.setBorder(new UIRoundedBorder(UIConstants.TITLED_BORDER_COLOR, 1, UIConstants.ARC));
jsParaPane.add(scrollPane, BorderLayout.WEST); jsParaPane.add(scrollPane, BorderLayout.WEST);
jsParaPane.add(label, BorderLayout.EAST); jsParaPane.add(label, BorderLayout.EAST);

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

@ -168,6 +168,22 @@ public class FRGUIPaneFactory {
return jp; return jp;
} }
/**
* 创建一个带标题边框面板垂直居左布局组件顶对齐
*
* @param string 边框标题
* @return JPanel对象
*/
public static JPanel createTopVerticalTitledBorderPane(String string) {
JPanel jp = new JPanel();
UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(string);
jp.setBorder(explainBorder);
VerticalFlowLayout layout = new VerticalFlowLayout(VerticalFlowLayout.TOP);
layout.setAlignLeft(true);
jp.setLayout(layout);
return jp;
}
/** /**
* 创建一个带标题边框面板并且居中显示 * 创建一个带标题边框面板并且居中显示
* *

31
designer-base/src/main/java/com/fr/design/layout/VerticalFlowLayout.java

@ -16,20 +16,17 @@ import java.awt.LayoutManager;
public class VerticalFlowLayout implements LayoutManager, java.io.Serializable { public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
/** /**
* This value indicates that each row of components * 竖直方向上将子组件设置为顶对齐方式
* should be left-justified.
*/ */
public static final int TOP = 0; public static final int TOP = 0;
/** /**
* This value indicates that each row of components * 竖直方向上将子组件设置为居中对齐方式
* should be centered.
*/ */
public static final int CENTER = 1; public static final int CENTER = 1;
/** /**
* This value indicates that each row of components * 竖直方向上将子组件设置为底对齐方式
* should be right-justified.
*/ */
public static final int BOTTOM = 2; public static final int BOTTOM = 2;
@ -71,7 +68,9 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
*/ */
int newAlign; // This is the one we actually use int newAlign; // This is the one we actually use
// 当列宽不一致时,是否需要左对齐(默认居中对齐) /**
* 当列宽不一致时是否需要将水平方向设置成左对齐默认水平方向为居中对齐
*/
boolean isAlignLeft = false; boolean isAlignLeft = false;
/** /**
@ -220,6 +219,7 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
* @param name the name of the component * @param name the name of the component
* @param comp the component to be added * @param comp the component to be added
*/ */
@Override
public void addLayoutComponent(String name, Component comp) { public void addLayoutComponent(String name, Component comp) {
} }
@ -230,6 +230,7 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
* @param comp the component to remove * @param comp the component to remove
* @see java.awt.Container#removeAll * @see java.awt.Container#removeAll
*/ */
@Override
public void removeLayoutComponent(Component comp) { public void removeLayoutComponent(Component comp) {
} }
@ -244,6 +245,7 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
* @see #minimumLayoutSize * @see #minimumLayoutSize
* @see java.awt.Container#getPreferredSize * @see java.awt.Container#getPreferredSize
*/ */
@Override
public Dimension preferredLayoutSize(Container target) { public Dimension preferredLayoutSize(Container target) {
synchronized (target.getTreeLock()) { synchronized (target.getTreeLock()) {
Dimension dim = new Dimension(0, 0); Dimension dim = new Dimension(0, 0);
@ -255,7 +257,7 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
if (m.isVisible()) { if (m.isVisible()) {
Dimension d = m.getPreferredSize(); Dimension d = m.getPreferredSize();
firstVisibleComponent = dialWithDim4PreferredLayoutSize(dim, d, firstVisibleComponent); firstVisibleComponent = dealWithDim4PreferredLayoutSize(dim, d, firstVisibleComponent);
} }
} }
Insets insets = target.getInsets(); Insets insets = target.getInsets();
@ -265,7 +267,7 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
} }
} }
protected boolean dialWithDim4PreferredLayoutSize(Dimension dim, Dimension d, boolean firstVisibleComponent) { protected boolean dealWithDim4PreferredLayoutSize(Dimension dim, Dimension d, boolean firstVisibleComponent) {
dim.width = Math.max(dim.width, d.width); dim.width = Math.max(dim.width, d.width);
if (firstVisibleComponent) { if (firstVisibleComponent) {
firstVisibleComponent = false; firstVisibleComponent = false;
@ -289,6 +291,7 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
* @see java.awt.Container * @see java.awt.Container
* @see java.awt.Container#doLayout * @see java.awt.Container#doLayout
*/ */
@Override
public Dimension minimumLayoutSize(Container target) { public Dimension minimumLayoutSize(Container target) {
synchronized (target.getTreeLock()) { synchronized (target.getTreeLock()) {
Dimension dim = new Dimension(0, 0); Dimension dim = new Dimension(0, 0);
@ -300,7 +303,7 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
if (m.isVisible()) { if (m.isVisible()) {
Dimension d = m.getMinimumSize(); Dimension d = m.getMinimumSize();
firstVisibleComponent = dialWithDim4MinimumLayoutSize(dim, d, i, firstVisibleComponent); firstVisibleComponent = dealWithDim4MinimumLayoutSize(dim, d, i, firstVisibleComponent);
} }
} }
Insets insets = target.getInsets(); Insets insets = target.getInsets();
@ -310,7 +313,7 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
} }
} }
protected boolean dialWithDim4MinimumLayoutSize(Dimension dim, Dimension d, int i, boolean firstVisibleComponent) { protected boolean dealWithDim4MinimumLayoutSize(Dimension dim, Dimension d, int i, boolean firstVisibleComponent) {
dim.width = Math.max(dim.width, d.width); dim.width = Math.max(dim.width, d.width);
if (i > 0) { if (i > 0) {
dim.height += vgap; dim.height += vgap;
@ -370,6 +373,7 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
* @see java.awt.Container * @see java.awt.Container
* @see java.awt.Container#doLayout * @see java.awt.Container#doLayout
*/ */
@Override
public void layoutContainer(Container target) { public void layoutContainer(Container target) {
synchronized (target.getTreeLock()) { synchronized (target.getTreeLock()) {
Insets insets = target.getInsets(); Insets insets = target.getInsets();
@ -410,7 +414,9 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
protected int[] dealWithDim4LayoutContainer(Container target, Insets insets, Dimension d, int x, int y, int roww, int start, int maxlen, int i, boolean ltr) { protected int[] dealWithDim4LayoutContainer(Container target, Insets insets, Dimension d, int x, int y, int roww, int start, int maxlen, int i, boolean ltr) {
if ((y == 0) || ((y + d.height) <= maxlen)) { if ((y == 0) || ((y + d.height) <= maxlen)) {
if (y > 0) y += vgap; if (y > 0) {
y += vgap;
}
y += d.height; y += d.height;
roww = Math.max(roww, d.width); roww = Math.max(roww, d.width);
} else { } else {
@ -449,6 +455,7 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
* *
* @return a string representation of this layout * @return a string representation of this layout
*/ */
@Override
public String toString() { public String toString() {
String str = ""; String str = "";
switch (this.newAlign) { switch (this.newAlign) {

29
designer-base/src/main/java/com/fr/design/locale/impl/BugNeedMark.java

@ -0,0 +1,29 @@
package com.fr.design.locale.impl;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.general.locale.LocaleMark;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/**
* @Author: Yuan.Wang
* @Date: 2020/7/29
*/
public class BugNeedMark implements LocaleMark<String> {
private Map<Locale, String> map = new HashMap<>();
private static final String TW_BUG_AND_NEEDS = CloudCenter.getInstance().acquireUrlByKind("bbs.bug.needs.zh_TW");
public BugNeedMark() {
map.put(Locale.TAIWAN, TW_BUG_AND_NEEDS);
}
@Override
public String getValue() {
String result = map.get(GeneralContext.getLocale());
return result == null ? TW_BUG_AND_NEEDS : result;
}
}

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

@ -10,6 +10,7 @@ import java.util.Set;
* 某些国际化环境支持的操作 * 某些国际化环境支持的操作
* 需要增加/删除支持的语言 统一在这里修改 无须改动业务代码 * 需要增加/删除支持的语言 统一在这里修改 无须改动业务代码
* 后续有新的不同语言下的差异操作 添加新的枚举 * 后续有新的不同语言下的差异操作 添加新的枚举
*
* @author Hades * @author Hades
* @date 2019/6/24 * @date 2019/6/24
*/ */
@ -38,6 +39,123 @@ public enum SupportLocaleImpl implements SupportLocale {
set.add(Locale.TAIWAN); set.add(Locale.TAIWAN);
return set; return set;
} }
},
/**
* 支持韩文
*/
SUPPORT_KOREA {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<Locale>();
set.add(Locale.KOREA);
return set;
}
},
/**
* BUG反馈
*/
BUG {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<Locale>();
set.add(Locale.CHINA);
set.add(Locale.US);
set.add(Locale.JAPAN);
set.add(Locale.KOREA);
return set;
}
},
/**
* 需求反馈
*/
NEED {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<Locale>();
set.add(Locale.CHINA);
set.add(Locale.US);
set.add(Locale.JAPAN);
set.add(Locale.KOREA);
return set;
}
},
/**
* BUG需求反馈
*/
BUG_AND_NEED {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<Locale>();
set.add(Locale.TAIWAN);
return set;
}
},
/**
* 视频
*/
VIDEO {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<Locale>();
set.add(Locale.US);
return set;
}
},
/**
* 技术支持-帮助菜单下
*/
TECH_SUPPORT_HELP {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<Locale>();
set.add(Locale.US);
return set;
}
},
/**
* 技术支持-社区菜单下
*/
TECH_SUPPORT_COMMUNITY {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<Locale>();
set.add(Locale.TAIWAN);
return set;
}
},
/**
* 帮助文档-帮助菜单下
*/
TUTORIAL_HELP {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<Locale>();
set.add(Locale.US);
set.add(Locale.KOREA);
set.add(Locale.JAPAN);
return set;
}
},
/**
* 帮助文档-社区菜单下
*/
TUTORIAL_COMMUNITY {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<Locale>();
set.add(Locale.CHINA);
set.add(Locale.TAIWAN);
return set;
}
} }

30
designer-base/src/main/java/com/fr/design/locale/impl/TechSupportMark.java

@ -0,0 +1,30 @@
package com.fr.design.locale.impl;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.general.locale.LocaleMark;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/**
* @Author: Yuan.Wang
* @Date: 2020/7/29
*/
public class TechSupportMark implements LocaleMark<String> {
private Map<Locale, String> map = new HashMap<>();
private static final String EN_TECH_SUPPORT = CloudCenter.getInstance().acquireUrlByKind("bbs.tech.support.en_US");
private static final String TW_TECH_SUPPORT = CloudCenter.getInstance().acquireUrlByKind("bbs.tech.support.zh_TW");
public TechSupportMark() {
map.put(Locale.US, EN_TECH_SUPPORT);
map.put(Locale.TAIWAN, TW_TECH_SUPPORT);
}
@Override
public String getValue() {
String result = map.get(GeneralContext.getLocale());
return result == null ? EN_TECH_SUPPORT : result;
}
}

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

@ -328,6 +328,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
if (DesignModeContext.isAuthorityEditing()) { if (DesignModeContext.isAuthorityEditing()) {
doResize(); doResize();
} }
//刷新FixedPopupPane的位置
EastRegionContainerPane.getInstance().freshCurrentPopupPane();
} }
}); });
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
@ -972,6 +974,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 添加的模板. * @param jt 添加的模板.
*/ */
public void addAndActivateJTemplate(JTemplate<?, ?> jt) { public void addAndActivateJTemplate(JTemplate<?, ?> jt) {
//切换文件后清空FixedPopupPane面板
EastRegionContainerPane.getInstance().clearCurrentPopupPane();
//释放模板对象 //释放模板对象
ActionFactory.editorRelease(); ActionFactory.editorRelease();
if (jt == null || jt.getEditingFILE() == null) { if (jt == null || jt.getEditingFILE() == null) {
@ -991,6 +995,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 模板 * @param jt 模板
*/ */
public void activateJTemplate(JTemplate<?, ?> jt) { public void activateJTemplate(JTemplate<?, ?> jt) {
//切换文件后清空FixedPopupPane面板
EastRegionContainerPane.getInstance().clearCurrentPopupPane();
//释放模板对象 //释放模板对象
ActionFactory.editorRelease(); ActionFactory.editorRelease();
if (jt == null || jt.getEditingFILE() == null) { if (jt == null || jt.getEditingFILE() == null) {
@ -1101,7 +1107,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @date 2014-10-14-下午6:31:05 * @date 2014-10-14-下午6:31:05
*/ */
private void openFile(FILE tplFile) { private void openFile(FILE tplFile) {
//切换文件后清空FixedPopupPane面板
EastRegionContainerPane.getInstance().clearCurrentPopupPane();
if (tplFile != null) { if (tplFile != null) {
int index = HistoryTemplateListCache.getInstance().contains(tplFile); int index = HistoryTemplateListCache.getInstance().contains(tplFile);
if (index != -1) { if (index != -1) {

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

@ -67,6 +67,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private JPanel leftPane; private JPanel leftPane;
private JPanel rightPane; private JPanel rightPane;
private FixedPopupPane currentPopupPane; private FixedPopupPane currentPopupPane;
private UIButton currentButton;
private static final int CONTAINER_WIDTH = containerWidth(); private static final int CONTAINER_WIDTH = containerWidth();
private static final int TAB_WIDTH = 38; private static final int TAB_WIDTH = 38;
private static final int TAB_BUTTON_WIDTH = 32; private static final int TAB_BUTTON_WIDTH = 32;
@ -227,8 +228,10 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
itemBean.getEnableModes()); itemBean.getEnableModes());
UIButton button = propertyItem.getButton(); UIButton button = propertyItem.getButton();
List<ActionListener> buttonListeners = itemBean.getButtonListeners(); List<ActionListener> buttonListeners = itemBean.getButtonListeners();
for (ActionListener buttonListener : buttonListeners) { if (buttonListeners != null) {
button.addActionListener(buttonListener); for (ActionListener buttonListener : buttonListeners) {
button.addActionListener(buttonListener);
}
} }
propertyItemMap.put(key, propertyItem); propertyItemMap.put(key, propertyItem);
@ -927,6 +930,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} else { } else {
hideCurrentPopupPane(); hideCurrentPopupPane();
currentPopupPane = popupPane; currentPopupPane = popupPane;
currentButton = button;
GUICoreUtils.showPopupMenu(popupPane, button, -popupPane.getPreferredSize().width, 0); GUICoreUtils.showPopupMenu(popupPane, button, -popupPane.getPreferredSize().width, 0);
} }
} }
@ -1007,6 +1011,35 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} }
} }
/**
* @Description:刷新currentPopupPane面板位置当设计器缩放时会调用这个函数
* @param
* @return:
* @Author: Henry.Wang
* @date: 2020/7/30 11:39
*/
public void freshCurrentPopupPane() {
if (currentPopupPane != null && currentPopupPane.isVisible()) {
hideCurrentPopupPane();
if (currentButton != null && !isRightPaneVisible()) {
GUICoreUtils.showPopupMenu(currentPopupPane, currentButton, -currentPopupPane.getPreferredSize().width, 0);
}
}
}
/**
* @Description:清空currentPopupPane数据当切换模板时会调用这个函数
* @param
* @return:
* @Author: Henry.Wang
* @date: 2020/7/30 11:42
*/
public void clearCurrentPopupPane() {
hideCurrentPopupPane();
currentPopupPane = null;
currentButton = null;
}
// 弹出属性面板的工具条 // 弹出属性面板的工具条
private class PopupToolPane extends JPanel { private class PopupToolPane extends JPanel {
private String title; private String title;

393
designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java

@ -1,45 +1,34 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ibutton.UISliderButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.islider.UISlider; import com.fr.design.gui.islider.UISlider;
import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JRadioButton;
import javax.swing.JSeparator;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.text.DefaultFormatterFactory; import javax.swing.plaf.basic.BasicSliderUI;
import javax.swing.text.NumberFormatter;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.EventQueue; import java.awt.EventQueue;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Font; import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.FocusEvent;
import java.awt.event.ItemListener; import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -47,76 +36,44 @@ import java.math.BigDecimal;
* Created by MoMeak on 2017/7/13. * Created by MoMeak on 2017/7/13.
*/ */
public class JFormSliderPane extends JPanel { public class JFormSliderPane extends JPanel {
public static final Image APPFIT_V0 = BaseUtils.readImage("com/fr/design/images/control/icon_thumb_normal.png");
private static final double ONEPOINTEIGHT = 1.8; private static final double ONEPOINTEIGHT = 1.8;
private static final int SIX = 6; private static final int SIX = 6;
private static final int TEN = 10; private static final int TEN = 10;
private static final int ONE_EIGHT = 18;
private static final int FONT_SIZE = 12;
private static final int SPINNER_WIDTH = 45;
private static final int SPINNER_HEIGHT = 20;
private static final int HALF_HUNDRED = 50; private static final int HALF_HUNDRED = 50;
private static final int HUNDRED = 100; private static final int HUNDRED = 100;
private static final int TWO_HUNDRED = 200; private static final int TWO_HUNDRED = 200;
private static final int THREE_HUNDRED = 300;
private static final int FOUR_HUNDRED = 400; private static final int FOUR_HUNDRED = 400;
private static final int DIALOG_WIDTH = 157; private static final int SHOWVALBUTTON_WIDTH = 35;
private static final int DIALOG_HEIGHT = 172;
private static final int SLIDER_WIDTH = 220;
private static final int SLIDER_HEIGHT = 20;
private static final int SHOWVALBUTTON_WIDTH = 40;
private static final int SHOWVALBUTTON_HEIGHTH = 20; private static final int SHOWVALBUTTON_HEIGHTH = 20;
private static final int SLIDER_GAP = 5; private static final String SUFFIX = "%";
private static final int TOOLTIP_Y = 30; private static final int TOOLTIP_Y = 30;
private static final Color BACK_COLOR = new Color(245, 245, 247); private static final Color BACK_COLOR = new Color(245, 245, 247);
public int showValue = 100; public int showValue = 100;
public double resolutionTimes = 1.0; private UINumberField showValField;
private UITextField showVal;
private JSpinner showValSpinner;
private UISlider slider; private UISlider slider;
private int times; private int times;
private int sliderValue; private int sliderValue;
private UIButton downButton; private UIButton downButton;
private UIButton upButton; private UIButton upButton;
private UISliderButton showValButton;
private UIRadioButton twoHundredButton;
private UIRadioButton oneHundredButton;
private UIRadioButton sevenFiveButton;
private UIRadioButton fiveTenButton;
private UIRadioButton twoFiveButton;
private UIRadioButton selfAdaptButton;
private UIRadioButton customButton;
//拖动条处理和button、直接输入不一样 //拖动条处理和button、直接输入不一样
private boolean isButtonOrIsTxt = true; private boolean isButtonOrIsTxt = true;
//是否选中指定的几个缩放等级,避免触发不必要的事件
private boolean selectSpecified = false;
private FormPopupPane dialog;
private int upButtonX;
private JPanel dialogContentPanel;
public JFormSliderPane() { public JFormSliderPane() {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
initSlider(); initSlider();
initShowValSpinner();
//MoMeak:控制只能输入10-400
JSpinner.NumberEditor editor = new JSpinner.NumberEditor(showValSpinner, "0");
showValSpinner.setEditor(editor);
JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
textField.setEditable(true);
DefaultFormatterFactory factory = (DefaultFormatterFactory) textField.getFormatterFactory();
NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter();
formatter.setAllowsInvalid(false);
initDownUpButton(); initDownUpButton();
initShowValButton(); initShowValField();
initUIRadioButton();
initPane();
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
panel.add(downButton); panel.add(downButton);
panel.add(slider); panel.add(slider);
panel.add(upButton); panel.add(upButton);
panel.add(showValButton); panel.add(showValField);
UILabel uiLabel = new UILabel(SUFFIX);
uiLabel.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4));
panel.add(uiLabel);
panel.setBackground(BACK_COLOR); panel.setBackground(BACK_COLOR);
this.add(panel, BorderLayout.NORTH); this.add(panel, BorderLayout.NORTH);
} }
@ -131,6 +88,7 @@ public class JFormSliderPane extends JPanel {
return new Point(event.getX(), event.getY() - TOOLTIP_Y); return new Point(event.getX(), event.getY() - TOOLTIP_Y);
} }
}; };
slider.setValue(HALF_HUNDRED);
slider.setUI(new JSliderPaneUI(slider)); slider.setUI(new JSliderPaneUI(slider));
slider.addChangeListener(listener); slider.addChangeListener(listener);
slider.setPreferredSize(new Dimension(220, 20)); slider.setPreferredSize(new Dimension(220, 20));
@ -139,16 +97,6 @@ public class JFormSliderPane extends JPanel {
slider.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Slider")); slider.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Slider"));
} }
private void initShowValSpinner() {
showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, 0, FOUR_HUNDRED, 1)) {
public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
showValSpinner.setEnabled(true);
showValSpinner.addChangeListener(showValSpinnerChangeListener);
showValSpinner.setPreferredSize(new Dimension(SPINNER_WIDTH, SPINNER_HEIGHT));
}
private void initDownUpButton() { private void initDownUpButton() {
downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png")) { downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png")) {
@ -173,142 +121,78 @@ public class JFormSliderPane extends JPanel {
upButton.addActionListener(buttonActionListener); upButton.addActionListener(buttonActionListener);
} }
private void initShowValButton() { private void initShowValField() {
showValButton = new UISliderButton(showValSpinner.getValue() + "%"); showValField = new UINumberField();
showValButton.setBackground(BACK_COLOR); showValField.setValue(showValue);
showValButton.setBorderPainted(false); showValField.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH));
showValButton.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH)); showValField.addKeyListener(new KeyListener() {
showValButton.addActionListener(showValButtonActionListener); @Override
showValButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Grade")); public void keyTyped(KeyEvent e) {
}
}
private void initUIRadioButton() {
twoHundredButton = new UIRadioButton("200%");
oneHundredButton = new UIRadioButton("100%");
sevenFiveButton = new UIRadioButton("75%");
fiveTenButton = new UIRadioButton("50%");
twoFiveButton = new UIRadioButton("25%");
selfAdaptButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Self_Adapt_Button"));
selfAdaptButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
customButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Custom_Button"));
customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
twoHundredButton.addItemListener(radioButtonItemListener);
oneHundredButton.addItemListener(radioButtonItemListener);
sevenFiveButton.addItemListener(radioButtonItemListener);
fiveTenButton.addItemListener(radioButtonItemListener);
twoFiveButton.addItemListener(radioButtonItemListener);
customButton.addItemListener(new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void keyPressed(KeyEvent e) {
JRadioButton temp = (JRadioButton) e.getSource();
if (temp.isSelected()) { }
JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
textField.requestFocus(); @Override
textField.selectAll(); public void keyReleased(KeyEvent evt) {
int code = evt.getKeyCode();
if (code == KeyEvent.VK_ENTER) {
showValFieldChange((int) showValField.getValue());
} }
} }
}); });
showValField.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
ButtonGroup bg = new ButtonGroup();// 初始化按钮组 }
bg.add(twoHundredButton);// 加入按钮组
bg.add(oneHundredButton);
bg.add(sevenFiveButton);
bg.add(fiveTenButton);
bg.add(twoFiveButton);
bg.add(selfAdaptButton);
bg.add(customButton);
customButton.setSelected(true);
}
private void initPane() { @Override
double p = TableLayout.PREFERRED; public void focusLost(FocusEvent e) {
double f = TableLayout.FILL; showValFieldChange((int) showValField.getValue());
double[] columnSize = {p, f}; }
double[] rowSize = {p, p, p, p, p, p, p, p}; });
UILabel upLabel = new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_EnlargeOrReduce"));
upLabel.setOpaque(false);
JPanel septPane = new JPanel(new BorderLayout());
JSeparator sept = new JSeparator();
sept.setBackground(new Color(232, 232, 233));
septPane.add(sept, BorderLayout.NORTH);
septPane.setBorder(BorderFactory.createEmptyBorder(2, 5, 1, 10));
septPane.setBackground(BACK_COLOR);
twoHundredButton.setBackground(BACK_COLOR);
oneHundredButton.setBackground(BACK_COLOR);
sevenFiveButton.setBackground(BACK_COLOR);
fiveTenButton.setBackground(BACK_COLOR);
twoFiveButton.setBackground(BACK_COLOR);
// selfAdaptButton.setBackground(BACK_COLOR);
customButton.setBackground(BACK_COLOR);
Component[][] components = new Component[][]{
new Component[]{upLabel, null},
new Component[]{septPane, null},
new Component[]{twoHundredButton, null},
new Component[]{oneHundredButton, null},
new Component[]{sevenFiveButton, null},
new Component[]{fiveTenButton, null},
new Component[]{twoFiveButton, null},
new Component[]{customButton, createSpinnerPanel()}
};
dialogContentPanel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, LayoutConstants.VGAP_MEDIUM, 0);
dialogContentPanel.setBackground(BACK_COLOR);
dialogContentPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
} }
private JPanel createSpinnerPanel() {
JPanel spinnerPanel = new JPanel(new FlowLayout());
spinnerPanel.add(showValSpinner); private void showValFieldChange(int value) {
UILabel percent = new UILabel("%"); isButtonOrIsTxt = true;
percent.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE)); showValue = getPreferredValue(value);
spinnerPanel.add(percent); refreshShowValueFieldText();
spinnerPanel.setBackground(BACK_COLOR); refreshSlider();
return spinnerPanel;
} }
private ActionListener showValButtonActionListener = new ActionListener() { private int getPreferredValue(int value){
@Override if (value > FOUR_HUNDRED) {
public void actionPerformed(ActionEvent e) { value = FOUR_HUNDRED;
popupDialog();
} }
}; if (value < TEN) {
value = TEN;
private ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
int val = (int) ((UIBasicSpinner) e.getSource()).getValue();
isButtonOrIsTxt = true;
resolutionTimes = divide(showValue, 100, 2);
if (val > FOUR_HUNDRED) {
showValSpinner.setValue(FOUR_HUNDRED);
val = FOUR_HUNDRED;
}
if (val < TEN) {
showValSpinner.setValue(TEN);
val = TEN;
}
refreshSlider(val);
refreshBottun(val);
JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
textField.setCaretPosition(showValSpinner.getValue().toString().length());
if (!selectSpecified) {
customButton.setSelected(true);
}
} }
}; return value;
}
private void refreshShowValueFieldText(){
showValField.setValue(showValue);
setAdjustButtonStatus();
}
//定义一个监听器,用于监听所有滑动条 //定义一个监听器,用于监听所有滑动条
private ChangeListener listener = new ChangeListener() { private ChangeListener listener = new ChangeListener() {
public void stateChanged(ChangeEvent event) { public void stateChanged(ChangeEvent event) {
//取出滑动条的值,并在文本中显示出来 //取出滑动条的值,并在文本中显示出来
if (!isButtonOrIsTxt) { if (!isButtonOrIsTxt) {
customButton.setSelected(true);
EventQueue.invokeLater(new Runnable() { EventQueue.invokeLater(new Runnable() {
public void run() { public void run() {
sliderValue = slider.getValue(); sliderValue = slider.getValue();
getTimes(sliderValue); getTimes(sliderValue);
showValue = times; showValue = times;
showValSpinner.setValue(times); refreshShowValueFieldText();
} }
}); });
} else { } else {
@ -317,41 +201,28 @@ public class JFormSliderPane extends JPanel {
} }
}; };
private ItemListener radioButtonItemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
JRadioButton temp = (JRadioButton) e.getSource();
if (temp.isSelected()) {
selectSpecified = true;
showValSpinner.setValue(Integer.valueOf(temp.getText().substring(0, temp.getText().indexOf("%"))));
selectSpecified = false;
}
}
};
private void refreshSlider(int val) { private void refreshSlider() {
showValue = val; slider.setValue(calSliderValue(showValue));
if (showValue > HUNDRED) {
slider.setValue((int) (showValue + TWO_HUNDRED) / SIX);
} else if (showValue < HUNDRED) {
slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT));
} else {
slider.setValue(HALF_HUNDRED);
}
} }
private void setAdjustButtonStatus(){
private void refreshBottun(int val) { this.downButton.setEnabled(this.showValue > TEN);
showValButton.setText(val + "%"); this.upButton.setEnabled(this.showValue < FOUR_HUNDRED);
} }
public double getResolutionTimes() { private int calSliderValue(int value) {
return this.resolutionTimes; int result;
if (value > HUNDRED) {
result = (value + TWO_HUNDRED) / SIX;
} else if (value < HUNDRED) {
result = (int) ((value - TEN) / ONEPOINTEIGHT);
} else {
result = HALF_HUNDRED;
}
return result;
} }
public int getshowValue() {
return this.showValue;
}
public static double divide(double v1, double v2, int scale) { public static double divide(double v1, double v2, int scale) {
BigDecimal b1 = new BigDecimal(Double.toString(v1)); BigDecimal b1 = new BigDecimal(Double.toString(v1));
@ -362,30 +233,28 @@ public class JFormSliderPane extends JPanel {
private ActionListener buttonActionListener = new ActionListener() { private ActionListener buttonActionListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
showValue = (int) showValSpinner.getValue();
isButtonOrIsTxt = true; isButtonOrIsTxt = true;
if ("less".equals(e.getActionCommand())) { if ("less".equals(e.getActionCommand())) {
int newDownVal = showValue - TEN; int newDownVal = showValue - TEN;
if (newDownVal >= TEN) { if (newDownVal >= TEN) {
showValue = newDownVal; showValue = newDownVal;
showValSpinner.setValue(newDownVal);
} else { } else {
showValue = newDownVal; showValue = TEN;
showValSpinner.setValue(TEN);
} }
refreshShowValueFieldText();
refreshSlider();
} }
if ("more".equals(e.getActionCommand())) { if ("more".equals(e.getActionCommand())) {
int newUpVal = showValue + TEN; int newUpVal = showValue + TEN;
if (newUpVal <= FOUR_HUNDRED) { if (newUpVal <= FOUR_HUNDRED) {
showValue = newUpVal; showValue = newUpVal;
showValSpinner.setValue(newUpVal);
} else { } else {
showValue = newUpVal; showValue = FOUR_HUNDRED;
showValSpinner.setValue(FOUR_HUNDRED);
} }
refreshShowValueFieldText();
refreshSlider();
} }
isButtonOrIsTxt = true; isButtonOrIsTxt = true;
customButton.setSelected(true);
} }
}; };
@ -396,35 +265,72 @@ public class JFormSliderPane extends JPanel {
} else if (value < HALF_HUNDRED) { } else if (value < HALF_HUNDRED) {
times = (int) Math.round(ONEPOINTEIGHT * value + TEN); times = (int) Math.round(ONEPOINTEIGHT * value + TEN);
} else { } else {
times = (int) (SIX * value - TWO_HUNDRED); times = SIX * value - TWO_HUNDRED;
} }
} }
public JSpinner getShowVal() { public int getShowValue() {
return this.showValSpinner; return this.showValue;
} }
public UIRadioButton getSelfAdaptButton() { public void setShowValue(int value) {
return this.selfAdaptButton; showValFieldChange(value);
} }
private void popupDialog() {
Point btnCoords = upButton.getLocationOnScreen(); public void addValueChangeListener(ChangeListener changeListener){
if (dialog == null) { this.slider.addChangeListener(changeListener);
dialog = new FormPopupPane(upButton, dialogContentPanel); }
if (upButtonX == 0) {
upButtonX = btnCoords.x; class JSliderPaneUI extends BasicSliderUI {
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
} private static final int THUMB_XOFFSET = 8;
} else { private static final int THUMB_YOFFSET = 3;
if (upButtonX == 0) { private static final int FOUR = 4;
upButtonX = btnCoords.x; private static final int FIVE = 5;
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT); private static final int SIX = 6;
private static final int MID_X_SHIFT = 2; // 中点标记的水平位置偏移
public JSliderPaneUI(UISlider b) {
super(b);
}
/**
* 绘制指示物
*/
public void paintThumb(Graphics g) {
Rectangle knobBounds = thumbRect;
Graphics2D g2d = (Graphics2D) g;
g2d.drawImage(APPFIT_V0, knobBounds.x - THUMB_XOFFSET, knobBounds.y + THUMB_YOFFSET, null);
g2d.dispose();
}
/**
* 绘制刻度轨迹
*/
public void paintTrack(Graphics g) {
int cy, cw;
Rectangle trackBounds = trackRect;
if (slider.getOrientation() == UISlider.HORIZONTAL) {
Graphics2D g2 = (Graphics2D) g;
cy = (trackBounds.height / 2);
cw = trackBounds.width;
g2.setPaint(BACK_COLOR);
g2.fillRect(0, -cy, cw + 10, cy * 4);
g.setColor(new Color(216, 216, 216));
g.drawLine(0, cy, cw + 3, cy);
g.drawLine(MID_X_SHIFT + cw / 2, cy - FOUR, MID_X_SHIFT + cw / 2, cy + FOUR);
} else { } else {
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT); super.paintTrack(g);
} }
} }
public void setThumbLocation(int x, int y) {
super.setThumbLocation(x, y);
slider.repaint();
}
} }
public static void main(String[] args) { public static void main(String[] args) {
@ -440,16 +346,3 @@ public class JFormSliderPane extends JPanel {
} }
} }
class FormPopupPane extends JPopupMenu {
private static final int DIALOG_WIDTH = 157;
private static final int DIALOG_HEIGHT = 172;
FormPopupPane(UIButton b, JPanel dialogContentPanel) {
this.add(dialogContentPanel, BorderLayout.CENTER);
this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT));
this.setBackground(new Color(245, 245, 247));
}
}

6
designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java

@ -40,7 +40,11 @@ public class WestRegionContainerPane extends UIResizableContainer {
@Override @Override
public void on(PluginEvent event) { public void on(PluginEvent event) {
setDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); if (getDownPane() != null) {
replaceDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
} else {
setDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
}
} }
}, new PluginFilter() { }, new PluginFilter() {

25
designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java

@ -8,6 +8,7 @@ import com.fr.design.ui.util.UIUtil;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.log.Log4jConfig; import com.fr.general.log.Log4jConfig;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.third.apache.log4j.Level; import com.fr.third.apache.log4j.Level;
import com.fr.third.apache.log4j.spi.LoggingEvent; import com.fr.third.apache.log4j.spi.LoggingEvent;
import com.fr.third.apache.log4j.spi.ThrowableInformation; import com.fr.third.apache.log4j.spi.ThrowableInformation;
@ -53,12 +54,14 @@ public class DesignerLogHandler {
private static final int SERVER_GAP_Y = -20; private static final int SERVER_GAP_Y = -20;
private static final String ERROR_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert") + ":"; private static final String ERROR_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Seriously") + ":";
private static final String WARN_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Seriously") + ":"; private static final String WARN_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert") + ":";
private static final String NORMAL_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Normal") + ":"; private static final String NORMAL_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Normal") + ":";
private static final String ACTION_MAP_KEY = "clear";
public static DesignerLogHandler getInstance() { public static DesignerLogHandler getInstance() {
return HOLDER.singleton; return HOLDER.singleton;
@ -223,14 +226,14 @@ public class DesignerLogHandler {
InputMap inputMap = resultPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); InputMap inputMap = resultPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), DefaultEditorKit.copyAction); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), DefaultEditorKit.copyAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER), DefaultEditorKit.selectAllAction); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER), DefaultEditorKit.selectAllAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_L, DEFAULT_MODIFIER), "clear"); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_L, DEFAULT_MODIFIER), ACTION_MAP_KEY);
ActionMap actionMap = resultPane.getActionMap(); ActionMap actionMap = resultPane.getActionMap();
actionMap.put("clear", new AbstractAction() { actionMap.put(ACTION_MAP_KEY, new AbstractAction() {
@Override @Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
resultPane.setText(""); resultPane.setText(StringUtils.EMPTY);
caption.clearMessage(); caption.clearMessage();
} }
}); });
@ -293,10 +296,10 @@ public class DesignerLogHandler {
SimpleAttributeSet attrSet = new SimpleAttributeSet(); SimpleAttributeSet attrSet = new SimpleAttributeSet();
if (style == DesignerLogger.ERROR_INT) { if (style == DesignerLogger.ERROR_INT) {
StyleConstants.setForeground(attrSet, new Color(247, 148, 29)); StyleConstants.setForeground(attrSet, Color.RED);
StyleConstants.setBold(attrSet, true); StyleConstants.setBold(attrSet, true);
} else if (style == DesignerLogger.WARN_INT) { } else if (style == DesignerLogger.WARN_INT) {
StyleConstants.setForeground(attrSet, Color.red); StyleConstants.setForeground(attrSet, new Color(247, 148, 29));
StyleConstants.setBold(attrSet, true); StyleConstants.setBold(attrSet, true);
} else if (style == DesignerLogger.INFO_INT) { } else if (style == DesignerLogger.INFO_INT) {
StyleConstants.setForeground(attrSet, Color.black); StyleConstants.setForeground(attrSet, Color.black);
@ -330,9 +333,9 @@ public class DesignerLogHandler {
LogMessageBar.getInstance().setMessage(message); LogMessageBar.getInstance().setMessage(message);
if (level == DesignerLogger.INFO_INT && showInfo.isSelected()) { if (level == DesignerLogger.INFO_INT && showInfo.isSelected()) {
caption.infoAdd(); caption.infoAdd();
} else if (level == DesignerLogger.ERROR_INT && showError.isSelected()) { } else if (level == DesignerLogger.WARN_INT && showError.isSelected()) {
caption.errorAdd(); caption.errorAdd();
} else if (level == DesignerLogger.WARN_INT && showServer.isSelected()) { } else if (level == DesignerLogger.ERROR_INT && showServer.isSelected()) {
caption.serverAdd(); caption.serverAdd();
} }
} }
@ -343,7 +346,7 @@ public class DesignerLogHandler {
this.copy.setEnabled(true); this.copy.setEnabled(true);
this.clear.setEnabled(true); this.clear.setEnabled(true);
if (ComparatorUtils.equals(this.jTextArea.getText(), "")) { if (ComparatorUtils.equals(this.jTextArea.getText(), StringUtils.EMPTY)) {
this.selectAll.setEnabled(false); this.selectAll.setEnabled(false);
this.clear.setEnabled(false); this.clear.setEnabled(false);
} }
@ -367,7 +370,7 @@ public class DesignerLogHandler {
} else if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.copy.getText())) { } else if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.copy.getText())) {
LogHandlerArea.this.jTextArea.copy(); LogHandlerArea.this.jTextArea.copy();
} else if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.clear.getText())) { } else if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.clear.getText())) {
LogHandlerArea.this.jTextArea.setText(""); LogHandlerArea.this.jTextArea.setText(StringUtils.EMPTY);
caption.clearMessage(); caption.clearMessage();
} }
} }

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

@ -11,12 +11,14 @@ import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction; 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.BugNeedAction;
import com.fr.design.actions.community.CenterAction; import com.fr.design.actions.community.CenterAction;
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;
import com.fr.design.actions.community.SignAction; import com.fr.design.actions.community.SignAction;
import com.fr.design.actions.community.TechSolutionAction; import com.fr.design.actions.community.TechSolutionAction;
import com.fr.design.actions.community.TechSupportAction;
import com.fr.design.actions.community.VideoAction; import com.fr.design.actions.community.VideoAction;
import com.fr.design.actions.file.CloseCurrentTemplateAction; import com.fr.design.actions.file.CloseCurrentTemplateAction;
import com.fr.design.actions.file.ExitDesignerAction; import com.fr.design.actions.file.ExitDesignerAction;
@ -529,11 +531,30 @@ public abstract class ToolBarMenuDock {
*/ */
public ShortCut[] createHelpShortCuts() { public ShortCut[] createHelpShortCuts() {
final java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>(); final java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>();
// 英文,把 video 和帮助文档放到 Help 下面
if (GeneralContext.getLocale().equals(Locale.US)) { Locale locale = GeneralContext.getLocale();
shortCuts.add(new VideoAction());
shortCuts.add(new TutorialAction()); LocaleCenter.buildAction(new LocaleAction() {
} @Override
public void execute() {
shortCuts.add(new VideoAction());
}
}, SupportLocaleImpl.VIDEO);
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new TutorialAction());
}
}, SupportLocaleImpl.TUTORIAL_HELP);
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new TechSupportAction());
}
}, SupportLocaleImpl.TECH_SUPPORT_HELP);
//远程不使用更新升级,产品演示 //远程不使用更新升级,产品演示
if (WorkContext.getCurrent().isLocal()) { if (WorkContext.getCurrent().isLocal()) {
shortCuts.add(new WebDemoAction()); shortCuts.add(new WebDemoAction());
@ -571,14 +592,44 @@ public abstract class ToolBarMenuDock {
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new VideoAction()); shortCuts.add(new VideoAction());
shortCuts.add(new TutorialAction()); LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new TutorialAction());
}
}, SupportLocaleImpl.TUTORIAL_COMMUNITY);
shortCuts.add(new QuestionAction()); shortCuts.add(new QuestionAction());
shortCuts.add(new TechSolutionAction()); shortCuts.add(new TechSolutionAction());
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new BugAction()); LocaleCenter.buildAction(new LocaleAction() {
shortCuts.add(new NeedAction()); @Override
public void execute() {
shortCuts.add(new BugAction());
}
}, SupportLocaleImpl.BUG);
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new NeedAction());
}
}, SupportLocaleImpl.NEED);
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new BugNeedAction());
}
}, SupportLocaleImpl.BUG_AND_NEED);
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new TechSupportAction());
}
}, SupportLocaleImpl.TECH_SUPPORT_COMMUNITY);
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);

3
designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.vcs.common; package com.fr.design.mainframe.vcs.common;
import com.fr.io.FineEncryptUtils;
import com.fr.base.io.XMLEncryptUtils; import com.fr.base.io.XMLEncryptUtils;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
@ -48,7 +49,7 @@ public class VcsCacheFileNodeFile extends FileNodeFILE {
); );
return envPath.endsWith(".cpt") || envPath.endsWith(".frm") return envPath.endsWith(".cpt") || envPath.endsWith(".frm")
? XMLEncryptUtils.decodeInputStream(in) : in; ? XMLEncryptUtils.decodeInputStream(FineEncryptUtils.decode(in)) : in;
} }

39
designer-base/src/main/java/com/fr/design/os/impl/PopupDialogSaveAction.java

@ -0,0 +1,39 @@
package com.fr.design.os.impl;
import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction;
import java.awt.*;
/**
* linux下超链弹窗等保存问题
*
* @author hades
* @version 10.0
* Created by hades on 2020/7/21
*/
public class PopupDialogSaveAction implements OSBasedAction {
private UIListControlPane currentControlPane;
private Window popupDialog;
@Override
public void execute(Object... objects) {
boolean canSave = OperatingSystem.isLinux() && popupDialog != null && popupDialog.isVisible() && currentControlPane != null;
if (canSave) {
currentControlPane.saveSettings();
}
}
public void register(UIListControlPane currentControlPane, Window popupDialog) {
this.currentControlPane = currentControlPane;
this.popupDialog = popupDialog;
}
public void unregister() {
this.currentControlPane = null;
this.popupDialog = null;
}
}

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

@ -117,6 +117,13 @@ public enum SupportOSImpl implements SupportOS {
public boolean support() { public boolean support() {
return OperatingSystem.isWindows(); return OperatingSystem.isWindows();
} }
},
KOREAN_INPUT {
@Override
public boolean support() {
return OperatingSystem.isWindows();
}
} }
} }

12
designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java

@ -2,8 +2,6 @@ package com.fr.design.os.impl;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.update.ui.dialog.UpdateMainDialog; import com.fr.design.update.ui.dialog.UpdateMainDialog;
import com.fr.design.utils.DesignUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSBasedAction;
/** /**
@ -12,14 +10,10 @@ import com.fr.stable.os.support.OSBasedAction;
* @date 2019/10/9 * @date 2019/10/9
*/ */
public class UpdateDialogAction implements OSBasedAction { public class UpdateDialogAction implements OSBasedAction {
private static String UPDATE_ROUTE = "#management/backup";
@Override @Override
public void execute(Object... objects) { public void execute(Object... objects) {
if(!OperatingSystem.isLinux()) { UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame()); dialog.showDialog();
dialog.showDialog();
}else{
DesignUtils.visitEnvServerByParameters( UPDATE_ROUTE,null,null);
}
} }
} }

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

@ -50,6 +50,10 @@ public interface ParameterDesignerProvider {
void addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex); void addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex);
default int addingAllParameter2EditorWithReturnValue(Parameter[] parameterArray, int currentIndex) {
return 0;
}
JPanel[] toolbarPanes4Form(); JPanel[] toolbarPanes4Form();
JComponent[] toolBarButton4Form(); JComponent[] toolBarButton4Form();

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

@ -11,6 +11,7 @@ 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 com.fr.stable.os.OperatingSystem;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
@ -124,14 +125,20 @@ public class GradientBar extends JComponent implements UIObserver, ColorSelectab
protected void addMouseDragListener() { protected void addMouseDragListener() {
this.addMouseMotionListener(new MouseAdapter() { this.addMouseMotionListener(new MouseAdapter() {
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
int oldIndex = index;
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
if (list.get(i).contains(e.getX(), e.getY())) { if (list.get(i).contains(e.getX(), e.getY())) {
index = i; index = i;
break; break;
} }
} }
if(OperatingSystem.isLinux() && AssistUtils.equals(oldIndex,index)){
if(Math.abs(p1.getX() - e.getX()) > Math.abs(p2.getX() - e.getX())){
index = 1;
}else{
index = 0;
}
}
boolean x = e.getX() <= max && e.getX() >= min; boolean x = e.getX() <= max && e.getX() >= min;
if (x && e.getY() < MAX_VERTICAL) { if (x && e.getY() < MAX_VERTICAL) {
list.get(index).setX(e.getX()); list.get(index).setX(e.getX());

5
designer-base/src/main/java/com/fr/design/update/actions/RecoverForDesigner.java

@ -24,6 +24,8 @@ public class RecoverForDesigner implements Recover {
private final String installHome = StableUtils.getInstallHome(); private final String installHome = StableUtils.getInstallHome();
private static final String HYPHEN = "-";
@Override @Override
public boolean recover() { public boolean recover() {
try{ try{
@ -41,7 +43,8 @@ public class RecoverForDesigner implements Recover {
@Override @Override
public boolean backup() { public boolean backup() {
//jar包备份文件的目录为"backup/"+jar包当前版本号 //jar包备份文件的目录为"backup/"+jar包当前版本号
String todayBackupDir = StableUtils.pathJoin(installHome, UpdateConstants.DESIGNER_BACKUP_DIR, (GeneralUtils.readBuildNO())); String versionBuildNo = GeneralUtils.getVersion() + HYPHEN + GeneralUtils.readBuildNO();
String todayBackupDir = StableUtils.pathJoin(installHome, UpdateConstants.DESIGNER_BACKUP_DIR, versionBuildNo);
String envHome = ProjectLibrary.getInstance().getLibHome(); String envHome = ProjectLibrary.getInstance().getLibHome();
backupFilesFromInstallEnv(envHome, todayBackupDir); backupFilesFromInstallEnv(envHome, todayBackupDir);
backupFilesFromInstallLib(installHome, todayBackupDir); backupFilesFromInstallLib(installHome, todayBackupDir);

2
designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateDialog.java

@ -79,7 +79,7 @@ class DesignerPushUpdateDialog extends UIDialog {
private Model createModel(DesignerUpdateInfo updateInfo) { private Model createModel(DesignerUpdateInfo updateInfo) {
Model model = new Model(); Model model = new Model();
model.setVersion(updateInfo.getLatestVersion()); model.setVersion(updateInfo.getLatestFullVersion());
model.setContent(updateInfo.getPushContent()); model.setContent(updateInfo.getPushContent());
model.setMoreInfoUrl(updateInfo.getMoreInfoUrl()); model.setMoreInfoUrl(updateInfo.getMoreInfoUrl());
model.setBackgroundUrl(updateInfo.getBackgroundUrl()); model.setBackgroundUrl(updateInfo.getBackgroundUrl());

33
designer-base/src/main/java/com/fr/design/update/push/DesignerUpdateInfo.java

@ -1,7 +1,12 @@
package com.fr.design.update.push; package com.fr.design.update.push;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSON;
import com.fr.json.JSONFactory;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.security.InvalidParameterException; import java.security.InvalidParameterException;
@ -14,9 +19,12 @@ class DesignerUpdateInfo {
private static final String KEY_CONTENT = "content"; private static final String KEY_CONTENT = "content";
private static final String KEY_BACKGROUND_URL = "background"; private static final String KEY_BACKGROUND_URL = "background";
private static final String KEY_MORE_INFO_URL = "more"; private static final String KEY_MORE_INFO_URL = "more";
private static final String SPLIT_CHAR = "-";
private final String currentVersion; // 当前版本 private final String currentVersion; // 当前版本
private final String latestVersion; // 最新版本 private final String latestVersion; // 最新版本
private final String latestFullVersion; // 最新版本的完整信息
private final String lastIgnoredVersion; // 最近一次跳过的版本 private final String lastIgnoredVersion; // 最近一次跳过的版本
private final String pushVersion; // 推送版本 private final String pushVersion; // 推送版本
@ -27,6 +35,7 @@ class DesignerUpdateInfo {
DesignerUpdateInfo(String currentVersion, String latestVersion, String lastIgnoredVersion, JSONObject pushData) { DesignerUpdateInfo(String currentVersion, String latestVersion, String lastIgnoredVersion, JSONObject pushData) {
this.currentVersion = currentVersion; this.currentVersion = currentVersion;
this.latestVersion = latestVersion; this.latestVersion = latestVersion;
this.latestFullVersion = initLatestFullVersion();
this.lastIgnoredVersion = lastIgnoredVersion; this.lastIgnoredVersion = lastIgnoredVersion;
this.pushVersion = pushData.optString(KEY_VERSION); this.pushVersion = pushData.optString(KEY_VERSION);
@ -58,6 +67,30 @@ class DesignerUpdateInfo {
return latestVersion; return latestVersion;
} }
String initLatestFullVersion() {
try {
String url = CloudCenter.getInstance().acquireUrlByKind("jar10.new.update");
if (StringUtils.isBlank(url)) {
return StringUtils.EMPTY;
}
String res = HttpToolbox.get(url);
if (StringUtils.isBlank(res)) {
return StringUtils.EMPTY;
}
JSONObject jsonObject = JSONFactory.createJSON(JSON.OBJECT, res);
String version = jsonObject.getString("version");
String build = jsonObject.getString("build");
return version + SPLIT_CHAR + build;
} catch (Throwable e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return StringUtils.EMPTY;
}
String getLatestFullVersion() {
return latestFullVersion;
}
String getLastIgnoredVersion() { String getLastIgnoredVersion() {
return lastIgnoredVersion; return lastIgnoredVersion;
} }

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

@ -29,6 +29,7 @@ import com.fr.general.*;
import com.fr.general.http.HttpToolbox; import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.process.engine.core.FineProcessContext; import com.fr.process.engine.core.FineProcessContext;
import com.fr.process.engine.core.FineProcessEngineEvent; import com.fr.process.engine.core.FineProcessEngineEvent;
@ -80,6 +81,8 @@ public class UpdateMainDialog extends UIDialog {
private static final String UPDATE_CACHE_STATE_FAIL = "fail"; private static final String UPDATE_CACHE_STATE_FAIL = "fail";
private static final String UPDATE_CACHE_STATE_SUCCESS = "success"; private static final String UPDATE_CACHE_STATE_SUCCESS = "success";
private static final String HYPHEN = "-";
private final SimpleDateFormat CHANGELOG_FORMAT = new SimpleDateFormat("M/d/y, h:m:s a", Locale.ENGLISH); private final SimpleDateFormat CHANGELOG_FORMAT = new SimpleDateFormat("M/d/y, h:m:s a", Locale.ENGLISH);
private final SimpleDateFormat UPDATE_INFO_TABLE_FORMAT = new SimpleDateFormat("yyyy.MM.dd"); private final SimpleDateFormat UPDATE_INFO_TABLE_FORMAT = new SimpleDateFormat("yyyy.MM.dd");
@ -303,8 +306,9 @@ public class UpdateMainDialog extends UIDialog {
new UILabel(UpdateConstants.DEFAULT_APP_NAME + StringUtils.BLANK + ProductConstants.VERSION) new UILabel(UpdateConstants.DEFAULT_APP_NAME + StringUtils.BLANK + ProductConstants.VERSION)
); );
String notInstallVersion = InterProviderFactory.getProvider().getLocText("Fine-Core_Basic_About_No_Build");
jarCurrentLabel = new UILabel(StringUtils.isEmpty(GeneralUtils.readBuildNO()) ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_Not_Install_Version") : GeneralUtils.readBuildNO(), SwingConstants.CENTER); String versionBuildNo = GeneralUtils.getVersion() + HYPHEN + GeneralUtils.readBuildNO();
jarCurrentLabel = new UILabel(ComparatorUtils.equals(notInstallVersion, GeneralUtils.readBuildNO()) ? notInstallVersion : versionBuildNo, SwingConstants.CENTER);
UILabel noJarPreviousRevision = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_No_Previous_Version")); UILabel noJarPreviousRevision = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_No_Previous_Version"));
UpdateActionLabel jarRestorePreviousRevision = new UpdateActionLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_Restore"), false); UpdateActionLabel jarRestorePreviousRevision = new UpdateActionLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_Restore"), false);
jarRestorePreviousRevision.setForeground(new Color(RESTORE_LABEL_COLOR)); jarRestorePreviousRevision.setForeground(new Color(RESTORE_LABEL_COLOR));

61
designer-base/src/main/java/com/fr/design/utils/ParameterUtils.java

@ -0,0 +1,61 @@
package com.fr.design.utils;
import com.fr.base.Parameter;
import com.fr.base.ParameterHelper;
import com.fr.general.ComparatorUtils;
import com.fr.stable.ArrayUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
/**
* @Author: Yuan.Wang
* @Date: 2020/8/11
*/
public class ParameterUtils {
/**
* 获得新的参数集合,返回的集合中的参数的顺序为新增参数全部放在后面以保证原有参数的相对顺序
*
* @param paramTexts sql语句
* @param oldParameters 旧的参数集合
* @return 新参数集合
*/
public static Parameter[] analyzeAndUnionParameters(String[] paramTexts, Parameter[] oldParameters) {
Parameter[] newParameters = ParameterHelper.analyze4Parameters(paramTexts, false);
return unionParametersInRelativeOrder(oldParameters, newParameters);
}
/**
* 合并新旧参数集合新增参数全部放在后面以保证原有参数的相对顺序
*
* @param oldParameters 旧的参数集合
* @param newParameters 新的参数集合
* @return 新参数集合
*/
private static Parameter[] unionParametersInRelativeOrder(Parameter[] oldParameters, Parameter[] newParameters) {
if (ArrayUtils.isEmpty(newParameters) || ArrayUtils.isEmpty(oldParameters)) {
return newParameters;
}
Parameter[] result = new Parameter[newParameters.length];
List<Parameter> newParameterList = new ArrayList<>(Arrays.asList(newParameters));
int i = 0;
//遍历旧参数数组中的参数,如果新参数list中存在同名参数,将该参数加入到result里,同时删除list中的同名参数
for (Parameter oldParameter : oldParameters) {
Iterator<Parameter> iterator = newParameterList.listIterator();
while (iterator.hasNext()) {
Parameter newParameter = iterator.next();
if (ComparatorUtils.equals(oldParameter.getName(), newParameter.getName())) {
result[i++] = oldParameter;
iterator.remove();
break;
}
}
}
//将新参数list中的剩余参数添加到result中
System.arraycopy(newParameterList.toArray(new Parameter[0]), 0, result, i, newParameterList.size());
return result;
}
}

7
designer-base/src/main/java/com/fr/env/CheckServiceDialog.java vendored

@ -59,10 +59,13 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
label.setPreferredSize(new Dimension(650,30)); label.setPreferredSize(new Dimension(650,30));
String text = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Local_Designer") + localBranch String text = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Local_Designer") + localBranch
+ Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remote_Server") + remoteBranch; + Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remote_Server") +
Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Is_Old") +
localBranch;
String delimiter = DisplayUtils.getDisplayLength(text) > 70? "<br>":"/"; String delimiter = DisplayUtils.getDisplayLength(text) > 70? "<br>":"/";
JLabel label2 = new JLabel("<html>"+Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Local_Designer") JLabel label2 = new JLabel("<html>"+Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Local_Designer")
+ localBranch + delimiter + Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remote_Server") + remoteBranch+"</html>"); + localBranch + delimiter + Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remote_Server") +
Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Is_Old")+ localBranch +"</html>");
label2.setPreferredSize(new Dimension(600,30)); label2.setPreferredSize(new Dimension(600,30));
JTextPane tipsPane = new JTextPane(); JTextPane tipsPane = new JTextPane();

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

@ -44,6 +44,7 @@ import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.io.File; import java.io.File;
import java.util.function.Supplier;
import static com.fr.design.layout.TableLayout.FILL; import static com.fr.design.layout.TableLayout.FILL;
import static com.fr.design.layout.TableLayout.PREFERRED; import static com.fr.design.layout.TableLayout.PREFERRED;
@ -439,20 +440,29 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
* 设置 app servlet 默认值 * 设置 app servlet 默认值
*/ */
private void setDefaultAppAndServlet() { private void setDefaultAppAndServlet() {
String appName; setWrap(webAppNameInput, () -> FRContext.getCommonOperator().getAppName(), RemoteWorkspaceURL.DEFAULT_WEB_APP_NAME);
String servletName; setWrap(servletNameInput, () -> ServerConfig.getInstance().getServletName(), RemoteWorkspaceURL.DEFAULT_SERVLET_NAME);
try { }
appName = FRContext.getCommonOperator().getAppName();
} catch (Exception ignored) { private void setWrap(final UITextField textField, final Supplier<String> supplier, final String defaultName) {
appName = RemoteWorkspaceURL.DEFAULT_WEB_APP_NAME; new SwingWorker<String, Void>() {
}
try { @Override
servletName = ServerConfig.getInstance().getServletName(); protected String doInBackground() throws Exception {
} catch (Exception ignored) { return supplier.get();
servletName = RemoteWorkspaceURL.DEFAULT_SERVLET_NAME; }
}
webAppNameInput.setText(appName); @Override
servletNameInput.setText(servletName); protected void done() {
String name = defaultName;
try {
name = get();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage() , e);
}
textField.setText(name);
}
}.execute();
} }

3
designer-base/src/main/java/com/fr/file/FileFILE.java

@ -1,5 +1,6 @@
package com.fr.file; package com.fr.file;
import com.fr.io.FineEncryptUtils;
import com.fr.base.io.XMLEncryptUtils; import com.fr.base.io.XMLEncryptUtils;
import com.fr.design.gui.itree.filetree.FileComparator; import com.fr.design.gui.itree.filetree.FileComparator;
import com.fr.design.gui.itree.filetree.FileTreeIcon; import com.fr.design.gui.itree.filetree.FileTreeIcon;
@ -186,7 +187,7 @@ public class FileFILE implements FILE {
public InputStream asInputStream() throws Exception { public InputStream asInputStream() throws Exception {
InputStream in = new java.io.FileInputStream(file); InputStream in = new java.io.FileInputStream(file);
return file.getName().endsWith(".cpt") || file.getName().endsWith(".frm") return file.getName().endsWith(".cpt") || file.getName().endsWith(".frm")
? XMLEncryptUtils.decodeInputStream(EncryptUtils.decodeInputStream(in)) : in; ? XMLEncryptUtils.decodeInputStream(EncryptUtils.decodeInputStream(FineEncryptUtils.decode(in))) : in;
} }
/** /**

3
designer-base/src/main/java/com/fr/file/FileNodeFILE.java

@ -2,6 +2,7 @@ package com.fr.file;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.io.FineEncryptUtils;
import com.fr.base.io.XMLEncryptUtils; import com.fr.base.io.XMLEncryptUtils;
import com.fr.design.file.NodeAuthProcessor; import com.fr.design.file.NodeAuthProcessor;
import com.fr.design.gui.itree.filetree.FileNodeComparator; import com.fr.design.gui.itree.filetree.FileNodeComparator;
@ -388,7 +389,7 @@ public class FileNodeFILE implements FILE {
); );
return envPath.endsWith(".cpt") || envPath.endsWith(".frm") return envPath.endsWith(".cpt") || envPath.endsWith(".frm")
? XMLEncryptUtils.decodeInputStream(EncryptUtils.decodeInputStream(in)) : in; ? XMLEncryptUtils.decodeInputStream(EncryptUtils.decodeInputStream(FineEncryptUtils.decode(in))) : in;
} }
/** /**

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

@ -2,12 +2,18 @@ package com.fr.start.server;
import com.fr.concurrent.NamedThreadFactory; import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.gui.iprogressbar.ProgressDialog; import com.fr.design.gui.iprogressbar.ProgressDialog;
import com.fr.design.i18n.Toolkit;
import com.fr.design.locale.impl.SupportLocaleImpl;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.event.Null; import com.fr.event.Null;
import com.fr.general.FRFont;
import com.fr.general.locale.LocaleAction;
import com.fr.general.locale.LocaleCenter;
import javax.swing.plaf.ColorUIResource;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -27,6 +33,11 @@ public class FineEmbedServerMonitor {
private static final int STEP_HEARTBEAT = 40; private static final int STEP_HEARTBEAT = 40;
private static volatile FineEmbedServerMonitor monitor; private static volatile FineEmbedServerMonitor monitor;
private static ProgressDialog progressBar = DesignerContext.getDesignerFrame().getProgressDialog(); private static ProgressDialog progressBar = DesignerContext.getDesignerFrame().getProgressDialog();
//由于默认值的字体不支持韩文,所以要对韩文单独生成字体
private FRFont font = null;
private static final int FONT_RGB = 333334;
private static final int FONT_SIZE = 14;
private static final String FONT_NAME = "Dialog";
private FineEmbedServerMonitor() { private FineEmbedServerMonitor() {
} }
@ -86,8 +97,15 @@ public class FineEmbedServerMonitor {
} }
if (!DesignerContext.getDesignerFrame().getProgressDialog().isVisible()) { if (!DesignerContext.getDesignerFrame().getProgressDialog().isVisible()) {
DesignerContext.getDesignerFrame().showProgressDialog(); DesignerContext.getDesignerFrame().showProgressDialog();
DesignerContext.getDesignerFrame().getProgressDialog() //如果为韩文则改变字体
.updateLoadingText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Embed_Server")); LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
font = FRFont.getInstance().applySize(FONT_SIZE).applyForeground(new ColorUIResource(FONT_RGB)).applyName(FONT_NAME);
}
}, SupportLocaleImpl.SUPPORT_KOREA);
String text = Toolkit.i18nText("Fine-Design_Basic_Loading_Embed_Server");
DesignerContext.getDesignerFrame().getProgressDialog().updateLoadingText(text, font);
} }
DesignerContext.getDesignerFrame().updateProgress(getProgress()); DesignerContext.getDesignerFrame().updateProgress(getProgress());
} }

BIN
designer-base/src/main/resources/com/fr/design/images/bbs/support.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

2
designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.css

@ -1,6 +1,6 @@
body { body {
padding-left: 30px; padding-left: 30px;
padding-top: 30px; padding-top: 25px;
color: white; color: white;
background-size: 100% 100% !important; background-size: 100% 100% !important;
-moz-background-size: 100% 100% !important; -moz-background-size: 100% 100% !important;

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

@ -22,4 +22,12 @@ public class FormulaPaneTest extends TestCase {
Assert.assertArrayEquals(result, strs); Assert.assertArrayEquals(result, strs);
} }
@Test
public void test4SimilarComparator() {
String[] strs = new String[]{"TESTB", "TESTACD", "Ftest", "Gtest", "TEST"};
String[] result = new String[]{"TEST", "TESTACD", "TESTB", "Ftest", "Gtest"};
Arrays.sort(strs, new FormulaPane.SimilarComparator("test"));
Assert.assertArrayEquals(result, strs);
}
} }

39
designer-base/src/test/java/com/fr/design/mainframe/JFormSliderPaneTest.java

@ -0,0 +1,39 @@
package com.fr.design.mainframe;
import com.fr.invoke.Reflect;
import org.junit.Assert;
import org.junit.Test;
/**
* Created by kerry on 2020-07-28
*/
public class JFormSliderPaneTest {
@Test
public void testGetPreferredValue() {
JFormSliderPane sliderPane = new JFormSliderPane();
int result = Reflect.on(sliderPane).call("getPreferredValue", 100).get();
Assert.assertEquals(100, result);
result = Reflect.on(sliderPane).call("getPreferredValue", 0).get();
Assert.assertEquals(10, result);
result = Reflect.on(sliderPane).call("getPreferredValue", 1000).get();
Assert.assertEquals(400, result);
}
@Test
public void testCalSliderValue() {
JFormSliderPane sliderPane = new JFormSliderPane();
int result = Reflect.on(sliderPane).call("calSliderValue", 10).get();
Assert.assertEquals(0, result);
result = Reflect.on(sliderPane).call("calSliderValue", 90).get();
Assert.assertEquals(44, result);
result = Reflect.on(sliderPane).call("calSliderValue", 100).get();
Assert.assertEquals(50, result);
result = Reflect.on(sliderPane).call("calSliderValue", 200).get();
Assert.assertEquals(66, result);
result = Reflect.on(sliderPane).call("calSliderValue", 400).get();
Assert.assertEquals(100, result);
}
}

38
designer-base/src/test/java/com/fr/design/utils/ParameterUtilsTest.java

@ -0,0 +1,38 @@
package com.fr.design.utils;
import com.fr.base.Parameter;
import junit.framework.TestCase;
/**
* @Author: Yuan.Wang
* @Date: 2020/8/11
*/
public class ParameterUtilsTest extends TestCase {
public void testAnalyzeAndUnionParameters() {
String[] paramTexts = {"${a}${b}${d}", ""};
Parameter[] oldParameters = new Parameter[]{new Parameter("c"), new Parameter("b"), new Parameter("a")};
Parameter[] rightResult = new Parameter[]{new Parameter("b"), new Parameter("a"), new Parameter("d")};
Parameter[] result = ParameterUtils.analyzeAndUnionParameters(paramTexts, oldParameters);
assertEquals(result.length, rightResult.length);
for (int i = 0; i < rightResult.length; i++) {
assertEquals(rightResult[i].getName(), result[i].getName());
}
paramTexts = new String[]{"${a}${b}${d}", ""};
oldParameters = new Parameter[]{};
rightResult = new Parameter[]{new Parameter("a"), new Parameter("b"), new Parameter("d")};
result = ParameterUtils.analyzeAndUnionParameters(paramTexts, oldParameters);
assertEquals(result.length,rightResult.length);
paramTexts = new String[]{"${b}", ""};
oldParameters = new Parameter[]{new Parameter("b"), new Parameter("a"), new Parameter("d")};
rightResult = new Parameter[]{new Parameter("b")};
result = ParameterUtils.analyzeAndUnionParameters(paramTexts, oldParameters);
assertEquals(result.length,rightResult.length);
assertEquals(result.length, rightResult.length);
for (int i = 0; i < rightResult.length; i++) {
assertEquals(rightResult[i].getName(), result[i].getName());
}
}
}

3
designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java

@ -49,6 +49,7 @@ import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.PiePlot4VanChart; import com.fr.plugin.chart.PiePlot4VanChart;
import com.fr.plugin.chart.area.VanChartAreaPlot; import com.fr.plugin.chart.area.VanChartAreaPlot;
import com.fr.plugin.chart.box.VanChartBoxPlot;
import com.fr.plugin.chart.bubble.VanChartBubblePlot; import com.fr.plugin.chart.bubble.VanChartBubblePlot;
import com.fr.plugin.chart.column.VanChartColumnPlot; import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.plugin.chart.custom.VanChartCustomPlot; import com.fr.plugin.chart.custom.VanChartCustomPlot;
@ -79,6 +80,7 @@ import com.fr.stable.StringUtils;
import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider;
import com.fr.van.chart.area.AreaIndependentVanChartInterface; import com.fr.van.chart.area.AreaIndependentVanChartInterface;
import com.fr.van.chart.bar.BarIndependentVanChartInterface; import com.fr.van.chart.bar.BarIndependentVanChartInterface;
import com.fr.van.chart.box.BoxIndependentVanChartInterface;
import com.fr.van.chart.bubble.BubbleIndependentVanChartInterface; import com.fr.van.chart.bubble.BubbleIndependentVanChartInterface;
import com.fr.van.chart.column.VanColumnChartTypeUI; import com.fr.van.chart.column.VanColumnChartTypeUI;
import com.fr.van.chart.custom.CustomIndependentVanChartInterface; import com.fr.van.chart.custom.CustomIndependentVanChartInterface;
@ -202,6 +204,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartWordCloudPlot.WORD_CLOUD_PLOT_ID, new WordCloudIndependentVanChartInterface()); addChartTypeInterface(VAN_CHART_PRIORITY, VanChartWordCloudPlot.WORD_CLOUD_PLOT_ID, new WordCloudIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartGanttPlot.VAN_CHART_GANTT_PLOT_ID, new GanttIndependentVanChartInterface()); addChartTypeInterface(VAN_CHART_PRIORITY, VanChartGanttPlot.VAN_CHART_GANTT_PLOT_ID, new GanttIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartStructurePlot.STRUCTURE_PLOT_ID, new VanStructureChartTypeUI()); addChartTypeInterface(VAN_CHART_PRIORITY, VanChartStructurePlot.STRUCTURE_PLOT_ID, new VanStructureChartTypeUI());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartBoxPlot.VAN_CHART_BOX_PLOT_ID, new BoxIndependentVanChartInterface());
} }

66
designer-chart/src/main/java/com/fr/design/chart/AutoChartIcon.java

@ -1,85 +1,29 @@
package com.fr.design.chart; package com.fr.design.chart;
import com.fr.base.chart.BaseChartPainter; import com.fr.base.chart.BaseChartPainter;
import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.base.chart.result.WebChartIDInfo; import com.fr.base.chart.result.WebChartIDInfo;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import javax.swing.Icon;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
/** /**
* @author Bjorn * @author Bjorn
* @version 10.0 * @version 10.0
* Created by Bjorn on 2020-05-29 * Created by Bjorn on 2020-05-29
*/ */
public class AutoChartIcon implements Icon { public class AutoChartIcon extends ChartIcon {
private static final int WIDTH = 500; private static final int WIDTH = 500;
private static final int HEIGHT = 281; private static final int HEIGHT = 281;
private ChartCollection chartCollection;
private CallbackEvent callbackEvent;
private String chartName;
public AutoChartIcon(ChartCollection chartCollection) { public AutoChartIcon(ChartCollection chartCollection) {
this.chartCollection = chartCollection; super(chartCollection);
initChartName();
}
public ChartCollection getChartCollection() {
return chartCollection;
} }
public String getChartName() {
return chartName;
}
private void initChartName() {
Chart chart = chartCollection.getSelectedChart(Chart.class);
String[] subName = ChartTypeInterfaceManager.getInstance().getSubName(chart.getPlot().getPlotID());
chartName = subName[0];
}
public void registerCallBackEvent(CallbackEvent callbackEvent) {
this.callbackEvent = callbackEvent;
}
/**
* 画出缩略图Icon
*
* @param g 图形的上下文
* @param c 所在的Component
* @param x 缩略图的起始坐标x
* @param y 缩略图的起始坐标y
*/
@Override @Override
public void paintIcon(Component c, Graphics g, int x, int y) { protected BaseChartPainter getChartPainter() {
BaseChartPainter painter = getChartCollection().createResultChartPainterWithOutDealFormula(Calculator.createCalculator(),
BaseChartPainter painter = chartCollection.createResultChartPainterWithOutDealFormula(Calculator.createCalculator(),
WebChartIDInfo.createAutoTypeInfo(), getIconWidth(), getIconHeight()); WebChartIDInfo.createAutoTypeInfo(), getIconWidth(), getIconHeight());
return painter;
int resolution = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getJTemplateResolution();
Graphics2D g2d = (Graphics2D) g;
Paint oldPaint = g2d.getPaint();
g.translate(x, y);
g2d.setPaint(Color.white);
g2d.fillRect(0, 0, getIconWidth(), getIconHeight());
painter.paint(g2d, getIconWidth(), getIconHeight(), resolution, null, callbackEvent);
g.translate(-x, -y);
g2d.setPaint(oldPaint);
} }
/** /**

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

@ -6,9 +6,7 @@ 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.HistoryTemplateListCache; 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.ChartHyperlinkGroup; import com.fr.design.module.ChartHyperlinkGroup;
import com.fr.design.module.ChartPreStyleAction;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.form.ui.ChartEditor; import com.fr.form.ui.ChartEditor;
import com.fr.locale.InterMutableKey; import com.fr.locale.InterMutableKey;
@ -20,7 +18,6 @@ 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;
import com.fr.van.chart.map.server.ChartMapEditorAction;
/** /**
* Created by juhaoyu on 2018/6/27. * Created by juhaoyu on 2018/6/27.
@ -43,10 +40,6 @@ public class ChartDesignerActivator extends Activator implements Prepare {
DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class); DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class);
ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction());
ActionFactory.registerChartEmptyDataStyleAction(new ChartEmptyDataStyleAction());
ActionFactory.registerChartMapEditorAction(new ChartMapEditorAction());
ActionFactory.registerChartCollection(ChartCollection.class); ActionFactory.registerChartCollection(ChartCollection.class);
DesignModuleFactory.registerExtraWidgetOptions(ChartTypeInterfaceManager.initWidgetOption()); DesignModuleFactory.registerExtraWidgetOptions(ChartTypeInterfaceManager.initWidgetOption());

89
designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java

@ -1,8 +1,13 @@
package com.fr.design.chart; package com.fr.design.chart;
import com.fr.base.GraphHelper; import com.fr.base.chart.BaseChartPainter;
import com.fr.general.IOUtils; import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.stable.Constants; import com.fr.base.chart.result.WebChartIDInfo;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.script.Calculator;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLable; import com.fr.stable.xml.XMLable;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
@ -13,7 +18,6 @@ import java.awt.Component;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Paint; import java.awt.Paint;
import java.awt.image.BufferedImage;
/** /**
* 图表的缩略图Icon, 在选择图表类型界面 用到. * 图表的缩略图Icon, 在选择图表类型界面 用到.
@ -21,21 +25,47 @@ import java.awt.image.BufferedImage;
public class ChartIcon implements Icon, XMLable { public class ChartIcon implements Icon, XMLable {
private static final int WIDTH = 400; private static final int WIDTH = 400;
private static final int HEIGHT = 225; private static final int HEIGHT = 225;
/**
* 缩略图中的图片路径
*/ private ChartCollection chartCollection;
private String imagePath; private CallbackEvent callbackEvent;
private String chartName; private String chartName;
/** /**
* 构造Chart的缩略图Icon * 构造Chart的缩略图Icon
*/ */
public ChartIcon(String imagePath, String chartName) { public ChartIcon(ChartCollection chartCollection) {
this.imagePath = imagePath; this.chartCollection = chartCollection;
initChartName();
}
public ChartCollection getChartCollection() {
return chartCollection;
}
public String getChartName() {
return chartName;
}
public void setChartCollection(ChartCollection chartCollection) {
this.chartCollection = chartCollection;
}
public void setChartName(String chartName) {
this.chartName = chartName; this.chartName = chartName;
} }
private void initChartName() {
ChartProvider chart = chartCollection.getSelectedChartProvider(ChartProvider.class);
String[] subName = ChartTypeInterfaceManager.getInstance().getSubName(chart.getID());
chartName = subName[0];
}
public void registerCallBackEvent(CallbackEvent callbackEvent) {
this.callbackEvent = callbackEvent;
}
/** /**
* 画出缩略图Icon * 画出缩略图Icon
* *
@ -47,21 +77,29 @@ public class ChartIcon implements Icon, XMLable {
@Override @Override
public void paintIcon(Component c, Graphics g, int x, int y) { public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2d = (Graphics2D) g; BaseChartPainter chartPainter = getChartPainter();
Paint oldPaint = g2d.getPaint(); int resolution = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getJTemplateResolution();
Graphics2D g2d = (Graphics2D) g;
Paint oldPaint = g2d.getPaint();
g.translate(x, y); g.translate(x, y);
g2d.setPaint(Color.white); g2d.setPaint(Color.white);
g2d.fillRect(0, 0, getIconWidth(), getIconHeight()); g2d.fillRect(0, 0, getIconWidth(), getIconHeight());
BufferedImage demoImage = IOUtils.readImageWithCache(imagePath);
GraphHelper.paintImage(g, getIconWidth(), getIconHeight(), demoImage, Constants.IMAGE_ADJUST, Constants.NULL, Constants.NULL, -1, -1); chartPainter.paint(g2d, getIconWidth(), getIconHeight(), resolution, null, callbackEvent);
g.translate(-x, -y); g.translate(-x, -y);
g2d.setPaint(oldPaint); g2d.setPaint(oldPaint);
} }
protected BaseChartPainter getChartPainter() {
BaseChartPainter painter = chartCollection.createResultChartPainterWithOutDealFormula(Calculator.createCalculator(),
WebChartIDInfo.createEmptyDesignerInfo(), getIconWidth(), getIconHeight());
return painter;
}
/** /**
* 返回缩略图的宽度 * 返回缩略图的宽度
* *
@ -83,20 +121,6 @@ public class ChartIcon implements Icon, XMLable {
} }
/**
* 返回缩略图中的图片路径
*
* @return 缩略图中的图片路径
*/
public String getImagePath() {
return imagePath;
}
public String getChartName() {
return chartName;
}
@Override @Override
public void readXML(XMLableReader reader) { public void readXML(XMLableReader reader) {
//do nothing //do nothing
@ -114,8 +138,11 @@ public class ChartIcon implements Icon, XMLable {
@Override @Override
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
ChartIcon cloned = (ChartIcon) super.clone(); ChartIcon cloned = (ChartIcon) super.clone();
cloned.imagePath = this.imagePath; if (getChartCollection() != null) {
cloned.chartName = this.chartName; cloned.setChartCollection(this.getChartCollection());
}
cloned.setChartName(this.getChartName());
;
return cloned; return cloned;
} }

30
designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java

@ -3,6 +3,7 @@ package com.fr.design.chart;
* the Pane of the Chart * the Pane of the Chart
*/ */
import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider; import com.fr.chartx.attr.ChartProvider;
@ -12,7 +13,6 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.mainframe.chart.info.ChartInfoCollector;
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.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListCellRenderer;
@ -23,10 +23,12 @@ import javax.swing.JSplitPane;
import javax.swing.ListCellRenderer; import javax.swing.ListCellRenderer;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
public class ChartTypePane extends ChartCommonWizardPane { public class ChartTypePane extends ChartCommonWizardPane implements CallbackEvent {
private static final long serialVersionUID = -1175602484968520546L; private static final long serialVersionUID = -1175602484968520546L;
private String[] chartIDs = ChartTypeManager.getInstanceWithCheck().getAllChartIDs(); private String[] chartIDs = ChartTypeManager.getInstanceWithCheck().getAllChartIDs();
@ -35,6 +37,8 @@ public class ChartTypePane extends ChartCommonWizardPane {
private JList iconViewList = null; private JList iconViewList = null;
private DefaultListModel iconListModel = null; private DefaultListModel iconListModel = null;
private static Map<ChartProvider, ChartProvider> map = new ConcurrentHashMap();
public ChartTypePane() { public ChartTypePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
DefaultListModel defaultListModel = new DefaultListModel(); DefaultListModel defaultListModel = new DefaultListModel();
@ -96,14 +100,21 @@ public class ChartTypePane extends ChartCommonWizardPane {
int main_index = mainTypeList.getSelectedIndex(); int main_index = mainTypeList.getSelectedIndex();
String id = ChartTypePane.this.chartIDs[main_index]; String id = ChartTypePane.this.chartIDs[main_index];
String[] demoImagePath = ChartTypeInterfaceManager.getInstance().getDemoImagePath(id); ChartProvider[] charts = ChartTypeManager.getInstance().getCharts(id);
String[] subName = ChartTypeInterfaceManager.getInstance().getSubName(id); String[] subName = ChartTypeInterfaceManager.getInstance().getSubName(id);
ChartTypePane.this.iconListModel.clear(); ChartTypePane.this.iconListModel.clear();
for (int i = 0, len = subName.length; i < len; i++) { for (int i = 0, len = charts.length; i < len; i++) {
String ImagePath = demoImagePath.length > i ? demoImagePath[i] : StringUtils.EMPTY; ChartProvider chart = charts[i];
String chartName = subName[i]; if (map.get(chart) == null) {
ChartTypePane.this.iconListModel.addElement(new ChartIcon(ImagePath, chartName)); ChartProvider chartProvider = chart.transformProperties();
map.put(chart, chartProvider);
}
ChartCollection chartCollection = new ChartCollection(map.get(chart));
ChartIcon chartIcon = new ChartIcon(chartCollection);
chartIcon.setChartName(subName[i]);
chartIcon.registerCallBackEvent(ChartTypePane.this);
ChartTypePane.this.iconListModel.addElement(chartIcon);
} }
iconViewList.setSelectedIndex(0); iconViewList.setSelectedIndex(0);
} }
@ -144,4 +155,9 @@ public class ChartTypePane extends ChartCommonWizardPane {
update(chart4Update); update(chart4Update);
} }
@Override
public void callback() {
this.repaint();
}
} }

31
designer-chart/src/main/java/com/fr/design/chart/auto/AutoTypeCalculate.java

@ -22,6 +22,8 @@ import com.fr.stable.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* @author Bjorn * @author Bjorn
@ -30,6 +32,15 @@ import java.util.List;
*/ */
public class AutoTypeCalculate { public class AutoTypeCalculate {
public static Pattern[] dataPatterns;
static {
Pattern pattern1 = Pattern.compile("^(19|20)\\d{2}$");
Pattern pattern2 = Pattern.compile("^\\d{4}(0?[1-9]|1[012])$");
Pattern pattern3 = Pattern.compile("^\\d{4}(0?[1-9]|1[012])(0?[1-9]|[12]\\d|3[01])$");
dataPatterns = new Pattern[]{pattern1, pattern2, pattern3};
}
public static List<VanChart> calculateType(String tableName, List<String> columns) { public static List<VanChart> calculateType(String tableName, List<String> columns) {
List<ColumnInfo> columnValue = calculateField(tableName, columns); List<ColumnInfo> columnValue = calculateField(tableName, columns);
if (columnValue.isEmpty()) { if (columnValue.isEmpty()) {
@ -86,9 +97,29 @@ public class AutoTypeCalculate {
return false; return false;
} }
} }
//不是日期型数字才是指标
return !isNumberData(values);
}
private static boolean isNumberData(List<String> values) {
for (String value : values) {
if (!isNumberData(value)) {
return false;
}
}
return true; return true;
} }
private static boolean isNumberData(String value) {
for (Pattern pattern : dataPatterns) {
Matcher matcher = pattern.matcher(value);
if (matcher.matches()) {
return true;
}
}
return false;
}
private static List<ColumnInfo> calculateField(String tableName, List<String> columns) { private static List<ColumnInfo> calculateField(String tableName, List<String> columns) {
NameTableData nameTableData = new NameTableData(tableName); NameTableData nameTableData = new NameTableData(tableName);
TableDataSource dataSource = TableDataSourceTailor.extractTableData(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget()); TableDataSource dataSource = TableDataSourceTailor.extractTableData(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget());

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

@ -1,19 +1,18 @@
package com.fr.design.chartx.component; package com.fr.design.chartx.component;
import com.fr.data.util.function.AbstractDataFunction; import com.fr.data.util.function.AbstractDataFunction;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.chartx.component.correlation.AbstractCorrelationPane; import com.fr.design.chartx.component.correlation.AbstractCorrelationPane;
import com.fr.design.chartx.component.correlation.CalculateComboBoxEditorComponent; import com.fr.design.chartx.component.correlation.CalculateComboBoxEditorComponent;
import com.fr.design.chartx.component.correlation.FieldEditorComponentWrapper; import com.fr.design.chartx.component.correlation.FieldEditorComponentWrapper;
import com.fr.design.chartx.component.correlation.UIComboBoxEditorComponent; import com.fr.design.chartx.component.correlation.UIComboBoxEditorComponent;
import com.fr.design.chartx.component.correlation.UITextFieldEditorComponent; import com.fr.design.chartx.component.correlation.UITextFieldEditorComponent;
import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.gui.ibutton.UIButtonGroup;
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.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper; import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper;
import com.fr.extended.chart.UIComboBoxWithNone; import com.fr.extended.chart.UIComboBoxWithNone;
@ -22,19 +21,25 @@ import com.fr.stable.StringUtils;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.util.ArrayList; import javax.swing.event.ChangeEvent;
import java.util.List; import javax.swing.event.ChangeListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
/** /**
* Created by shine on 2018/9/12. * Created by shine on 2018/9/12.
* 系列名使用字段名or字段值的抽象的pane 支持多种属性结构的存取 * 系列名使用字段名or字段值的抽象的pane 支持多种属性结构的存取
*/ */
public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<T> { public abstract class AbstractCustomFieldComboBoxPane<T> extends BasicBeanPane<T> {
private UIButtonGroup<Boolean> nameOrValue;
private JPanel cardPane;
private CardLayout cardLayout;
private AbstractUseFieldValuePane useFieldValuePane; private AbstractUseFieldValuePane useFieldValuePane;
@ -42,73 +47,43 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
private List<String> fieldList = new ArrayList<String>(); private List<String> fieldList = new ArrayList<String>();
@Override public AbstractCustomFieldComboBoxPane() {
protected void initLayout() {
this.setLayout(new BorderLayout(0, 6));
JPanel northPane = new JPanel(new BorderLayout());
northPane.add(jcb, BorderLayout.CENTER);
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"));
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, 20));
northPane.add(label, BorderLayout.WEST);
this.add(northPane, BorderLayout.NORTH);
this.add(cardPane, BorderLayout.CENTER);
}
@Override
protected List<FurtherBasicBeanPane<? extends T>> initPaneList() {
useFieldValuePane = createUseFieldValuePane(); useFieldValuePane = createUseFieldValuePane();
customFieldNamePane = createCustomFieldNamePane(); customFieldNamePane = createCustomFieldNamePane();
List<FurtherBasicBeanPane<? extends T>> list = new ArrayList<FurtherBasicBeanPane<? extends T>>();
list.add(useFieldValuePane);
list.add(paneWrapper());
return list;
}
private FurtherBasicBeanPane<? extends T> paneWrapper() { nameOrValue = new UIButtonGroup<Boolean>(
FurtherBasicBeanPane pane = new FurtherBasicBeanPane() { new String[]{useFieldValuePane.title4PopupWindow(), customFieldNamePane.title4PopupWindow()},
new Boolean[]{false, true});
nameOrValue.setSelectedItem(false);
nameOrValue.addChangeListener(new ChangeListener() {
@Override @Override
public String title4PopupWindow() { public void stateChanged(ChangeEvent e) {
return Toolkit.i18nText("Fine-Design_Chart_Enable_Field_Name"); checkCardPane();
} }
});
JPanel northPane = DataLayoutHelper.createDataLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"), nameOrValue);
@Override cardLayout = new CardLayout();
public boolean accept(Object ob) { cardPane = new JPanel(cardLayout);
return false; cardPane.add(useFieldValuePane, useFieldValuePane.title4PopupWindow());
} cardPane.add(customFieldNamePane, customFieldNamePane.title4PopupWindow());
@Override
public void reset() {
}
@Override this.setLayout(new BorderLayout(0, 6));
public void populateBean(Object ob) { this.add(northPane, BorderLayout.NORTH);
} this.add(cardPane, BorderLayout.CENTER);
@Override
public Object updateBean() {
return null;
}
};
pane.setLayout(new BorderLayout(0, 6));
pane.add(customFieldNamePane, BorderLayout.CENTER);
return pane;
} }
protected abstract AbstractUseFieldValuePane createUseFieldValuePane(); protected abstract AbstractUseFieldValuePane createUseFieldValuePane();
protected abstract AbstractCustomFieldNamePane createCustomFieldNamePane(); protected abstract AbstractCustomFieldNamePane createCustomFieldNamePane();
@Override
protected String title4PopupWindow() {
return StringUtils.EMPTY;
}
protected boolean valueComboBoxHasNone() { protected boolean valueComboBoxHasNone() {
return false; return false;
} }
public void checkBoxUse(boolean hasUse) { public void checkBoxUse(boolean hasUse) {
jcb.setEnabled(hasUse); nameOrValue.setEnabled(hasUse);
useFieldValuePane.checkBoxUse(hasUse); useFieldValuePane.checkBoxUse(hasUse);
} }
@ -122,6 +97,19 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
fieldList = columnNameList; fieldList = columnNameList;
} }
private void checkCardPane() {
cardLayout.show(cardPane, nameOrValue.getSelectedItem() ? customFieldNamePane.title4PopupWindow() : useFieldValuePane.title4PopupWindow());
}
protected void populateNameOrValue(boolean b) {
nameOrValue.setSelectedItem(b);
checkCardPane();
}
protected boolean updateNameOrValue() {
return nameOrValue.getSelectedItem();
}
protected void populateCustomFieldNamePane(T t) { protected void populateCustomFieldNamePane(T t) {
customFieldNamePane.populateBean(t); customFieldNamePane.populateBean(t);
} }
@ -138,6 +126,16 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
useFieldValuePane.updateBean(t); useFieldValuePane.updateBean(t);
} }
@Override
public T updateBean() {
return null;
}
@Override
protected String title4PopupWindow() {
return null;
}
protected abstract class AbstractUseFieldValuePane extends FurtherBasicBeanPane<T> { protected abstract class AbstractUseFieldValuePane extends FurtherBasicBeanPane<T> {
private UIComboBox series; private UIComboBox series;
private UIComboBox value; private UIComboBox value;
@ -169,11 +167,7 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), function}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), function},
}; };
double p = TableLayout.PREFERRED; JPanel panel = DataLayoutHelper.createDataLayoutPane(components);
double[] columnSize = {78, 122};
double[] rowSize = {p, p, p};
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout(0, 6)); this.setLayout(new BorderLayout(0, 6));
this.add(panel, BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
@ -258,5 +252,10 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
protected Object[] createLine() { protected Object[] createLine() {
return new String[]{StringUtils.EMPTY, StringUtils.EMPTY, Toolkit.i18nText("Fine-Design_Chart_Use_None")}; return new String[]{StringUtils.EMPTY, StringUtils.EMPTY, Toolkit.i18nText("Fine-Design_Chart_Use_None")};
} }
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Chart_Enable_Field_Name");
}
} }
} }

12
designer-chart/src/main/java/com/fr/design/chartx/component/SeriesValueFieldComboBoxPane.java

@ -27,23 +27,21 @@ public class SeriesValueFieldComboBoxPane extends AbstractCustomFieldComboBoxPan
@Override @Override
public void populateBean(SeriesValueCorrelationDefinition ob) { public void populateBean(SeriesValueCorrelationDefinition ob) {
populateNameOrValue(ob.isCustomFieldValue());
if (ob.isCustomFieldValue()) { if (ob.isCustomFieldValue()) {
populateCustomFieldNamePane(ob); populateCustomFieldNamePane(ob);
jcb.setSelectedIndex(1);
} else { } else {
populateUseFieldValuePane(ob); populateUseFieldValuePane(ob);
jcb.setSelectedIndex(0);
} }
} }
@Override @Override
public void updateBean(SeriesValueCorrelationDefinition ob) { public void updateBean(SeriesValueCorrelationDefinition ob) {
if (jcb.getSelectedIndex() == 0) { ob.setCustomFieldValue(updateNameOrValue());
ob.setCustomFieldValue(false); if (ob.isCustomFieldValue()) {
updateUseFieldValuePane(ob);
} else {
ob.setCustomFieldValue(true);
updateCustomFieldNamePane(ob); updateCustomFieldNamePane(ob);
} else {
updateUseFieldValuePane(ob);
} }
} }

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

@ -52,7 +52,7 @@ public class ColorSchemeComboBox extends UIComboBox {
this.setRenderer(new ColorSchemeCellRenderer()); this.setRenderer(new ColorSchemeCellRenderer());
} }
private Map<String, ColorInfo> getColorSchemesFromConfig() { protected Map<String, ColorInfo> getColorSchemesFromConfig() {
Map<String, ColorInfo> colorSchemes = new LinkedHashMap<>(); Map<String, ColorInfo> colorSchemes = new LinkedHashMap<>();
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance(); ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
@ -92,7 +92,14 @@ public class ColorSchemeComboBox extends UIComboBox {
} }
public void refresh() { public void refresh() {
this.colorSchemes = getColorSchemesFromConfig(); refresh(null);
}
public void refresh(Map<String, ColorInfo> colorSchemes) {
if (colorSchemes == null) {
colorSchemes = getColorSchemesFromConfig();
}
this.colorSchemes = colorSchemes;
this.setModel(new DefaultComboBoxModel(colorSchemes.keySet().toArray())); this.setModel(new DefaultComboBoxModel(colorSchemes.keySet().toArray()));
} }
@ -149,7 +156,7 @@ public class ColorSchemeComboBox extends UIComboBox {
return colorSchemes.keySet(); return colorSchemes.keySet();
} }
public class ColorInfo { public static class ColorInfo {
private List<Color> colors; private List<Color> colors;

69
designer-chart/src/main/java/com/fr/design/chartx/data/DataLayoutHelper.java

@ -0,0 +1,69 @@
package com.fr.design.chartx.data;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.Component;
import java.util.Arrays;
/**
* @author shine
* @version 10.0
* Created by shine on 2020/7/22
*/
public class DataLayoutHelper {
public static int WIDTH = 150;
public static int LABEL_HEIGHT = 20;
public static int LABEL_WIDTH = 65;
public static int LEFT_GAP = 15;
public static int RIGHT_GAP = 10;
public static void setWIDTH(int WIDTH) {
DataLayoutHelper.WIDTH = WIDTH;
}
public static void setLabelHeight(int labelHeight) {
LABEL_HEIGHT = labelHeight;
}
public static void setLabelWidth(int labelWidth) {
LABEL_WIDTH = labelWidth;
}
public static void setLeftGap(int leftGap) {
LEFT_GAP = leftGap;
}
public static void setRightGap(int rightGap) {
RIGHT_GAP = rightGap;
}
public static JPanel createDataLayoutPane(Component[][] components) {
int len = components.length;
double p = TableLayout.PREFERRED;
double[] columnSize = {DataLayoutHelper.LABEL_WIDTH, DataLayoutHelper.WIDTH};
double[] rowSize = new double[len];
Arrays.fill(rowSize, p);
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}
public static JPanel createDataLayoutPane(String label, Component component) {
Component[][] components = new Component[][]{
new Component[]{new UILabel(label, SwingConstants.LEFT), component}
};
return createDataLayoutPane(components);
}
public static void addNormalBorder(JComponent component) {
component.setBorder(BorderFactory.createEmptyBorder(0, DataLayoutHelper.LEFT_GAP, 0, DataLayoutHelper.RIGHT_GAP));
}
}

15
designer-chart/src/main/java/com/fr/design/chartx/data/map/AbstractAreaLngLatPane.java

@ -1,18 +1,15 @@
package com.fr.design.chartx.data.map; package com.fr.design.chartx.data.map;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.util.Arrays;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Component; import java.awt.Component;
@ -67,8 +64,10 @@ public abstract class AbstractAreaLngLatPane extends JPanel {
locationType.setSelectedIndex(0); locationType.setSelectedIndex(0);
JPanel northPane = DataLayoutHelper.createDataLayoutPane(Toolkit.i18nText("FR-Plugin_Design_Geographic_Location"), locationType);
this.setLayout(new BorderLayout(0, 6)); this.setLayout(new BorderLayout(0, 6));
this.add(locationType, BorderLayout.NORTH); this.add(northPane, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
} }
@ -103,12 +102,8 @@ public abstract class AbstractAreaLngLatPane extends JPanel {
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), fieldComponents[i]}; components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), fieldComponents[i]};
} }
double p = TableLayout.PREFERRED;
double[] columnSize = {ChartDataPane.LABEL_WIDTH, 122};
double[] rowSize = new double[len];
Arrays.fill(rowSize, p);
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 6); return DataLayoutHelper.createDataLayoutPane(components);
} }
} }

1
designer-chart/src/main/java/com/fr/design/chartx/data/map/MapChartDataPane.java

@ -38,6 +38,7 @@ public class MapChartDataPane extends AbstractChartDataPane<MapChartDataDefiniti
VanChartMapPlot mapPlot = this.getVanChart().getPlot(); VanChartMapPlot mapPlot = this.getVanChart().getPlot();
mapType = mapPlot == null ? mapType : mapPlot.getMapType(); mapType = mapPlot == null ? mapType : mapPlot.getMapType();
} }
AreaMapDataSetFieldsPane areaMapDataSetFieldsPane; AreaMapDataSetFieldsPane areaMapDataSetFieldsPane;
PointMapDataSetFieldsPane pointMapDataSetFieldsPane; PointMapDataSetFieldsPane pointMapDataSetFieldsPane;
LineMapDataSetFieldsPane lineMapDataSetFieldsPane; LineMapDataSetFieldsPane lineMapDataSetFieldsPane;

15
designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractCellDataFieldsPane.java

@ -3,17 +3,13 @@ package com.fr.design.chartx.fields;
import com.fr.chartx.data.field.AbstractColumnFieldCollection; import com.fr.chartx.data.field.AbstractColumnFieldCollection;
import com.fr.chartx.data.field.ColumnField; import com.fr.chartx.data.field.ColumnField;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.util.Arrays;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
@ -46,8 +42,6 @@ public abstract class AbstractCellDataFieldsPane<T extends AbstractColumnFieldCo
if (south != null) { if (south != null) {
this.add(south, BorderLayout.SOUTH); this.add(south, BorderLayout.SOUTH);
} }
this.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
} }
protected JPanel createCenterPane() { protected JPanel createCenterPane() {
@ -65,12 +59,7 @@ public abstract class AbstractCellDataFieldsPane<T extends AbstractColumnFieldCo
components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), formulaPanes[i]}; components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), formulaPanes[i]};
} }
double p = TableLayout.PREFERRED; return DataLayoutHelper.createDataLayoutPane(components);
double[] columnSize = {ChartDataPane.LABEL_WIDTH, 122};
double[] rowSize = new double[len];
Arrays.fill(rowSize, p);
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 6);
} }

15
designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractDataSetFieldsPane.java

@ -4,25 +4,21 @@ import com.fr.chartx.data.field.AbstractColumnFieldCollection;
import com.fr.chartx.data.field.ColumnField; import com.fr.chartx.data.field.ColumnField;
import com.fr.data.util.function.AbstractDataFunction; import com.fr.data.util.function.AbstractDataFunction;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chartx.data.DataLayoutHelper;
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.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper; import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.util.Arrays;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.List;
import static com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper.refreshBoxItems; import static com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper.refreshBoxItems;
@ -49,7 +45,6 @@ public abstract class AbstractDataSetFieldsPane<T extends AbstractColumnFieldCol
protected void initComponents() { protected void initComponents() {
this.setLayout(new BorderLayout(0, 6)); this.setLayout(new BorderLayout(0, 6));
this.setBorder(BorderFactory.createEmptyBorder(6, 24, 0, 15));
JPanel north = createNorthPane(), JPanel north = createNorthPane(),
center = createCenterPane(), center = createCenterPane(),
@ -86,12 +81,8 @@ public abstract class AbstractDataSetFieldsPane<T extends AbstractColumnFieldCol
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), fieldComponents[i]}; components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), fieldComponents[i]};
} }
double p = TableLayout.PREFERRED;
double[] columnSize = {ChartDataPane.LABEL_WIDTH, 122};
double[] rowSize = new double[len];
Arrays.fill(rowSize, p);
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 6); return DataLayoutHelper.createDataLayoutPane(components);
} }
protected JPanel createSouthPane() { protected JPanel createSouthPane() {

7
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MapDataSetFieldsPane.java

@ -5,23 +5,24 @@ import com.fr.base.Utils;
import com.fr.chartx.TwoTuple; import com.fr.chartx.TwoTuple;
import com.fr.chartx.data.field.diff.ColumnFieldCollectionWithSeriesValue; import com.fr.chartx.data.field.diff.ColumnFieldCollectionWithSeriesValue;
import com.fr.design.chartx.component.MapAreaMatchPane; import com.fr.design.chartx.component.MapAreaMatchPane;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.DialogActionListener;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.plugin.chart.map.data.MapMatchResult;
import com.fr.plugin.chart.map.VanChartMapPlot; import com.fr.plugin.chart.map.VanChartMapPlot;
import com.fr.plugin.chart.map.data.MapMatchResult;
import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; import com.fr.plugin.chart.map.server.ChartGEOJSONHelper;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import java.util.Set;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.Set;
/** /**
* @author Bjorn * @author Bjorn
@ -53,7 +54,7 @@ public abstract class MapDataSetFieldsPane<T extends ColumnFieldCollectionWithSe
public JPanel createAreaPanel(final UIComboBox areaBox) { public JPanel createAreaPanel(final UIComboBox areaBox) {
JPanel areaPanel = new JPanel(new BorderLayout(10, 0)); JPanel areaPanel = new JPanel(new BorderLayout(10, 0));
areaBox.setPreferredSize(new Dimension(91, 20)); areaBox.setPreferredSize(new Dimension(DataLayoutHelper.WIDTH - 10 - 20, DataLayoutHelper.LABEL_HEIGHT));
areaPanel.add(areaBox, BorderLayout.WEST); areaPanel.add(areaBox, BorderLayout.WEST);
UIButton uiButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png")); UIButton uiButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png"));
uiButton.addActionListener(new ActionListener() { uiButton.addActionListener(new ActionListener() {

2
designer-chart/src/main/java/com/fr/design/chartx/single/CellDataPane.java

@ -2,6 +2,7 @@ package com.fr.design.chartx.single;
import com.fr.chartx.data.CellDataDefinition; import com.fr.chartx.data.CellDataDefinition;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.chartx.fields.AbstractCellDataFieldsPane; import com.fr.design.chartx.fields.AbstractCellDataFieldsPane;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -23,6 +24,7 @@ public class CellDataPane extends FurtherBasicBeanPane<CellDataDefinition> {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(cellDataFieldsPane, BorderLayout.CENTER); this.add(cellDataFieldsPane, BorderLayout.CENTER);
DataLayoutHelper.addNormalBorder(this);
} }
@Override @Override

30
designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java

@ -3,25 +3,20 @@ package com.fr.design.chartx.single;
import com.fr.chartx.data.DataSetDefinition; import com.fr.chartx.data.DataSetDefinition;
import com.fr.data.impl.NameTableData; import com.fr.data.impl.NameTableData;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.chartx.fields.AbstractDataSetFieldsPane; import com.fr.design.chartx.fields.AbstractDataSetFieldsPane;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane; import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane;
import com.fr.design.utils.gui.UIComponentUtils;
import java.util.List; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.util.List;
/** /**
* Created by shine on 2019/5/21. * Created by shine on 2019/5/21.
*/ */
public class DataSetPane extends FurtherBasicBeanPane<DataSetDefinition> { public class DataSetPane extends FurtherBasicBeanPane<DataSetDefinition> {
private static final int TABLE_DATA_LABEL_LINE_WRAP_WIDTH = 65;
private static final int TABLE_DATA_PANE_WIDTH = 246;
private DatabaseTableDataPane tableDataPane; private DatabaseTableDataPane tableDataPane;
@ -32,24 +27,27 @@ public class DataSetPane extends FurtherBasicBeanPane<DataSetDefinition> {
} }
private void initComps(AbstractDataSetFieldsPane dataSetFieldsPane) { private void initComps(AbstractDataSetFieldsPane dataSetFieldsPane) {
UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Table_Data")); tableDataPane = new DatabaseTableDataPane(null) {
UIComponentUtils.setLineWrap(label, TABLE_DATA_LABEL_LINE_WRAP_WIDTH);
UIComponentUtils.setPreferedWidth(label, ChartDataPane.LABEL_WIDTH);
tableDataPane = new DatabaseTableDataPane(label) {
@Override @Override
protected void userEvent() { protected void userEvent() {
refreshBoxListAndTableName(); refreshBoxListAndTableName();
checkBoxUse(); checkBoxUse();
} }
@Override
protected void setBorder() {
}
}; };
tableDataPane.setPreferredSize(new Dimension(TABLE_DATA_PANE_WIDTH, tableDataPane.getPreferredSize().height));
this.dataSetFieldsPane = dataSetFieldsPane; this.dataSetFieldsPane = dataSetFieldsPane;
this.setLayout(new BorderLayout()); JPanel northPane = DataLayoutHelper.createDataLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Table_Data"), tableDataPane);
this.add(tableDataPane, BorderLayout.NORTH); this.setLayout(new BorderLayout(0, 6));
this.add(northPane, BorderLayout.NORTH);
this.add(dataSetFieldsPane, BorderLayout.CENTER); this.add(dataSetFieldsPane, BorderLayout.CENTER);
DataLayoutHelper.addNormalBorder(this);
checkBoxUse(); checkBoxUse();
} }

22
designer-chart/src/main/java/com/fr/design/chartx/single/SingleDataPane.java

@ -3,28 +3,22 @@ package com.fr.design.chartx.single;
import com.fr.chartx.data.AbstractDataDefinition; import com.fr.chartx.data.AbstractDataDefinition;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.chartx.fields.AbstractCellDataFieldsPane; import com.fr.design.chartx.fields.AbstractCellDataFieldsPane;
import com.fr.design.chartx.fields.AbstractDataSetFieldsPane; import com.fr.design.chartx.fields.AbstractDataSetFieldsPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.UIComponentUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.awt.BorderLayout;
/** /**
* Created by shine on 2019/5/21. * Created by shine on 2019/5/21.
*/ */
public class SingleDataPane extends BasicBeanPane<AbstractDataDefinition> { public class SingleDataPane extends BasicBeanPane<AbstractDataDefinition> {
private static final int TABLE_DATA_LABEL_LINE_WIDTH = 81;
private UIComboBoxPane<AbstractDataDefinition> comboBoxPane; private UIComboBoxPane<AbstractDataDefinition> comboBoxPane;
private DataSetPane dataSetPane; private DataSetPane dataSetPane;
@ -50,18 +44,12 @@ public class SingleDataPane extends BasicBeanPane<AbstractDataDefinition> {
} }
protected void initLayout() { protected void initLayout() {
this.setLayout(new BorderLayout(LayoutConstants.HGAP_LARGE, 6)); this.setLayout(new BorderLayout(0, 6));
JPanel northPane = new JPanel(new BorderLayout(LayoutConstants.HGAP_LARGE, 0)); JPanel northPane = DataLayoutHelper.createDataLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Data_Source"), jcb);
DataLayoutHelper.addNormalBorder(northPane);
UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Source"));
UIComponentUtils.setPreferedWidth(label, TABLE_DATA_LABEL_LINE_WIDTH);
northPane.add(label,BorderLayout.WEST);
northPane.add(jcb, BorderLayout.CENTER);
northPane.setBorder(BorderFactory.createEmptyBorder(5,24,0,15));
this.add(northPane, BorderLayout.NORTH); this.add(northPane, BorderLayout.NORTH);
this.add(cardPane, BorderLayout.CENTER); this.add(cardPane, BorderLayout.CENTER);
} }
@Override @Override

59
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/ChartDataFilterPane.java

@ -9,11 +9,11 @@ import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
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.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.style.AbstractChartTabPane; import com.fr.design.mainframe.chart.gui.style.AbstractChartTabPane;
import com.fr.design.mainframe.chart.gui.style.ThirdTabPane; import com.fr.design.mainframe.chart.gui.style.ThirdTabPane;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
@ -21,12 +21,12 @@ import javax.swing.BorderFactory;
import javax.swing.JPanel; 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.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.util.ArrayList;
import java.util.List;
/** /**
* 图表数据 分类 系列 过滤界面. * 图表数据 分类 系列 过滤界面.
@ -37,7 +37,7 @@ import java.util.List;
public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> { public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
private static final long serialVersionUID = 3650522989381790194L; private static final long serialVersionUID = 3650522989381790194L;
private static final int PAN_WIDTH = 246; private static final int PAN_WIDTH = 246;
private static final int FIL_HEIGHT = 150; private static final int FIL_HEIGHT = 200;
private CategoryFilterPane categoryPane; private CategoryFilterPane categoryPane;
private SeriesFilterPane seriesPane; private SeriesFilterPane seriesPane;
@ -50,6 +50,11 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
this.isNeedPresent = true; this.isNeedPresent = true;
} }
public ChartDataFilterPane(Plot plot, ChartDataPane parent, boolean isNeedPresent) {
super(plot, parent);
this.isNeedPresent = isNeedPresent;
}
protected void initTabPane() { protected void initTabPane() {
super.initTabPane(); super.initTabPane();
tabPane.setPreferredSize(new Dimension(221, 25)); tabPane.setPreferredSize(new Dimension(221, 25));
@ -109,7 +114,7 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
* @return 返回标题. * @return 返回标题.
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"); return Toolkit.i18nText("Fine-Design_Chart_Data_Filter");
} }
/** /**
@ -144,12 +149,17 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
} }
public void populateBean(ChartCollection collection, boolean isNeedPresent) { public void populateBean(ChartCollection collection, boolean isNeedPresent) {
relayoutPane(isNeedPresent); TopDefinitionProvider topDefinition = collection.getSelectedChart().getFilterDefinition();
populateDefinition(topDefinition, isNeedPresent);
}
public void populateDefinition(TopDefinitionProvider topDefinition, boolean isNeedSummary) {
relayoutPane(isNeedSummary);
if (categoryPane != null) { if (categoryPane != null) {
categoryPane.populateBean(collection.getSelectedChart().getFilterDefinition()); categoryPane.populateBean(topDefinition);
} }
if (seriesPane != null) { if (seriesPane != null) {
seriesPane.populateBean(collection.getSelectedChart().getFilterDefinition()); seriesPane.populateBean(topDefinition);
} }
checkBoxUse(); checkBoxUse();
} }
@ -165,11 +175,16 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
* 保存界面数据筛选. * 保存界面数据筛选.
*/ */
public void updateBean(ChartCollection collection) { public void updateBean(ChartCollection collection) {
TopDefinitionProvider topDefinition = collection.getSelectedChart().getFilterDefinition();
updateDefinition(topDefinition);
}
public void updateDefinition(TopDefinitionProvider topDefinition) {
if (categoryPane != null) { if (categoryPane != null) {
categoryPane.updateBean(collection.getSelectedChart().getFilterDefinition()); categoryPane.updateBean(topDefinition);
} }
if (seriesPane != null) { if (seriesPane != null) {
seriesPane.updateBean(collection.getSelectedChart().getFilterDefinition()); seriesPane.updateBean(topDefinition);
} }
} }
@ -222,13 +237,13 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
} }
protected JPanel initOtherPane() { protected JPanel initOtherPane() {
onlyPreData = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Only_Use_Before_Records")); onlyPreData = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Only_Use_Before_Records"));
JPanel panel1 = new JPanel(new BorderLayout()); JPanel panel1 = new JPanel(new BorderLayout());
JPanel panel2 = new JPanel(new BorderLayout()); JPanel panel2 = new JPanel(new BorderLayout());
panel1.add(onlyPreData, BorderLayout.NORTH); panel1.add(onlyPreData, BorderLayout.NORTH);
preDataNum = new UITextField(); preDataNum = new UITextField();
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Records_Num")); UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Records_Num"));
combineOther = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_CombineOther")); combineOther = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Data_CombineOther"));
combineOther.setSelected(true); combineOther.setSelected(true);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
@ -244,7 +259,7 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
//默认不显示 //默认不显示
preDataNumPane.setVisible(false); preDataNumPane.setVisible(false);
panel1.add(preDataNumPane, BorderLayout.CENTER); panel1.add(preDataNumPane, BorderLayout.CENTER);
notShowNull = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Not_Show_Cate")); notShowNull = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Data_Not_Show_Cate"));
panel2.add(notShowNull, BorderLayout.NORTH); panel2.add(notShowNull, BorderLayout.NORTH);
onlyPreData.addChangeListener(new ChangeListener() { onlyPreData.addChangeListener(new ChangeListener() {
@ -258,7 +273,7 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
fire(); fire();
} }
}; };
presentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Present") ,present); presentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Style_Present") ,present);
panel2.add(presentPane, BorderLayout.SOUTH); panel2.add(presentPane, BorderLayout.SOUTH);
double[] column = {f}; double[] column = {f};
@ -281,7 +296,7 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
* 界面标题 "分类" * 界面标题 "分类"
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Category"); return Toolkit.i18nText("Fine-Design_Chart_Style_Category");
} }
/** /**
@ -397,13 +412,13 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
protected JPanel initOtherPane() { protected JPanel initOtherPane() {
onlyPreData = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Only_Use_Before_Records")); onlyPreData = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Only_Use_Before_Records"));
JPanel panel1 = new JPanel(new BorderLayout()); JPanel panel1 = new JPanel(new BorderLayout());
JPanel panel2 = new JPanel(new BorderLayout()); JPanel panel2 = new JPanel(new BorderLayout());
panel1.add(onlyPreData, BorderLayout.NORTH); panel1.add(onlyPreData, BorderLayout.NORTH);
preDataNum = new UITextField(); preDataNum = new UITextField();
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Records_Num")); UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Records_Num"));
combineOther = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_CombineOther")); combineOther = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Data_CombineOther"));
combineOther.setSelected(true); combineOther.setSelected(true);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
@ -419,7 +434,7 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
//默认不显示 //默认不显示
preDataNumPane.setVisible(false); preDataNumPane.setVisible(false);
panel1.add(preDataNumPane, BorderLayout.CENTER); panel1.add(preDataNumPane, BorderLayout.CENTER);
notShowNull = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Not_Show_Series")); notShowNull = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Data_Not_Show_Series"));
panel2.add(notShowNull, BorderLayout.NORTH); panel2.add(notShowNull, BorderLayout.NORTH);
onlyPreData.addChangeListener(new ChangeListener() { onlyPreData.addChangeListener(new ChangeListener() {
@ -433,7 +448,7 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
fire(); fire();
} }
}; };
presentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Present") ,present); presentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Style_Present") ,present);
panel2.add(presentPane, BorderLayout.SOUTH); panel2.add(presentPane, BorderLayout.SOUTH);
double[] column = {f}; double[] column = {f};
@ -457,7 +472,7 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
* 界面标题 * 界面标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series"); return Toolkit.i18nText("Fine-Design_Chart_Series");
} }
/** /**

25
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java

@ -8,6 +8,7 @@ import com.fr.chart.chartdata.NormalReportDataDefinition;
import com.fr.chart.chartdata.SeriesDefinition; import com.fr.chart.chartdata.SeriesDefinition;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
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.stable.StringUtils; import com.fr.stable.StringUtils;
@ -33,12 +34,12 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent
public CategoryPlotReportDataContentPane(ChartDataPane parent) { public CategoryPlotReportDataContentPane(ChartDataPane parent) {
initEveryPane(); initEveryPane();
categoryName = initCategoryBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Name")); categoryName = initCategoryBox(Toolkit.i18nText("Fine-Design_Chart_Category_Name"));
categoryName.setPreferredSize(new Dimension(236,30)); categoryName.setPreferredSize(new Dimension(236,30));
categoryName.setBorder(BorderFactory.createEmptyBorder(0,24,0,20)); categoryName.setBorder(BorderFactory.createEmptyBorder(0,24,0,20));
this.add(categoryName, "0,0,1,0"); this.add(categoryName, "0,0,1,0");
filterPane = new ChartDataFilterPane(new Bar2DPlot(), parent); filterPane = new ChartDataFilterPane(new Bar2DPlot(), parent);
JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"),filterPane); JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"),filterPane);
panel.setBorder(getSidesBorder()); panel.setBorder(getSidesBorder());
filterPane.setBorder(getFilterPaneBorder()); filterPane.setBorder(getFilterPaneBorder());
this.add(panel, "0,6,1,4"); } this.add(panel, "0,6,1,4"); }
@ -50,7 +51,7 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent
this.setLayout(new BorderLayout(4, 0)); this.setLayout(new BorderLayout(4, 0));
if(StringUtils.isNotEmpty(leftLabel)) { if(StringUtils.isNotEmpty(leftLabel)) {
UILabel label1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Name")); UILabel label1 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Category_Name"));
label1.setPreferredSize(new Dimension(75, 20)); label1.setPreferredSize(new Dimension(75, 20));
this.add(label1, BorderLayout.WEST); this.add(label1, BorderLayout.WEST);
} }
@ -90,8 +91,8 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent
@Override @Override
protected String[] columnNames() { protected String[] columnNames() {
return new String[]{ return new String[]{
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name"), Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Value") Toolkit.i18nText("Fine-Design_Chart_Series_Value")
}; };
} }
@ -99,6 +100,10 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent
checkBoxUse(); checkBoxUse();
TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition();
populateDefinition(definition);
}
public void populateDefinition(TopDefinitionProvider definition) {
if (definition instanceof NormalReportDataDefinition) { if (definition instanceof NormalReportDataDefinition) {
NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition; NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition;
if (reportDefinition.getCategoryName() != null) { if (reportDefinition.getCategoryName() != null) {
@ -113,13 +118,18 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent
seriesPane.doLayout(); seriesPane.doLayout();
} }
filterPane.populateBean(collection); filterPane.populateDefinition(definition, true);
} }
public void updateBean(ChartCollection collection) { public void updateBean(ChartCollection collection) {
collection.getSelectedChart().setFilterDefinition(new NormalReportDataDefinition()); collection.getSelectedChart().setFilterDefinition(new NormalReportDataDefinition());
TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition();
updateDefinition(definition);
}
public void updateDefinition(TopDefinitionProvider definition) {
if (definition instanceof NormalReportDataDefinition) { if (definition instanceof NormalReportDataDefinition) {
NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition; NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition;
@ -135,6 +145,7 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent
reportDefinition.add(sd); reportDefinition.add(sd);
} }
} }
filterPane.updateBean(collection);
filterPane.updateDefinition(definition);
} }
} }

29
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java

@ -11,6 +11,7 @@ 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.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -41,11 +42,11 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
categoryCombox = new UIComboBox(); categoryCombox = new UIComboBox();
JPanel categoryPane = new JPanel(new BorderLayout(4,0)); JPanel categoryPane = new JPanel(new BorderLayout(4,0));
categoryPane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); categoryPane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground()));
UILabel label1 = new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Category")) ; UILabel label1 = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Style_Category")) ;
label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH,ChartDataPane.LABEL_HEIGHT)); label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH,ChartDataPane.LABEL_HEIGHT));
categoryCombox.setPreferredSize(new Dimension(100,20)); categoryCombox.setPreferredSize(new Dimension(100,20));
categoryCombox.addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")); categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
categoryPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox,null,null,label1,null})); categoryPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox,null,null,label1,null}));
categoryPane.setPreferredSize(new Dimension(246,30)); categoryPane.setPreferredSize(new Dimension(246,30));
categoryPane.setBorder(BorderFactory.createEmptyBorder(0,24,10,15)); categoryPane.setBorder(BorderFactory.createEmptyBorder(0,24,10,15));
@ -90,7 +91,7 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
protected void refreshBoxListWithSelectTableData(List list) { protected void refreshBoxListWithSelectTableData(List list) {
refreshBoxItems(categoryCombox, list); refreshBoxItems(categoryCombox, list);
categoryCombox.addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")); categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
seriesTypeComboxPane.refreshBoxListWithSelectTableData(list); seriesTypeComboxPane.refreshBoxListWithSelectTableData(list);
} }
@ -100,7 +101,7 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
*/ */
public void clearAllBoxList(){ public void clearAllBoxList(){
clearBoxItems(categoryCombox); clearBoxItems(categoryCombox);
categoryCombox.addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")); categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
seriesTypeComboxPane.clearAllBoxList(); seriesTypeComboxPane.clearAllBoxList();
} }
@ -135,9 +136,9 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
} }
NormalTableDataDefinition data = (NormalTableDataDefinition)top; NormalTableDataDefinition data = (NormalTableDataDefinition)top;
if(data == null || ComparatorUtils.equals(data.getCategoryName(), StringUtils.EMPTY)) { if(ComparatorUtils.equals(data.getCategoryName(), StringUtils.EMPTY)) {
categoryCombox.setSelectedItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")); categoryCombox.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
} else if(data!= null && !this.boxItemsContainsObject(categoryCombox,data.getCategoryName())){ } else if(!DataPaneHelper.boxItemsContainsObject(categoryCombox,data.getCategoryName())){
categoryCombox.setSelectedItem(null); categoryCombox.setSelectedItem(null);
}else { }else {
combineCustomEditValue(categoryCombox, data.getCategoryName()); combineCustomEditValue(categoryCombox, data.getCategoryName());
@ -146,20 +147,6 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
seriesTypeComboxPane.populateBean(collection,this.isNeedSummaryCaculateMethod()); seriesTypeComboxPane.populateBean(collection,this.isNeedSummaryCaculateMethod());
} }
private boolean boxItemsContainsObject(UIComboBox box,Object item){
if(box == null){
return false;
}
ComboBoxModel dataModel = box.getModel();
for (int i = 0; i < dataModel.getSize(); i++) {
if(ComparatorUtils.equals(dataModel.getElementAt(i),item)){
return true;
}
}
return false;
}
/** /**
* 重新布局整个面板 * 重新布局整个面板
*/ */

25
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/DataPaneHelper.java

@ -7,6 +7,7 @@ import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import javax.swing.ComboBoxModel;
import java.util.List; import java.util.List;
/** /**
@ -24,6 +25,30 @@ public class DataPaneHelper {
box.refreshBoxItems(list); box.refreshBoxItems(list);
} }
public static boolean boxItemsContainsObject(UIComboBox box, Object item) {
if (box == null) {
return false;
}
ComboBoxModel dataModel = box.getModel();
for (int i = 0; i < dataModel.getSize(); i++) {
if (ComparatorUtils.equals(dataModel.getElementAt(i), item)) {
return true;
}
}
return false;
}
public static void combineCustomEditValue(UIComboBox comBox, String value) {
if(comBox != null) {
comBox.setEditable(true);
comBox.setSelectedItem(value);
comBox.setEditable(false);
}
}
/** /**
* 清空box里所有东西 * 清空box里所有东西
* *

36
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java

@ -14,6 +14,7 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.itable.UITable; import com.fr.design.gui.itable.UITable;
import com.fr.design.gui.itable.UITableEditor; import com.fr.design.gui.itable.UITableEditor;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
@ -23,6 +24,8 @@ import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Container; import java.awt.Container;
@ -30,8 +33,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
/** /**
* 属性表 数据集界面: 系列名 使用字段名. * 属性表 数据集界面: 系列名 使用字段名.
@ -40,8 +41,15 @@ import java.util.List;
* @version 创建时间2012-12-26 下午04:39:46 * @version 创建时间2012-12-26 下午04:39:46
*/ */
public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollection> { public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollection> {
private static final String[] HEADS = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Field_Name"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Summary_Method")}; private static final String[] HEADS = {
private static final String[] HEADS_NO_SUMMARY = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Field_Name"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name")}; Toolkit.i18nText("Fine-Design_Chart_Field_Name"),
Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
Toolkit.i18nText("Fine-Design_Chart_Summary_Method")};
private static final String[] HEADS_NO_SUMMARY = {
Toolkit.i18nText("Fine-Design_Chart_Field_Name"),
Toolkit.i18nText("Fine-Design_Chart_Series_Name")};
private UICorrelationPane seriesDataPane; private UICorrelationPane seriesDataPane;
private List<String> field = new ArrayList<String>(); private List<String> field = new ArrayList<String>();
private JPanel centerPane; private JPanel centerPane;
@ -62,7 +70,7 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
return new ActionListener() { return new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
String[] blank =heads.length == 3?new String[]{StringUtils.EMPTY, StringUtils.EMPTY, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")}: String[] blank = heads.length == 3 ? new String[]{StringUtils.EMPTY, StringUtils.EMPTY, Toolkit.i18nText("Fine-Design_Chart_Use_None")} :
new String[]{StringUtils.EMPTY, StringUtils.EMPTY}; new String[]{StringUtils.EMPTY, StringUtils.EMPTY};
tablePane.addLine(blank); tablePane.addLine(blank);
fireTargetChanged(); fireTargetChanged();
@ -121,7 +129,7 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
* @return 标题 * @return 标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Enable_Field_Name"); return Toolkit.i18nText("Fine-Design_Basic_Chart_Field_Name");
} }
/** /**
@ -186,9 +194,13 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
} }
} }
public void populateBean(ChartCollection collection,boolean isNeedSummary){ public void populateBean(ChartCollection collection, boolean isNeedSummary) {
relayoutPane(isNeedSummary);
TopDefinitionProvider topDefinition = collection.getSelectedChart().getFilterDefinition(); TopDefinitionProvider topDefinition = collection.getSelectedChart().getFilterDefinition();
populateDefinition(topDefinition, isNeedSummary);
}
public void populateDefinition(TopDefinitionProvider topDefinition, boolean isNeedSummary) {
relayoutPane(isNeedSummary);
if (topDefinition instanceof MoreNameCDDefinition) { if (topDefinition instanceof MoreNameCDDefinition) {
MoreNameCDDefinition moreDefinition = (MoreNameCDDefinition) topDefinition; MoreNameCDDefinition moreDefinition = (MoreNameCDDefinition) topDefinition;
ChartSummaryColumn[] chartSummaryColumnArray = moreDefinition.getChartSummaryColumn(); ChartSummaryColumn[] chartSummaryColumnArray = moreDefinition.getChartSummaryColumn();
@ -221,6 +233,11 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
*/ */
public void updateBean(ChartCollection collection) { public void updateBean(ChartCollection collection) {
TopDefinitionProvider normalDefinition = collection.getSelectedChart().getFilterDefinition(); TopDefinitionProvider normalDefinition = collection.getSelectedChart().getFilterDefinition();
MoreNameCDDefinition moreDefinition = updateDefinition(normalDefinition);
collection.getSelectedChart().setFilterDefinition(moreDefinition);
}
public MoreNameCDDefinition updateDefinition(TopDefinitionProvider normalDefinition) {
MoreNameCDDefinition moreDefinition = null; MoreNameCDDefinition moreDefinition = null;
if (normalDefinition instanceof MoreNameCDDefinition) { if (normalDefinition instanceof MoreNameCDDefinition) {
moreDefinition = (MoreNameCDDefinition) normalDefinition; moreDefinition = (MoreNameCDDefinition) normalDefinition;
@ -242,7 +259,8 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
} }
} }
moreDefinition.setChartSummaryColumn(dataArray); moreDefinition.setChartSummaryColumn(dataArray);
collection.getSelectedChart().setFilterDefinition(moreDefinition);
return moreDefinition;
} }
/** /**

72
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java

@ -8,22 +8,22 @@ import com.fr.data.util.function.NoneFunction;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
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.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.extended.chart.UIComboBoxWithNone;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.List;
/** /**
* 属性表 数据集 系列名使用 系列值 界面. * 属性表 数据集 系列名使用 系列值 界面.
@ -39,7 +39,8 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
private boolean isNeedSummary = true; private boolean isNeedSummary = true;
public SeriesNameUseFieldValuePane() { public SeriesNameUseFieldValuePane() {
seriesName = new UIComboBox(); seriesName = new UIComboBoxWithNone();
seriesName.getModel().setSelectedItem(null);
seriesValue = new UIComboBox(); seriesValue = new UIComboBox();
calculateCombox = new CalculateComboBox(); calculateCombox = new CalculateComboBox();
calculateCombox.reset(); calculateCombox.reset();
@ -79,11 +80,11 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {f}; double[] columnSize = {f};
double[] rowSize = {p, p, p, p, p}; double[] rowSize = {p, p, p, p, p};
UILabel Label1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name")); UILabel Label1 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name"));
Label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); Label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
UILabel Label2 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Value")); UILabel Label2 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Value"));
Label2.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); Label2.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
UILabel Label3 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Summary_Method")); UILabel Label3 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"));
Label3.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); Label3.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
Component[][] components = getUseComponent(Label1, Label2, Label3); Component[][] components = getUseComponent(Label1, Label2, Label3);
@ -93,18 +94,18 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
} }
private void initCenterPaneWithOutCaculateSummary(){ private void initCenterPaneWithOutCaculateSummary() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {f}; double[] columnSize = {f};
double[] rowSize = {p, p, p, p}; double[] rowSize = {p, p, p, p};
UILabel Label1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name")); UILabel label1 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name"));
Label1.setPreferredSize(new Dimension(75, 20)); label1.setPreferredSize(getLabelDimension());
UILabel Label2 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Value")); UILabel label2 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Value"));
Label2.setPreferredSize(new Dimension(75, 20)); label2.setPreferredSize(getLabelDimension());
UILabel Label3 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Summary_Method")); UILabel label3 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"));
Label3.setPreferredSize(new Dimension(75, 20)); label3.setPreferredSize(getLabelDimension());
Component[][] components = getUseComponentWithOutSummary(Label1, Label2, Label3); Component[][] components = getUseComponentWithOutSummary(label1, label2, label3);
centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 4, 6); centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 4, 6);
centerPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1)); centerPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1));
@ -112,6 +113,10 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
} }
protected Dimension getLabelDimension() {
return new Dimension(75, 20);
}
protected Component[][] getUseComponent(UILabel Label1, UILabel Label2, UILabel Label3) { protected Component[][] getUseComponent(UILabel Label1, UILabel Label2, UILabel Label3) {
return new Component[][]{ return new Component[][]{
new Component[]{GUICoreUtils.createBorderLayoutPane(new Component[]{seriesName, null, null, Label1, null})}, new Component[]{GUICoreUtils.createBorderLayoutPane(new Component[]{seriesName, null, null, Label1, null})},
@ -170,20 +175,6 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
DataPaneHelper.clearBoxItems(seriesValue); DataPaneHelper.clearBoxItems(seriesValue);
} }
private boolean boxItemsContainsObject(UIComboBox box,Object item){
if(box == null){
return false;
}
ComboBoxModel dataModel = box.getModel();
for (int i = 0; i < dataModel.getSize(); i++) {
if(ComparatorUtils.equals(dataModel.getElementAt(i),item)){
return true;
}
}
return false;
}
/** /**
* 判断界面是否接受 * 判断界面是否接受
* @param ob 接受的对象 * @param ob 接受的对象
@ -199,7 +190,7 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
* @return 界面标题 * @return 界面标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Enable_Field_Value"); return Toolkit.i18nText("Fine-Design_Chart_Field_Value");
} }
/** /**
@ -226,17 +217,22 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
} }
} }
public void populateBean(ChartCollection ob , boolean isNeedSummary){ public void populateBean(ChartCollection ob, boolean isNeedSummary) {
relayoutPane(isNeedSummary);
TopDefinitionProvider topDefinition = ob.getSelectedChart().getFilterDefinition(); TopDefinitionProvider topDefinition = ob.getSelectedChart().getFilterDefinition();
populateDefinition(topDefinition, isNeedSummary);
}
public void populateDefinition(TopDefinitionProvider topDefinition, boolean isNeedSummary) {
relayoutPane(isNeedSummary);
if (topDefinition instanceof OneValueCDDefinition) { if (topDefinition instanceof OneValueCDDefinition) {
OneValueCDDefinition oneDefinition = (OneValueCDDefinition) topDefinition; OneValueCDDefinition oneDefinition = (OneValueCDDefinition) topDefinition;
seriesName.setEditable(true); seriesName.setEditable(true);
seriesName.setSelectedItem(this.boxItemsContainsObject(seriesName,oneDefinition.getSeriesColumnName()) seriesName.setSelectedItem(DataPaneHelper.boxItemsContainsObject(seriesName, oneDefinition.getSeriesColumnName())
? oneDefinition.getSeriesColumnName() : null); ? oneDefinition.getSeriesColumnName() : null);
seriesName.setEditable(false); seriesName.setEditable(false);
seriesValue.setEditable(true); seriesValue.setEditable(true);
seriesValue.setSelectedItem(this.boxItemsContainsObject(seriesValue,oneDefinition.getValueColumnName()) seriesValue.setSelectedItem(DataPaneHelper.boxItemsContainsObject(seriesValue,oneDefinition.getValueColumnName())
? oneDefinition.getValueColumnName() : null); ? oneDefinition.getValueColumnName() : null);
seriesValue.setEditable(false); seriesValue.setEditable(false);
if(this.isNeedSummary){ if(this.isNeedSummary){
@ -256,6 +252,11 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
* 保存界面内容 字段值 * 保存界面内容 字段值
*/ */
public void updateBean(ChartCollection collection) { public void updateBean(ChartCollection collection) {
OneValueCDDefinition oneDefinition = updateDefinition();
collection.getSelectedChart().setFilterDefinition(oneDefinition);
}
public OneValueCDDefinition updateDefinition() {
OneValueCDDefinition oneDefinition = createOneValueCDDefinition(); OneValueCDDefinition oneDefinition = createOneValueCDDefinition();
String seriesName = (String) this.seriesName.getSelectedItem(); String seriesName = (String) this.seriesName.getSelectedItem();
@ -267,7 +268,8 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
}else{ }else{
oneDefinition.setDataFunction(new NoneFunction()); oneDefinition.setDataFunction(new NoneFunction());
} }
collection.getSelectedChart().setFilterDefinition(oneDefinition);
return oneDefinition;
} }
protected OneValueCDDefinition createOneValueCDDefinition(){ protected OneValueCDDefinition createOneValueCDDefinition(){

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

@ -5,24 +5,25 @@ import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartdata.MoreNameCDDefinition; import com.fr.chart.chartdata.MoreNameCDDefinition;
import com.fr.chart.chartdata.OneValueCDDefinition; import com.fr.chart.chartdata.OneValueCDDefinition;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.BasicBeanPane;
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.ibutton.UIButtonGroup;
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.i18n.Toolkit;
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;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout;
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;
/** /**
* 属性表: 柱形, 饼图 数据集界面, "系列名使用"界面. * 属性表: 柱形, 饼图 数据集界面, "系列名使用"界面.
@ -30,7 +31,7 @@ import java.awt.Dimension;
* @author kunsnat E-mail:kunsnat@gmail.com * @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-26 下午03:17:08 * @version 创建时间2012-12-26 下午03:17:08
*/ */
public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> { public class SeriesTypeUseComboxPane extends BasicBeanPane<ChartCollection> {
private SeriesNameUseFieldValuePane nameFieldValuePane; private SeriesNameUseFieldValuePane nameFieldValuePane;
private SeriesNameUseFieldNamePane nameFieldNamePane; private SeriesNameUseFieldNamePane nameFieldNamePane;
@ -39,50 +40,106 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
private ChartDataPane parent; private ChartDataPane parent;
private Plot initplot; private Plot initplot;
private boolean isNeedSummary = true; private boolean isNeedSummary;
protected UIButtonGroup<Integer> content;
protected JPanel cardPane;
public SeriesTypeUseComboxPane(ChartDataPane parent, Plot initplot) { public SeriesTypeUseComboxPane(ChartDataPane parent, Plot initplot) {
this.initplot = initplot; this.initplot = initplot;
this.parent = parent; this.parent = parent;
cards = initPaneList();
this.isNeedSummary = true; this.isNeedSummary = true;
initComponents(); initComponents();
} }
protected void initComponents() {
nameFieldValuePane = createValuePane();
nameFieldNamePane = createNamePane();
cardPane = new JPanel(new CardLayout()) {
@Override
public Dimension getPreferredSize() {
if (content.getSelectedIndex() == 0) {
return nameFieldValuePane.getPreferredSize();
} else {
return nameFieldNamePane.getPreferredSize();
}
}
};
cardPane.add(nameFieldValuePane, nameFieldValuePane.title4PopupWindow());
cardPane.add(nameFieldNamePane, nameFieldNamePane.title4PopupWindow());
content = new UIButtonGroup<>(new String[]{nameFieldValuePane.title4PopupWindow(), nameFieldNamePane.title4PopupWindow()});
addItemChangeEvent();
initLayout();
content.setSelectedIndex(0);
}
private void addItemChangeEvent() {
content.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkCardPane();
}
});
}
protected void checkCardPane() {
comboBoxItemStateChanged();
CardLayout cl = (CardLayout) cardPane.getLayout();
if (content.getSelectedIndex() == 0) {
cl.show(cardPane, nameFieldValuePane.title4PopupWindow());
} else {
cl.show(cardPane, nameFieldNamePane.title4PopupWindow());
}
}
protected void initLayout() { protected void initLayout() {
this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM)); this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM));
JPanel northPane = new JPanel(new BorderLayout(4, 0)); JPanel northPane = new JPanel(new BorderLayout(4, 0));
UILabel label1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"));
label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); //使用系列名/系列值选项面板
northPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label1, null})); UILabel seriesLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"));
northPane.setBorder(BorderFactory.createEmptyBorder(10, 24, 0, 15)); seriesLabel.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
cardPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15)); JPanel borderLayoutPane = GUICoreUtils.createBorderLayoutPane(new Component[]{content, null, null, seriesLabel, null});
northPane.add(borderLayoutPane);
northPane.setBorder(BorderFactory.createEmptyBorder(10, 24, 0, 16));
this.add(northPane, BorderLayout.NORTH); this.add(northPane, BorderLayout.NORTH);
//系列名/系列值配置面板
cardPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
this.add(cardPane, BorderLayout.CENTER); this.add(cardPane, BorderLayout.CENTER);
dataScreeningPane = new ChartDataFilterPane(this.initplot, parent);
JPanel panel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), 290, 24, dataScreeningPane); //数据筛选
panel.setBorder(BorderFactory.createEmptyBorder(0,5,0,5)); dataScreeningPane = new ChartDataFilterPane(this.initplot, parent);
dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(10,5,0,5)); JPanel panel = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), 250, 24, dataScreeningPane);
panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
this.add(panel, BorderLayout.SOUTH); this.add(panel, BorderLayout.SOUTH);
} }
protected UIComboBox createComboBox() { public Dimension getPreferredSize() {
UIComboBox uiComboBox = new UIComboBox(); Dimension preferredSize = super.getPreferredSize();
UIComponentUtils.setPreferedWidth(uiComboBox, 100); return new Dimension(246, (int) preferredSize.getHeight());
return uiComboBox;
} }
/** /**
* 检查box 是否使用, hasUse, 表示上层已经使用, 否则, 则此界面都可使用 * 检查box 是否使用, hasUse, 表示上层已经使用, 否则, 则此界面都可使用
*
* @param hasUse 是否使用 * @param hasUse 是否使用
*/ */
public void checkUseBox(boolean hasUse) { public void checkUseBox(boolean hasUse) {
jcb.setEnabled(hasUse); content.setEnabled(hasUse);
nameFieldValuePane.checkUse(hasUse); nameFieldValuePane.checkUse(hasUse);
dataScreeningPane.checkBoxUse(); dataScreeningPane.checkBoxUse();
} }
/** /**
* 切换 变更数据集时, 刷新Box选中项目 * 切换 变更数据集时, 刷新Box选中项目
*
* @param list 列表 * @param list 列表
*/ */
public void refreshBoxListWithSelectTableData(List list) { public void refreshBoxListWithSelectTableData(List list) {
@ -93,28 +150,20 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
/** /**
* 清空所有的box设置 * 清空所有的box设置
*/ */
public void clearAllBoxList(){ public void clearAllBoxList() {
nameFieldValuePane.clearAllBoxList(); nameFieldValuePane.clearAllBoxList();
nameFieldNamePane.clearAllBoxList(); nameFieldNamePane.clearAllBoxList();
} }
/** /**
* 界面标题 * 界面标题
*
* @return 界面标题 * @return 界面标题
*/ */
protected String title4PopupWindow() { protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name_From");
} }
@Override
protected List<FurtherBasicBeanPane<? extends ChartCollection>> initPaneList() {
nameFieldValuePane = createValuePane();
nameFieldNamePane = createNamePane();
List<FurtherBasicBeanPane<? extends ChartCollection>> paneList = new ArrayList<FurtherBasicBeanPane<? extends ChartCollection>>();
paneList.add(nameFieldValuePane);
paneList.add(nameFieldNamePane);
return paneList;
}
protected SeriesNameUseFieldValuePane createValuePane() { protected SeriesNameUseFieldValuePane createValuePane() {
return new SeriesNameUseFieldValuePane(); return new SeriesNameUseFieldValuePane();
@ -135,15 +184,17 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
nameFieldNamePane.populateBean(ob, isNeedSummary); nameFieldNamePane.populateBean(ob, isNeedSummary);
} }
dataScreeningPane.populateBean(ob, isNeedSummary); dataScreeningPane.populateBean(ob, isNeedSummary);
checkCardPane();
} }
/** /**
* 重新布局整个面板 * 重新布局整个面板
*
* @param isNeedSummary 是否需要汇总 * @param isNeedSummary 是否需要汇总
*/ */
public void relayoutPane(boolean isNeedSummary) { public void relayoutPane(boolean isNeedSummary) {
this.isNeedSummary = isNeedSummary; this.isNeedSummary = isNeedSummary;
if (jcb.getSelectedIndex() == 0) { if (this.getSelectedIndex() == 0) {
nameFieldValuePane.relayoutPane(this.isNeedSummary); nameFieldValuePane.relayoutPane(this.isNeedSummary);
} else { } else {
nameFieldNamePane.relayoutPane(this.isNeedSummary); nameFieldNamePane.relayoutPane(this.isNeedSummary);
@ -152,9 +203,8 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
} }
@Override
protected void comboBoxItemStateChanged() { protected void comboBoxItemStateChanged() {
if (jcb.getSelectedIndex() == 0) { if (this.getSelectedIndex() == 0) {
nameFieldValuePane.relayoutPane(this.isNeedSummary); nameFieldValuePane.relayoutPane(this.isNeedSummary);
} else { } else {
nameFieldNamePane.relayoutPane(this.isNeedSummary); nameFieldNamePane.relayoutPane(this.isNeedSummary);
@ -178,4 +228,21 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
dataScreeningPane.updateBean(ob); dataScreeningPane.updateBean(ob);
} }
/**
* 保存数据
*
* @return 待保存的对象
*/
public ChartCollection updateBean() {
return null;
}
public int getSelectedIndex() {
return content.getSelectedIndex();
}
public void setSelectedIndex(int index) {
content.setSelectedIndex(index);
}
} }

12
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java

@ -10,6 +10,7 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.border.Border; import javax.swing.border.Border;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Component; import java.awt.Component;
@ -20,7 +21,6 @@ import java.awt.Graphics2D;
import java.awt.Insets; import java.awt.Insets;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.List;
public abstract class ThirdTabPane<T> extends BasicBeanPane<T>{ public abstract class ThirdTabPane<T> extends BasicBeanPane<T>{
@ -74,16 +74,6 @@ public abstract class ThirdTabPane<T> extends BasicBeanPane<T>{
} }
} }
@Override
public void paint(Graphics g) {
super.paint(g);
if (!paneList.isEmpty()) {
Graphics2D g2d = (Graphics2D)g;
g2d.setColor(UIConstants.LINE_COLOR);
g2d.drawLine(getWidth() - 2, tabPane.getPreferredSize().height, getWidth() - 2, getHeight() - 1);
}
}
protected void initLayout() { protected void initLayout() {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
if (!paneList.isEmpty()) { if (!paneList.isEmpty()) {

18
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java

@ -18,7 +18,6 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.ColorControlWindow; import com.fr.design.style.color.ColorControlWindow;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
@ -29,6 +28,8 @@ import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@ -40,8 +41,6 @@ import java.awt.LayoutManager;
import java.awt.Point; import java.awt.Point;
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;
public class UIColorPickerPane extends BasicPane implements UIObserver { public class UIColorPickerPane extends BasicPane implements UIObserver {
private static final int MARGIN_TOP = 7; private static final int MARGIN_TOP = 7;
@ -635,7 +634,7 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
@Override @Override
public void layoutContainer(Container parent) { public void layoutContainer(Container parent) {
upControlPane.setBounds(MARGIN_LEFT, MARGIN_TOP, UPCONTROLPANE_WIDTH, upControlPane.getPreferredSize().height); upControlPane.setBounds(getBoundX(), getBoundY(), getBoundWidth(), upControlPane.getPreferredSize().height);
colorGroup.setBounds(COLORGROUP_MARGIN_LEFT, 2 * MARGIN_TOP + upControlPane.getPreferredSize().height + LAYOUR_DET, colorGroup.getPreferredSize().width, colorGroup.getPreferredSize().height + upControlPane.getPreferredSize().height); colorGroup.setBounds(COLORGROUP_MARGIN_LEFT, 2 * MARGIN_TOP + upControlPane.getPreferredSize().height + LAYOUR_DET, colorGroup.getPreferredSize().width, colorGroup.getPreferredSize().height + upControlPane.getPreferredSize().height);
textGroup.setBounds(colorGroup.getPreferredSize().width + COLORGROUP_MARGIN_LEFT, MARGIN_TOP + upControlPane.getPreferredSize().height + LAYOUR_DET, textGroup.getPreferredSize().width, textGroup.getPreferredSize().height); textGroup.setBounds(colorGroup.getPreferredSize().width + COLORGROUP_MARGIN_LEFT, MARGIN_TOP + upControlPane.getPreferredSize().height + LAYOUR_DET, textGroup.getPreferredSize().width, textGroup.getPreferredSize().height);
} }
@ -646,6 +645,17 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
} }
}; };
protected int getBoundX() {
return MARGIN_LEFT;
}
protected int getBoundY() {
return MARGIN_TOP;
}
protected int getBoundWidth() {
return UPCONTROLPANE_WIDTH;
}
/** /**
*刷新颜色选取器 *刷新颜色选取器

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

@ -2,14 +2,16 @@ package com.fr.design.module;
import com.fr.base.ChartColorMatching; import com.fr.base.ChartColorMatching;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonGroup;
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.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.ChartColorAdjustPane; 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.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -19,7 +21,6 @@ import java.awt.CardLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -35,8 +36,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
private JPanel changeColorSetPane; private JPanel changeColorSetPane;
private CardLayout cardLayout; private CardLayout cardLayout;
private UIButton accButton; private UIButtonGroup groupButton;
private UIButton gradientButton;
private ChartColorAdjustPane colorAdjustPane; private ChartColorAdjustPane colorAdjustPane;
private FixedGradientBar colorGradient; private FixedGradientBar colorGradient;
@ -52,22 +52,19 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
JPanel customPane = new JPanel(FRGUIPaneFactory.createBorderLayout()); JPanel customPane = new JPanel(FRGUIPaneFactory.createBorderLayout());
JPanel buttonPane = new JPanel(); groupButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Custom_Color"), Toolkit.i18nText("Fine-Design_Chart_Gradient_Color")});
buttonPane.setLayout(new FlowLayout(FlowLayout.LEFT)); groupButton.setSelectedIndex(0);
buttonPane.add(accButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Color"))); customPane.add(groupButton, BorderLayout.NORTH);
buttonPane.add(gradientButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gradient_Color")));
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.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 150), "gradient");
changeColorSetPane.add(colorAdjustPane = new ChartColorAdjustPane(), "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);
accButton.setSelected(true); customPane.setPreferredSize(new Dimension(155, 300));
colorGradient.setPreferredSize(new Dimension(155, 30));
customPane.setPreferredSize(new Dimension(200, 200));
colorGradient.setPreferredSize(new Dimension(120, 30));
colorGradient.getSelectColorPointBtnP1().setColorInner(Color.WHITE); colorGradient.getSelectColorPointBtnP1().setColorInner(Color.WHITE);
colorGradient.getSelectColorPointBtnP2().setColorInner(FixedGradientBar.NEW_CHARACTER); colorGradient.getSelectColorPointBtnP2().setColorInner(FixedGradientBar.NEW_CHARACTER);
@ -84,24 +81,20 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
} }
private void initListener() { private void initListener() {
groupButton.addActionListener(new ActionListener() {
accButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
accButton.setSelected(true); checkCardPane();
gradientButton.setSelected(false);
cardLayout.show(changeColorSetPane, "acc");
} }
}); });
}
gradientButton.addActionListener(new ActionListener() { private void checkCardPane() {
@Override if (groupButton.getSelectedIndex() == 0) {
public void actionPerformed(ActionEvent e) { cardLayout.show(changeColorSetPane, "acc");
gradientButton.setSelected(true); } else {
accButton.setSelected(false); cardLayout.show(changeColorSetPane, "gradient");
cardLayout.show(changeColorSetPane, "gradient"); }
}
});
} }
@Override @Override
@ -117,8 +110,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
boolean isGradient = condition.getGradient(); boolean isGradient = condition.getGradient();
List<Color> colorList = condition.getColorList(); List<Color> colorList = condition.getColorList();
if (isGradient) { if (isGradient) {
gradientButton.setSelected(true); groupButton.setSelectedIndex(1);
accButton.setSelected(false);
cardLayout.show(changeColorSetPane, "gradient"); cardLayout.show(changeColorSetPane, "gradient");
if (colorList.size() == 2) { if (colorList.size() == 2) {
@ -127,8 +119,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
colorGradient.repaint(); colorGradient.repaint();
} }
} else { } else {
accButton.setSelected(true); groupButton.setSelectedIndex(0);
gradientButton.setSelected(false);
cardLayout.show(changeColorSetPane, "acc"); cardLayout.show(changeColorSetPane, "acc");
if (colorList.isEmpty()) { if (colorList.isEmpty()) {
@ -148,7 +139,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
List<Color> colorList = new ArrayList<Color>(); List<Color> colorList = new ArrayList<Color>();
if (gradientButton.isSelected()) { if (groupButton.getSelectedIndex() == 1) {
chartColorMatching.setGradient(true); chartColorMatching.setGradient(true);
Color start = colorGradient.getSelectColorPointBtnP1().getColorInner(); Color start = colorGradient.getSelectColorPointBtnP1().getColorInner();

142
designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java

@ -0,0 +1,142 @@
package com.fr.design.module;
import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig;
import com.fr.base.Utils;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.ShortCut4JControlPane;
import com.fr.design.gui.ilist.ModNameActionListener;
import com.fr.design.menu.ShortCut;
import com.fr.general.NameObject;
import com.fr.stable.Nameable;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.util.ArrayList;
import java.util.Iterator;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-07-08
*/
public class ChartPreStyleListPane extends JListControlPane {
ChartPreStyleManagerPane chartPreStyleManagerPane;
public ChartPreStyleListPane(ChartPreStyleManagerPane chartPreStyleManagerPane) {
super();
this.chartPreStyleManagerPane = chartPreStyleManagerPane;
initListener();
}
/**
* 创建有名字的creator
*
* @return 有名字的creator数组
*/
@Override
public NameableCreator[] createNameableCreators() {
return new NameableCreator[]{
new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_PreStyle_Duplicate"),
ChartColorMatching.class, ChartPreStylePane.class)
};
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_PreStyle");
}
@Override
public BasicBeanPane createPaneByCreators(NameableCreator creator) {
return new ChartPreStylePane() {
@Override
protected void refreshWhenStyleChange(ChartColorMatching preStyle) {
super.refreshWhenStyleChange(preStyle);
chartPreStyleManagerPane.refreshDefaultColorBox();
}
};
}
protected ShortCut4JControlPane[] createShortcuts() {
return new ShortCut4JControlPane[]{
shortCutFactory.addItemShortCut(),
createRemoveItemShortCut(),
shortCutFactory.copyItemShortCut(),
shortCutFactory.moveUpItemShortCut(),
shortCutFactory.moveDownItemShortCut(),
shortCutFactory.sortItemShortCut()
};
}
private ShortCut4JControlPane createRemoveItemShortCut() {
ShortCut4JControlPane shortCut4JControlPane = shortCutFactory.removeItemShortCut();
//替换删除按钮的check事件。
ShortCut shortCut = shortCut4JControlPane.getShortCut();
shortCut4JControlPane = new MoreThanOneShortCut(shortCut);
return shortCut4JControlPane;
}
public void initListener() {
nameableList.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
chartPreStyleManagerPane.refreshDefaultColorBox();
}
});
nameableList.addModNameActionListener(new ModNameActionListener() {
@Override
public void nameModed(int index, String oldName, String newName) {
chartPreStyleManagerPane.refreshDefaultColorBox(oldName, newName);
}
});
}
public void populateBean() {
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance().mirror();
ArrayList list = new ArrayList();
Iterator keys = config.names();
while (keys.hasNext()) {
Object key = keys.next();
ChartColorMatching value = (ChartColorMatching) config.getPreStyle(key);
list.add(new NameObject(Utils.objectToString(key), value));
}
Nameable[] values = (Nameable[]) list.toArray(new Nameable[list.size()]);
populate(values);
if (config.containsName(config.getCurrentStyle())) {
this.setSelectedName(config.getCurrentStyle());
}
}
public void updateBean() {
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
Nameable[] values = update();
config.clearAllPreStyle();
for (Nameable value : values) {
config.putPreStyle(value.getName(), ((NameObject) value).getObject());
}
}
private class MoreThanOneShortCut extends ShortCut4JControlPane {
public MoreThanOneShortCut(ShortCut shortCut) {
this.shortCut = shortCut;
}
@Override
public void checkEnable() {
this.shortCut.setEnabled(nameableList.getModel().getSize() > 1);
}
}
}

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

Loading…
Cancel
Save