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. 7
      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. 32
      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. 554
      designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java
  32. 23
      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. 35
      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. 18
      designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java
  41. 33
      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. 49
      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. 1032
      designer-base/src/main/java/com/fr/design/mainframe/JSliderPane.java
  49. 8
      designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java
  50. 25
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  51. 69
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  52. 3
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java
  53. 39
      designer-base/src/main/java/com/fr/design/os/impl/PopupDialogSaveAction.java
  54. 7
      designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java
  55. 12
      designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java
  56. 4
      designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java
  57. 11
      designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java
  58. 5
      designer-base/src/main/java/com/fr/design/update/actions/RecoverForDesigner.java
  59. 2
      designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateDialog.java
  60. 33
      designer-base/src/main/java/com/fr/design/update/push/DesignerUpdateInfo.java
  61. 8
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  62. 61
      designer-base/src/main/java/com/fr/design/utils/ParameterUtils.java
  63. 7
      designer-base/src/main/java/com/fr/env/CheckServiceDialog.java
  64. 38
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  65. 3
      designer-base/src/main/java/com/fr/file/FileFILE.java
  66. 3
      designer-base/src/main/java/com/fr/file/FileNodeFILE.java
  67. 22
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java
  68. BIN
      designer-base/src/main/resources/com/fr/design/images/bbs/support.png
  69. 2
      designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.css
  70. 10
      designer-base/src/test/java/com/fr/design/formula/FormulaPaneTest.java
  71. 39
      designer-base/src/test/java/com/fr/design/mainframe/JFormSliderPaneTest.java
  72. 38
      designer-base/src/test/java/com/fr/design/utils/ParameterUtilsTest.java
  73. 3
      designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java
  74. 66
      designer-chart/src/main/java/com/fr/design/chart/AutoChartIcon.java
  75. 7
      designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java
  76. 89
      designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java
  77. 30
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  78. 31
      designer-chart/src/main/java/com/fr/design/chart/auto/AutoTypeCalculate.java
  79. 121
      designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java
  80. 12
      designer-chart/src/main/java/com/fr/design/chartx/component/SeriesValueFieldComboBoxPane.java
  81. 13
      designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java
  82. 69
      designer-chart/src/main/java/com/fr/design/chartx/data/DataLayoutHelper.java
  83. 15
      designer-chart/src/main/java/com/fr/design/chartx/data/map/AbstractAreaLngLatPane.java
  84. 1
      designer-chart/src/main/java/com/fr/design/chartx/data/map/MapChartDataPane.java
  85. 15
      designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractCellDataFieldsPane.java
  86. 15
      designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractDataSetFieldsPane.java
  87. 7
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MapDataSetFieldsPane.java
  88. 2
      designer-chart/src/main/java/com/fr/design/chartx/single/CellDataPane.java
  89. 30
      designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java
  90. 22
      designer-chart/src/main/java/com/fr/design/chartx/single/SingleDataPane.java
  91. 59
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/ChartDataFilterPane.java
  92. 41
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java
  93. 53
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java
  94. 25
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/DataPaneHelper.java
  95. 36
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java
  96. 72
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java
  97. 137
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java
  98. 12
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java
  99. 18
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java
  100. 57
      designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.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");
} else {
localBranch = formatBranch(localBranch);
localBranch = GeneralUtils.getVersion();
remoteBranch = formatBranch(remoteBranch);
Set<Class> noExistServiceSet = getNoExistServiceSet(connectionInfo);
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 java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/*
@ -51,6 +52,10 @@ public class TableDataSourceAction extends TemplateComponentAction<JTemplate<?,
reportTableDataDialog.setDoOKSucceed(false);
return;
}
Iterator<String> iterator = tds.getTableDataNameIterator();
while (iterator.hasNext()) {
DesignTableDataManager.removeSelectedColumnNames(iterator.next());
}
DesignModelAdapter.getCurrentModelAdapter().renameTableData(tableDataPane.getDsNameChangedMap());
tableDataPane.update(tds);
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.selection.SelectionListener;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.stable.pinyin.PinyinFormat;
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++) {
String title = component.getTitleAt(i);
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) {
getComponentTexts((JPanel) tabComponent, separator, text, pinyin, shortPinyin);
} 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;
import java.awt.event.ActionEvent;
import java.io.File;
import java.util.List;
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.MenuDef;
import com.fr.file.FILEFactory;
import com.fr.file.FileFILE;
/**
* Open Resent MenuDef.
@ -68,7 +70,12 @@ public class OpenRecentReportMenuDef extends MenuDef {
* @param 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() {

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) {
JPanel vcsPane = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Vcs_Title"));
JPanel vcsPane = FRGUIPaneFactory.createTopVerticalTitledBorderPane(i18nText("Fine-Design_Vcs_Title"));
generalPane.add(vcsPane);
remindVcsLabel = new UILabel(i18nText("Fine-Design_Vcs_Remind"));
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"));
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.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.layout.FRGUIPaneFactory;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.GeneralUtils;
import com.fr.locale.InterProviderFactory;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
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 COMPANY_TELEPHONE = CloudCenter.getInstance().acquireUrlByKind("help.compNo");
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;
public AboutPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.maxWidth = GraphHelper.getWidth(getBuildTitle() + GeneralUtils.readFullBuildNO() +
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"));
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_OK"));
//center panel
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.add(centerPane, BorderLayout.CENTER);
@ -51,9 +55,10 @@ public class AboutPane extends JPanel {
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
centerPane.add(contentPane, BorderLayout.NORTH);
contentPane.add(new BoxCenterAligmentPane(getBuildTitle()));
BoxCenterAlignmentCopyablePane buildCopyPane = new BoxCenterAlignmentCopyablePane(
getBuildTitle(),
GeneralUtils.readFullBuildNO(),
StringUtils.EMPTY,
getVersionBuildNO(),
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_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
public Dimension getPreferredSize() {
return new Dimension(this.maxWidth, super.getPreferredSize().height);
@ -191,7 +205,7 @@ public class AboutPane extends JPanel {
private String getBuildTitle() {
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) {
@ -289,12 +303,13 @@ public class AboutPane extends JPanel {
public BoxCenterAlignmentCopyablePane(String title, String copyText, final String[] descriptions) {
setLayout(FRGUIPaneFactory.createBorderLayout());
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);
textField.setBackground(null);
textField.setBorder(null);
centerPane.add(label);
centerPane.add(textField);
textField.addMouseListener(new MouseAdapter() {
@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.TableData;
import com.fr.config.Configuration;
import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction;
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.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
import com.fr.file.ProcedureConfig;
import com.fr.file.TableDataConfig;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
import com.fr.transaction.WorkerFacade;
import javax.swing.KeyStroke;
@ -95,6 +92,10 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
}
DesignTableDataManager.clearGlobalDs();
// 保存时 移除服务器数据集列名缓存
for (String name : tableDataConfig.getTableDatas().keySet()) {
DesignTableDataManager.removeSelectedColumnNames(name);
}
Configurations.modify(new WorkerFacade(TableDataConfig.class) {
@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();
}

7
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.JScrollPane;
import java.awt.Dimension;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.LinkedHashMap;
@Open
public abstract class ConditionAttributesPane<T> extends BasicBeanPane<T> {
@ -27,7 +28,7 @@ public abstract class ConditionAttributesPane<T> extends BasicBeanPane<T> {
protected LiteConditionPane liteConditionPane;
protected java.util.Map<Class, ConditionAttrSingleConditionPane> classPaneMap = new HashMap<Class, ConditionAttrSingleConditionPane>();
protected Map<Class, ConditionAttrSingleConditionPane> classPaneMap = new LinkedHashMap<>();
//可用的Actions.
protected java.util.List<UpdateAction> useAbleActionList = new java.util.ArrayList<UpdateAction>();
@ -70,7 +71,7 @@ public abstract class ConditionAttributesPane<T> extends BasicBeanPane<T> {
selectedItemScrollPane.setMinimumSize(new Dimension((int) selectedItemScrollPane.getPreferredSize().getWidth(), MIN_HEIGHT));
propertyChangePane.add(selectedItemScrollPane);
}
public void updateBean(T ob) {
updateMenuDef();
}

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

@ -439,9 +439,14 @@ public abstract class DesignTableDataManager {
* @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
*/
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);
if (ArrayUtils.isEmpty(parameters)) {
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() {
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);
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);
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);
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);
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) {
public boolean isNeedParameterWhenPopulateJControlPane() {
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) {
public boolean isNeedParameterWhenPopulateJControlPane() {
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) {
@Override
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必须转化为内置的
*/
public class PreviewTableModel extends AbstractTableModel {
private static final int LEN_LIMIT = 1000;
private static final String THREE_DOT = "...";
private DataModel dataModel;
private String erroMessage = null;
@ -127,11 +131,21 @@ public class PreviewTableModel extends AbstractTableModel {
public Object getValueAt(int row, int column) {
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) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
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();
}
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
// update之后的parameters,转成一个parameterMap,用于预览TableData
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.syntax.ui.rsyntaxtextarea.SyntaxConstants;
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.menu.SeparatorDef;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.ParameterUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.sql.SqlUtils;
@ -219,8 +219,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
paramTexts[1] = SqlUtils.tryPureSqlText(pageQuery);
List<ParameterProvider> existParameterList = editorPane.update();
Parameter[] ps = existParameterList == null ? new Parameter[0] : existParameterList.toArray(new Parameter[existParameterList.size()]);
editorPane.populate(ParameterHelper.analyzeAndUnionSameParameters(paramTexts, ps));
editorPane.populate(ParameterUtils.analyzeAndUnionParameters(paramTexts, ps));
}
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") + ".");
}
}
// 保存前 刷新下参数列表 保证获取到最新的参数
refresh();
List<ParameterProvider> parameterList = editorPane.update();
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;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
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.ispinner.UISpinner;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.StringUtils;
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"),
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_COMPONENT_COUNT_OF_MAX_MEMORY = 4;
private static int getMaxComBoBoxWidth() {
int maxWidth = GraphHelper.getWidth(CACHE_LIST[0]);
for (int i = 1; i < CACHE_LIST.length; i++) {
@ -86,9 +89,13 @@ public class MaxMemRowCountPanel extends UIToolbar {
this.removeAll();
this.add(switchCache);
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(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.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.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.script.Calculator;
import com.fr.stable.ParameterProvider;
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.add(headLabel);
Iterator<Entry<String, TableDataWrapper>> entryIt = resMap.entrySet().iterator();
while (entryIt.hasNext()) {
TableDataWrapper tableDataWrappe = entryIt.next().getValue();
for (Entry<String, TableDataWrapper> stringTableDataWrapperEntry : resMap.entrySet()) {
TableDataWrapper tableDataWrappe = stringTableDataWrapperEntry.getValue();
String tmp = tableDataWrappe.getTableDataName();
if (!ComparatorUtils.equals(tableDataWrappe.getTableDataName(), multiName)) {
centerPanel.add(new BarPanel(tmp, tableDataWrappe.getIcon()));
@ -111,13 +111,10 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
}
private ActionListener getPreviewActionListener() {
return new ActionListener() {
public void actionPerformed(ActionEvent e) {
MultiTDTableData td = MultiTDTableDataPane.this.updateBean();
td.setTableDataSource(DesignTableDataManager.getEditingTableDataSource());
new TemplateTableDataWrapper(td).previewData();
}
return e -> {
MultiTDTableData td = MultiTDTableDataPane.this.updateBean();
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.setLayout(new BorderLayout());
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel() {
editorPane = new UITableEditorPane<>(new ParameterTableModel() {
@Override
public UITableEditAction[] createAction() {
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);
@ -162,29 +159,32 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
for (int i = 0; i < size; i++) {
paramTexts[i] = (String) object[i];
}
List<ParameterProvider> existParameterList = new ArrayList<ParameterProvider>();
Iterator<Entry<String, String>> dataItera = choosenTableData.entrySet().iterator();
List<String> parameterName = new ArrayList<String>();
while (dataItera.hasNext()) {
Entry<String, String> entry = dataItera.next();
TableData td = resMap.get(entry.getKey()).getTableData();
ParameterProvider[] currentparameters = td.getParameters(Calculator.createCalculator());
for (int i=0; i<currentparameters.length; i++){
if (parameterName.contains(currentparameters[i].getName())){
continue;
}
parameterName.add(currentparameters[i].getName());
existParameterList.add(currentparameters[i]);
}
List<ParameterProvider> existParameterList = new ArrayList<>();
List<String> parameterName = new ArrayList<>();
for (Entry<String, String> entry : choosenTableData.entrySet()) {
TableData td = resMap.get(entry.getKey()).getTableData();
ParameterProvider[] currentParameters = td.getParameters(Calculator.createCalculator());
for (ParameterProvider currentParameter : currentParameters) {
if (parameterName.contains(currentParameter.getName())) {
continue;
}
parameterName.add(currentParameter.getName());
try {
//采用给新的界面刷新参数时,clone一个值过去,不然会出现联动修改
existParameterList.add((ParameterProvider) currentParameter.clone());
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
ParameterProvider[] texts = ParameterHelper.analyze4Parameters(paramTexts, true);
for (int i=0; i<texts.length; i++) {
if (parameterName.contains(texts[i].getName())){
continue;
}
existParameterList.add(texts[i]);
for (ParameterProvider text : texts) {
if (parameterName.contains(text.getName())) {
continue;
}
existParameterList.add(text);
}
Parameter[] ps = existParameterList.toArray(new Parameter[existParameterList.size()]);
ParameterProvider[] ps = existParameterList.toArray(new ParameterProvider[0]);
editorPane.populate(ps);
existParameterList.clear();
parameterName.clear();
@ -217,7 +217,7 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
String name;
for (int i = 0; i < ob.getTableDataCount(); i++) {
name = ob.getTableDataName(i);
choosenTableData.put(name, "");
choosenTableData.put(name, StringUtils.EMPTY);
}
}
}
@ -236,15 +236,13 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
@Override
public MultiTDTableData updateBean() {
ConditionTableData td = new ConditionTableData();
Iterator<Entry<String, String>> it = choosenTableData.entrySet().iterator();
while (it.hasNext()) {
Entry<String, String> entry = it.next();
for (Entry<String, String> entry : choosenTableData.entrySet()) {
td.addTableData(entry.getKey(), entry.getValue());
}
List<ParameterProvider> paramList = editorPane.update();
if (paramList != null) {
td.setDefineParameters(paramList.toArray(new Parameter[paramList.size()]));
td.setDefineParameters(paramList.toArray(new Parameter[0]));
}
return td;
@ -348,9 +346,7 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
chekbox.setSelected(false);
formulaContentTextField.setEnabled(false);
formulaButton.setEnabled(false);
if (choosenTableData.containsKey(name)) {
choosenTableData.remove(name);
}
choosenTableData.remove(name);
} else {
formulaButton.setEnabled(true);
formulaContentTextField.setEnabled(true);
@ -372,9 +368,7 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
} else {
formulaButton.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() {
return new ActionListener() {
public void actionPerformed(ActionEvent e) {
final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(BaseFormula.createFormulaBuilder().build(formulaContentTextField.getText()));
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(MultiTDTableDataPane.this), new DialogActionAdapter() {
public void doOk() {
BaseFormula formula = formulaPane.update();
if (formula == null) {
formulaContentTextField.setText("");
} else {
formulaContentTextField.setText(formula.getContent().substring(1));
}
MultiTDTableDataPane.this.refresh();
return e -> {
final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(BaseFormula.createFormulaBuilder().build(formulaContentTextField.getText()));
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(MultiTDTableDataPane.this), new DialogActionAdapter() {
public void doOk() {
BaseFormula formula = formulaPane.update();
if (formula == null) {
formulaContentTextField.setText(StringUtils.EMPTY);
} else {
formulaContentTextField.setText(formula.getContent().substring(1));
}
}).setVisible(true);
}
MultiTDTableDataPane.this.refresh();
}
}).setVisible(true);
};
}
}

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

@ -1,6 +1,6 @@
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.base.operator.common.CommonOperator;
import com.fr.rpc.ExceptionHandler;
@ -24,11 +24,11 @@ public class RemoteWorkspace implements Workspace {
private final WorkspaceClient client;
private final String address;
private final WorkspaceConnectionInfo connection;
private volatile Boolean isRoot = null;
RemoteWorkspace(WorkspaceClient client, WorkspaceConnectionInfo connection) {
this.client = client;
@ -41,13 +41,13 @@ public class RemoteWorkspace implements Workspace {
return address;
}
@Override
public String getDescription() {
return Toolkit.i18nText("Fine-Design_Basic_Remote_Env");
}
@Override
public boolean isWarDeploy() {
return WorkContext.getCurrent().get(CommonOperator.class, new ExceptionHandler<Boolean>() {
@ -66,7 +66,7 @@ public class RemoteWorkspace implements Workspace {
@Override
public boolean isRoot() {
if (isRoot == null) {
synchronized (this) {
if (isRoot == null) {
@ -89,10 +89,10 @@ public class RemoteWorkspace implements Workspace {
@Override
public WorkspaceConnection getConnection() {
return client.getConnection();
}
@Override
public <T> T get(Class<T> type) {
@ -111,22 +111,22 @@ public class RemoteWorkspace implements Workspace {
}
return client.getPool().get(type);
}
@Override
public void close() {
client.close();
}
@Override
public int hashCode() {
return connection.hashCode();
}
@Override
public boolean equals(Object obj) {
return obj instanceof RemoteWorkspace && AssistUtils.equals(((RemoteWorkspace) obj).connection, this.connection);
}

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() {
FineLoggerFactory.getLogger().info("Env Change Template Loading...");
JTemplate currentTemplate = null;
if (stashFILEMap != null && stashFILEMap.size() != 0) {
int size = historyList.size();
for (int i = 0; i < size; i++) {
@ -385,20 +386,24 @@ public class HistoryTemplateListCache implements CallbackEvent {
historyList.set(i, template);
// 替换当前正在编辑的模板,使用添加并激活的方式,以便使用统一的入口来处理监听事件
if (isCurrentEditingFile(template.getPath())) {
loadCurrentTemplate(template);
currentTemplate = template;
}
} else {
// 当模板为空时 说明是一个新建的未保存模板 但是内存中保存了该模板 可以从中获取
JTemplate jt = historyList.get(i);
// 另外如果该模板是正在编辑的模板,需要要激活
if (jt != null && isCurrentEditingFile(jt.getPath())) {
loadCurrentTemplate(jt);
currentTemplate = jt;
}
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
// 最后加载当前正在编辑的模板 以保证数据集刷新正常
if (currentTemplate != null) {
loadCurrentTemplate(currentTemplate);
}
stashFILEMap.clear();
MutilTempalteTabPane.getInstance().refreshOpenedTemplate(historyList);
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
public void refresh() {
// 刷新远程文件夹权限
NodeAuthProcessor.getInstance().refresh();
reportletsTree.refresh();
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();
}
/**
* 把以关键词开头的和不以关键词开头的分别按照字母表顺序排序
* @param o1 待比较对象1
* @param o2 待比较对象2
* @return 比较结果1表示 o1 > o2, -1表示 o1 < o2, 0表示 o1 = o2
*/
@Override
public int compare(String o1, String o2) {
if (o1.toLowerCase().startsWith(searchKey)) {
return -1;
}
if (o2.toLowerCase().startsWith(searchKey)) {
return 1;
int result;
boolean o1StartWith = o1.toLowerCase().startsWith(searchKey);
boolean o2StartWith = o2.toLowerCase().startsWith(searchKey);
if (o1StartWith) {
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;
/**
* 单元格属性面板扩展接口,接口基本逻辑不通且不符合接口设计规范,单元格属性扩展可以使用CellPropertyPaneProvider
* Created by zhouping on 2015/11/11.
*/
@Deprecated
public interface CellAttributeProvider extends Immutable{
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.mainframe.DesignerContext;
import com.fr.design.menu.ShortCut;
import com.fr.design.os.impl.PopupDialogSaveAction;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.invoke.Reflect;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSSupportCenter;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
@ -273,6 +275,8 @@ abstract class UIControlPane extends JControlPane {
}
saveSettings();
setVisible(false);
PopupDialogSaveAction saveAction = OSSupportCenter.getAction(PopupDialogSaveAction.class);
saveAction.unregister();
}
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.UINameEdList;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.PopupDialogSaveAction;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable;
import com.fr.stable.os.support.OSSupportCenter;
import javax.swing.DefaultListModel;
import javax.swing.JList;
@ -216,6 +218,8 @@ public abstract class UIListControlPane extends UIControlPane implements ListCon
((PopupEditDialog)popupEditDialog).setTitle(getSelectedName());
}
popupEditDialog.setVisible(true);
PopupDialogSaveAction osBasedAction = OSSupportCenter.getAction(PopupDialogSaveAction.class);
osBasedAction.register(this, popupEditDialog);
}
}

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

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

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

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) {
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
* @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里放的是一行数据
private List<T> list = new ArrayList<T>();
@SuppressWarnings({ "unchecked", "rawtypes" })
protected UITableModelAdapter(String[] columnNames) {
this.columnNames = columnNames;
table = new JTable(this);
@ -101,8 +100,8 @@ public abstract class UITableModelAdapter<T extends Object> extends AbstractTabl
}
}
public void setRowAt(T value, int rowIndwx) {
this.list.set(rowIndwx, value);
public void setRowAt(T value, int rowIndex) {
this.list.set(rowIndex, value);
}
/**

35
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.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.DocumentListener;
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
@ -33,31 +42,33 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs
public UITextField() {
super();
InputEventBaseOnOS.addBasicEditInputMap(this);
initListener();
init();
}
public UITextField(int columns) {
super(columns);
InputEventBaseOnOS.addBasicEditInputMap(this);
initListener();
init();
}
public UITextField(String text, int columns) {
super(text, columns);
InputEventBaseOnOS.addBasicEditInputMap(this);
initListener();
init();
}
public UITextField(String text) {
super(text);
InputEventBaseOnOS.addBasicEditInputMap(this);
initListener();
init();
}
public UITextField(Document doc, String text, int columns) {
super(doc, text, columns);
init();
}
/**
* 每个构造方法里都需要做的一些操作
*/
public void init() {
InputEventBaseOnOS.addBasicEditInputMap(this);
initListener();
}
@ -251,4 +262,4 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs
this.isBorderPainted = isBorderPainted;
}
}
}

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;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.StateChangeListener;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.stable.Constants;
@ -75,6 +76,8 @@ public class TristateCheckBox extends UICheckBox {
private final TristateDecorator model;
public StateChangeListener stateChangeListener;
public TristateCheckBox(String text, Icon icon, State initial) {
super(text, icon);
setUI(new TristateCheckBoxUI());
@ -83,7 +86,7 @@ public class TristateCheckBox extends UICheckBox {
@Override
public void mousePressed(MouseEvent e) {
grabFocus();
model.setState(getNextState(model.getState()));
setState(getNextState(model.getState()));
}
});
// Reset the keyboard action map
@ -92,7 +95,7 @@ public class TristateCheckBox extends UICheckBox {
@Override
public void actionPerformed(ActionEvent e) {
grabFocus();
model.setState(getNextState(model.getState()));
setState(getNextState(model.getState()));
}
});
map.put("released", null);
@ -125,12 +128,20 @@ public class TristateCheckBox extends UICheckBox {
public void addMouseListener(MouseListener l) {
}
public void addStateChangeListener(StateChangeListener stateChangeListener) {
this.stateChangeListener=stateChangeListener;
}
/**
* Set the new state to either SELECTED, NOT_SELECTED or
* DO_NOT_CARE. If state == null, it is treated as DO_NOT_CARE.
*/
public void setState(State state) {
State old = getState();
model.setState(state);
if (old != state) {
fireBoxStateChanged();
}
}
/**
@ -141,6 +152,11 @@ public class TristateCheckBox extends UICheckBox {
return model.getState();
}
public void fireBoxStateChanged() {
if (stateChangeListener != null) {
stateChangeListener.stateChange();
}
}
/**
* 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.plaf.ColorUIResource;
import javax.swing.plaf.TextUI;
import javax.swing.plaf.basic.BasicBorders;
import javax.swing.text.AbstractDocument;
import javax.swing.text.BadLocationException;
import javax.swing.text.Caret;
@ -645,6 +646,7 @@ int currentCaretY; // Used to know when to rehighlight current line.
setTabsEmulated(false);
// Stuff needed by the caret listener below.
setBorder(new BasicBorders.MarginBorder());
previousCaretY = currentCaretY = getInsets().top;
// 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.setBorder(BorderFactory.createEmptyBorder(4, 20, 4, 5));
custom.setBorder(BorderFactory.createEmptyBorder(4, 15, 4, 5));
ButtonGroup group = new ButtonGroup();
group.setSelected(center.getModel(), true);
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"));
leftLabel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 10));
leftLabel.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 10));
leftLocation = new UINumberField();
leftLocation.setMinValue(0);
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 UILabel funNameLabel;
private AutoCompletion ac;
private static final Dimension FUNCTION_NAME_LABEL_SIZE = new Dimension(300, 80);
private int titleWidth = 180;
@ -68,7 +69,7 @@ public class JSContentPane extends BasicPane {
JPanel jsParaPane = new JPanel(new BorderLayout(4, 4));
jsParaPane.setPreferredSize(new Dimension(300, 80));
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));
jsParaPane.add(scrollPane, BorderLayout.WEST);
jsParaPane.add(label, BorderLayout.EAST);

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

@ -168,6 +168,22 @@ public class FRGUIPaneFactory {
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;
}
/**
* 创建一个带标题边框面板并且居中显示
*
@ -584,4 +600,4 @@ public class FRGUIPaneFactory {
return h;
}
}
}

33
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 {
/**
* This value indicates that each row of components
* should be left-justified.
* 竖直方向上将子组件设置为顶对齐方式
*/
public static final int TOP = 0;
/**
* This value indicates that each row of components
* should be centered.
* 竖直方向上将子组件设置为居中对齐方式
*/
public static final int CENTER = 1;
/**
* This value indicates that each row of components
* should be right-justified.
* 竖直方向上将子组件设置为底对齐方式
*/
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
// 当列宽不一致时,是否需要左对齐(默认居中对齐)
/**
* 当列宽不一致时是否需要将水平方向设置成左对齐默认水平方向为居中对齐
*/
boolean isAlignLeft = false;
/**
@ -220,6 +219,7 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
* @param name the name of the component
* @param comp the component to be added
*/
@Override
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
* @see java.awt.Container#removeAll
*/
@Override
public void removeLayoutComponent(Component comp) {
}
@ -244,6 +245,7 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
* @see #minimumLayoutSize
* @see java.awt.Container#getPreferredSize
*/
@Override
public Dimension preferredLayoutSize(Container target) {
synchronized (target.getTreeLock()) {
Dimension dim = new Dimension(0, 0);
@ -255,7 +257,7 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
if (m.isVisible()) {
Dimension d = m.getPreferredSize();
firstVisibleComponent = dialWithDim4PreferredLayoutSize(dim, d, firstVisibleComponent);
firstVisibleComponent = dealWithDim4PreferredLayoutSize(dim, d, firstVisibleComponent);
}
}
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);
if (firstVisibleComponent) {
firstVisibleComponent = false;
@ -289,6 +291,7 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
* @see java.awt.Container
* @see java.awt.Container#doLayout
*/
@Override
public Dimension minimumLayoutSize(Container target) {
synchronized (target.getTreeLock()) {
Dimension dim = new Dimension(0, 0);
@ -300,7 +303,7 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
if (m.isVisible()) {
Dimension d = m.getMinimumSize();
firstVisibleComponent = dialWithDim4MinimumLayoutSize(dim, d, i, firstVisibleComponent);
firstVisibleComponent = dealWithDim4MinimumLayoutSize(dim, d, i, firstVisibleComponent);
}
}
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);
if (i > 0) {
dim.height += vgap;
@ -370,6 +373,7 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
* @see java.awt.Container
* @see java.awt.Container#doLayout
*/
@Override
public void layoutContainer(Container target) {
synchronized (target.getTreeLock()) {
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) {
if ((y == 0) || ((y + d.height) <= maxlen)) {
if (y > 0) y += vgap;
if (y > 0) {
y += vgap;
}
y += d.height;
roww = Math.max(roww, d.width);
} else {
@ -449,6 +455,7 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
*
* @return a string representation of this layout
*/
@Override
public String toString() {
String str = "";
switch (this.newAlign) {
@ -465,4 +472,4 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
return getClass().getName() + "[hgap=" + hgap + ",vgap=" + vgap + str + "]";
}
}
}

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
* @date 2019/6/24
*/
@ -38,6 +39,123 @@ public enum SupportLocaleImpl implements SupportLocale {
set.add(Locale.TAIWAN);
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()) {
doResize();
}
//刷新FixedPopupPane的位置
EastRegionContainerPane.getInstance().freshCurrentPopupPane();
}
});
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
@ -972,6 +974,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 添加的模板.
*/
public void addAndActivateJTemplate(JTemplate<?, ?> jt) {
//切换文件后清空FixedPopupPane面板
EastRegionContainerPane.getInstance().clearCurrentPopupPane();
//释放模板对象
ActionFactory.editorRelease();
if (jt == null || jt.getEditingFILE() == null) {
@ -991,6 +995,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 模板
*/
public void activateJTemplate(JTemplate<?, ?> jt) {
//切换文件后清空FixedPopupPane面板
EastRegionContainerPane.getInstance().clearCurrentPopupPane();
//释放模板对象
ActionFactory.editorRelease();
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
*/
private void openFile(FILE tplFile) {
//切换文件后清空FixedPopupPane面板
EastRegionContainerPane.getInstance().clearCurrentPopupPane();
if (tplFile != null) {
int index = HistoryTemplateListCache.getInstance().contains(tplFile);
if (index != -1) {

49
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 rightPane;
private FixedPopupPane currentPopupPane;
private UIButton currentButton;
private static final int CONTAINER_WIDTH = containerWidth();
private static final int TAB_WIDTH = 38;
private static final int TAB_BUTTON_WIDTH = 32;
@ -227,8 +228,10 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
itemBean.getEnableModes());
UIButton button = propertyItem.getButton();
List<ActionListener> buttonListeners = itemBean.getButtonListeners();
for (ActionListener buttonListener : buttonListeners) {
button.addActionListener(buttonListener);
if (buttonListeners != null) {
for (ActionListener buttonListener : buttonListeners) {
button.addActionListener(buttonListener);
}
}
propertyItemMap.put(key, propertyItem);
@ -493,17 +496,17 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public void replaceAuthorityEditionPane(JComponent pane) {
propertyItemMap.get(KEY_AUTHORITY_EDITION).replaceContentPane(pane);
}
public JComponent getAuthorityEditionPane() {
return propertyItemMap.get(KEY_AUTHORITY_EDITION).getContentPane();
}
public void replaceConfiguredRolesPane(JComponent pane) {
propertyItemMap.get(KEY_CONFIGURED_ROLES).replaceContentPane(pane);
}
public void replaceKeyPane(final String key, final JComponent pane) {
//需要放到 ui 线程中处理
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
@ -512,11 +515,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}
});
}
public JComponent getConfiguredRolesPane() {
return propertyItemMap.get(KEY_CONFIGURED_ROLES).getContentPane();
}
public void addParameterPane(JComponent paraPane) {
propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceHeaderPane(paraPane);
}
@ -927,6 +930,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} else {
hideCurrentPopupPane();
currentPopupPane = popupPane;
currentButton = button;
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 String title;

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

@ -1,45 +1,34 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.design.constants.LayoutConstants;
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.islider.UISlider;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
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.ChangeListener;
import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.NumberFormatter;
import javax.swing.plaf.basic.BasicSliderUI;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.EventQueue;
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.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.math.BigDecimal;
@ -47,76 +36,44 @@ import java.math.BigDecimal;
* Created by MoMeak on 2017/7/13.
*/
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 int SIX = 6;
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 HUNDRED = 100;
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 DIALOG_WIDTH = 157;
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_WIDTH = 35;
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 Color BACK_COLOR = new Color(245, 245, 247);
public int showValue = 100;
public double resolutionTimes = 1.0;
private UITextField showVal;
private JSpinner showValSpinner;
private UINumberField showValField;
private UISlider slider;
private int times;
private int sliderValue;
private UIButton downButton;
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、直接输入不一样
private boolean isButtonOrIsTxt = true;
//是否选中指定的几个缩放等级,避免触发不必要的事件
private boolean selectSpecified = false;
private FormPopupPane dialog;
private int upButtonX;
private JPanel dialogContentPanel;
public JFormSliderPane() {
this.setLayout(new BorderLayout());
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();
initShowValButton();
initUIRadioButton();
initPane();
initShowValField();
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
panel.add(downButton);
panel.add(slider);
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);
this.add(panel, BorderLayout.NORTH);
}
@ -131,6 +88,7 @@ public class JFormSliderPane extends JPanel {
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
slider.setValue(HALF_HUNDRED);
slider.setUI(new JSliderPaneUI(slider));
slider.addChangeListener(listener);
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"));
}
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() {
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);
}
private void initShowValButton() {
showValButton = new UISliderButton(showValSpinner.getValue() + "%");
showValButton.setBackground(BACK_COLOR);
showValButton.setBorderPainted(false);
showValButton.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH));
showValButton.addActionListener(showValButtonActionListener);
showValButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Grade"));
}
private void initShowValField() {
showValField = new UINumberField();
showValField.setValue(showValue);
showValField.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH));
showValField.addKeyListener(new KeyListener() {
@Override
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
public void itemStateChanged(ItemEvent e) {
JRadioButton temp = (JRadioButton) e.getSource();
if (temp.isSelected()) {
JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
textField.requestFocus();
textField.selectAll();
public void keyPressed(KeyEvent e) {
}
@Override
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() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
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));
@Override
public void focusLost(FocusEvent e) {
showValFieldChange((int) showValField.getValue());
}
});
}
private JPanel createSpinnerPanel() {
JPanel spinnerPanel = new JPanel(new FlowLayout());
spinnerPanel.add(showValSpinner);
UILabel percent = new UILabel("%");
percent.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
spinnerPanel.add(percent);
spinnerPanel.setBackground(BACK_COLOR);
return spinnerPanel;
private void showValFieldChange(int value) {
isButtonOrIsTxt = true;
showValue = getPreferredValue(value);
refreshShowValueFieldText();
refreshSlider();
}
private ActionListener showValButtonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
popupDialog();
private int getPreferredValue(int value){
if (value > FOUR_HUNDRED) {
value = FOUR_HUNDRED;
}
};
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);
}
if (value < TEN) {
value = TEN;
}
};
return value;
}
private void refreshShowValueFieldText(){
showValField.setValue(showValue);
setAdjustButtonStatus();
}
//定义一个监听器,用于监听所有滑动条
private ChangeListener listener = new ChangeListener() {
public void stateChanged(ChangeEvent event) {
//取出滑动条的值,并在文本中显示出来
if (!isButtonOrIsTxt) {
customButton.setSelected(true);
EventQueue.invokeLater(new Runnable() {
public void run() {
sliderValue = slider.getValue();
getTimes(sliderValue);
showValue = times;
showValSpinner.setValue(times);
refreshShowValueFieldText();
}
});
} 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) {
showValue = val;
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 refreshSlider() {
slider.setValue(calSliderValue(showValue));
}
private void refreshBottun(int val) {
showValButton.setText(val + "%");
private void setAdjustButtonStatus(){
this.downButton.setEnabled(this.showValue > TEN);
this.upButton.setEnabled(this.showValue < FOUR_HUNDRED);
}
public double getResolutionTimes() {
return this.resolutionTimes;
private int calSliderValue(int value) {
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) {
BigDecimal b1 = new BigDecimal(Double.toString(v1));
@ -362,30 +233,28 @@ public class JFormSliderPane extends JPanel {
private ActionListener buttonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
showValue = (int) showValSpinner.getValue();
isButtonOrIsTxt = true;
if ("less".equals(e.getActionCommand())) {
int newDownVal = showValue - TEN;
if (newDownVal >= TEN) {
showValue = newDownVal;
showValSpinner.setValue(newDownVal);
} else {
showValue = newDownVal;
showValSpinner.setValue(TEN);
showValue = TEN;
}
refreshShowValueFieldText();
refreshSlider();
}
if ("more".equals(e.getActionCommand())) {
int newUpVal = showValue + TEN;
if (newUpVal <= FOUR_HUNDRED) {
showValue = newUpVal;
showValSpinner.setValue(newUpVal);
} else {
showValue = newUpVal;
showValSpinner.setValue(FOUR_HUNDRED);
showValue = FOUR_HUNDRED;
}
refreshShowValueFieldText();
refreshSlider();
}
isButtonOrIsTxt = true;
customButton.setSelected(true);
}
};
@ -396,35 +265,72 @@ public class JFormSliderPane extends JPanel {
} else if (value < HALF_HUNDRED) {
times = (int) Math.round(ONEPOINTEIGHT * value + TEN);
} else {
times = (int) (SIX * value - TWO_HUNDRED);
times = SIX * value - TWO_HUNDRED;
}
}
public JSpinner getShowVal() {
return this.showValSpinner;
public int getShowValue() {
return this.showValue;
}
public UIRadioButton getSelfAdaptButton() {
return this.selfAdaptButton;
public void setShowValue(int value) {
showValFieldChange(value);
}
private void popupDialog() {
Point btnCoords = upButton.getLocationOnScreen();
if (dialog == null) {
dialog = new FormPopupPane(upButton, dialogContentPanel);
if (upButtonX == 0) {
upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
}
} else {
if (upButtonX == 0) {
upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
public void addValueChangeListener(ChangeListener changeListener){
this.slider.addChangeListener(changeListener);
}
class JSliderPaneUI extends BasicSliderUI {
private static final int THUMB_XOFFSET = 8;
private static final int THUMB_YOFFSET = 3;
private static final int FOUR = 4;
private static final int FIVE = 5;
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 {
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) {
@ -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));
}
}

1032
designer-base/src/main/java/com/fr/design/mainframe/JSliderPane.java

File diff suppressed because it is too large Load Diff

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

@ -39,8 +39,12 @@ public class WestRegionContainerPane extends UIResizableContainer {
@Override
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() {

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.log.Log4jConfig;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.third.apache.log4j.Level;
import com.fr.third.apache.log4j.spi.LoggingEvent;
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 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 ACTION_MAP_KEY = "clear";
public static DesignerLogHandler getInstance() {
return HOLDER.singleton;
@ -223,14 +226,14 @@ public class DesignerLogHandler {
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_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.put("clear", new AbstractAction() {
actionMap.put(ACTION_MAP_KEY, new AbstractAction() {
@Override
public void actionPerformed(ActionEvent evt) {
resultPane.setText("");
resultPane.setText(StringUtils.EMPTY);
caption.clearMessage();
}
});
@ -293,10 +296,10 @@ public class DesignerLogHandler {
SimpleAttributeSet attrSet = new SimpleAttributeSet();
if (style == DesignerLogger.ERROR_INT) {
StyleConstants.setForeground(attrSet, new Color(247, 148, 29));
StyleConstants.setForeground(attrSet, Color.RED);
StyleConstants.setBold(attrSet, true);
} else if (style == DesignerLogger.WARN_INT) {
StyleConstants.setForeground(attrSet, Color.red);
StyleConstants.setForeground(attrSet, new Color(247, 148, 29));
StyleConstants.setBold(attrSet, true);
} else if (style == DesignerLogger.INFO_INT) {
StyleConstants.setForeground(attrSet, Color.black);
@ -330,9 +333,9 @@ public class DesignerLogHandler {
LogMessageBar.getInstance().setMessage(message);
if (level == DesignerLogger.INFO_INT && showInfo.isSelected()) {
caption.infoAdd();
} else if (level == DesignerLogger.ERROR_INT && showError.isSelected()) {
} else if (level == DesignerLogger.WARN_INT && showError.isSelected()) {
caption.errorAdd();
} else if (level == DesignerLogger.WARN_INT && showServer.isSelected()) {
} else if (level == DesignerLogger.ERROR_INT && showServer.isSelected()) {
caption.serverAdd();
}
}
@ -343,7 +346,7 @@ public class DesignerLogHandler {
this.copy.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.clear.setEnabled(false);
}
@ -367,7 +370,7 @@ public class DesignerLogHandler {
} else if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.copy.getText())) {
LogHandlerArea.this.jTextArea.copy();
} else if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.clear.getText())) {
LogHandlerArea.this.jTextArea.setText("");
LogHandlerArea.this.jTextArea.setText(StringUtils.EMPTY);
caption.clearMessage();
}
}

69
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.community.BBSAction;
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.FacebookFansAction;
import com.fr.design.actions.community.NeedAction;
import com.fr.design.actions.community.QuestionAction;
import com.fr.design.actions.community.SignAction;
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.file.CloseCurrentTemplateAction;
import com.fr.design.actions.file.ExitDesignerAction;
@ -529,11 +531,30 @@ public abstract class ToolBarMenuDock {
*/
public ShortCut[] createHelpShortCuts() {
final java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>();
// 英文,把 video 和帮助文档放到 Help 下面
if (GeneralContext.getLocale().equals(Locale.US)) {
shortCuts.add(new VideoAction());
shortCuts.add(new TutorialAction());
}
Locale locale = GeneralContext.getLocale();
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()) {
shortCuts.add(new WebDemoAction());
@ -571,14 +592,44 @@ public abstract class ToolBarMenuDock {
shortCuts.add(SeparatorDef.DEFAULT);
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 TechSolutionAction());
shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new BugAction());
shortCuts.add(new NeedAction());
LocaleCenter.buildAction(new LocaleAction() {
@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);

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;
import com.fr.io.FineEncryptUtils;
import com.fr.base.io.XMLEncryptUtils;
import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode;
@ -48,7 +49,7 @@ public class VcsCacheFileNodeFile extends FileNodeFILE {
);
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() {
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.update.ui.dialog.UpdateMainDialog;
import com.fr.design.utils.DesignUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction;
/**
@ -12,14 +10,10 @@ import com.fr.stable.os.support.OSBasedAction;
* @date 2019/10/9
*/
public class UpdateDialogAction implements OSBasedAction {
private static String UPDATE_ROUTE = "#management/backup";
@Override
public void execute(Object... objects) {
if(!OperatingSystem.isLinux()) {
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.showDialog();
}else{
DesignUtils.visitEnvServerByParameters( UPDATE_ROUTE,null,null);
}
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.showDialog();
}
}

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);
default int addingAllParameter2EditorWithReturnValue(Parameter[] parameterArray, int currentIndex) {
return 0;
}
JPanel[] toolbarPanes4Form();
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.stable.AssistUtils;
import com.fr.stable.os.OperatingSystem;
import javax.swing.JComponent;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@ -124,14 +125,20 @@ public class GradientBar extends JComponent implements UIObserver, ColorSelectab
protected void addMouseDragListener() {
this.addMouseMotionListener(new MouseAdapter() {
public void mouseDragged(MouseEvent e) {
int oldIndex = index;
for (int i = 0; i < list.size(); i++) {
if (list.get(i).contains(e.getX(), e.getY())) {
index = i;
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;
if (x && e.getY() < MAX_VERTICAL) {
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 static final String HYPHEN = "-";
@Override
public boolean recover() {
try{
@ -41,7 +43,8 @@ public class RecoverForDesigner implements Recover {
@Override
public boolean backup() {
//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();
backupFilesFromInstallEnv(envHome, 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) {
Model model = new Model();
model.setVersion(updateInfo.getLatestVersion());
model.setVersion(updateInfo.getLatestFullVersion());
model.setContent(updateInfo.getPushContent());
model.setMoreInfoUrl(updateInfo.getMoreInfoUrl());
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;
import com.fr.general.CloudCenter;
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.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import java.security.InvalidParameterException;
@ -14,9 +19,12 @@ class DesignerUpdateInfo {
private static final String KEY_CONTENT = "content";
private static final String KEY_BACKGROUND_URL = "background";
private static final String KEY_MORE_INFO_URL = "more";
private static final String SPLIT_CHAR = "-";
private final String currentVersion; // 当前版本
private final String latestVersion; // 最新版本
private final String latestFullVersion; // 最新版本的完整信息
private final String lastIgnoredVersion; // 最近一次跳过的版本
private final String pushVersion; // 推送版本
@ -27,6 +35,7 @@ class DesignerUpdateInfo {
DesignerUpdateInfo(String currentVersion, String latestVersion, String lastIgnoredVersion, JSONObject pushData) {
this.currentVersion = currentVersion;
this.latestVersion = latestVersion;
this.latestFullVersion = initLatestFullVersion();
this.lastIgnoredVersion = lastIgnoredVersion;
this.pushVersion = pushData.optString(KEY_VERSION);
@ -58,6 +67,30 @@ class DesignerUpdateInfo {
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() {
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.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.process.engine.core.FineProcessContext;
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_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 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)
);
jarCurrentLabel = new UILabel(StringUtils.isEmpty(GeneralUtils.readBuildNO()) ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_Not_Install_Version") : GeneralUtils.readBuildNO(), SwingConstants.CENTER);
String notInstallVersion = InterProviderFactory.getProvider().getLocText("Fine-Core_Basic_About_No_Build");
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"));
UpdateActionLabel jarRestorePreviousRevision = new UpdateActionLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_Restore"), false);
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));
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>":"/";
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));
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.WindowEvent;
import java.io.File;
import java.util.function.Supplier;
import static com.fr.design.layout.TableLayout.FILL;
import static com.fr.design.layout.TableLayout.PREFERRED;
@ -439,20 +440,29 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
* 设置 app servlet 默认值
*/
private void setDefaultAppAndServlet() {
String appName;
String servletName;
try {
appName = FRContext.getCommonOperator().getAppName();
} catch (Exception ignored) {
appName = RemoteWorkspaceURL.DEFAULT_WEB_APP_NAME;
}
try {
servletName = ServerConfig.getInstance().getServletName();
} catch (Exception ignored) {
servletName = RemoteWorkspaceURL.DEFAULT_SERVLET_NAME;
}
webAppNameInput.setText(appName);
servletNameInput.setText(servletName);
setWrap(webAppNameInput, () -> FRContext.getCommonOperator().getAppName(), RemoteWorkspaceURL.DEFAULT_WEB_APP_NAME);
setWrap(servletNameInput, () -> ServerConfig.getInstance().getServletName(), RemoteWorkspaceURL.DEFAULT_SERVLET_NAME);
}
private void setWrap(final UITextField textField, final Supplier<String> supplier, final String defaultName) {
new SwingWorker<String, Void>() {
@Override
protected String doInBackground() throws Exception {
return supplier.get();
}
@Override
protected void done() {
String name = defaultName;
try {
name = get();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage() , e);
}
textField.setText(name);
}
}.execute();
}

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

@ -1,5 +1,6 @@
package com.fr.file;
import com.fr.io.FineEncryptUtils;
import com.fr.base.io.XMLEncryptUtils;
import com.fr.design.gui.itree.filetree.FileComparator;
import com.fr.design.gui.itree.filetree.FileTreeIcon;
@ -186,7 +187,7 @@ public class FileFILE implements FILE {
public InputStream asInputStream() throws Exception {
InputStream in = new java.io.FileInputStream(file);
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.FRContext;
import com.fr.io.FineEncryptUtils;
import com.fr.base.io.XMLEncryptUtils;
import com.fr.design.file.NodeAuthProcessor;
import com.fr.design.gui.itree.filetree.FileNodeComparator;
@ -388,7 +389,7 @@ public class FileNodeFILE implements FILE {
);
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.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.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
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.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@ -27,6 +33,11 @@ public class FineEmbedServerMonitor {
private static final int STEP_HEARTBEAT = 40;
private static volatile FineEmbedServerMonitor monitor;
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() {
}
@ -86,8 +97,15 @@ public class FineEmbedServerMonitor {
}
if (!DesignerContext.getDesignerFrame().getProgressDialog().isVisible()) {
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());
}

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 {
padding-left: 30px;
padding-top: 30px;
padding-top: 25px;
color: white;
background-size: 100% 100% !important;
-moz-background-size: 100% 100% !important;

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

@ -22,4 +22,12 @@ public class FormulaPaneTest extends TestCase {
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.plugin.chart.PiePlot4VanChart;
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.column.VanChartColumnPlot;
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.van.chart.area.AreaIndependentVanChartInterface;
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.column.VanColumnChartTypeUI;
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, VanChartGanttPlot.VAN_CHART_GANTT_PLOT_ID, new GanttIndependentVanChartInterface());
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;
import com.fr.base.chart.BaseChartPainter;
import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.base.chart.result.WebChartIDInfo;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.file.HistoryTemplateListCache;
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
* @version 10.0
* 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 HEIGHT = 281;
private ChartCollection chartCollection;
private CallbackEvent callbackEvent;
private String chartName;
public AutoChartIcon(ChartCollection chartCollection) {
this.chartCollection = chartCollection;
initChartName();
}
public ChartCollection getChartCollection() {
return chartCollection;
super(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
public void paintIcon(Component c, Graphics g, int x, int y) {
BaseChartPainter painter = chartCollection.createResultChartPainterWithOutDealFormula(Calculator.createCalculator(),
protected BaseChartPainter getChartPainter() {
BaseChartPainter painter = getChartCollection().createResultChartPainterWithOutDealFormula(Calculator.createCalculator(),
WebChartIDInfo.createAutoTypeInfo(), getIconWidth(), getIconHeight());
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);
return painter;
}
/**

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.file.HistoryTemplateListCache;
import com.fr.design.mainframe.ChartPropertyPane;
import com.fr.design.module.ChartEmptyDataStyleAction;
import com.fr.design.module.ChartHyperlinkGroup;
import com.fr.design.module.ChartPreStyleAction;
import com.fr.design.module.DesignModuleFactory;
import com.fr.form.ui.ChartEditor;
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.plugin.ExtraChartDesignClassManagerProvider;
import com.fr.van.chart.DownloadOnlineSourcesHelper;
import com.fr.van.chart.map.server.ChartMapEditorAction;
/**
* Created by juhaoyu on 2018/6/27.
@ -43,10 +40,6 @@ public class ChartDesignerActivator extends Activator implements Prepare {
DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class);
ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction());
ActionFactory.registerChartEmptyDataStyleAction(new ChartEmptyDataStyleAction());
ActionFactory.registerChartMapEditorAction(new ChartMapEditorAction());
ActionFactory.registerChartCollection(ChartCollection.class);
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;
import com.fr.base.GraphHelper;
import com.fr.general.IOUtils;
import com.fr.stable.Constants;
import com.fr.base.chart.BaseChartPainter;
import com.fr.base.chart.chartdata.CallbackEvent;
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.XMLable;
import com.fr.stable.xml.XMLableReader;
@ -13,7 +18,6 @@ import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.image.BufferedImage;
/**
* 图表的缩略图Icon, 在选择图表类型界面 用到.
@ -21,21 +25,47 @@ import java.awt.image.BufferedImage;
public class ChartIcon implements Icon, XMLable {
private static final int WIDTH = 400;
private static final int HEIGHT = 225;
/**
* 缩略图中的图片路径
*/
private String imagePath;
private ChartCollection chartCollection;
private CallbackEvent callbackEvent;
private String chartName;
/**
* 构造Chart的缩略图Icon
*/
public ChartIcon(String imagePath, String chartName) {
this.imagePath = imagePath;
public ChartIcon(ChartCollection chartCollection) {
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;
}
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
*
@ -47,21 +77,29 @@ public class ChartIcon implements Icon, XMLable {
@Override
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);
g2d.setPaint(Color.white);
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);
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
public void readXML(XMLableReader reader) {
//do nothing
@ -114,8 +138,11 @@ public class ChartIcon implements Icon, XMLable {
@Override
public Object clone() throws CloneNotSupportedException {
ChartIcon cloned = (ChartIcon) super.clone();
cloned.imagePath = this.imagePath;
cloned.chartName = this.chartName;
if (getChartCollection() != null) {
cloned.setChartCollection(this.getChartCollection());
}
cloned.setChartName(this.getChartName());
;
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
*/
import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.charttypes.ChartTypeManager;
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.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer;
@ -23,10 +23,12 @@ import javax.swing.JSplitPane;
import javax.swing.ListCellRenderer;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.awt.Color;
import java.awt.Component;
public class ChartTypePane extends ChartCommonWizardPane {
public class ChartTypePane extends ChartCommonWizardPane implements CallbackEvent {
private static final long serialVersionUID = -1175602484968520546L;
private String[] chartIDs = ChartTypeManager.getInstanceWithCheck().getAllChartIDs();
@ -35,6 +37,8 @@ public class ChartTypePane extends ChartCommonWizardPane {
private JList iconViewList = null;
private DefaultListModel iconListModel = null;
private static Map<ChartProvider, ChartProvider> map = new ConcurrentHashMap();
public ChartTypePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
DefaultListModel defaultListModel = new DefaultListModel();
@ -96,14 +100,21 @@ public class ChartTypePane extends ChartCommonWizardPane {
int main_index = mainTypeList.getSelectedIndex();
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);
ChartTypePane.this.iconListModel.clear();
for (int i = 0, len = subName.length; i < len; i++) {
String ImagePath = demoImagePath.length > i ? demoImagePath[i] : StringUtils.EMPTY;
String chartName = subName[i];
ChartTypePane.this.iconListModel.addElement(new ChartIcon(ImagePath, chartName));
for (int i = 0, len = charts.length; i < len; i++) {
ChartProvider chart = charts[i];
if (map.get(chart) == null) {
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);
}
@ -144,4 +155,9 @@ public class ChartTypePane extends ChartCommonWizardPane {
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.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author Bjorn
@ -30,6 +32,15 @@ import java.util.List;
*/
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) {
List<ColumnInfo> columnValue = calculateField(tableName, columns);
if (columnValue.isEmpty()) {
@ -86,9 +97,29 @@ public class AutoTypeCalculate {
return false;
}
}
//不是日期型数字才是指标
return !isNumberData(values);
}
private static boolean isNumberData(List<String> values) {
for (String value : values) {
if (!isNumberData(value)) {
return false;
}
}
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) {
NameTableData nameTableData = new NameTableData(tableName);
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;
import com.fr.data.util.function.AbstractDataFunction;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.chartx.component.correlation.AbstractCorrelationPane;
import com.fr.design.chartx.component.correlation.CalculateComboBoxEditorComponent;
import com.fr.design.chartx.component.correlation.FieldEditorComponentWrapper;
import com.fr.design.chartx.component.correlation.UIComboBoxEditorComponent;
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.ilable.UILabel;
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.table.DataPaneHelper;
import com.fr.extended.chart.UIComboBoxWithNone;
@ -22,19 +21,25 @@ import com.fr.stable.StringUtils;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.util.ArrayList;
import java.util.List;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
/**
* Created by shine on 2018/9/12.
* 系列名使用字段名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;
@ -42,73 +47,43 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
private List<String> fieldList = new ArrayList<String>();
@Override
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);
}
public AbstractCustomFieldComboBoxPane() {
@Override
protected List<FurtherBasicBeanPane<? extends T>> initPaneList() {
useFieldValuePane = createUseFieldValuePane();
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() {
FurtherBasicBeanPane pane = new FurtherBasicBeanPane() {
nameOrValue = new UIButtonGroup<Boolean>(
new String[]{useFieldValuePane.title4PopupWindow(), customFieldNamePane.title4PopupWindow()},
new Boolean[]{false, true});
nameOrValue.setSelectedItem(false);
nameOrValue.addChangeListener(new ChangeListener() {
@Override
public String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Chart_Enable_Field_Name");
public void stateChanged(ChangeEvent e) {
checkCardPane();
}
});
JPanel northPane = DataLayoutHelper.createDataLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"), nameOrValue);
@Override
public boolean accept(Object ob) {
return false;
}
@Override
public void reset() {
}
cardLayout = new CardLayout();
cardPane = new JPanel(cardLayout);
cardPane.add(useFieldValuePane, useFieldValuePane.title4PopupWindow());
cardPane.add(customFieldNamePane, customFieldNamePane.title4PopupWindow());
@Override
public void populateBean(Object ob) {
}
@Override
public Object updateBean() {
return null;
}
};
pane.setLayout(new BorderLayout(0, 6));
pane.add(customFieldNamePane, BorderLayout.CENTER);
return pane;
this.setLayout(new BorderLayout(0, 6));
this.add(northPane, BorderLayout.NORTH);
this.add(cardPane, BorderLayout.CENTER);
}
protected abstract AbstractUseFieldValuePane createUseFieldValuePane();
protected abstract AbstractCustomFieldNamePane createCustomFieldNamePane();
@Override
protected String title4PopupWindow() {
return StringUtils.EMPTY;
}
protected boolean valueComboBoxHasNone() {
return false;
}
public void checkBoxUse(boolean hasUse) {
jcb.setEnabled(hasUse);
nameOrValue.setEnabled(hasUse);
useFieldValuePane.checkBoxUse(hasUse);
}
@ -122,6 +97,19 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
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) {
customFieldNamePane.populateBean(t);
}
@ -138,6 +126,16 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
useFieldValuePane.updateBean(t);
}
@Override
public T updateBean() {
return null;
}
@Override
protected String title4PopupWindow() {
return null;
}
protected abstract class AbstractUseFieldValuePane extends FurtherBasicBeanPane<T> {
private UIComboBox series;
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},
};
double p = TableLayout.PREFERRED;
double[] columnSize = {78, 122};
double[] rowSize = {p, p, p};
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
JPanel panel = DataLayoutHelper.createDataLayoutPane(components);
this.setLayout(new BorderLayout(0, 6));
this.add(panel, BorderLayout.CENTER);
@ -258,5 +252,10 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
protected Object[] createLine() {
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
public void populateBean(SeriesValueCorrelationDefinition ob) {
populateNameOrValue(ob.isCustomFieldValue());
if (ob.isCustomFieldValue()) {
populateCustomFieldNamePane(ob);
jcb.setSelectedIndex(1);
} else {
populateUseFieldValuePane(ob);
jcb.setSelectedIndex(0);
}
}
@Override
public void updateBean(SeriesValueCorrelationDefinition ob) {
if (jcb.getSelectedIndex() == 0) {
ob.setCustomFieldValue(false);
updateUseFieldValuePane(ob);
} else {
ob.setCustomFieldValue(true);
ob.setCustomFieldValue(updateNameOrValue());
if (ob.isCustomFieldValue()) {
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());
}
private Map<String, ColorInfo> getColorSchemesFromConfig() {
protected Map<String, ColorInfo> getColorSchemesFromConfig() {
Map<String, ColorInfo> colorSchemes = new LinkedHashMap<>();
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
@ -92,7 +92,14 @@ public class ColorSchemeComboBox extends UIComboBox {
}
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()));
}
@ -149,7 +156,7 @@ public class ColorSchemeComboBox extends UIComboBox {
return colorSchemes.keySet();
}
public class ColorInfo {
public static class ColorInfo {
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;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.util.Arrays;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
@ -67,8 +64,10 @@ public abstract class AbstractAreaLngLatPane extends JPanel {
locationType.setSelectedIndex(0);
JPanel northPane = DataLayoutHelper.createDataLayoutPane(Toolkit.i18nText("FR-Plugin_Design_Geographic_Location"), locationType);
this.setLayout(new BorderLayout(0, 6));
this.add(locationType, BorderLayout.NORTH);
this.add(northPane, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER);
}
@ -103,12 +102,8 @@ public abstract class AbstractAreaLngLatPane extends JPanel {
for (int i = 0; i < len; 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();
mapType = mapPlot == null ? mapType : mapPlot.getMapType();
}
AreaMapDataSetFieldsPane areaMapDataSetFieldsPane;
PointMapDataSetFieldsPane pointMapDataSetFieldsPane;
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.ColumnField;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.formula.TinyFormulaPane;
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 javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.util.Arrays;
import java.awt.BorderLayout;
import java.awt.Component;
@ -46,8 +42,6 @@ public abstract class AbstractCellDataFieldsPane<T extends AbstractColumnFieldCo
if (south != null) {
this.add(south, BorderLayout.SOUTH);
}
this.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
}
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]};
}
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);
}

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.data.util.function.AbstractDataFunction;
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.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.table.DataPaneHelper;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.util.Arrays;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.List;
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() {
this.setLayout(new BorderLayout(0, 6));
this.setBorder(BorderFactory.createEmptyBorder(6, 24, 0, 15));
JPanel north = createNorthPane(),
center = createCenterPane(),
@ -86,12 +81,8 @@ public abstract class AbstractDataSetFieldsPane<T extends AbstractColumnFieldCol
for (int i = 0; i < len; 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() {

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.data.field.diff.ColumnFieldCollectionWithSeriesValue;
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.DialogActionListener;
import com.fr.design.gui.ibutton.UIButton;
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.data.MapMatchResult;
import com.fr.plugin.chart.map.server.ChartGEOJSONHelper;
import com.fr.plugin.chart.vanchart.VanChart;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.tree.DefaultMutableTreeNode;
import java.util.Set;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Set;
/**
* @author Bjorn
@ -53,7 +54,7 @@ public abstract class MapDataSetFieldsPane<T extends ColumnFieldCollectionWithSe
public JPanel createAreaPanel(final UIComboBox areaBox) {
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);
UIButton uiButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png"));
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.design.beans.FurtherBasicBeanPane;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.chartx.fields.AbstractCellDataFieldsPane;
import com.fr.design.i18n.Toolkit;
@ -23,6 +24,7 @@ public class CellDataPane extends FurtherBasicBeanPane<CellDataDefinition> {
this.setLayout(new BorderLayout());
this.add(cellDataFieldsPane, BorderLayout.CENTER);
DataLayoutHelper.addNormalBorder(this);
}
@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.data.impl.NameTableData;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.chartx.fields.AbstractDataSetFieldsPane;
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.mainframe.chart.gui.ChartDataPane;
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.Dimension;
import java.util.List;
/**
* Created by shine on 2019/5/21.
*/
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;
@ -32,24 +27,27 @@ public class DataSetPane extends FurtherBasicBeanPane<DataSetDefinition> {
}
private void initComps(AbstractDataSetFieldsPane dataSetFieldsPane) {
UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Table_Data"));
UIComponentUtils.setLineWrap(label, TABLE_DATA_LABEL_LINE_WRAP_WIDTH);
UIComponentUtils.setPreferedWidth(label, ChartDataPane.LABEL_WIDTH);
tableDataPane = new DatabaseTableDataPane(label) {
tableDataPane = new DatabaseTableDataPane(null) {
@Override
protected void userEvent() {
refreshBoxListAndTableName();
checkBoxUse();
}
@Override
protected void setBorder() {
}
};
tableDataPane.setPreferredSize(new Dimension(TABLE_DATA_PANE_WIDTH, tableDataPane.getPreferredSize().height));
this.dataSetFieldsPane = dataSetFieldsPane;
this.setLayout(new BorderLayout());
this.add(tableDataPane, BorderLayout.NORTH);
JPanel northPane = DataLayoutHelper.createDataLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Table_Data"), tableDataPane);
this.setLayout(new BorderLayout(0, 6));
this.add(northPane, BorderLayout.NORTH);
this.add(dataSetFieldsPane, BorderLayout.CENTER);
DataLayoutHelper.addNormalBorder(this);
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.design.beans.BasicBeanPane;
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.AbstractDataSetFieldsPane;
import com.fr.design.constants.LayoutConstants;
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.utils.gui.UIComponentUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout;
/**
* Created by shine on 2019/5/21.
*/
public class SingleDataPane extends BasicBeanPane<AbstractDataDefinition> {
private static final int TABLE_DATA_LABEL_LINE_WIDTH = 81;
private UIComboBoxPane<AbstractDataDefinition> comboBoxPane;
private DataSetPane dataSetPane;
@ -50,18 +44,12 @@ public class SingleDataPane extends BasicBeanPane<AbstractDataDefinition> {
}
protected void initLayout() {
this.setLayout(new BorderLayout(LayoutConstants.HGAP_LARGE, 6));
JPanel northPane = new JPanel(new BorderLayout(LayoutConstants.HGAP_LARGE, 0));
this.setLayout(new BorderLayout(0, 6));
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(cardPane, BorderLayout.CENTER);
}
@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.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
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.ThirdTabPane;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
@ -21,12 +21,12 @@ import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
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> {
private static final long serialVersionUID = 3650522989381790194L;
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 SeriesFilterPane seriesPane;
@ -50,6 +50,11 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
this.isNeedPresent = true;
}
public ChartDataFilterPane(Plot plot, ChartDataPane parent, boolean isNeedPresent) {
super(plot, parent);
this.isNeedPresent = isNeedPresent;
}
protected void initTabPane() {
super.initTabPane();
tabPane.setPreferredSize(new Dimension(221, 25));
@ -109,7 +114,7 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
* @return 返回标题.
*/
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) {
relayoutPane(isNeedPresent);
TopDefinitionProvider topDefinition = collection.getSelectedChart().getFilterDefinition();
populateDefinition(topDefinition, isNeedPresent);
}
public void populateDefinition(TopDefinitionProvider topDefinition, boolean isNeedSummary) {
relayoutPane(isNeedSummary);
if (categoryPane != null) {
categoryPane.populateBean(collection.getSelectedChart().getFilterDefinition());
categoryPane.populateBean(topDefinition);
}
if (seriesPane != null) {
seriesPane.populateBean(collection.getSelectedChart().getFilterDefinition());
seriesPane.populateBean(topDefinition);
}
checkBoxUse();
}
@ -165,11 +175,16 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
* 保存界面数据筛选.
*/
public void updateBean(ChartCollection collection) {
TopDefinitionProvider topDefinition = collection.getSelectedChart().getFilterDefinition();
updateDefinition(topDefinition);
}
public void updateDefinition(TopDefinitionProvider topDefinition) {
if (categoryPane != null) {
categoryPane.updateBean(collection.getSelectedChart().getFilterDefinition());
categoryPane.updateBean(topDefinition);
}
if (seriesPane != null) {
seriesPane.updateBean(collection.getSelectedChart().getFilterDefinition());
seriesPane.updateBean(topDefinition);
}
}
@ -222,13 +237,13 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
}
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 panel2 = new JPanel(new BorderLayout());
panel1.add(onlyPreData, BorderLayout.NORTH);
preDataNum = new UITextField();
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Records_Num"));
combineOther = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_CombineOther"));
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Records_Num"));
combineOther = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Data_CombineOther"));
combineOther.setSelected(true);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
@ -244,7 +259,7 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
//默认不显示
preDataNumPane.setVisible(false);
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);
onlyPreData.addChangeListener(new ChangeListener() {
@ -258,7 +273,7 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
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);
double[] column = {f};
@ -281,7 +296,7 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
* 界面标题 "分类"
*/
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() {
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 panel2 = new JPanel(new BorderLayout());
panel1.add(onlyPreData, BorderLayout.NORTH);
preDataNum = new UITextField();
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Records_Num"));
combineOther = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_CombineOther"));
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Records_Num"));
combineOther = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Data_CombineOther"));
combineOther.setSelected(true);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
@ -419,7 +434,7 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
//默认不显示
preDataNumPane.setVisible(false);
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);
onlyPreData.addChangeListener(new ChangeListener() {
@ -433,7 +448,7 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
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);
double[] column = {f};
@ -457,7 +472,7 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
* 界面标题
*/
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series");
return Toolkit.i18nText("Fine-Design_Chart_Series");
}
/**

41
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.design.formula.TinyFormulaPane;
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.data.ChartDataFilterPane;
import com.fr.stable.StringUtils;
@ -26,35 +27,35 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent
protected TinyFormulaPane categoryName;
protected ChartDataFilterPane filterPane;
public CategoryPlotReportDataContentPane(){
}
public CategoryPlotReportDataContentPane(ChartDataPane parent) {
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.setBorder(BorderFactory.createEmptyBorder(0,24,0,20));
this.add(categoryName, "0,0,1,0");
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());
filterPane.setBorder(getFilterPaneBorder());
this.add(panel, "0,6,1,4"); }
protected TinyFormulaPane initCategoryBox(final String leftLabel) {
TinyFormulaPane categoryName = new TinyFormulaPane() {
@Override
protected void initLayout() {
this.setLayout(new BorderLayout(4, 0));
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));
this.add(label1, BorderLayout.WEST);
}
formulaTextField.setPreferredSize(new Dimension(100, 20));
this.add(formulaTextField, BorderLayout.CENTER);
this.add(formulaTextFieldButton, BorderLayout.EAST);
@ -83,15 +84,15 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent
checkBoxUse();
}
});
return categoryName;
}
@Override
protected String[] columnNames() {
return new String[]{
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Value")
Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
Toolkit.i18nText("Fine-Design_Chart_Series_Value")
};
}
@ -99,6 +100,10 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent
checkBoxUse();
TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition();
populateDefinition(definition);
}
public void populateDefinition(TopDefinitionProvider definition) {
if (definition instanceof NormalReportDataDefinition) {
NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition;
if (reportDefinition.getCategoryName() != null) {
@ -109,20 +114,25 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent
populateList(list);
}
}
seriesPane.doLayout();
}
filterPane.populateBean(collection);
filterPane.populateDefinition(definition, true);
}
public void updateBean(ChartCollection collection) {
collection.getSelectedChart().setFilterDefinition(new NormalReportDataDefinition());
TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition();
updateDefinition(definition);
}
public void updateDefinition(TopDefinitionProvider definition) {
if (definition instanceof NormalReportDataDefinition) {
NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition;
reportDefinition.setCategoryName(canBeFormula(categoryName.getUITextField().getText()));
List list = updateList();
@ -135,6 +145,7 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent
reportDefinition.add(sd);
}
}
filterPane.updateBean(collection);
filterPane.updateDefinition(definition);
}
}

53
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.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
@ -28,24 +29,24 @@ import java.util.List;
*/
public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPane{
private static final long serialVersionUID = 7284078589672079657L;
protected UIComboBox categoryCombox;
protected SeriesTypeUseComboxPane seriesTypeComboxPane;
public CategoryPlotTableDataContentPane() {
}
public CategoryPlotTableDataContentPane(ChartDataPane parent) {
categoryCombox = new UIComboBox();
JPanel categoryPane = new JPanel(new BorderLayout(4,0));
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));
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.setPreferredSize(new Dimension(246,30));
categoryPane.setBorder(BorderFactory.createEmptyBorder(0,24,10,15));
@ -56,7 +57,7 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
this.add(getJSeparator());
seriesTypeComboxPane = new SeriesTypeUseComboxPane(parent, new Bar2DPlot());
this.add(seriesTypeComboxPane, BorderLayout.SOUTH);
categoryCombox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
checkSeriseUse(categoryCombox.getSelectedItem() != null);
@ -64,7 +65,7 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
}
});
}
protected void makeToolTipUse(UIComboBox comBox) {
if(comBox.getSelectedItem() != null) {
comBox.setToolTipText(comBox.getSelectedItem().toString());
@ -72,7 +73,7 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
comBox.setToolTipText(null);
}
}
/**
* 检查 某些Box是否可用
* @param hasUse 是否使用.
@ -81,16 +82,16 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
categoryCombox.setEnabled(hasUse);
checkSeriseUse(hasUse);
}
protected void checkSeriseUse(boolean hasUse) {
if(seriesTypeComboxPane != null) {
seriesTypeComboxPane.checkUseBox(hasUse && categoryCombox.getSelectedItem() != null);
}
}
protected void refreshBoxListWithSelectTableData(List 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);
}
@ -100,10 +101,10 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
*/
public void clearAllBoxList(){
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();
}
/**
* 保存界面内容到ChartCollection
*/
@ -129,15 +130,15 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
public void populateBean(ChartCollection collection) {
super.populateBean(collection);
TopDefinition top = (TopDefinition)collection.getSelectedChart().getFilterDefinition();
if(!(top instanceof NormalTableDataDefinition)) {
return;
}
NormalTableDataDefinition data = (NormalTableDataDefinition)top;
if(data == null || ComparatorUtils.equals(data.getCategoryName(), StringUtils.EMPTY)) {
categoryCombox.setSelectedItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None"));
} else if(data!= null && !this.boxItemsContainsObject(categoryCombox,data.getCategoryName())){
if(ComparatorUtils.equals(data.getCategoryName(), StringUtils.EMPTY)) {
categoryCombox.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
} else if(!DataPaneHelper.boxItemsContainsObject(categoryCombox,data.getCategoryName())){
categoryCombox.setSelectedItem(null);
}else {
combineCustomEditValue(categoryCombox, data.getCategoryName());
@ -146,20 +147,6 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
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.log.FineLoggerFactory;
import javax.swing.ComboBoxModel;
import java.util.List;
/**
@ -24,6 +25,30 @@ public class DataPaneHelper {
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里所有东西
*

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.UITableEditor;
import com.fr.design.gui.itextfield.UITextField;
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.data.CalculateComboBox;
@ -23,6 +24,8 @@ import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.event.ChangeEvent;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
@ -30,8 +33,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
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
*/
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_NO_SUMMARY = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Field_Name"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name")};
private static final String[] HEADS = {
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 List<String> field = new ArrayList<String>();
private JPanel centerPane;
@ -62,7 +70,7 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
return new ActionListener() {
@Override
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};
tablePane.addLine(blank);
fireTargetChanged();
@ -121,7 +129,7 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
* @return 标题
*/
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){
relayoutPane(isNeedSummary);
public void populateBean(ChartCollection collection, boolean isNeedSummary) {
TopDefinitionProvider topDefinition = collection.getSelectedChart().getFilterDefinition();
populateDefinition(topDefinition, isNeedSummary);
}
public void populateDefinition(TopDefinitionProvider topDefinition, boolean isNeedSummary) {
relayoutPane(isNeedSummary);
if (topDefinition instanceof MoreNameCDDefinition) {
MoreNameCDDefinition moreDefinition = (MoreNameCDDefinition) topDefinition;
ChartSummaryColumn[] chartSummaryColumnArray = moreDefinition.getChartSummaryColumn();
@ -221,6 +233,11 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
*/
public void updateBean(ChartCollection collection) {
TopDefinitionProvider normalDefinition = collection.getSelectedChart().getFilterDefinition();
MoreNameCDDefinition moreDefinition = updateDefinition(normalDefinition);
collection.getSelectedChart().setFilterDefinition(moreDefinition);
}
public MoreNameCDDefinition updateDefinition(TopDefinitionProvider normalDefinition) {
MoreNameCDDefinition moreDefinition = null;
if (normalDefinition instanceof MoreNameCDDefinition) {
moreDefinition = (MoreNameCDDefinition) normalDefinition;
@ -242,7 +259,8 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
}
}
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.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
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.ComboBoxModel;
import javax.swing.JPanel;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.List;
/**
* 属性表 数据集 系列名使用 系列值 界面.
@ -39,7 +39,8 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
private boolean isNeedSummary = true;
public SeriesNameUseFieldValuePane() {
seriesName = new UIComboBox();
seriesName = new UIComboBoxWithNone();
seriesName.getModel().setSelectedItem(null);
seriesValue = new UIComboBox();
calculateCombox = new CalculateComboBox();
calculateCombox.reset();
@ -79,11 +80,11 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
double f = TableLayout.FILL;
double[] columnSize = {f};
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));
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));
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));
Component[][] components = getUseComponent(Label1, Label2, Label3);
@ -93,18 +94,18 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
this.add(centerPane, BorderLayout.CENTER);
}
private void initCenterPaneWithOutCaculateSummary(){
private void initCenterPaneWithOutCaculateSummary() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p, p, p, p};
UILabel Label1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name"));
Label1.setPreferredSize(new Dimension(75, 20));
UILabel Label2 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Value"));
Label2.setPreferredSize(new Dimension(75, 20));
UILabel Label3 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Summary_Method"));
Label3.setPreferredSize(new Dimension(75, 20));
Component[][] components = getUseComponentWithOutSummary(Label1, Label2, Label3);
UILabel label1 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name"));
label1.setPreferredSize(getLabelDimension());
UILabel label2 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Value"));
label2.setPreferredSize(getLabelDimension());
UILabel label3 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"));
label3.setPreferredSize(getLabelDimension());
Component[][] components = getUseComponentWithOutSummary(label1, label2, label3);
centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 4, 6);
centerPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1));
@ -112,6 +113,10 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
this.add(centerPane, BorderLayout.CENTER);
}
protected Dimension getLabelDimension() {
return new Dimension(75, 20);
}
protected Component[][] getUseComponent(UILabel Label1, UILabel Label2, UILabel Label3) {
return new Component[][]{
new Component[]{GUICoreUtils.createBorderLayoutPane(new Component[]{seriesName, null, null, Label1, null})},
@ -170,20 +175,6 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
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 接受的对象
@ -199,7 +190,7 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
* @return 界面标题
*/
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){
relayoutPane(isNeedSummary);
public void populateBean(ChartCollection ob, boolean isNeedSummary) {
TopDefinitionProvider topDefinition = ob.getSelectedChart().getFilterDefinition();
populateDefinition(topDefinition, isNeedSummary);
}
public void populateDefinition(TopDefinitionProvider topDefinition, boolean isNeedSummary) {
relayoutPane(isNeedSummary);
if (topDefinition instanceof OneValueCDDefinition) {
OneValueCDDefinition oneDefinition = (OneValueCDDefinition) topDefinition;
seriesName.setEditable(true);
seriesName.setSelectedItem(this.boxItemsContainsObject(seriesName,oneDefinition.getSeriesColumnName())
seriesName.setSelectedItem(DataPaneHelper.boxItemsContainsObject(seriesName, oneDefinition.getSeriesColumnName())
? oneDefinition.getSeriesColumnName() : null);
seriesName.setEditable(false);
seriesValue.setEditable(true);
seriesValue.setSelectedItem(this.boxItemsContainsObject(seriesValue,oneDefinition.getValueColumnName())
seriesValue.setSelectedItem(DataPaneHelper.boxItemsContainsObject(seriesValue,oneDefinition.getValueColumnName())
? oneDefinition.getValueColumnName() : null);
seriesValue.setEditable(false);
if(this.isNeedSummary){
@ -256,6 +252,11 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
* 保存界面内容 字段值
*/
public void updateBean(ChartCollection collection) {
OneValueCDDefinition oneDefinition = updateDefinition();
collection.getSelectedChart().setFilterDefinition(oneDefinition);
}
public OneValueCDDefinition updateDefinition() {
OneValueCDDefinition oneDefinition = createOneValueCDDefinition();
String seriesName = (String) this.seriesName.getSelectedItem();
@ -267,7 +268,8 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
}else{
oneDefinition.setDataFunction(new NoneFunction());
}
collection.getSelectedChart().setFilterDefinition(oneDefinition);
return oneDefinition;
}
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.chartdata.MoreNameCDDefinition;
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.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ibutton.UIButtonGroup;
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.data.ChartDataFilterPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* 属性表: 柱形, 饼图 数据集界面, "系列名使用"界面.
@ -30,7 +31,7 @@ import java.awt.Dimension;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-26 下午03:17:08
*/
public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
public class SeriesTypeUseComboxPane extends BasicBeanPane<ChartCollection> {
private SeriesNameUseFieldValuePane nameFieldValuePane;
private SeriesNameUseFieldNamePane nameFieldNamePane;
@ -39,50 +40,106 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
private ChartDataPane parent;
private Plot initplot;
private boolean isNeedSummary = true;
private boolean isNeedSummary;
protected UIButtonGroup<Integer> content;
protected JPanel cardPane;
public SeriesTypeUseComboxPane(ChartDataPane parent, Plot initplot) {
this.initplot = initplot;
this.parent = parent;
cards = initPaneList();
this.isNeedSummary = true;
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() {
this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM));
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}));
northPane.setBorder(BorderFactory.createEmptyBorder(10, 24, 0, 15));
cardPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
//使用系列名/系列值选项面板
UILabel seriesLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"));
seriesLabel.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
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);
//系列名/系列值配置面板
cardPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
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.setBorder(BorderFactory.createEmptyBorder(10,5,0,5));
//数据筛选
dataScreeningPane = new ChartDataFilterPane(this.initplot, parent);
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);
}
protected UIComboBox createComboBox() {
UIComboBox uiComboBox = new UIComboBox();
UIComponentUtils.setPreferedWidth(uiComboBox, 100);
return uiComboBox;
public Dimension getPreferredSize() {
Dimension preferredSize = super.getPreferredSize();
return new Dimension(246, (int) preferredSize.getHeight());
}
/**
* 检查box 是否使用, hasUse, 表示上层已经使用, 否则, 则此界面都可使用
*
* @param hasUse 是否使用
*/
public void checkUseBox(boolean hasUse) {
jcb.setEnabled(hasUse);
content.setEnabled(hasUse);
nameFieldValuePane.checkUse(hasUse);
dataScreeningPane.checkBoxUse();
}
/**
* 切换 变更数据集时, 刷新Box选中项目
*
* @param list 列表
*/
public void refreshBoxListWithSelectTableData(List list) {
@ -93,28 +150,20 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
/**
* 清空所有的box设置
*/
public void clearAllBoxList(){
public void clearAllBoxList() {
nameFieldValuePane.clearAllBoxList();
nameFieldNamePane.clearAllBoxList();
}
/**
* 界面标题
*
* @return 界面标题
*/
protected String title4PopupWindow() {
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() {
return new SeriesNameUseFieldValuePane();
@ -135,15 +184,17 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
nameFieldNamePane.populateBean(ob, isNeedSummary);
}
dataScreeningPane.populateBean(ob, isNeedSummary);
checkCardPane();
}
/**
* 重新布局整个面板
*
* @param isNeedSummary 是否需要汇总
*/
public void relayoutPane(boolean isNeedSummary) {
this.isNeedSummary = isNeedSummary;
if (jcb.getSelectedIndex() == 0) {
if (this.getSelectedIndex() == 0) {
nameFieldValuePane.relayoutPane(this.isNeedSummary);
} else {
nameFieldNamePane.relayoutPane(this.isNeedSummary);
@ -152,9 +203,8 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
}
@Override
protected void comboBoxItemStateChanged() {
if (jcb.getSelectedIndex() == 0) {
if (this.getSelectedIndex() == 0) {
nameFieldValuePane.relayoutPane(this.isNeedSummary);
} else {
nameFieldNamePane.relayoutPane(this.isNeedSummary);
@ -178,4 +228,21 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
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.border.Border;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
@ -20,7 +21,6 @@ import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
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() {
this.setLayout(new BorderLayout());
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.ColorSelectBox;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
@ -29,6 +28,8 @@ import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
@ -40,8 +41,6 @@ import java.awt.LayoutManager;
import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
public class UIColorPickerPane extends BasicPane implements UIObserver {
private static final int MARGIN_TOP = 7;
@ -635,7 +634,7 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
@Override
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);
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;
}
/**
*刷新颜色选取器

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

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

Loading…
Cancel
Save