From b63c2b1f12ffee124eaa4a1b66d95de0d0051b4a Mon Sep 17 00:00:00 2001 From: zheng Date: Thu, 5 Sep 2019 17:22:26 +0800 Subject: [PATCH 01/29] =?UTF-8?q?CHART-10247=20=E5=9B=BE=E8=A1=A8=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E7=95=8C=E9=9D=A2=E4=B8=8D=E5=8E=BBchart=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E9=87=8C=E9=9D=A2=E6=8B=BF=E5=9B=BE=E7=89=87=20?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E5=8E=BBChartTypeUIProvider=E6=8B=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 203 ++++++++---------- .../com/fr/design/chart/ChartTypePane.java | 45 ++-- ...Provider.java => ChartTypeUIProvider.java} | 81 ++++--- .../fun/impl/AbstractIndependentChartUI.java | 66 ------ ...bstractIndependentChartUIWithAPILevel.java | 23 +- .../fun/impl/AbstractIndependentChartsUI.java | 27 +-- .../chart/gui/ChartTypeButtonPane.java | 5 +- .../mainframe/chart/gui/ChartTypePane.java | 19 +- .../AbstractExtendedChartUIProvider.java | 19 +- .../fr/extended/chart/ExtendedTypePane.java | 3 +- .../AreaIndependentVanChartInterface.java | 27 ++- .../bar/BarIndependentVanChartInterface.java | 28 ++- .../BubbleIndependentVanChartInterface.java | 17 +- .../ColumnIndependentVanChartInterface.java | 34 ++- .../CustomIndependentVanChartInterface.java | 20 +- .../DrillMapIndependentVanChartInterface.java | 18 +- .../FunnelIndependentVanChartInterface.java | 9 +- .../GanttIndependentVanChartInterface.java | 11 +- .../GaugeIndependentVanChartInterface.java | 21 +- .../HeatMapIndependentVanChartInterface.java | 10 +- .../LineIndependentVanChartInterface.java | 19 +- .../map/MapIndependentVanChartInterface.java | 20 +- .../MultiPieIndependentVanChartInterface.java | 19 +- .../pie/PieIndependentVanChartInterface.java | 19 +- .../RadarIndependentVanChartInterface.java | 18 +- .../ScatterIndependentVanChartInterface.java | 10 +- ...StructureIndependentVanChartInterface.java | 16 +- .../TreeMapIndependentVanChartInterface.java | 9 +- ...WordCloudIndependentVanChartInterface.java | 19 +- .../java/com/fr/poly/PolyComponentsBar.java | 11 +- 30 files changed, 467 insertions(+), 379 deletions(-) rename designer-chart/src/main/java/com/fr/design/chart/fun/{IndependentChartUIProvider.java => ChartTypeUIProvider.java} (73%) delete mode 100644 designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java diff --git a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java index 8c3f56ae01..7a945995ee 100644 --- a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java @@ -1,13 +1,14 @@ package com.fr.design; import com.fr.chart.base.ChartConstants; -import com.fr.chart.base.ChartInternationalNameContentBean; +import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chartx.attr.ChartProvider; import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane; -import com.fr.design.chart.fun.IndependentChartUIProvider; +import com.fr.design.chart.fun.ChartTypeUIProvider; +import com.fr.design.chart.fun.impl.AbstractIndependentChartsUI; import com.fr.design.chart.gui.ChartWidgetOption; import com.fr.design.chartinterface.AreaIndependentChartInterface; import com.fr.design.chartinterface.BarIndependentChartInterface; @@ -38,10 +39,11 @@ import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPa import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.module.DesignModuleFactory; +import com.fr.extended.chart.AbstractExtendedChartUIProvider; import com.fr.form.ui.ChartEditor; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; -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.bubble.VanChartBubblePlot; @@ -111,9 +113,9 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr private static ChartTypeInterfaceManager classManager = new ChartTypeInterfaceManager(); - - private static LinkedHashMap> chartTypeInterfaces = - new LinkedHashMap>(); + + private static LinkedHashMap> chartTypeInterfaces = + new LinkedHashMap>(); private static Map idAndPriorityMap = new HashMap(); @@ -156,18 +158,18 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr public static WidgetOption[] initWidgetOption() { - ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); - ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; + String[] chartIDs = ChartTypeManager.getInstance().getAllChartIDs(); + ChartWidgetOption[] child = new ChartWidgetOption[chartIDs.length]; int index = 0; - for (ChartInternationalNameContentBean bean : typeName) { - String plotID = bean.getChartID(); - ChartProvider[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); - if (ArrayUtils.isEmpty(rowChart) && !ChartTypeManager.innerChart(plotID)) { + for (String chartID : chartIDs) { + ChartProvider[] rowChart = ChartTypeManager.getInstance().getChartTypes(chartID); + if (ArrayUtils.isEmpty(rowChart) && !ChartTypeManager.innerChart(chartID)) { continue; } - String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); + String name = ChartTypeInterfaceManager.getInstance().getName(chartID); + String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(chartID); Icon icon = IOUtils.readIcon(iconPath); - child[index] = new ChartWidgetOption(InterProviderFactory.getProvider().getLocText(bean.getName()), icon, ChartEditor.class, plotID); + child[index] = new ChartWidgetOption(name, icon, ChartEditor.class, chartID); index++; } @@ -218,18 +220,18 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface()); addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface()); } - - private static void addChartTypeInterface(String priority, String plotID, IndependentChartUIProvider provider) { + + private static void addChartTypeInterface(String priority, String plotID, ChartTypeUIProvider provider) { if (chartTypeInterfaces != null) { if (!chartTypeInterfaces.containsKey(priority)) { //新建一个具体图表列表 - CloseableContainedMap chartUIList - = new CloseableContainedMap(LinkedHashMap.class); + CloseableContainedMap chartUIList + = new CloseableContainedMap(LinkedHashMap.class); chartUIList.put(plotID, provider); chartTypeInterfaces.put(priority, chartUIList); } else { - Map chartUIList = chartTypeInterfaces.get(priority); + Map chartUIList = chartTypeInterfaces.get(priority); if (!chartUIList.containsKey(plotID)) { chartUIList.put(plotID, provider); } @@ -238,7 +240,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr } } - private IndependentChartUIProvider getChartTypeInterface(String plotID) { + private ChartTypeUIProvider getChartTypeInterface(String plotID) { if (idAndPriorityMap.containsKey(plotID)) { String priority = idAndPriorityMap.get(plotID); if (chartTypeInterfaces.containsKey(priority)) { @@ -267,66 +269,30 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority)) { - Map chartUIList = chartTypeInterfaces.get(priority); - - Iterator> iterator = chartUIList.entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry entry = iterator.next(); - String plotID = entry.getKey(); - - AbstractChartTypePane pane = entry.getValue().getPlotTypePane(); - if (AssistUtils.equals(pane.title4PopupWindow(), TYPE_PANE_DEFAULT_TITLE)) { - continue; - } - pane.setPlotID(plotID); - paneList.add(pane); - - if (allChartTypePane.get(priority) == null) { - allChartTypePane.put(priority, new LinkedHashMap>()); - } - allChartTypePane.get(priority).put(plotID, pane); - } - } - } - - private String getChartName(String plotID, IndependentChartUIProvider provider) { - String name = provider.getPlotTypeTitle4PopupWindow(); - if (StringUtils.isEmpty(name)) { - name = ChartTypeManager.getInstance().getChartName(plotID); - } - return name; - } + Map chartUIList = chartTypeInterfaces.get(priority); - public String getTitle4PopupWindow(String plotID) { - IndependentChartUIProvider provider = getChartTypeInterface(plotID); - if (provider != null) { - return provider.getPlotTypeTitle4PopupWindow(); - } - return StringUtils.EMPTY; - } - - /** - * 获取指定图表的标题 - */ - public String getTitle4PopupWindow(String priority, String plotID) { - - if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)) { - IndependentChartUIProvider provider = chartTypeInterfaces.get(priority).get(plotID); - return getChartName(plotID, provider); - } - - //兼容老的插件 - if (chartTypeInterfaces != null) { - Iterator iterator = chartTypeInterfaces.entrySet().iterator(); + Iterator> iterator = chartUIList.entrySet().iterator(); while (iterator.hasNext()) { - Map.Entry entry = (Map.Entry) iterator.next(); - String defaultPriority = (String) entry.getKey(); - if (chartTypeInterfaces.get(defaultPriority).containsKey(plotID)) { - return getChartName(plotID, chartTypeInterfaces.get(defaultPriority).get(plotID)); + try { + Map.Entry entry = iterator.next(); + String plotID = entry.getKey(); + + AbstractChartTypePane pane = entry.getValue().getPlotTypePane(); + if (AssistUtils.equals(pane.title4PopupWindow(), TYPE_PANE_DEFAULT_TITLE)) { + continue; + } + pane.setPlotID(plotID); + paneList.add(pane); + + if (allChartTypePane.get(priority) == null) { + allChartTypePane.put(priority, new LinkedHashMap>()); + } + allChartTypePane.get(priority).put(plotID, pane); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } } - return StringUtils.EMPTY; } private List getPriorityInOrder() { @@ -346,16 +312,53 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr public String getIconPath(String plotID) { if (chartTypeInterfaces != null) { - IndependentChartUIProvider provider = getChartTypeInterface(plotID); + ChartTypeUIProvider provider = getChartTypeInterface(plotID); if (provider != null) { return provider.getIconPath(); } } return StringUtils.EMPTY; } + + public String[] getSubName(String id) { + if (chartTypeInterfaces != null) { + ChartTypeUIProvider provider = getChartTypeInterface(id); + if (provider != null) { + String[] subNames = provider.getSubName(); + return ArrayUtils.isEmpty(subNames) ? new String[]{getName(id)} : subNames; + } + } + return new String[0]; + } + + public String getName(String id) { + if (chartTypeInterfaces != null) { + ChartTypeUIProvider provider = getChartTypeInterface(id); + if (provider != null) { + String name = provider.getName(); + return StringUtils.isEmpty(name) ? getCompatibleName(id, provider) : name; + } + } + return StringUtils.EMPTY; + } + + //兼容 + private static String getCompatibleName(String id, ChartTypeUIProvider provider) { + if (provider instanceof AbstractIndependentChartsUI) { + return provider.getPlotTypePane().title4PopupWindow(); + } + if (provider instanceof AbstractExtendedChartUIProvider) { + ChartProvider chartProvider = ChartTypeManager.getInstanceWithCheck().getChartTypes(id)[0]; + if (chartProvider instanceof Chart) { + return ((Chart) chartProvider).getChartName(); + } + } + + return StringUtils.EMPTY; + } public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) { - IndependentChartUIProvider provider = getChartTypeInterface(plotID); + ChartTypeUIProvider provider = getChartTypeInterface(plotID); if (provider != null) { return provider.getChartDataPane(listener); } @@ -363,20 +366,8 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr return new ChartDataPane(listener); } - /** - * 获取对应ID的图表数量 - * - */ - private int getChartSize(String key) { - - if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(key)) { - return chartTypeInterfaces.get(key).size(); - } - return 0; - } - public AbstractChartAttrPane[] getAttrPaneArray(String plotID, AttributeChangeListener listener) { - IndependentChartUIProvider provider = getChartTypeInterface(plotID); + ChartTypeUIProvider provider = getChartTypeInterface(plotID); if (provider != null) { return provider.getAttrPaneArray(listener); } @@ -387,7 +378,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { - IndependentChartUIProvider provider = getChartTypeInterface(plot.getPlotID()); + ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID()); if (provider != null) { return provider.getTableDataSourcePane(plot, parent); } @@ -397,7 +388,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { - IndependentChartUIProvider provider = getChartTypeInterface(plot.getPlotID()); + ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID()); if (provider != null) { return provider.getReportDataSourcePane(plot, parent); } @@ -405,17 +396,9 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr return null; } - private boolean plotInChart(String plotID, String priority) { - - return chartTypeInterfaces != null - && chartTypeInterfaces.containsKey(priority) - && chartTypeInterfaces.get(priority).containsKey(plotID); - } - - public ConditionAttributesPane getPlotConditionPane(Plot plot) { - IndependentChartUIProvider provider = getChartTypeInterface(plot.getPlotID()); + ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID()); if (provider != null) { return provider.getPlotConditionPane(plot); } @@ -425,7 +408,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot) { - IndependentChartUIProvider provider = getChartTypeInterface(plot.getPlotID()); + ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID()); if (provider != null) { return provider.getPlotSeriesPane(parent, plot); } @@ -441,7 +424,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr */ public boolean isUseDefaultPane(String plotID) { - IndependentChartUIProvider provider = getChartTypeInterface(plotID); + ChartTypeUIProvider provider = getChartTypeInterface(plotID); if (provider != null) { return provider.isUseDefaultPane(); } @@ -452,7 +435,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr public boolean needChartChangePane(ChartProvider chart) { if (chart != null) { String chartID = chart.getID(); - IndependentChartUIProvider provider = getChartTypeInterface(chartID); + ChartTypeUIProvider provider = getChartTypeInterface(chartID); if (provider != null) { return provider.needChartChangePane(); } @@ -467,7 +450,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr if (isIndependentChartUIProvider(injection)) { String priority = injection.getAttribute("priority", DEFAULT_PRIORITY); String plotID = injection.getAttribute("plotID"); - IndependentChartUIProvider instance = (IndependentChartUIProvider) injection.getObject(); + ChartTypeUIProvider instance = (ChartTypeUIProvider) injection.getObject(); addChartTypeInterface(priority, plotID, instance); } } @@ -487,7 +470,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr if (chartTypeInterfaces != null) { if (chartTypeInterfaces.containsKey(priority)) { - Map chartUIList = chartTypeInterfaces.get(priority); + Map chartUIList = chartTypeInterfaces.get(priority); chartUIList.remove(plotID); } } @@ -495,13 +478,13 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr private boolean isIndependentChartUIProvider(PluginSingleInjection injection) { - - return !(injection == null || injection.getObject() == null) && IndependentChartUIProvider.XML_TAG.equals(injection.getName()) && injection.getObject() instanceof IndependentChartUIProvider; + + return !(injection == null || injection.getObject() == null) && ChartTypeUIProvider.XML_TAG.equals(injection.getName()) && injection.getObject() instanceof ChartTypeUIProvider; } public ChartEditPane getChartEditPane(String plotID) { - IndependentChartUIProvider provider = getChartTypeInterface(plotID); + ChartTypeUIProvider provider = getChartTypeInterface(plotID); if (provider != null) { return provider.getChartEditPane(plotID); } @@ -509,7 +492,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr } public ChartsConfigPane getChartConfigPane(String plotID) { - IndependentChartUIProvider provider = getChartTypeInterface(plotID); + ChartTypeUIProvider provider = getChartTypeInterface(plotID); if (provider != null) { return provider.getChartConfigPane(plotID); } diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java index 599a70915f..d349b39678 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java @@ -3,14 +3,13 @@ package com.fr.design.chart; * the Pane of the Chart */ -import com.fr.chart.base.ChartInternationalNameContentBean; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chartx.attr.ChartProvider; +import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import javax.swing.BorderFactory; @@ -28,29 +27,7 @@ import java.awt.Component; public class ChartTypePane extends ChartCommonWizardPane { private static final long serialVersionUID = -1175602484968520546L; - private ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstanceWithCheck().getAllChartBaseNames(); - private ChartProvider[][] charts4Icon = null; - - { - charts4Icon = new ChartProvider[this.typeName.length][]; - for (int i = 0; i < this.typeName.length; i++) { - ChartProvider[] rowCharts = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.typeName[i].getChartID()); - int rowChartsCount = rowCharts.length; - charts4Icon[i] = new ChartProvider[rowChartsCount]; - for (int j = 0; j < rowChartsCount; j++) { - try { - charts4Icon[i][j] = (ChartProvider) rowCharts[j].clone(); - //todo@shinerefactor 老图表也是提供一张图片 这边就不用setTitle(null) 然后实时去画 -// charts4Icon[i][j].setTitle(null); -// if(charts4Icon[i][j].getPlot() != null){ -// charts4Icon[i][j].getPlot().setLegend(null); -// } - } catch (CloneNotSupportedException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - } - } + private String[] chartIDs = ChartTypeManager.getInstanceWithCheck().getAllChartIDs(); private JList mainTypeList = null; private JList iconViewList = null; @@ -61,8 +38,8 @@ public class ChartTypePane extends ChartCommonWizardPane { DefaultListModel defaultListModel = new DefaultListModel(); mainTypeList = new JList(defaultListModel); - for (int i = 0; i < typeName.length; i++) { - defaultListModel.insertElementAt(InterProviderFactory.getProvider().getLocText(typeName[i].getName()), i); + for (int i = 0; i < chartIDs.length; i++) { + defaultListModel.insertElementAt(ChartTypeInterfaceManager.getInstance().getName(chartIDs[i]), i); } mainTypeList.addListSelectionListener(listSelectionListener); @@ -115,11 +92,15 @@ public class ChartTypePane extends ChartCommonWizardPane { protected ListSelectionListener listSelectionListener = new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { int main_index = mainTypeList.getSelectedIndex(); - ChartProvider[] sub_charts = ChartTypePane.this.charts4Icon[main_index]; + String id = ChartTypePane.this.chartIDs[main_index]; + + String[] demoImagePath = ChartTypeManager.getInstanceWithCheck().getDemoImagePath(id); + String[] subName = ChartTypeInterfaceManager.getInstance().getSubName(id); + ChartTypePane.this.iconListModel.clear(); - for (int i = 0; i < sub_charts.length; i++) { - String ImagePath = sub_charts[i].demoImagePath(); - String chartName = sub_charts[i].getChartName(); + for (int i = 0, len = demoImagePath.length; i < len; i++) { + String ImagePath = demoImagePath[i]; + String chartName = subName[i]; ChartTypePane.this.iconListModel.addElement(new ChartIcon(ImagePath, chartName)); } iconViewList.setSelectedIndex(0); @@ -143,7 +124,7 @@ public class ChartTypePane extends ChartCommonWizardPane { ChartProvider chart4Update = cc.getSelectedChartProvider(); if (chart4Update == null) { - String plotID = typeName[mainTypeList.getSelectedIndex()].getChartID(); + String plotID = this.chartIDs[mainTypeList.getSelectedIndex()]; ChartProvider chart = ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()]; try { chart4Update = (ChartProvider) chart.clone(); diff --git a/designer-chart/src/main/java/com/fr/design/chart/fun/IndependentChartUIProvider.java b/designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java similarity index 73% rename from designer-chart/src/main/java/com/fr/design/chart/fun/IndependentChartUIProvider.java rename to designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java index 4872da46bc..80256b617c 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/fun/IndependentChartUIProvider.java +++ b/designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java @@ -21,26 +21,70 @@ import com.fr.stable.fun.Level; * @since 8.0 * 自定义图表类型设设计界面接口 */ -public interface IndependentChartUIProvider extends Level { +public interface ChartTypeUIProvider extends Level { String XML_TAG = SpecialLevel.IndependentChartUIProvider.getTagName(); int CURRENT_API_LEVEL = 3; - boolean needChartChangePane(); - /** - * 图表的类型定义界面类型,就是属性表的第一个界面 + * 图表 类型定义界面类型,就是属性表的第一个界面 + * 可以返回null 代表没有 图表类型切换界面 * * @return 图表的类型定义界面类型 */ AbstractChartTypePane getPlotTypePane(); + /** + * 图表 数据配置界面 即属性表的第二个界面 + * 可以返回null 代表没有数据配置界面 + */ + ChartDataPane getChartDataPane(AttributeChangeListener listener); + + /** + * 图表 属性界面数组 其他样式界面数组 + * 可以返回空数组 代表没有其他样式界面 + * + * @return 属性界面 + */ + AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener); + + /** + * 图表 名称 + * eg:柱形图 + * + * @return 图表 名称 + */ + String getName(); + + /** + * 图表 名称 + * 柱形图 堆积柱形图 等 + * + * @return 图表 名称 + */ + String[] getSubName(); + + /** + * 图标路径 + * 表单 工具栏 拖拽图表小图标 + * 16*16 + * + * @return 图标路径 + */ + String getIconPath(); + + + //todo:把下面这些接口删除 + @Deprecated + boolean needChartChangePane(); + /** * 数据集数据源的界面 * * @return 数据集数据源的界面 */ + @Deprecated AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent); @@ -49,6 +93,7 @@ public interface IndependentChartUIProvider extends Level { * * @return 单元格数据源的界面 */ + @Deprecated AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent); /** @@ -56,6 +101,7 @@ public interface IndependentChartUIProvider extends Level { * * @return 条件属性界面 */ + @Deprecated ConditionAttributesPane getPlotConditionPane(Plot plot); /** @@ -63,40 +109,21 @@ public interface IndependentChartUIProvider extends Level { * * @return 系列界面 */ + @Deprecated BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot); - - /** - * 图表的属性界面数组 - * - * @return 属性界面 - */ - AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener); - - ChartDataPane getChartDataPane(AttributeChangeListener listener); - /** * 是否使用默认的界面,为了避免界面来回切换 * * @return 是否使用默认的界面 */ + @Deprecated boolean isUseDefaultPane(); - /** - * 图标路径 - * - * @return 图标路径 - */ - String getIconPath(); - - /** - * plot面板的标题 - */ - String getPlotTypeTitle4PopupWindow(); - + @Deprecated ChartEditPane getChartEditPane(String plotID); - + @Deprecated ChartsConfigPane getChartConfigPane(String plotID); } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java deleted file mode 100644 index 848fc44367..0000000000 --- a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.fr.design.chart.fun.impl; - -import com.fr.chart.chartattr.Plot; -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.chart.fun.IndependentChartUIProvider; -import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; -import com.fr.design.condition.ConditionAttributesPane; -import com.fr.design.gui.frpane.AttributeChangeListener; -import com.fr.design.mainframe.chart.AbstractChartAttrPane; -import com.fr.design.mainframe.chart.ChartEditPane; -import com.fr.design.mainframe.chart.ChartsConfigPane; -import com.fr.design.mainframe.chart.gui.ChartDataPane; -import com.fr.design.mainframe.chart.gui.ChartStylePane; -import com.fr.general.ComparatorUtils; -import com.fr.stable.StableUtils; - - -/** - * Created by eason on 15/4/23. - */ -@Deprecated -public abstract class AbstractIndependentChartUI implements IndependentChartUIProvider { - - @Override - public int currentAPILevel() { - return -1; - } - - public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ - return new AbstractChartAttrPane[0]; - } - - public ChartDataPane getChartDataPane(AttributeChangeListener listener){ - return new ChartDataPane(listener); - } - - /** - * 是否使用默认的界面,为了避免界面来回切换 - * @return 是否使用默认的界面 - */ - public boolean isUseDefaultPane(){ - return true; - } - - public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ - return getPlotSeriesPane(); - } - - public BasicBeanPane getPlotSeriesPane(){ - return null; - } - - public boolean equals(Object obj) { - return obj != null && ComparatorUtils.equals(obj.getClass(), this.getClass()); - } - - public ConditionAttributesPane getPlotConditionPane(Plot plot){ - return new DataSeriesConditionPane(); - } - - public ChartEditPane getChartEditPane(String plotID){ return StableUtils.construct(ChartEditPane.class);} - - public ChartsConfigPane getChartConfigPane(String plotID){return null;} - - -} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java index cbf988cf82..38f4ab0a65 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java +++ b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java @@ -2,7 +2,7 @@ package com.fr.design.chart.fun.impl; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.chart.fun.IndependentChartUIProvider; +import com.fr.design.chart.fun.ChartTypeUIProvider; import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; @@ -17,7 +17,7 @@ import com.fr.stable.StableUtils; /** * Created by Mitisky on 16/3/7. */ -public abstract class AbstractIndependentChartUIWithAPILevel implements IndependentChartUIProvider { +public abstract class AbstractIndependentChartUIWithAPILevel implements ChartTypeUIProvider { //这个不能改,是做兼容用的 //2016.10.14-11.24号的8.0jar因为改了这个为3,不会提示5.26号之前的插件更新 private static final int OLD_PLUGIN_LEVEL = -2; @@ -37,6 +37,17 @@ public abstract class AbstractIndependentChartUIWithAPILevel implements Independ return new ChartDataPane(listener); } + //todo@bjornrefactor 适配旧版本图表后 删掉下面两个方法 + @Override + public String getName() { + return null; + } + + @Override + public String[] getSubName() { + return new String[0]; + } + /** * 是否使用默认的界面,为了避免界面来回切换 * @return 是否使用默认的界面 @@ -66,14 +77,6 @@ public abstract class AbstractIndependentChartUIWithAPILevel implements Independ return new DataSeriesConditionPane(); } - /** - * plot面板的标题 - * 插件兼容 - */ - public String getPlotTypeTitle4PopupWindow(){ - return getPlotTypePane().title4PopupWindow(); - } - public ChartEditPane getChartEditPane(String plotID){ return StableUtils.construct(ChartEditPane.class);} public ChartsConfigPane getChartConfigPane(String plotID){return null;} diff --git a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java index 19244a3fdd..649210f389 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java +++ b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java @@ -3,7 +3,7 @@ package com.fr.design.chart.fun.impl; import com.fr.chart.chartattr.Plot; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.chart.fun.IndependentChartUIProvider; +import com.fr.design.chart.fun.ChartTypeUIProvider; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.AbstractChartAttrPane; @@ -26,8 +26,19 @@ import com.fr.stable.fun.mark.API; * 用户使用第三方图表需要继承的面板抽象类 */ -@API(level = IndependentChartUIProvider.CURRENT_API_LEVEL) -public abstract class AbstractIndependentChartsUI extends AbstractProvider implements IndependentChartUIProvider { +@Deprecated +@API(level = ChartTypeUIProvider.CURRENT_API_LEVEL) +public abstract class AbstractIndependentChartsUI extends AbstractProvider implements ChartTypeUIProvider { + + @Override + public String getName() { + return null; + } + + @Override + public String[] getSubName() { + return new String[0]; + } public String mark4Provider() { return getClass().getName(); @@ -96,16 +107,6 @@ public abstract class AbstractIndependentChartsUI extends AbstractProvider imple return "com/fr/design/images/form/toolbar/ChartF-Column.png"; } - @Override - - /** - * plot面板的标题 - * 插件兼容 - */ - public String getPlotTypeTitle4PopupWindow(){ - return getPlotTypePane().title4PopupWindow(); - } - @Override public ChartEditPane getChartEditPane(String plotID) { return new ChartsEditPane(); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 4d72211134..4dedb133d3 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -178,9 +178,8 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen */ public ChartProvider getChangeStateNewChart() { ChartProvider chart = editingCollection.getSelectedChartProvider(); - String priority = ChartTypeManager.VAN_CHART_PRIORITY; - //todo@shinerefactor - // chart.getPriority(); + String chartID = chart.getID(); + String priority = ChartTypeManager.getInstanceWithCheck().getPriority(chartID); return ChartTypeManager.getInstanceWithCheck().getFirstChart(priority); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java index 8ac031f754..46725007ff 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java @@ -1,6 +1,5 @@ package com.fr.design.mainframe.chart.gui; -import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.SwitchState; import com.fr.chart.charttypes.ChartTypeManager; @@ -146,12 +145,6 @@ public class ChartTypePane extends AbstractChartAttrPane{ //chartID改变的话图表类型就算改变了 if (StringUtils.isNotEmpty(chartID)) { - if (chart instanceof Chart) { - //todo@shinerefactor: 这边看下是否可以删除 - ((Chart) chart).setWrapperName(ChartTypeManager.getInstanceWithCheck().getWrapperName(chartID)); - ((Chart) chart).setChartImagePath(ChartTypeManager.getInstanceWithCheck().getChartImagePath(chartID)); - } - boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(chartID); if (editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, chartID))) { @@ -217,12 +210,10 @@ public class ChartTypePane extends AbstractChartAttrPane{ private void relayout(ChartCollection collection){ //重构需要重构下拉框选项和cardNames ChartProvider chart = collection.getSelectedChartProvider(); - String priority = ChartTypeManager.VAN_CHART_PRIORITY; - //TODO@shinerefactor - // chart.getPriority(); - String plotID = chart.getID(); - boolean enabledChart = ChartTypeManager.enabledChart(plotID); - String item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(priority, plotID); + String chartID = chart.getID(); + String priority = ChartTypeManager.getInstanceWithCheck().getPriority(chartID); + boolean enabledChart = ChartTypeManager.enabledChart(chartID); + String item = ChartTypeInterfaceManager.getInstance().getName(chartID); //第一步就是重构cards cards.clear(); @@ -233,7 +224,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ addOnePriorityCards(priority); } } else { - addOnePlotIDCards(priority, plotID); + addOnePlotIDCards(priority, chartID); } //下拉框重构开始。为了防止重构是触发update diff --git a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartUIProvider.java b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartUIProvider.java index b1d03a4c3c..a1a088020f 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartUIProvider.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartUIProvider.java @@ -2,7 +2,7 @@ package com.fr.extended.chart; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.chart.fun.IndependentChartUIProvider; +import com.fr.design.chart.fun.ChartTypeUIProvider; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.AbstractChartAttrPane; @@ -13,18 +13,27 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; -import com.fr.stable.StringUtils; import com.fr.stable.fun.impl.AbstractProvider; /** * Created by shine on 2018/3/2. */ -public abstract class AbstractExtendedChartUIProvider extends AbstractProvider implements IndependentChartUIProvider { +public abstract class AbstractExtendedChartUIProvider extends AbstractProvider implements ChartTypeUIProvider { protected abstract AbstractExtendedChartTableDataPane getTableDataSourcePane(); protected abstract AbstractReportDataContentPane getReportDataSourcePane(); + @Override + public String getName() { + return null; + } + + @Override + public String[] getSubName() { + return new String[0]; + } + @Override public boolean needChartChangePane() { return false; @@ -85,10 +94,6 @@ public abstract class AbstractExtendedChartUIProvider extends AbstractProvider i return null; } - public String getPlotTypeTitle4PopupWindow(){ - return StringUtils.EMPTY; - } - @Override public ChartsConfigPane getChartConfigPane(String plotID) { return null; diff --git a/designer-chart/src/main/java/com/fr/extended/chart/ExtendedTypePane.java b/designer-chart/src/main/java/com/fr/extended/chart/ExtendedTypePane.java index affc3a611a..2d9ebb5dc1 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/ExtendedTypePane.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/ExtendedTypePane.java @@ -2,6 +2,7 @@ package com.fr.extended.chart; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chartx.attr.ChartProvider; +import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.gui.type.ChartImagePane; @@ -71,7 +72,7 @@ public class ExtendedTypePane extends AbstractChartType @Override public String title4PopupWindow() { - return ChartTypeManager.getInstance().getChartName(getPlotID()); + return ChartTypeInterfaceManager.getInstance().getName(getPlotID()); } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/area/AreaIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/area/AreaIndependentVanChartInterface.java index a604a8a0ee..79d12301ed 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/area/AreaIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/area/AreaIndependentVanChartInterface.java @@ -3,6 +3,7 @@ package com.fr.van.chart.area; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.van.chart.vanchart.AbstractMultiCategoryVanChartUI; @@ -16,6 +17,24 @@ public class AreaIndependentVanChartInterface extends AbstractMultiCategoryVanCh return "com/fr/design/images/form/toolbar/area.png"; } + @Override + public String getName() { + return Toolkit.i18nText("Fine-Design_Chart_New_Area"); + } + + @Override + public String[] getSubName() { + String area = Toolkit.i18nText("Fine-Design_Chart_New_Area"); + String stack = Toolkit.i18nText("Fine-Design_Chart_Stacked"); + String percent = Toolkit.i18nText("Fine-Design_Chart_Use_Percent"); + return new String[]{ + area, + stack + area, + percent + stack + area, + Toolkit.i18nText("Fine-Design_Chart_Mode_Custom") + }; + } + @Override public AbstractChartTypePane getPlotTypePane() { return new VanChartAreaPlotPane(); @@ -29,12 +48,4 @@ public class AreaIndependentVanChartInterface extends AbstractMultiCategoryVanCh return new VanChartAreaSeriesPane(parent, plot); } - /** - * plot面板的标题 - * 插件兼容 - */ - public String getPlotTypeTitle4PopupWindow(){ - return VanChartAreaPlotPane.TITLE; - } - } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/bar/BarIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/bar/BarIndependentVanChartInterface.java index 7642733f6b..813698c19e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/bar/BarIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/bar/BarIndependentVanChartInterface.java @@ -4,6 +4,7 @@ import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; @@ -17,6 +18,25 @@ import com.fr.van.chart.vanchart.AbstractMultiCategoryVanChartUI; * Created by Mitisky on 15/10/20. */ public class BarIndependentVanChartInterface extends AbstractMultiCategoryVanChartUI { + + @Override + public String getName() { + return Toolkit.i18nText("Fine-Design_Chart_New_Bar"); + } + + @Override + public String[] getSubName() { + String bar = Toolkit.i18nText("Fine-Design_Chart_New_Bar"); + String stack = Toolkit.i18nText("Fine-Design_Chart_Stacked"); + String percent = Toolkit.i18nText("Fine-Design_Chart_Use_Percent"); + return new String[]{ + bar, + stack + bar, + percent + stack + bar, + Toolkit.i18nText("Fine-Design_Chart_Mode_Custom") + }; + } + @Override public String getIconPath() { return "com/fr/design/images/form/toolbar/bar.png"; @@ -45,12 +65,4 @@ public class BarIndependentVanChartInterface extends AbstractMultiCategoryVanCha return new AbstractChartAttrPane[]{stylePane, otherPane}; } - /** - * plot面板的标题 - * 插件兼容 - */ - public String getPlotTypeTitle4PopupWindow(){ - return VanChartBarPlotPane.TITLE; - } - } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java index f744bdf01d..86522174c6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java @@ -5,6 +5,7 @@ import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; @@ -22,6 +23,18 @@ import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; * Created by Mitisky on 16/3/31. */ public class BubbleIndependentVanChartInterface extends AbstractIndependentVanChartUI { + @Override + public String getName() { + return Toolkit.i18nText("Fine-Design_Chart_New_Bubble"); + } + + @Override + public String[] getSubName() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Bubble_Chart"), + Toolkit.i18nText("Fine-Design_Chart_New_Force_Bubble") + }; + } /** * 图表的类型定义界面类型,就是属性表的第一个界面 * @@ -79,8 +92,4 @@ public class BubbleIndependentVanChartInterface extends AbstractIndependentVanCh public ConditionAttributesPane getPlotConditionPane(Plot plot){ return new VanChartBubbleConditionPane(plot); } - - public String getPlotTypeTitle4PopupWindow(){ - return VanChartBubblePlotPane.TITLE; - } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/column/ColumnIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/column/ColumnIndependentVanChartInterface.java index 3d5d706618..d85cfc5fc9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/column/ColumnIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/column/ColumnIndependentVanChartInterface.java @@ -2,10 +2,8 @@ package com.fr.van.chart.column; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.chartx.MultiCategoryChartDataPane; import com.fr.design.condition.ConditionAttributesPane; -import com.fr.design.gui.frpane.AttributeChangeListener; -import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.van.chart.vanchart.AbstractMultiCategoryVanChartUI; @@ -14,6 +12,25 @@ import com.fr.van.chart.vanchart.AbstractMultiCategoryVanChartUI; * Created by Mitisky on 15/9/24. */ public class ColumnIndependentVanChartInterface extends AbstractMultiCategoryVanChartUI { + + @Override + public String getName() { + return Toolkit.i18nText("Fine-Design_Chart_New_Column"); + } + + @Override + public String[] getSubName() { + String column = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Column"); + String stack = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Stacked"); + String percent = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Percent"); + return new String[]{ + column, + stack + column, + percent + stack + column, + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Mode_Custom") + }; + } + @Override public String getIconPath() { return "com/fr/design/images/form/toolbar/column.png"; @@ -33,12 +50,13 @@ public class ColumnIndependentVanChartInterface extends AbstractMultiCategoryVan return new VanChartColumnSeriesPane(parent, plot); } - public String getPlotTypeTitle4PopupWindow(){ - return VanChartColumnPlotPane.TITLE; - } - // @Override // public ChartDataPane getChartDataPane(AttributeChangeListener listener) { -// return new MultiCategoryChartDataPane(listener); +// return new AbstractDataPane(listener) { +// @Override +// protected SingleDataPane createSingleDataPane() { +// return new SingleDataPane(new MultiCategoryDataSetFieldsPane(), new MultiCategoryCellDataFieldsPane()); +// } +// }; // } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/CustomIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/custom/CustomIndependentVanChartInterface.java index d982e7d804..2d376f89bd 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/CustomIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/CustomIndependentVanChartInterface.java @@ -1,6 +1,7 @@ package com.fr.van.chart.custom; import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; @@ -14,6 +15,21 @@ import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; * Created by Mitisky on 16/2/16. */ public class CustomIndependentVanChartInterface extends AbstractIndependentVanChartUI { + @Override + public String getName() { + return Toolkit.i18nText("Fine-Design_Chart_New_Combine"); + } + + @Override + public String[] getSubName() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_New_Column_Line"), + Toolkit.i18nText("Fine-Design_Chart_New_Column_Area"), + Toolkit.i18nText("Fine-Design_Chart_New_StackColumn_Line"), + Toolkit.i18nText("Fine-Design_Chart_New_Custom_Combine") + }; + } + /** * 图表的类型定义界面类型,就是属性表的第一个界面 * @@ -49,8 +65,4 @@ public class CustomIndependentVanChartInterface extends AbstractIndependentVanCh public ChartDataPane getChartDataPane(AttributeChangeListener listener){ return new VanChartCustomDataPane(listener); } - - public String getPlotTypeTitle4PopupWindow(){ - return VanChartCustomPlotPane.TITLE; - } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/DrillMapIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/DrillMapIndependentVanChartInterface.java index 1169b64084..efa2eb684b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/DrillMapIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/DrillMapIndependentVanChartInterface.java @@ -1,6 +1,7 @@ package com.fr.van.chart.drillmap; import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; @@ -16,6 +17,19 @@ import com.fr.van.chart.map.designer.style.VanChartMapStylePane; * Created by Mitisky on 16/6/20. */ public class DrillMapIndependentVanChartInterface extends MapIndependentVanChartInterface { + @Override + public String getName() { + return Toolkit.i18nText("Fine-Design_Chart_Drill_Map"); + } + + @Override + public String[] getSubName() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Region_Map"), + Toolkit.i18nText("Fine-Design_Chart_PointMap"), + Toolkit.i18nText("Fine-Design_Chart_Custom_Map") + }; + } /** * 图标路径 @@ -50,8 +64,4 @@ public class DrillMapIndependentVanChartInterface extends MapIndependentVanChart VanChartOtherPane otherPane = new VanChartDrillMapOtherPane(); return new AbstractChartAttrPane[]{stylePane, otherPane}; } - - public String getPlotTypeTitle4PopupWindow(){ - return VanChartDrillMapPlotPane.TITLE; - } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/FunnelIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/FunnelIndependentVanChartInterface.java index fd9a1f3938..2b5a28db19 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/FunnelIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/FunnelIndependentVanChartInterface.java @@ -5,6 +5,7 @@ import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; @@ -25,6 +26,11 @@ import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; * Created by Mitisky on 16/10/10. */ public class FunnelIndependentVanChartInterface extends AbstractIndependentVanChartUI { + @Override + public String getName() { + return Toolkit.i18nText("Fine-Design_Chart_New_Funnel"); + } + /** * 图表的类型定义界面类型,就是属性表的第一个界面 * @@ -77,7 +83,4 @@ public class FunnelIndependentVanChartInterface extends AbstractIndependentVanCh return "com/fr/design/images/form/toolbar/funnel.png"; } - public String getPlotTypeTitle4PopupWindow(){ - return VanChartFunnelTypePane.TITLE; - } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/GanttIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/GanttIndependentVanChartInterface.java index 80ad24935b..b840c925b3 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/GanttIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/GanttIndependentVanChartInterface.java @@ -5,6 +5,7 @@ import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; @@ -27,6 +28,11 @@ import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; * Created by hufan on 2017/1/9. */ public class GanttIndependentVanChartInterface extends AbstractIndependentVanChartUI { + @Override + public String getName() { + return Toolkit.i18nText("Fine-Design_Chart_New_Gantt"); + } + @Override public AbstractChartTypePane getPlotTypePane() { return new VanChartGanttPlotPane(); @@ -59,11 +65,6 @@ public class GanttIndependentVanChartInterface extends AbstractIndependentVanCha return "com/fr/design/images/form/toolbar/gantt.png"; } - - public String getPlotTypeTitle4PopupWindow(){ - return VanChartGanttPlotPane.TITLE; - } - /** * 图表的属性界面数组 * @return 属性界面 diff --git a/designer-chart/src/main/java/com/fr/van/chart/gauge/GaugeIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/gauge/GaugeIndependentVanChartInterface.java index 65ee896a3f..8a9c6cde13 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gauge/GaugeIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gauge/GaugeIndependentVanChartInterface.java @@ -3,6 +3,7 @@ package com.fr.van.chart.gauge; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; @@ -31,6 +32,22 @@ public class GaugeIndependentVanChartInterface extends AbstractIndependentVanCha return "com/fr/design/images/form/toolbar/gauge.png"; } + @Override + public String getName() { + return Toolkit.i18nText("Fine-Design_Chart_New_Gauge"); + } + + @Override + public String[] getSubName() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Gauge_Pointer"), + Toolkit.i18nText("Fine-Design_Chart_Gauge_Pointer180"), + Toolkit.i18nText("Fine-Design_Chart_Gauge_Ring"), + Toolkit.i18nText("Fine-Design_Chart_Gauge_Slot"), + Toolkit.i18nText("Fine-Design_Chart_Gauge_Cuvette") + }; + } + @Override public AbstractChartTypePane getPlotTypePane() { return new VanChartGaugePlotPane(); @@ -79,8 +96,4 @@ public class GaugeIndependentVanChartInterface extends AbstractIndependentVanCha public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ return new VanChartGaugeSeriesPane(parent, plot); } - - public String getPlotTypeTitle4PopupWindow(){ - return VanChartGaugePlotPane.TITLE; - } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/HeatMapIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/HeatMapIndependentVanChartInterface.java index 2b3a2868a5..2bb347d4f1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/HeatMapIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/HeatMapIndependentVanChartInterface.java @@ -5,6 +5,7 @@ import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; @@ -32,6 +33,11 @@ public class HeatMapIndependentVanChartInterface extends MapIndependentVanChartI return "com/fr/design/images/form/toolbar/heatmap.png"; } + @Override + public String getName() { + return Toolkit.i18nText("Fine-Design_Chart_New_HeatMap"); + } + public AbstractChartTypePane getPlotTypePane() { return new VanChartHeatMapTypePane(); } @@ -62,8 +68,4 @@ public class HeatMapIndependentVanChartInterface extends MapIndependentVanChartI }; return new AbstractChartAttrPane[]{stylePane, otherPane}; } - - public String getPlotTypeTitle4PopupWindow(){ - return VanChartHeatMapTypePane.TITLE; - } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/line/LineIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/line/LineIndependentVanChartInterface.java index 4d552b420b..171e72ac22 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/line/LineIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/line/LineIndependentVanChartInterface.java @@ -3,6 +3,7 @@ package com.fr.van.chart.line; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.van.chart.vanchart.AbstractMultiCategoryVanChartUI; @@ -16,6 +17,20 @@ public class LineIndependentVanChartInterface extends AbstractMultiCategoryVanCh return "com/fr/design/images/form/toolbar/line.png"; } + @Override + public String getName() { + return Toolkit.i18nText("Fine-Design_Chart_New_Line"); + } + + @Override + public String[] getSubName() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Line_Chart"), + Toolkit.i18nText("Fine-Design_Chart_Stacked_Line"), + Toolkit.i18nText("Fine-Design_Chart_Mode_Custom") + }; + } + @Override public AbstractChartTypePane getPlotTypePane() { return new VanChartLinePlotPane(); @@ -29,8 +44,4 @@ public class LineIndependentVanChartInterface extends AbstractMultiCategoryVanCh return new VanChartLineSeriesPane(parent, plot); } - public String getPlotTypeTitle4PopupWindow(){ - return VanChartLinePlotPane.TITLE; - } - } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/MapIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/map/MapIndependentVanChartInterface.java index dff6d3d697..a84a56e6fc 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/MapIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/MapIndependentVanChartInterface.java @@ -4,6 +4,7 @@ import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; @@ -32,6 +33,21 @@ import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; */ public class MapIndependentVanChartInterface extends AbstractIndependentVanChartUI { + @Override + public String getName() { + return Toolkit.i18nText("Fine-Design_Chart_New_Map"); + } + + @Override + public String[] getSubName() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Region_Map"), + Toolkit.i18nText("Fine-Design_Chart_PointMap"), + Toolkit.i18nText("Fine-Design_Chart_LineMap"), + Toolkit.i18nText("Fine-Design_Chart_Combine_Map") + }; + } + /** * 图表的类型定义界面类型,就是属性表的第一个界面 * @@ -93,8 +109,4 @@ public class MapIndependentVanChartInterface extends AbstractIndependentVanChart public ConditionAttributesPane getPlotConditionPane(Plot plot){ return new VanChartMapConditionPane(plot); } - - public String getPlotTypeTitle4PopupWindow(){ - return VanChartMapPlotPane.TITLE; - } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java index 091334193f..3d72cd3d77 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java @@ -2,10 +2,8 @@ package com.fr.van.chart.multilayer; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.chartx.MultiPieChartDataPane; import com.fr.design.condition.ConditionAttributesPane; -import com.fr.design.gui.frpane.AttributeChangeListener; -import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.van.chart.multilayer.other.VanChartMultiPieConditionPane; @@ -26,9 +24,19 @@ public class MultiPieIndependentVanChartInterface extends AbstractIndependentVan return "com/fr/design/images/form/toolbar/multiPie.png"; } + @Override + public String getName() { + return Toolkit.i18nText("Fine-Design_Chart_New_MultiPie"); + } + // @Override // public ChartDataPane getChartDataPane(AttributeChangeListener listener) { -// return new MultiPieChartDataPane(listener); +// return new AbstractDataPane(listener) { +// @Override +// protected SingleDataPane createSingleDataPane() { +// return new SingleDataPane(new MultiPieDataSetFieldsPane(), new MultiPieCellDataFieldsPane()); +// } +// }; // } public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ @@ -39,7 +47,4 @@ public class MultiPieIndependentVanChartInterface extends AbstractIndependentVan return new VanChartMultiPieConditionPane(plot); } - public String getPlotTypeTitle4PopupWindow(){ - return VanChartMultiPiePlotPane.TITLE; - } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/PieIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/pie/PieIndependentVanChartInterface.java index e98278aab7..4e37c53c1c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/PieIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/PieIndependentVanChartInterface.java @@ -3,6 +3,7 @@ package com.fr.van.chart.pie; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; @@ -23,6 +24,20 @@ public class PieIndependentVanChartInterface extends AbstractIndependentVanChart return "com/fr/design/images/form/toolbar/pie.png"; } + @Override + public String getName() { + return Toolkit.i18nText("Fine-Design_Chart_New_Pie"); + } + + @Override + public String[] getSubName() { + return new String[]{ + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Pie"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_SameArc_Pie"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_DifferArc_Pie") + }; + } + @Override public AbstractChartTypePane getPlotTypePane() { return new VanChartPiePlotPane(); @@ -48,8 +63,4 @@ public class PieIndependentVanChartInterface extends AbstractIndependentVanChart public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ return (parent instanceof VanChartDataPane) ? new CategoryCustomPlotTableDataContentPane(parent) : new CategoryPlotTableDataContentPane(parent); } - - public String getPlotTypeTitle4PopupWindow(){ - return VanChartPiePlotPane.TITLE; - } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/radar/RadarIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/radar/RadarIndependentVanChartInterface.java index b243ade9d3..547b2d4a73 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/radar/RadarIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/radar/RadarIndependentVanChartInterface.java @@ -3,6 +3,7 @@ package com.fr.van.chart.radar; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; @@ -16,6 +17,19 @@ public class RadarIndependentVanChartInterface extends AbstractIndependentVanCha return "com/fr/design/images/form/toolbar/radar.png"; } + @Override + public String getName() { + return Toolkit.i18nText("Fine-Design_Chart_New_Radar"); + } + + @Override + public String[] getSubName() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Radar_Chart"), + Toolkit.i18nText("Fine-Design_Chart_StackColumn_Radar") + }; + } + @Override public AbstractChartTypePane getPlotTypePane() { return new VanChartRadarPlotPane(); @@ -28,8 +42,4 @@ public class RadarIndependentVanChartInterface extends AbstractIndependentVanCha public ConditionAttributesPane getPlotConditionPane(Plot plot){ return new VanChartRadarConditionPane(plot); } - - public String getPlotTypeTitle4PopupWindow(){ - return VanChartRadarPlotPane.TITLE; - } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java index 5efbbbb59a..8374a78795 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java @@ -6,6 +6,7 @@ import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; @@ -34,6 +35,11 @@ public class ScatterIndependentVanChartInterface extends AbstractIndependentVanC return new VanChartScatterPlotPane(); } + @Override + public String getName() { + return Toolkit.i18nText("Fine-Design_Chart_New_Scatter"); + } + /** * 图标路径 * @@ -78,8 +84,4 @@ public class ScatterIndependentVanChartInterface extends AbstractIndependentVanC public ConditionAttributesPane getPlotConditionPane(Plot plot){ return new VanChartScatterConditionPane(plot); } - - public String getPlotTypeTitle4PopupWindow(){ - return VanChartScatterPlotPane.TITLE; - } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/StructureIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/StructureIndependentVanChartInterface.java index 3f3529e7ac..f2b0a9d59c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/StructureIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/StructureIndependentVanChartInterface.java @@ -5,13 +5,13 @@ import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; - import com.fr.plugin.chart.base.VanChartConstants; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; import com.fr.van.chart.designer.other.VanChartOtherPane; @@ -32,6 +32,20 @@ public class StructureIndependentVanChartInterface extends AbstractIndependentVa return new VanChartStructureTypePane(); } + @Override + public String getName() { + return Toolkit.i18nText("Fine-Design_Chart_New_Structure"); + } + + @Override + public String[] getSubName() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Vertical_Structure"), + Toolkit.i18nText("Fine-Design_Chart_Horizontal_Structure"), + Toolkit.i18nText("Fine-Design_Chart_Radial_Structure") + }; + } + @Override public String getIconPath() { return "com/fr/design/images/form/toolbar/structure.png"; diff --git a/designer-chart/src/main/java/com/fr/van/chart/treemap/TreeMapIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/treemap/TreeMapIndependentVanChartInterface.java index 8c7a6b5e06..021062fe62 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/treemap/TreeMapIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/treemap/TreeMapIndependentVanChartInterface.java @@ -4,6 +4,7 @@ import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; @@ -22,6 +23,11 @@ public class TreeMapIndependentVanChartInterface extends MultiPieIndependentVanC return new VanChartTreeMapPlotPane(); } + @Override + public String getName() { + return Toolkit.i18nText("Fine-Design_Chart_New_TreeMap"); + } + @Override public String getIconPath() { return "com/fr/design/images/form/toolbar/treeMap.png"; @@ -43,7 +49,4 @@ public class TreeMapIndependentVanChartInterface extends MultiPieIndependentVanC return new AbstractChartAttrPane[]{stylePane, otherPane}; } - public String getPlotTypeTitle4PopupWindow(){ - return VanChartTreeMapPlotPane.TITLE; - } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java index 36ed07bedc..71c67be912 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java @@ -3,12 +3,11 @@ package com.fr.van.chart.wordcloud.designer; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.chartx.WordCloudChartDataPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.AbstractChartAttrPane; -import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.plugin.chart.base.VanChartConstants; @@ -36,6 +35,11 @@ public class WordCloudIndependentVanChartInterface extends AbstractIndependentVa return new VanChartWordCloudTypePane(); } + @Override + public String getName() { + return Toolkit.i18nText("Fine-Design_Chart_Word_Cloud"); + } + /** * 图标路径 * @@ -87,12 +91,13 @@ public class WordCloudIndependentVanChartInterface extends AbstractIndependentVa return new AbstractChartAttrPane[]{stylePane, otherPane}; } - public String getPlotTypeTitle4PopupWindow(){ - return VanChartWordCloudTypePane.TITLE; - } - // @Override // public ChartDataPane getChartDataPane(AttributeChangeListener listener) { -// return new WordCloudChartDataPane(listener); +// return new AbstractDataPane(listener) { +// @Override +// protected SingleDataPane createSingleDataPane() { +// return new SingleDataPane(new WordCloudDataSetFieldsPane(), new WordCloudCellDataFieldsPane()); +// } +// }; // } } diff --git a/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java b/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java index d06f77af41..d1c7ddd406 100644 --- a/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java +++ b/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java @@ -3,8 +3,8 @@ package com.fr.poly; import com.fr.base.BaseUtils; import com.fr.base.chart.BaseChartCollection; import com.fr.base.chart.BaseChartGetter; -import com.fr.base.chart.BaseChartNameID; import com.fr.base.vcs.DesignerMode; +import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; @@ -12,7 +12,6 @@ import com.fr.design.gui.itooltip.MultiLineToolTip; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.dnd.SerializableTransferable; -import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import com.fr.report.poly.PolyECBlock; import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; @@ -54,8 +53,8 @@ public class PolyComponentsBar extends JToolBar { setFloatable(false); setBackground(UIConstants.TOOLBARUI_BACKGROUND); setLayout(FRGUIPaneFactory.create1ColumnGridLayout()); - BaseChartNameID[] typeName = BaseChartGetter.getStaticAllChartBaseNames(); - int typeLen = typeName.length < MAX_BAR_NUM ? typeName.length : MAX_BAR_NUM; + String[] iDs = ChartTypeManager.getInstance().getAllChartIDs(); + int typeLen = iDs.length < MAX_BAR_NUM ? iDs.length : MAX_BAR_NUM; serIcons = new SerIcon[typeLen + 1]; serIcons[0] = new SerIcon( PolyECBlock.class, @@ -64,10 +63,10 @@ public class PolyComponentsBar extends JToolBar { ); this.add(serIcons[0]); for (int i = 0; i < typeLen; i++) { - String chartID = typeName[i].getChartID(); + String chartID = iDs[i]; String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(chartID); BaseChartCollection chartCollection = BaseChartGetter.createChartCollection(chartID); - serIcons[i + 1] = new SerIcon(chartCollection, InterProviderFactory.getProvider().getLocText(typeName[i].getName()), iconPath); + serIcons[i + 1] = new SerIcon(chartCollection, ChartTypeInterfaceManager.getInstance().getName(chartID), iconPath); this.add(serIcons[i + 1]); } From 844fd9e1d806db168a5647e708159a31a72ee81b Mon Sep 17 00:00:00 2001 From: zheng Date: Fri, 6 Sep 2019 10:15:32 +0800 Subject: [PATCH 02/29] =?UTF-8?q?CHART-10225=20=E5=85=BC=E5=AE=B9=E6=89=A9?= =?UTF-8?q?=E5=B1=95=E5=9B=BE=E8=A1=A8=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 71 +++++++++++++++---- .../chart/fun/IndependentChartUIProvider.java | 11 +++ .../mainframe/chart/ChartsEditPane.java | 8 ++- .../chart/gui/type/AbstractChartTypePane.java | 25 ++++--- 4 files changed, 84 insertions(+), 31 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/design/chart/fun/IndependentChartUIProvider.java diff --git a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java index 7a945995ee..f0d012544d 100644 --- a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java @@ -5,10 +5,10 @@ import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chartx.attr.ChartProvider; +import com.fr.common.annotations.Compatible; import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.chart.fun.ChartTypeUIProvider; -import com.fr.design.chart.fun.impl.AbstractIndependentChartsUI; import com.fr.design.chart.gui.ChartWidgetOption; import com.fr.design.chartinterface.AreaIndependentChartInterface; import com.fr.design.chartinterface.BarIndependentChartInterface; @@ -39,10 +39,10 @@ import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPa import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.module.DesignModuleFactory; -import com.fr.extended.chart.AbstractExtendedChartUIProvider; import com.fr.form.ui.ChartEditor; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; +import com.fr.invoke.Reflect; import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.PiePlot4VanChart; import com.fr.plugin.chart.area.VanChartAreaPlot; @@ -281,19 +281,24 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr if (AssistUtils.equals(pane.title4PopupWindow(), TYPE_PANE_DEFAULT_TITLE)) { continue; } - pane.setPlotID(plotID); + pane.reLayout(plotID); paneList.add(pane); if (allChartTypePane.get(priority) == null) { allChartTypePane.put(priority, new LinkedHashMap>()); } allChartTypePane.get(priority).put(plotID, pane); - } catch (Exception e) { + } catch (Throwable e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } } } + + @Compatible + public String getTitle4PopupWindow(String plotID) { + return getName(plotID); + } private List getPriorityInOrder() { @@ -324,18 +329,45 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr if (chartTypeInterfaces != null) { ChartTypeUIProvider provider = getChartTypeInterface(id); if (provider != null) { - String[] subNames = provider.getSubName(); - return ArrayUtils.isEmpty(subNames) ? new String[]{getName(id)} : subNames; + String[] subNames = null; + try { + subNames = provider.getSubName(); + } catch (Throwable throwable) { + //do nothing + } + return ArrayUtils.isEmpty(subNames) ? getCompatibleSubName(id, provider) : subNames; } } return new String[0]; } + //兼容 + private String[] getCompatibleSubName(String id, ChartTypeUIProvider provider) { + ChartProvider[] chartProviders = ChartTypeManager.getInstanceWithCheck().getChartTypes(id); + + if (chartProviders.length == 1) { + return new String[]{getName(id)}; + } + String[] result = new String[chartProviders.length]; + for (int i = 0; i < chartProviders.length; i++) { + if (chartProviders[i] instanceof Chart) { + result[i] = ((Chart) chartProviders[i]).getChartName(); + } + } + return result; + } + public String getName(String id) { if (chartTypeInterfaces != null) { ChartTypeUIProvider provider = getChartTypeInterface(id); if (provider != null) { - String name = provider.getName(); + String name = null; + try { + name = provider.getName(); + } catch (Throwable throwable) { + //do nothing + } + return StringUtils.isEmpty(name) ? getCompatibleName(id, provider) : name; } } @@ -344,17 +376,26 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr //兼容 private static String getCompatibleName(String id, ChartTypeUIProvider provider) { - if (provider instanceof AbstractIndependentChartsUI) { - return provider.getPlotTypePane().title4PopupWindow(); + + String result = null; + try { + result = Reflect.on(provider).call("getPlotTypeTitle4PopupWindow").get(); + } catch (Exception e) { + //do nothing } - if (provider instanceof AbstractExtendedChartUIProvider) { - ChartProvider chartProvider = ChartTypeManager.getInstanceWithCheck().getChartTypes(id)[0]; - if (chartProvider instanceof Chart) { - return ((Chart) chartProvider).getChartName(); - } + if (StringUtils.isNotEmpty(result)) { + return result; } - return StringUtils.EMPTY; + ChartProvider chartProvider = ChartTypeManager.getInstanceWithCheck().getChartTypes(id)[0]; + if (chartProvider instanceof Chart) { + result = ((Chart) chartProvider).getChartName(); + } + if (StringUtils.isNotEmpty(result)) { + return result; + } + + return provider.getPlotTypePane().title4PopupWindow(); } public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) { diff --git a/designer-chart/src/main/java/com/fr/design/chart/fun/IndependentChartUIProvider.java b/designer-chart/src/main/java/com/fr/design/chart/fun/IndependentChartUIProvider.java new file mode 100644 index 0000000000..88a14c0906 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chart/fun/IndependentChartUIProvider.java @@ -0,0 +1,11 @@ +package com.fr.design.chart.fun; + +import com.fr.common.annotations.Compatible; + +/** + * Created by shine on 2019/09/05. + */ +@Compatible +public interface IndependentChartUIProvider extends ChartTypeUIProvider { + +} diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartsEditPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartsEditPane.java index b9f5a2fbdc..ff6844d8bc 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartsEditPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartsEditPane.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.chart; import com.fr.chart.chartattr.Chart; +import com.fr.chartx.attr.ChartProvider; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.mainframe.chart.gui.ChartDataPane; @@ -30,15 +31,16 @@ public class ChartsEditPane extends ChartEditPane { * 重新构造面板 * @param currentChart 图表 */ - public void reLayout(Chart currentChart) { + public void reLayout(ChartProvider currentChart) { if (currentChart != null) { + Chart chart = (Chart) currentChart; this.removeAll(); this.setLayout(new BorderLayout()); paneList = new ArrayList(); String plotID = ""; - if (currentChart.getPlot() != null) { - plotID = currentChart.getPlot().getPlotID(); + if (chart.getPlot() != null) { + plotID = chart.getPlot().getPlotID(); } dataPane4SupportCell = createChartDataPane(plotID); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java index 2634247623..fa80f19d8d 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java @@ -60,6 +60,11 @@ public abstract class AbstractChartTypePane extends Fur } public AbstractChartTypePane() { + } + + public void reLayout(String chartID) { + this.plotID = chartID; + double vs = 4; double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -156,9 +161,11 @@ public abstract class AbstractChartTypePane extends Fur } } - for(int i = 0; i < typeDemo.size(); i++) { - typeDemo.get(i).checkBorder(); - typeDemo.get(i).repaint(); + if (this.typeDemo != null && !typeDemo.isEmpty()) { + for (int i = 0; i < typeDemo.size(); i++) { + typeDemo.get(i).checkBorder(); + typeDemo.get(i).repaint(); + } } } @@ -197,22 +204,14 @@ public abstract class AbstractChartTypePane extends Fur return plotID; } - public void setPlotID(String plotID) { - this.plotID = plotID; - } - /** * * @param ob 对象 * @return */ public boolean accept(Object ob) { - if(ob instanceof Chart){ - Chart chart = (Chart)ob; - Plot plot = chart.getPlot(); - if(plot != null && ComparatorUtils.equals(plot.getPlotID(), getPlotID())){ - return true; - } + if (ob instanceof ChartProvider) { + return ComparatorUtils.equals(((ChartProvider) ob).getID(), getPlotID()); } return false; } From c8a190cab7513cca8d56db27722798d58648b840 Mon Sep 17 00:00:00 2001 From: zheng Date: Fri, 6 Sep 2019 10:40:24 +0800 Subject: [PATCH 03/29] =?UTF-8?q?=E5=88=A0=E9=99=A4=20typepane=E7=9A=84tip?= =?UTF-8?q?Name=20title4pop=20plottypeid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../van/chart/area/VanChartAreaPlotPane.java | 37 ------------------- .../fr/van/chart/bar/VanChartBarPlotPane.java | 36 ------------------ .../chart/bubble/VanChartBubblePlotPane.java | 29 --------------- .../chart/column/VanChartColumnPlotPane.java | 37 ------------------- .../chart/custom/VanChartCustomPlotPane.java | 32 ---------------- .../type/AbstractVanChartTypePane.java | 16 ++++++++ .../type/VanChartDrillMapPlotPane.java | 31 ---------------- .../designer/type/VanChartFunnelTypePane.java | 29 --------------- .../designer/type/VanChartGanttPlotPane.java | 22 ----------- .../chart/gauge/VanChartGaugePlotPane.java | 30 --------------- .../type/VanChartHeatMapTypePane.java | 29 --------------- .../van/chart/line/VanChartLinePlotPane.java | 30 --------------- .../designer/type/VanChartMapPlotPane.java | 31 ---------------- .../multilayer/VanChartMultiPiePlotPane.java | 19 ---------- .../fr/van/chart/pie/VanChartPiePlotPane.java | 29 --------------- .../chart/radar/VanChartRadarPlotPane.java | 28 -------------- .../scatter/VanChartScatterPlotPane.java | 28 -------------- .../type/VanChartStructureTypePane.java | 25 ------------- .../treemap/VanChartTreeMapPlotPane.java | 10 +---- .../type/VanChartWordCloudTypePane.java | 10 +---- 20 files changed, 18 insertions(+), 520 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaPlotPane.java index 3d655d005e..5cec0753a7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaPlotPane.java @@ -3,7 +3,6 @@ package com.fr.van.chart.area; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.log.FineLoggerFactory; - import com.fr.plugin.chart.area.AreaIndependentVanChart; import com.fr.plugin.chart.area.VanChartAreaPlot; import com.fr.van.chart.designer.type.AbstractVanChartTypePane; @@ -12,8 +11,6 @@ import com.fr.van.chart.designer.type.AbstractVanChartTypePane; * Created by Mitisky on 15/11/18. */ public class VanChartAreaPlotPane extends AbstractVanChartTypePane { - public static final String TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Area"); - private static final long serialVersionUID = -8161581682558781651L; @Override protected String[] getTypeIconPath() { @@ -25,40 +22,6 @@ public class VanChartAreaPlotPane extends AbstractVanChartTypePane { }; } - @Override - protected String[] getTypeTipName() { - String area = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Area"); - String stack = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Stacked"); - String percent = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Percent"); - return new String[]{ - area, - stack + area, - percent + stack + area, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Mode_Custom") - }; - } - - /** - * 返回界面标题 - * - * @return 界面标题 - */ - public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Area"); - } - - - - /** - * 获取各图表类型界面ID, 本质是plotID - * - * @return 图表类型界面ID - */ - @Override - protected String getPlotTypeID() { - return VanChartAreaPlot.VAN_CHART_AREA_PLOT_ID; - } - protected Plot getSelectedClonedPlot() { VanChartAreaPlot newPlot = null; Chart[] areaChart = AreaIndependentVanChart.AreaVanChartTypes; diff --git a/designer-chart/src/main/java/com/fr/van/chart/bar/VanChartBarPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/bar/VanChartBarPlotPane.java index a9aad22e27..83d1db2e96 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/bar/VanChartBarPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/bar/VanChartBarPlotPane.java @@ -3,7 +3,6 @@ package com.fr.van.chart.bar; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.log.FineLoggerFactory; - import com.fr.plugin.chart.bar.BarIndependentVanChart; import com.fr.plugin.chart.column.VanChartColumnPlot; import com.fr.van.chart.designer.type.AbstractVanChartTypePane; @@ -12,9 +11,6 @@ import com.fr.van.chart.designer.type.AbstractVanChartTypePane; * Created by Mitisky on 15/10/20. */ public class VanChartBarPlotPane extends AbstractVanChartTypePane { - public static final String TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Bar"); - - private static final long serialVersionUID = 2879689884048643002L; @Override protected String[] getTypeIconPath() { @@ -25,38 +21,6 @@ public class VanChartBarPlotPane extends AbstractVanChartTypePane { }; } - @Override - protected String[] getTypeTipName() { - String bar = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Bar"); - String stack = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Stacked"); - String percent = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Percent"); - return new String[]{ - bar, - stack + bar, - percent + stack + bar, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Mode_Custom") - }; - } - - /** - * 返回界面标题 - * @return 界面标题 - */ - public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Bar"); - } - - - /** - * 获取各图表类型界面ID, 本质是plotID - * - * @return 图表类型界面ID - */ - @Override - protected String getPlotTypeID() { - return VanChartColumnPlot.VAN_CHART_BAR_PLOT_ID; - } - protected Plot getSelectedClonedPlot(){ VanChartColumnPlot newPlot = null; Chart[] barChart = BarIndependentVanChart.BarVanChartTypes; diff --git a/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubblePlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubblePlotPane.java index f60f2948a8..d1f93a19e8 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubblePlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubblePlotPane.java @@ -7,7 +7,6 @@ import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionCollection; import com.fr.log.FineLoggerFactory; - import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.base.VanChartZoom; import com.fr.plugin.chart.bubble.BubbleIndependentVanChart; @@ -20,7 +19,6 @@ import com.fr.van.chart.designer.type.AbstractVanChartTypePane; * Created by Mitisky on 16/3/31. */ public class VanChartBubblePlotPane extends AbstractVanChartTypePane { - public static final String TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Bubble");; private static final long serialVersionUID = -3481633368542654247L; @@ -35,23 +33,6 @@ public class VanChartBubblePlotPane extends AbstractVanChartTypePane { }; } - @Override - protected String[] getTypeTipName() { - return new String[]{ - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Bubble_Chart"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Force_Bubble") - }; - } - - /** - * 返回界面标题 - * @return 界面标题 - */ - public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Bubble"); - } - - private void removeDefaultAttr(ConditionAttr conditionAttr, Class targetClass) { DataSeriesCondition attr = conditionAttr.getExisted(targetClass); if (attr != null){ @@ -59,16 +40,6 @@ public class VanChartBubblePlotPane extends AbstractVanChartTypePane { } } - /** - * 获取各图表类型界面ID, 本质是plotID - * - * @return 图表类型界面ID - */ - @Override - protected String getPlotTypeID() { - return VanChartBubblePlot.VAN_CHART_BUBBLE_PLOT_ID; - } - protected Plot getSelectedClonedPlot(){ VanChartBubblePlot newPlot = null; Chart[] bubbleChart = BubbleIndependentVanChart.BubbleVanChartTypes; diff --git a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotPane.java index be16a7662d..40269cc15c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotPane.java @@ -3,7 +3,6 @@ package com.fr.van.chart.column; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.log.FineLoggerFactory; - import com.fr.plugin.chart.column.ColumnIndependentVanChart; import com.fr.plugin.chart.column.VanChartColumnPlot; import com.fr.van.chart.designer.type.AbstractVanChartTypePane; @@ -12,10 +11,6 @@ import com.fr.van.chart.designer.type.AbstractVanChartTypePane; * Created by Mitisky on 15/9/24. */ public class VanChartColumnPlotPane extends AbstractVanChartTypePane { - public static final String TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Column"); - - private static final long serialVersionUID = 5950923001789733745L; - @Override protected String[] getTypeIconPath() { @@ -26,38 +21,6 @@ public class VanChartColumnPlotPane extends AbstractVanChartTypePane { }; } - @Override - protected String[] getTypeTipName() { - String column = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Column"); - String stack = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Stacked"); - String percent = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Percent"); - return new String[]{ - column, - stack + column, - percent + stack + column, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Mode_Custom") - }; - } - - /** - * 返回界面标题 - * @return 界面标题 - */ - public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Column"); - } - - - /** - * 获取各图表类型界面ID, 本质是plotID - * - * @return 图表类型界面ID - */ - @Override - protected String getPlotTypeID() { - return VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID; - } - protected Plot getSelectedClonedPlot(){ VanChartColumnPlot newPlot = null; Chart[] columnChart = ColumnIndependentVanChart.ColumnVanChartTypes; diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java index f93c29945e..927fa31485 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java @@ -10,7 +10,6 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.type.ChartImagePane; import com.fr.log.FineLoggerFactory; - import com.fr.plugin.chart.base.VanChartAttrLine; import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.custom.CustomDefinition; @@ -35,7 +34,6 @@ import java.util.Map; * Created by Mitisky on 16/2/16. */ public class VanChartCustomPlotPane extends AbstractVanChartTypePane { - public static final String TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Combine"); //是否选择自定义 private boolean isCustom = false; @@ -114,26 +112,6 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane { }; } - @Override - protected String[] getTypeTipName() { - return new String[]{ - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Column_Line"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Column_Area"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_StackColumn_Line"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Custom_Combine") - }; - } - - @Override - /** - * 返回界面标题 - * @return 界面标题 - */ - public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Combine"); - } - - @Override public void updateBean(Chart chart) { @@ -241,16 +219,6 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane { } - /** - * 获取各图表类型界面ID, 本质是plotID - * - * @return 图表类型界面ID - */ - @Override - protected String getPlotTypeID() { - return VanChartCustomPlot.VAN_CHART_CUSTOM_PLOT_ID; - } - protected Plot getSelectedClonedPlot() { VanChartCustomPlot newPlot = null; Chart[] customChart = CustomIndependentVanChart.CustomVanChartTypes; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java index 9ae650d97f..b8550e0d42 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java @@ -7,6 +7,7 @@ import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionCollection; import com.fr.chart.chartglyph.DataSheet; +import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.MultilineLabel; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; @@ -45,6 +46,21 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane Date: Fri, 6 Sep 2019 11:32:42 +0800 Subject: [PATCH 04/29] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=8A=BD=E8=B1=A1?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/fun/impl/AbstractChartTypeUI.java | 84 +++++++++++++++++++ ...ne.java => AbstractVanSingleDataPane.java} | 30 +++---- .../fr/design/chartx/GanttChartDataPane.java | 25 ++++-- .../design/chartx/MultiPieChartDataPane.java | 21 ----- .../design/chartx/WordCloudChartDataPane.java | 20 ----- .../design/chartx/impl/AbstractDataPane.java | 68 +++++++++++++++ .../design/chartx/impl/AbstractOtherPane.java | 42 ++++++++++ .../fr/design/chartx/impl/CommonTypePane.java | 79 +++++++++++++++++ 8 files changed, 304 insertions(+), 65 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java rename designer-chart/src/main/java/com/fr/design/chartx/{MultiCategoryChartDataPane.java => AbstractVanSingleDataPane.java} (57%) delete mode 100644 designer-chart/src/main/java/com/fr/design/chartx/MultiPieChartDataPane.java delete mode 100644 designer-chart/src/main/java/com/fr/design/chartx/WordCloudChartDataPane.java create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractDataPane.java create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractOtherPane.java create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/impl/CommonTypePane.java diff --git a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java new file mode 100644 index 0000000000..a4a7b56117 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java @@ -0,0 +1,84 @@ +package com.fr.design.chart.fun.impl; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.ChartTypeUIProvider; +import com.fr.design.chartx.impl.AbstractDataPane; +import com.fr.design.chartx.impl.AbstractOtherPane; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.ChartEditPane; +import com.fr.design.mainframe.chart.ChartsConfigPane; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.stable.fun.impl.AbstractProvider; + +/** + * Created by shine on 2019/09/03. + */ +public abstract class AbstractChartTypeUI extends AbstractProvider implements ChartTypeUIProvider { + + @Override + public abstract AbstractDataPane getChartDataPane(AttributeChangeListener listener); + + @Override + public abstract AbstractOtherPane[] getAttrPaneArray(AttributeChangeListener listener); + + @Override + public String[] getSubName() { + return new String[]{getName()}; + } + + @Override + public boolean needChartChangePane() { + return false; + } + + @Override + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { + return null; + } + + @Override + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { + return null; + } + + @Override + public boolean isUseDefaultPane() { + return false; + } + + @Override + public int currentAPILevel() { + return CURRENT_API_LEVEL; + } + + @Override + public String mark4Provider() { + return getClass().getName(); + } + + @Override + public ChartEditPane getChartEditPane(String plotID) { + return new ChartEditPane(); + } + + @Override + public ConditionAttributesPane getPlotConditionPane(Plot plot) { + return null; + } + + @Override + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot) { + return null; + } + + @Override + public ChartsConfigPane getChartConfigPane(String plotID) { + return null; + } + +} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/chartx/MultiCategoryChartDataPane.java b/designer-chart/src/main/java/com/fr/design/chartx/AbstractVanSingleDataPane.java similarity index 57% rename from designer-chart/src/main/java/com/fr/design/chartx/MultiCategoryChartDataPane.java rename to designer-chart/src/main/java/com/fr/design/chartx/AbstractVanSingleDataPane.java index 721fc8480e..1db85d8c58 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/MultiCategoryChartDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/AbstractVanSingleDataPane.java @@ -1,24 +1,30 @@ package com.fr.design.chartx; import com.fr.chartx.data.AbstractDataDefinition; -import com.fr.design.chartx.fields.diff.MultiCategoryCellDataFieldsPane; -import com.fr.design.chartx.fields.diff.MultiCategoryDataSetFieldsPane; import com.fr.design.chartx.single.SingleDataPane; import com.fr.design.gui.frpane.AttributeChangeListener; import javax.swing.JPanel; /** - * Created by shine on 2019/5/22. + * Created by shine on 2019/09/06. */ -public class MultiCategoryChartDataPane extends AbstractChartDataPane { - +public abstract class AbstractVanSingleDataPane extends AbstractChartDataPane { private SingleDataPane singleDataPane; - public MultiCategoryChartDataPane(AttributeChangeListener listener) { + + public AbstractVanSingleDataPane(AttributeChangeListener listener) { super(listener); } + @Override + protected JPanel createContentPane() { + singleDataPane = createSingleDataPane(); + return singleDataPane; + } + + protected abstract SingleDataPane createSingleDataPane(); + @Override protected void populate(AbstractDataDefinition dataDefinition) { singleDataPane.populateBean(dataDefinition); @@ -28,16 +34,4 @@ public class MultiCategoryChartDataPane extends AbstractChartDataPane { - private MultiCategoryChartDataPane dataPane; - private MultiCategoryChartDataPane linkPane; + private AbstractVanSingleDataPane dataPane; + private AbstractVanSingleDataPane linkPane; @Override protected JPanel createContentPane() { - dataPane = new MultiCategoryChartDataPane(listener); - linkPane = new MultiCategoryChartDataPane(listener); + dataPane = new AbstractVanSingleDataPane(listener) { + @Override + protected SingleDataPane createSingleDataPane() { + return new SingleDataPane(new MultiCategoryDataSetFieldsPane(), new MultiCategoryCellDataFieldsPane()); + } + }; + linkPane = new AbstractVanSingleDataPane(listener) { + @Override + protected SingleDataPane createSingleDataPane() { + return new SingleDataPane(new MultiCategoryDataSetFieldsPane(), new MultiCategoryCellDataFieldsPane()); + } + }; return new VanChartGroupPane(new String[]{"data", "link"}, new JPanel[]{dataPane, linkPane}) { }; } @@ -27,13 +40,13 @@ public class GanttChartDataPane extends AbstractChartDataPane extends AbstractChartAttrPane { + + protected abstract void populate(T chart); + + protected abstract void update(T chart); + + @Override + public void populate(ChartCollection collection) { + if (collection == null) { + return; + } + AbstractChartWithData chart = collection.getSelectedChart(AbstractChartWithData.class); + if (chart == null) { + return; + } + + populate((T) chart); + } + + @Override + public void update(ChartCollection collection) { + + if (collection == null) { + return; + } + AbstractChartWithData chart = collection.getSelectedChart(AbstractChartWithData.class); + if (chart == null) { + return; + } + + update((T) chart); + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/impl/CommonTypePane.java b/designer-chart/src/main/java/com/fr/design/chartx/impl/CommonTypePane.java new file mode 100644 index 0000000000..24d9bf95dc --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/impl/CommonTypePane.java @@ -0,0 +1,79 @@ +package com.fr.design.chartx.impl; + +import com.fr.chart.charttypes.ChartTypeManager; +import com.fr.chart.impl.AbstractChartWithData; +import com.fr.chartx.attr.ChartProvider; +import com.fr.design.ChartTypeInterfaceManager; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.gui.type.ChartImagePane; + +/** + * Created by shine on 2019/09/04. + */ +public class CommonTypePane extends AbstractChartTypePane { + + @Override + protected String[] getTypeIconPath() { + return new String[0]; + } + + @Override + protected String[] getTypeTipName() { + return ChartTypeInterfaceManager.getInstance().getSubName(getPlotID()); + } + + @Override + public ChartProvider getDefaultChart() { + return ChartTypeManager.getInstance().getChartTypes(getPlotID())[0]; + } + + @Override + public String title4PopupWindow() { + return ChartTypeInterfaceManager.getInstance().getName(getPlotID()); + } + + protected int getSelectIndexInChart(T chart) { + return 0; + } + + protected void setSelectIndexInChart(T chart, int index) { + } + + @Override + public void populateBean(AbstractChartWithData ob) { + if (getTypeIconPath().length > 0) { + for (ChartImagePane imagePane : typeDemo) { + imagePane.isPressing = false; + } + typeDemo.get(getSelectIndexInChart((T) ob)).isPressing = true; + checkDemosBackground(); + } + } + + @Override + public void updateBean(AbstractChartWithData ob) { + if (getTypeIconPath().length > 0) { + for (int index = 0, len = typeDemo.size(); index < len; index++) { + if (typeDemo.get(index).isPressing) { + setSelectIndexInChart((T) ob, index); + return; + } + } + } + } + + @Override + protected String[] getTypeLayoutPath() { + return new String[0]; + } + + @Override + protected String[] getTypeLayoutTipName() { + return new String[0]; + } + + @Override + protected String getPlotTypeID() { + return null; + } +} From c941193f99f9e0502337ce28ad555d4ce171baf9 Mon Sep 17 00:00:00 2001 From: zheng Date: Fri, 6 Sep 2019 11:54:15 +0800 Subject: [PATCH 05/29] =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/chartx/StructureChartDataPane.java | 23 ------------------- 1 file changed, 23 deletions(-) delete mode 100644 designer-chart/src/main/java/com/fr/design/chartx/StructureChartDataPane.java diff --git a/designer-chart/src/main/java/com/fr/design/chartx/StructureChartDataPane.java b/designer-chart/src/main/java/com/fr/design/chartx/StructureChartDataPane.java deleted file mode 100644 index 31737559cb..0000000000 --- a/designer-chart/src/main/java/com/fr/design/chartx/StructureChartDataPane.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.fr.design.chartx; - -import com.fr.design.chartx.fields.diff.StructureCellDataFieldsPane; -import com.fr.design.chartx.fields.diff.StructureDataSetFieldsPane; -import com.fr.design.chartx.single.SingleDataPane; -import com.fr.design.gui.frpane.AttributeChangeListener; - -/** - * @author Bjorn - * @version 10.0 - * Created by Bjorn on 2019-09-02 - */ -public class StructureChartDataPane extends MultiCategoryChartDataPane { - - public StructureChartDataPane(AttributeChangeListener listener) { - super(listener); - } - - @Override - protected SingleDataPane createSingleDataPane() { - return new SingleDataPane(new StructureDataSetFieldsPane(), new StructureCellDataFieldsPane()); - } -} From d0867aaef1d78232ee8ee4181cbeb5afe5308afd Mon Sep 17 00:00:00 2001 From: zheng Date: Fri, 6 Sep 2019 13:24:04 +0800 Subject: [PATCH 06/29] =?UTF-8?q?CHART-10225=20=E8=A1=A8=E5=8D=95=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=20=E5=9B=BE=E8=A1=A8=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/chart/MiddleChartComponent.java | 3 --- .../fr/design/chart/gui/ChartComponent.java | 26 ++++++------------- .../design/chart/gui/ChartWidgetOption.java | 2 +- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/chart/MiddleChartComponent.java b/designer-base/src/main/java/com/fr/design/gui/chart/MiddleChartComponent.java index 01d9e7dd32..8269b8d05d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/chart/MiddleChartComponent.java +++ b/designer-base/src/main/java/com/fr/design/gui/chart/MiddleChartComponent.java @@ -1,7 +1,6 @@ package com.fr.design.gui.chart; import com.fr.base.chart.BaseChartCollection; -import com.fr.chartx.attr.ChartProvider; import com.fr.stable.core.PropertyChangeListener; import javax.swing.JComponent; @@ -18,7 +17,5 @@ public abstract class MiddleChartComponent extends JComponent { public abstract void reset(); - public abstract ChartProvider getEditingChart(); - public abstract void addStopEditingListener(PropertyChangeListener list); } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java index d5d15af7c8..e3d6a52101 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java +++ b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java @@ -2,21 +2,21 @@ package com.fr.design.chart.gui; import com.fr.base.ScreenResolution; import com.fr.base.chart.BaseChartCollection; +import com.fr.base.chart.BaseChartPainter; import com.fr.base.chart.chartdata.CallbackEvent; -import com.fr.chart.ChartWebPara; +import com.fr.base.chart.result.WebChartIDInfo; import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.ChartCollection; -import com.fr.chartx.attr.ChartProvider; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.log.FineLoggerFactory; +import com.fr.script.Calculator; import com.fr.stable.core.PropertyChangeListener; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; -import java.awt.Image; import java.awt.Paint; import java.awt.RenderingHints; import java.awt.event.MouseEvent; @@ -35,7 +35,6 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene private static final long serialVersionUID = 744164838619052097L; private final List listeners = new ArrayList(); private ChartCollection chartCollection4Design; - private ChartProvider editingChart; private int chartWidth = -1; private int chartHeight = -1; @@ -91,11 +90,8 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene public void reset() { fireStopEditing(); - this.editingChart = null; this.chartHeight = this.chartWidth = -1; - this.editingChart = this.chartCollection4Design.getSelectedChartProvider(); - refreshChartGlyph(); repaint(); @@ -138,11 +134,6 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene return (this.chartCollection4Design == null) ? 0 : this.chartCollection4Design.getChartCount(); } - public ChartProvider getEditingChart() { - return editingChart; - } - - public void paintComponent(Graphics g) { // super.paintComponent(g); @@ -180,7 +171,6 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene */ private void refreshChartGlyph() { Dimension d = getBounds().getSize(); - this.editingChart = this.chartCollection4Design.getSelectedChartProvider();// kunsnat: 切换选中时 同步切换Plot this.chartWidth = d.width - ChartConstants.PREGAP4BOUNDS; this.chartHeight = d.height - ChartConstants.PREGAP4BOUNDS; } @@ -240,20 +230,20 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene } private boolean needRefreshChartGlyph() { - return editingChart == null || chartWidth != this.getBounds().width || chartHeight != this.getBounds().height; + return chartWidth != this.getBounds().width || chartHeight != this.getBounds().height; } private void drawChart(Graphics2D g2d) { - if (editingChart != null) { + if (chartCollection4Design != null) { + BaseChartPainter painter = chartCollection4Design.createResultChartPainter(Calculator.createCalculator(), + WebChartIDInfo.createEmptyDesignerInfo(), chartWidth, chartHeight); int resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution(); if (resolution == 0){ resolution = ScreenResolution.getScreenResolution(); } - Image chartImage = editingChart.toImage(chartWidth, chartHeight, resolution, new ChartWebPara()); - - g2d.drawImage(chartImage, 0, 0, null); + painter.paint(g2d, chartWidth, chartHeight, resolution, null); } } diff --git a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java index 753bb47cd3..42eabf93e1 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java +++ b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java @@ -37,7 +37,7 @@ public class ChartWidgetOption extends WidgetOption { Class clz = widgetClass(); try { ChartEditor widget = clz.newInstance(); - widget.setChartCollection(BaseChartGetter.createChartCollection(this.chartID)); + widget.resetChangeChartCollection(BaseChartGetter.createChartCollection(this.chartID)); return widget; } catch (InstantiationException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); From afdd96c1a36094e1b073695def74b287ffa79e69 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 6 Sep 2019 17:32:16 +0800 Subject: [PATCH 07/29] =?UTF-8?q?REPORT-20327=20sonar=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/poly/PolyDesignUI.java | 27 +++++----- .../com/fr/poly/creator/BlockCreator.java | 37 +++++++------ .../java/com/fr/poly/creator/BlockEditor.java | 53 ++++++++++--------- .../com/fr/start/fx/PrismImageLoader2.java | 4 +- .../java/com/fr/start/fx/SplashFxWindow.java | 1 + 5 files changed, 66 insertions(+), 56 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/poly/PolyDesignUI.java b/designer-realize/src/main/java/com/fr/poly/PolyDesignUI.java index 2bf55e5a07..d12920bfdc 100644 --- a/designer-realize/src/main/java/com/fr/poly/PolyDesignUI.java +++ b/designer-realize/src/main/java/com/fr/poly/PolyDesignUI.java @@ -47,7 +47,7 @@ import java.util.ArrayList; */ public class PolyDesignUI extends ComponentUI { private static final Color PAGINATE_LINE_COLOR = Color.GRAY; - + private static final double SCROLL_POINT = 50; private static final int SCROLL_DISTANCE = 15; private static final int TEN = 10; @@ -65,11 +65,11 @@ public class PolyDesignUI extends ComponentUI { /** * 从组件中获取设计器, 并赋值 - * + * * @param c 组件对象 - * + * * @date 2015-2-12-下午2:38:05 - * + * */ public void installUI(JComponent c) { designer = ((PolyArea) c).getPolyDesigner(); @@ -137,7 +137,7 @@ public class PolyDesignUI extends ComponentUI { } } } - + private void changeForbiddenWindowVisibility(BlockCreator creator){ Rectangle pixRec = creator.getBounds(); boolean intersected = designer.intersectsAllBlock(creator); @@ -145,12 +145,12 @@ public class PolyDesignUI extends ComponentUI { creator.getEditor().hideForbiddenWindow(); return; } - + int x = (int) (designer.getAreaLocationX() + pixRec.getCenterX()*time - designer.getHorizontalValue()); int y = (int) (designer.getAreaLocationY() + pixRec.getCenterY()*time - designer.getVerticalValue()); creator.getEditor().showForbiddenWindow(x, y); } - + private Rectangle getCreatorPixRectangle(BlockCreator creator, Point location){ int width = creator.getWidth(); int height = creator.getHeight(); @@ -158,21 +158,22 @@ public class PolyDesignUI extends ComponentUI { int resy = location.y - height / 2 + designer.getVerticalValue(); return new Rectangle(resx, resy, width, height); } - + + @SuppressWarnings("squid:S2142") private void scrollWhenCreatorAtCorner(final BlockCreator creator){ Thread scrollThread = new Thread(new Runnable() { - + @Override public void run() { try { Thread.sleep(100); - + int rightCornerX = creator.getX() + creator.getWidth(); int rightCornerY = creator.getY() + creator.getHeight(); JScrollBar horizonBar = designer.getHorizontalScrollBar(); JScrollBar verticalBar = designer.getVerticalScrollBar(); - + int scrollX = designer.getWidth() + horizonBar.getValue(); int scrollY = designer.getHeight() + verticalBar.getValue(); @@ -180,7 +181,7 @@ public class PolyDesignUI extends ComponentUI { if(rightCornerX > scrollX - SCROLL_POINT){ horizonBar.setValue(horizonBar.getValue() + SCROLL_DISTANCE); } - + if(rightCornerY > scrollY - SCROLL_POINT){ verticalBar.setValue(verticalBar.getValue() + SCROLL_DISTANCE); } @@ -200,7 +201,7 @@ public class PolyDesignUI extends ComponentUI { GraphHelper.drawString(g, convertUnit(y), 0, resy); GraphHelper.drawString(g, convertUnit(x), resx, 10); } - + private String convertUnit(int i) { short unit = designer.getRulerLengthUnit(); // int resolution = ScreenResolution.getScreenResolution(); diff --git a/designer-realize/src/main/java/com/fr/poly/creator/BlockCreator.java b/designer-realize/src/main/java/com/fr/poly/creator/BlockCreator.java index 1d11a783d6..5b581f8f15 100644 --- a/designer-realize/src/main/java/com/fr/poly/creator/BlockCreator.java +++ b/designer-realize/src/main/java/com/fr/poly/creator/BlockCreator.java @@ -54,6 +54,9 @@ public abstract class BlockCreator extends JComponent i @Override public boolean equals(Object o) { + if (o == null) { + return false; + } return ComparatorUtils.equals(o.getClass().getName(), this.getClass().getName()); } }); @@ -81,7 +84,7 @@ public abstract class BlockCreator extends JComponent i //默认大小, 报表块默认3列6行, 图表块默认330*240 public abstract UnitRectangle getDefaultBlockBounds(); - + // 不同的Block有不同的显示器 protected abstract JComponent initMonitor(); @@ -97,9 +100,9 @@ public abstract class BlockCreator extends JComponent i /** * 检测按钮状态 - * + * * @date 2015-2-5-上午11:33:46 - * + * */ public abstract void checkButtonEnable(); @@ -134,31 +137,31 @@ public abstract class BlockCreator extends JComponent i /** * 获取当前工具栏组 - * + * * @return 工具栏组 - * + * * @date 2015-2-5-上午11:29:07 - * + * */ public abstract ToolBarDef[] toolbars4Target(); /** * 在Form的工具栏组 - * + * * @return 组件数组 - * + * * @date 2015-2-5-上午11:31:46 - * + * */ public abstract JComponent[] toolBarButton4Form(); - + /** * 获取当前菜单栏组 - * + * * @return 菜单栏组 - * + * * @date 2015-2-5-上午11:29:07 - * + * */ public abstract MenuDef[] menus4Target(); @@ -167,12 +170,12 @@ public abstract class BlockCreator extends JComponent i /** * 获取菜单里的快捷方式数组 - * + * * @return 菜单里的快捷方式数组 - * + * * @date 2015-2-5-上午11:27:08 - * + * */ public abstract ShortCut[] shortcut4TemplateMenu(); -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/poly/creator/BlockEditor.java b/designer-realize/src/main/java/com/fr/poly/creator/BlockEditor.java index 6860841779..cac1a0e226 100644 --- a/designer-realize/src/main/java/com/fr/poly/creator/BlockEditor.java +++ b/designer-realize/src/main/java/com/fr/poly/creator/BlockEditor.java @@ -30,20 +30,20 @@ import com.fr.stable.unit.UnitRectangle; * @since 6.5.4 创建于2011-5-5 聚合报表块编辑器 */ public abstract class BlockEditor extends JComponent{ - + protected PolyDesigner designer; protected BlockCreator creator; protected int resolution = ScreenResolution.getScreenResolution(); protected T editComponent; - + private JComponent addHeightTool;// 改变高度的组件 private JComponent addWidthTool; // 改变宽度的组件 private JComponent moveTool; // 拖动聚合块的组件 - + private boolean isDragging; private Absorptionline lineInX; private Absorptionline lineInY; - + private BlockForbiddenWindow forbiddenWindow; public BlockEditor(PolyDesigner designer, BlockCreator creator) { @@ -74,16 +74,16 @@ public abstract class BlockEditor this.moveTool = new BlockControlButton(); this.add(BlockEditorLayout.BOTTOMCORNER, this.moveTool); - + this.forbiddenWindow = new BlockForbiddenWindow(); } - + /** * 重置当前鼠标选中状态 - * + * */ public abstract void resetSelectionAndChooseState(); - + protected abstract T createEffective(); protected abstract Dimension getAddHeigthPreferredSize(); @@ -91,9 +91,9 @@ public abstract class BlockEditor protected abstract Dimension getAddWidthPreferredSize(); protected abstract void initDataChangeListener(); - + protected abstract RowOperationMouseHandler createRowOperationMouseHandler(); - + protected abstract ColumnOperationMouseHandler createColumnOperationMouseHandler(); protected void addColumnRowListeners() { @@ -122,28 +122,31 @@ public abstract class BlockEditor initSize(); LayoutUtils.layoutRootContainer(BlockEditor.this); } - + @Override public boolean equals(Object o) { + if (o == null) { + return false; + } return ComparatorUtils.equals(o.getClass().getName(), this.getClass().getName()); } }); } - + public void setDragging(boolean isDragging) { this.isDragging = isDragging; } - + /** * 当前是否处于拖动状态 - * + * * @return 是否处于拖动状态 - * + * */ public boolean isDragging() { return this.isDragging; } - + public void setXAbsorptionline(Absorptionline line) { this.lineInX = line; } @@ -151,27 +154,27 @@ public abstract class BlockEditor public void setYAbsorptionline(Absorptionline line) { this.lineInY = line; } - - + + /** * 显示禁止重叠窗口 - * + * * @param x x坐标 * @param y y坐标 - * + * */ public void showForbiddenWindow(int x, int y){ this.forbiddenWindow.showWindow(x, y); } - + /** * 隐藏禁止重叠窗口 - * + * */ public void hideForbiddenWindow(){ this.forbiddenWindow.hideWindow(); } - + public void paintAbsorptionline(Graphics g) { if(lineInX != null) { lineInX.paint(g,designer); @@ -202,7 +205,7 @@ public abstract class BlockEditor public Dimension getCornerSize() { return new Dimension(); } - + private class BlockControlButton extends UIButton { @Override public ButtonUI getUI() { @@ -220,4 +223,4 @@ public abstract class BlockEditor }; } } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java b/designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java index 470b382c93..e262e917e9 100644 --- a/designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java +++ b/designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java @@ -1,6 +1,7 @@ package com.fr.start.fx; import com.fr.concurrent.NamedThreadFactory; +import com.fr.log.FineLoggerFactory; import com.sun.javafx.iio.ImageFrame; import com.sun.javafx.iio.ImageLoadListener; import com.sun.javafx.iio.ImageLoader; @@ -79,6 +80,7 @@ class PrismImageLoader2 implements com.sun.javafx.tk.ImageLoader { } @Override + @SuppressWarnings("squid:S2142") public PlatformImage getFrame(int index) { while (images[index] == null) { synchronized (this) { @@ -86,7 +88,7 @@ class PrismImageLoader2 implements com.sun.javafx.tk.ImageLoader { try { this.wait(); } catch (InterruptedException e) { - e.printStackTrace(); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } } diff --git a/designer-realize/src/main/java/com/fr/start/fx/SplashFxWindow.java b/designer-realize/src/main/java/com/fr/start/fx/SplashFxWindow.java index 073cee7ae4..00ad512939 100644 --- a/designer-realize/src/main/java/com/fr/start/fx/SplashFxWindow.java +++ b/designer-realize/src/main/java/com/fr/start/fx/SplashFxWindow.java @@ -55,6 +55,7 @@ public class SplashFxWindow extends Application { * * @return 运行实例 */ + @SuppressWarnings("squid:S2142") public static SplashFxWindow waitForStartUpTest() { try { LATCH.await(); From 7ddfbdaa443e78b52db5ab26c1e0a7225bb4f56f Mon Sep 17 00:00:00 2001 From: jinbokai Date: Sun, 8 Sep 2019 11:16:39 +0800 Subject: [PATCH 08/29] =?UTF-8?q?REPORT-20328=20sonar=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/iscrollbar/UIScrollBarUI.java | 4 ++-- .../com/fr/design/gui/ispinner/UISpinner.java | 8 +++++--- .../modes/MakefileTokenMaker.java | 17 +++++++++-------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java index 8054a29eac..d3393054ae 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java @@ -1326,9 +1326,9 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo newModel.addChangeListener(modelListener); scrollbar.repaint(); scrollbar.revalidate(); - } else if ("orientation" == propertyName) { + } else if (StringUtils.equals("orientation", propertyName)) { updateButtonDirections(); - } else if ("componentOrientation" == propertyName) { + } else if (StringUtils.equals("componentOrientation", propertyName)) { updateButtonDirections(); InputMap inputMap = getInputMap(JComponent.WHEN_FOCUSED); SwingUtilities.replaceUIInputMap(scrollbar, JComponent.WHEN_FOCUSED, inputMap); diff --git a/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java b/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java index ba6913a38a..66a9a75755 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java +++ b/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java @@ -9,9 +9,11 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.utils.gui.GUIPaintUtils; +import com.fr.stable.CommonUtils; import com.fr.stable.Constants; import com.fr.stable.StringUtils; +import com.fr.stable.collections.utils.MathUtils; import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -109,7 +111,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver } value = value < minValue ? minValue : value; value = value > maxValue ? maxValue : value; - if (value == this.value) { + if (CommonUtils.equals(value, this.value)) { return; } this.value = value; @@ -132,7 +134,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver value = value < minValue ? minValue : value; value = value > maxValue ? maxValue : value; - if (value == this.value) { + if (CommonUtils.equals(value, this.value)) { return; } this.value = value; @@ -371,4 +373,4 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver // jf.setSize(400, 400); // jf.setVisible(true); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/modes/MakefileTokenMaker.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/modes/MakefileTokenMaker.java index f556cc5b77..30b4b6d859 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/modes/MakefileTokenMaker.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/modes/MakefileTokenMaker.java @@ -10,12 +10,13 @@ */ package com.fr.design.gui.syntax.ui.rsyntaxtextarea.modes; -import java.io.*; +import com.fr.design.gui.syntax.ui.rsyntaxtextarea.AbstractJFlexTokenMaker; +import com.fr.design.gui.syntax.ui.rsyntaxtextarea.Token; +import com.fr.design.gui.syntax.ui.rsyntaxtextarea.TokenImpl; +import java.io.IOException; import java.util.Stack; import javax.swing.text.Segment; -import com.fr.design.gui.syntax.ui.rsyntaxtextarea.*; - /** * Scanner for makefiles.

@@ -762,8 +763,8 @@ public final void yybegin(int newState) { { addToken(Token.LITERAL_CHAR); } case 25: break; - case 12: - { if (!varDepths.empty() && varDepths.peek()==Boolean.TRUE) { + case 12: + { if (!varDepths.empty() && Boolean.TRUE.equals(varDepths.peek())) { varDepths.pop(); if (varDepths.empty()) { addToken(start,zzStartRead, Token.VARIABLE); yybegin(YYINITIAL); @@ -771,8 +772,8 @@ public final void yybegin(int newState) { } } case 26: break; - case 11: - { if (!varDepths.empty() && varDepths.peek()==Boolean.FALSE) { + case 11: + { if (!varDepths.empty() && Boolean.FALSE.equals(varDepths.peek())) { varDepths.pop(); if (varDepths.empty()) { addToken(start,zzStartRead, Token.VARIABLE); yybegin(YYINITIAL); @@ -864,4 +865,4 @@ public final void yybegin(int newState) { } -} \ No newline at end of file +} From 08e59519d8276f9b1f63d7697384b3f20a05041b Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Sun, 8 Sep 2019 15:47:22 +0800 Subject: [PATCH 09/29] =?UTF-8?q?REPORT-20981=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E7=AE=A1=E7=90=86=E5=87=8F=E5=B0=91=E7=A3=81?= =?UTF-8?q?=E7=9B=98=E5=8D=A0=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/PreferencePane.java | 298 ++++++++++++++++-- .../mainframe/vcs/common/VcsHelper.java | 2 + 2 files changed, 281 insertions(+), 19 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 2a856f159d..0232b9f14b 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -1,6 +1,6 @@ package com.fr.design.actions.file; -import com.fr.base.BaseUtils; +import com.fr.cluster.engine.base.FineClusterConfig; import com.fr.config.Configuration; import com.fr.config.ServerPreferenceConfig; import com.fr.design.DesignerEnvManager; @@ -18,50 +18,49 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIDictionaryComboBox; import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.iprogressbar.UIProgressBarUI; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.update.push.DesignerPushUpdateManager; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.widget.FRWidgetFactory; +import com.fr.env.RemoteEnvPane; +import com.fr.env.TestConnectionResult; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.general.log.Log4jConfig; import com.fr.locale.InterProviderFactory; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.Constants; +import com.fr.stable.StringUtils; import com.fr.third.apache.log4j.Level; import com.fr.transaction.Configurations; import com.fr.transaction.Worker; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.vcs.VcsOperator; +import com.fr.workspace.server.vcs.git.config.GcConfig; -import javax.swing.BorderFactory; -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.KeyStroke; -import javax.swing.SwingUtilities; +import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Window; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; +import java.awt.*; +import java.awt.event.*; import java.io.File; +import java.text.DecimalFormat; import java.util.Locale; import java.util.Map; +import java.util.UUID; +import java.util.concurrent.ExecutionException; /** * 选项对话框 @@ -148,8 +147,19 @@ public class PreferencePane extends BasicPane { private UICheckBox saveCommitCheckBox; private UICheckBox useIntervalCheckBox; private IntegerEditor saveIntervalEditor; + private UICheckBox gcEnableCheckBox; + private UIButton gcButton; private UILabel remindVcsLabel; + private JDialog gcDialog; + private UILabel gcMessage = new UILabel(); + private JPanel gcDialogDownPane = new JPanel(); + private JPanel gcProgressBarPanel = new JPanel(); + private JProgressBar gcProgressBar; + private Timer gcProgressTimer; + private UIButton gcOkButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK")); + private UIButton gcCancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel")); + public PreferencePane() { @@ -230,6 +240,10 @@ public class PreferencePane extends BasicPane { saveCommitCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Vcs_No_Delete")); saveIntervalEditor = new IntegerEditor(60); useIntervalCheckBox = new UICheckBox(); + + //gc面板 + JPanel gcControlPane = createGcControlPane(); + JPanel enableVcsPanel = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); enableVcsPanel.add(vcsEnableCheckBox); enableVcsPanel.add(remindVcsLabel); @@ -262,6 +276,36 @@ public class PreferencePane extends BasicPane { vcsPane.add(enableVcsPanel); vcsPane.add(intervalPanel); vcsPane.add(saveCommitCheckBox); + vcsPane.add(gcControlPane); + } + + /** + * 模创建板版本gc 配置操作面板 + * + * @return 面板 + */ + private JPanel createGcControlPane() { + //gc面板 + JPanel gcControlPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); + JPanel gcButtonPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 40, 0)); + gcEnableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Vcs_Storage_Optimization")); + gcButton = initGcButton(); + gcButtonPane.add(gcButton); + gcControlPane.add(gcEnableCheckBox); + gcControlPane.add(gcButtonPane); + gcButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent evt) { + tryGc(); + } + }); + + //集群下禁用 + if (FineClusterConfig.getInstance().isCluster()) { + gcEnableCheckBox.setEnabled(false); + gcButton.setEnabled(false); + } + return gcControlPane; } private void createFunctionPane(JPanel generalPane) { @@ -629,6 +673,7 @@ public class PreferencePane extends BasicPane { saveIntervalEditor.setValue(vcsConfigManager.getSaveInterval()); saveCommitCheckBox.setSelected(vcsConfigManager.isSaveCommit()); useIntervalCheckBox.setSelected(vcsConfigManager.isUseInterval()); + gcEnableCheckBox.setSelected(GcConfig.getInstance().isGcEnable()); supportCellEditorDefCheckBox.setSelected(designerEnvManager.isSupportCellEditorDef()); @@ -726,6 +771,18 @@ public class PreferencePane extends BasicPane { vcsConfigManager.setVcsEnable(this.vcsEnableCheckBox.isSelected()); vcsConfigManager.setSaveCommit(this.saveCommitCheckBox.isSelected()); vcsConfigManager.setUseInterval(this.useIntervalCheckBox.isSelected()); + Configurations.update(new Worker() { + @Override + public void run() { + GcConfig.getInstance().setGcEnable(gcEnableCheckBox.isSelected()); + } + + @Override + public Class[] targets() { + return new Class[]{GcConfig.class}; + } + }); + if (this.autoPushUpdateCheckBox != null) { designerEnvManager.setAutoPushUpdateEnabled(this.autoPushUpdateCheckBox.isSelected()); } @@ -762,7 +819,6 @@ public class PreferencePane extends BasicPane { } - // 如果语言设置改变了,则显示重启对话框 public void showRestartDialog() { if (!languageChanged) { @@ -797,4 +853,208 @@ public class PreferencePane extends BasicPane { public BasicDialog showWindow(Window window, DialogActionListener l) { return showWindowWithCustomSize(window, l, new Dimension(BasicDialog.DEFAULT.width, this.getPreferredSize().height + OFFSET_HEIGHT)); } + + private void tryGc() { + //停止gc线程时使用 + final String uuid = String.valueOf(UUID.randomUUID()); + final SwingWorker worker = new SwingWorker() { + private long size = 0; + + @Override + protected Boolean doInBackground() { + size = WorkContext.getCurrent().get(VcsOperator.class).immediatelyGc(uuid); + return true; + } + + @Override + protected void done() { + try { + get(); + } catch (InterruptedException | ExecutionException e) { + FineLoggerFactory.getLogger().error(e, e.getMessage()); + } + stopGcProgressTimer(); + gcMessage.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Vcs_Reduce_File_Size") + fileSizeConvert(size)); + if (null != gcProgressBar) { + gcProgressBarPanel.remove(gcProgressBar); + } + if (null != gcDialog) { + gcDialog.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News")); + } + gcDialogDownPane.remove(gcCancelButton); + gcDialogDownPane.revalidate(); + gcDialogDownPane.repaint(); + gcDialogDownPane.add(gcOkButton); + } + }; + worker.execute(); + initGcDialog(); + gcOkButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + gcDialog.dispose(); + } + }); + gcCancelButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + stopGcProgressTimer(); + + //中断gc 线程 + if (StringUtils.isNotEmpty(uuid)) { + WorkContext.getCurrent().get(VcsOperator.class).cancelImmediatelyGc(uuid); + } + gcDialog.dispose(); + worker.cancel(true); + } + }); + gcDialog.addWindowListener(new WindowAdapter() { + @Override + public void windowClosed(WindowEvent e) { + stopGcProgressTimer(); + worker.cancel(true); + } + }); + gcDialog.setVisible(true); + gcDialog.dispose(); + } + + /** + * 初始化 gc 对话框 + */ + private void initGcDialog() { + gcDialog = new JDialog((Dialog) SwingUtilities.getWindowAncestor(PreferencePane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Vcs_Clean_Progress") + "...", true); + gcDialog.setSize(new Dimension(340, 140)); + + JPanel jp = new JPanel(); + //中上 + JPanel gcUpPane = new JPanel(); + gcUpPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); + gcUpPane.add(new UILabel(UIManager.getIcon("OptionPane.informationIcon"))); + gcProgressBarPanel = createProgressBarPane(); + gcUpPane.add(gcProgressBarPanel); + + //中下 + gcDialogDownPane = new JPanel(); + gcDialogDownPane.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 0)); + gcDialogDownPane.add(gcCancelButton); + + jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); + jp.add(gcUpPane); + jp.add(gcDialogDownPane); + gcDialog.add(jp); + gcDialog.setResizable(false); + gcDialog.setLocationRelativeTo(SwingUtilities.getWindowAncestor(PreferencePane.this)); + } + + /** + * gc 进度条面板 + * + * @return + */ + private JPanel createProgressBarPane() { + JPanel jp = new JPanel(); + VerticalFlowLayout layout = new VerticalFlowLayout(); + layout.setAlignLeft(true); + jp.setLayout(layout); + + //提示 + gcMessage = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Vcs_Cleaning")); + // 创建一个进度条 + gcProgressBar = createGcProgressBar(0, 30, 240, 15, Color.GREEN); + gcProgressTimer = createGcProgressTimer(500, gcProgressBar); + gcProgressTimer.start(); + jp.add(gcMessage); + jp.add(gcProgressBar); + return jp; + } + + /** + * 创建 gc 进度条 + * + * @param min 最小值 + * @param max 最大值 + * @param width 宽度 + * @param height 高度 + * @param color 填充的图片颜色 + * @return + */ + private JProgressBar createGcProgressBar(int min, int max, int width, int height, Color color) { + // 创建一个进度条 + JProgressBar progressBar = new JProgressBar(min, max); + UIProgressBarUI progressBarUI = new UIProgressBarUI(); + progressBar.setUI(progressBarUI); + + //颜色(进度条里的小方块) + progressBar.setForeground(color); + + progressBar.setOpaque(false); + progressBar.setPreferredSize(new Dimension(width, height)); + return progressBar; + } + + /** + * @param delay 每隔 delay 毫秒更新进度 + * @param progressBar 要更新的进度条 + * @return + */ + private Timer createGcProgressTimer(int delay, final JProgressBar progressBar) { + if (null == progressBar) { + return null; + } + // 模拟延时操作进度, 每隔 delay / 1000 秒更新进度 + Timer timer = new Timer(delay, new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + int currentProgress = progressBar.getValue() + 1; + if (currentProgress > progressBar.getMaximum()) { + currentProgress = progressBar.getMinimum(); + } + progressBar.setValue(currentProgress); + } + }); + + return timer; + } + + /** + * 停止进度条模拟计时器 + */ + private void stopGcProgressTimer() { + if (null == gcProgressTimer) { + return; + } + gcProgressTimer.stop(); + } + + /** + * 将字节转换成 KB or MB or GB 保留两位小数 + * + * @param size + * @return + */ + private String fileSizeConvert(long size) { + DecimalFormat df = new DecimalFormat("0.00"); + double n = 1024d; + if (size > Math.pow(n, 3)) { + return df.format(size / Math.pow(n, 3)) + "GB"; + } + if (size > Math.pow(n, 2)) { + return df.format(size / Math.pow(n, 2)) + "MB"; + } + return new StringBuilder().append(df.format(size / n)).append("KB").toString(); + } + + /** + * 立即清理的Button + * + * @return + */ + private UIButton initGcButton() { + UIButton gcButton = new UIButton(Toolkit.i18nText("Fine-Design_Vcs_Clean")); + gcButton.setPreferredSize(new Dimension(100, 15)); + gcButton.setRoundBorder(true, Constants.LEFT); + return gcButton; + } + } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index 0b3213ac52..7dea041554 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -20,6 +20,7 @@ import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.filesystem.VcsFileSystem; +import com.fr.workspace.server.vcs.git.config.GcConfig; import javax.swing.Icon; import javax.swing.border.EmptyBorder; @@ -146,6 +147,7 @@ public class VcsHelper implements JTemplateActionListener { if (needDeleteVersion(oldEntity)) { operator.deleteVersion(oldEntity.getFilename(), oldEntity.getVersion()); } + operator.gc(true); } }).start(); From fc6b965de5a5df1d53a6a024260048b2b1299d51 Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Sun, 8 Sep 2019 16:09:08 +0800 Subject: [PATCH 10/29] =?UTF-8?q?REPORT-20981=20=E5=8E=BB=E6=8E=89import?= =?UTF-8?q?=20*?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/PreferencePane.java | 36 ++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 0232b9f14b..81b66451a8 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -32,8 +32,6 @@ import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.update.push.DesignerPushUpdateManager; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.widget.FRWidgetFactory; -import com.fr.env.RemoteEnvPane; -import com.fr.env.TestConnectionResult; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; import com.fr.general.IOUtils; @@ -50,11 +48,39 @@ import com.fr.workspace.WorkContext; import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.git.config.GcConfig; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import javax.swing.BoxLayout; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.JDialog; + +import javax.swing.Timer; +import javax.swing.SwingWorker; +import javax.swing.UIManager; +import javax.swing.KeyStroke; +import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; -import java.awt.event.*; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dialog; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.FlowLayout; + +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowEvent; + +import java.awt.event.WindowAdapter; import java.io.File; import java.text.DecimalFormat; import java.util.Locale; From 7a8281c1a976af1e6b6916f759cec0634e00cca4 Mon Sep 17 00:00:00 2001 From: pengda Date: Sun, 8 Sep 2019 17:20:55 +0800 Subject: [PATCH 11/29] =?UTF-8?q?sonar=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?,=E6=97=A0jira=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/grid/GridRowUI.java | 4 ++-- designer-realize/src/main/java/com/fr/grid/GridUI.java | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/GridRowUI.java b/designer-realize/src/main/java/com/fr/grid/GridRowUI.java index 44f1fe8749..a0245a3d86 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridRowUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridRowUI.java @@ -7,7 +7,7 @@ import java.awt.geom.Rectangle2D; import javax.swing.JComponent; import javax.swing.UIManager; import javax.swing.plaf.ComponentUI; - +import com.fr.stable.AssistUtils; import com.fr.base.BaseUtils; import com.fr.base.DynamicUnitList; import com.fr.base.GraphHelper; @@ -106,7 +106,7 @@ public class GridRowUI extends ComponentUI { tmpHeight1 += tmpIncreaseHeight; tmpIncreaseHeight = rowHeightList.get(i).toPixD(resolution); // check these row wich height is zero. - tmpHeight2 = tmpIncreaseHeight == 0 ? tmpHeight1 + 1 : tmpHeight1 + tmpIncreaseHeight; + tmpHeight2 = AssistUtils.equals(tmpIncreaseHeight,0d) ? tmpHeight1 + 1 : tmpHeight1 + tmpIncreaseHeight; // check selection bound. Selection sel = reportPane.getSelection(); int[] selectedRows = sel.getSelectedRows(); diff --git a/designer-realize/src/main/java/com/fr/grid/GridUI.java b/designer-realize/src/main/java/com/fr/grid/GridUI.java index c7ea413687..0ccff309f6 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridUI.java @@ -47,6 +47,7 @@ import com.fr.stable.ColumnRow; import com.fr.stable.Constants; import com.fr.stable.script.CalculatorUtils; import com.fr.stable.unit.FU; +import com.fr.stable.AssistUtils; import com.fr.third.antlr.ANTLRException; import javax.swing.JComponent; @@ -617,10 +618,10 @@ public class GridUI extends ComponentUI { tmpLine2D = (Line2D) paginateLineList.get(j);// 直接强制转换,因为List中肯定都是Line2D型的 for (int k = j + 1; k < paginateLineList.size(); k++) { tmpLine2D2 = (Line2D) paginateLineList.get(k); - if (tmpLine2D2.getX1() == tmpLine2D.getX1() - && tmpLine2D2.getX2() == tmpLine2D.getX2() - && tmpLine2D2.getY1() == tmpLine2D.getY1() - && tmpLine2D2.getY2() == tmpLine2D.getY2()) { + if (AssistUtils.equals(tmpLine2D2.getX1() ,tmpLine2D.getX1()) + && AssistUtils.equals(tmpLine2D2.getX2() , tmpLine2D.getX2()) + && AssistUtils.equals(tmpLine2D2.getY1() , tmpLine2D.getY1()) + && AssistUtils.equals(tmpLine2D2.getY2() , tmpLine2D.getY2())) { paginateLineList.remove(k); } } From 2c27f88fef34d92083af6895e7234555bb4b4773 Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Sun, 8 Sep 2019 20:32:39 +0800 Subject: [PATCH 12/29] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=EF=BC=8Cs?= =?UTF-8?q?onar=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/layout/TableLayout.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/layout/TableLayout.java b/designer-base/src/main/java/com/fr/design/layout/TableLayout.java index b812263c6b..43a7b7eed4 100644 --- a/designer-base/src/main/java/com/fr/design/layout/TableLayout.java +++ b/designer-base/src/main/java/com/fr/design/layout/TableLayout.java @@ -321,7 +321,7 @@ public class TableLayout implements LayoutManager2, Serializable { this row/column. */ public static final double MINIMUM = -3.0; - + final double epsilon = 0.0000001; //****************************************************************************** //** Constructors *** @@ -1807,8 +1807,8 @@ public class TableLayout implements LayoutManager2, Serializable { for (counter = entry.cr1[z]; counter <= entry.cr2[z]; counter++) if (crSpec[z][counter] >= 1.0) scalableSize -= crSpec[z][counter]; - else if ((crSpec[z][counter] == PREFERRED) || - (crSpec[z][counter] == MINIMUM)) { + else if (Math.abs(crSpec[z][counter] - PREFERRED) < epsilon || + Math.abs(crSpec[z][counter] - MINIMUM) < epsilon) { scalableSize -= crPrefMin[counter]; } @@ -1824,13 +1824,13 @@ public class TableLayout implements LayoutManager2, Serializable { // Add scaled size to relativeWidth relativeSize += crSpec[z][counter]; // Cr is fill - else if ((crSpec[z][counter] == FILL) && (fillSizeRatio != 0.0)) + else if (Math.abs(crSpec[z][counter] - FILL) < epsilon && Math.abs(fillSizeRatio - 0.0) >= epsilon) // Add fill size to relativeWidth relativeSize += fillSizeRatio; } // Determine the total scaled size as estimated by this component - if (relativeSize == 0) + if (Math.abs(relativeSize - 0) < epsilon) temp = 0; else temp = (int) (scalableSize / relativeSize + 0.5); @@ -1851,8 +1851,8 @@ public class TableLayout implements LayoutManager2, Serializable { if (crSpec[z][counter] >= 1.0) totalSize += (int) (crSpec[z][counter] + 0.5); // Is the current cr a preferred/minimum size - else if ((crSpec[z][counter] == PREFERRED) || - (crSpec[z][counter] == MINIMUM)) { + else if (Math.abs(crSpec[z][counter] - PREFERRED) < epsilon|| + Math.abs(crSpec[z][counter] - MINIMUM) < epsilon) { // Add preferred/minimum width totalSize += crPrefMin[counter]; } From 0b4c7d51fd699c65b76a5a54da5222dd40dc3852 Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Sun, 8 Sep 2019 20:34:15 +0800 Subject: [PATCH 13/29] =?UTF-8?q?REPORT-20329=20sonar=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/type/VanChartMapPlotPane.java | 3 ++ .../multilayer/VanChartMultiPiePlotPane.java | 3 ++ .../MultiPiePlotReportDataContentPane.java | 3 +- .../MultiPiePlotTableDataContentPane.java | 3 +- .../fr/van/chart/pie/VanChartPiePlotPane.java | 3 ++ .../chart/radar/VanChartRadarPlotPane.java | 3 ++ .../range/component/LegendGradientBar.java | 3 +- .../scatter/VanChartScatterPlotPane.java | 3 ++ .../type/VanChartStructureTypePane.java | 3 ++ .../treemap/VanChartTreeMapPlotPane.java | 3 ++ .../fr/design/designer/beans/AdapterBus.java | 3 ++ .../design/designer/creator/XChartEditor.java | 28 ++++++++++++------- .../designer/creator/XWAbsoluteLayout.java | 7 +++-- .../design/designer/creator/XWFitLayout.java | 7 +++-- 14 files changed, 56 insertions(+), 19 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java index 1c8b102b34..737c79c062 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java @@ -146,6 +146,9 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane { } } Plot cloned = null; + if (null == newPlot) { + return cloned; + } try { cloned = (Plot)newPlot.clone(); } catch (CloneNotSupportedException e) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/VanChartMultiPiePlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/VanChartMultiPiePlotPane.java index fadef10db7..f53853e700 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/VanChartMultiPiePlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/VanChartMultiPiePlotPane.java @@ -49,6 +49,9 @@ public class VanChartMultiPiePlotPane extends AbstractVanChartTypePane { } Plot cloned = null; + if (null == newPlot) { + return cloned; + } try { cloned = (Plot)newPlot.clone(); } catch (CloneNotSupportedException e) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/data/MultiPiePlotReportDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/data/MultiPiePlotReportDataContentPane.java index 12eba5581a..217806a495 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/data/MultiPiePlotReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/data/MultiPiePlotReportDataContentPane.java @@ -14,6 +14,7 @@ import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; import com.fr.plugin.chart.multilayer.data.MultiPieReportDataDefinition; +import com.fr.stable.AssistUtils; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -81,7 +82,7 @@ public class MultiPiePlotReportDataContentPane extends AbstractReportDataContent @Override public void setTextFieldValue(double value) { //如果为0,则没有改变值 - if (value == 0){ + if (AssistUtils.equals(0, value)) { return; } super.setTextFieldValue(value); diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/data/MultiPiePlotTableDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/data/MultiPiePlotTableDataContentPane.java index fddef0ec55..580b1e91af 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/data/MultiPiePlotTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/data/MultiPiePlotTableDataContentPane.java @@ -18,6 +18,7 @@ import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.multilayer.data.MultiPieValueDefinition; import com.fr.stable.ArrayUtils; +import com.fr.stable.AssistUtils; import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -170,7 +171,7 @@ public class MultiPiePlotTableDataContentPane extends AbstractTableDataContentPa @Override public void setTextFieldValue(double value) { //如果为0,则没有改变值 - if (value == 0){ + if (AssistUtils.equals(0, value)) { return; } super.setTextFieldValue(value); diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPiePlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPiePlotPane.java index 981956be0a..4581e85402 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPiePlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPiePlotPane.java @@ -62,6 +62,9 @@ public class VanChartPiePlotPane extends AbstractVanChartTypePane { } Plot cloned = null; + if (null == newPlot) { + return cloned; + } try { cloned = (Plot)newPlot.clone(); } catch (CloneNotSupportedException e) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/radar/VanChartRadarPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/radar/VanChartRadarPlotPane.java index 3123cf6069..93aacad729 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/radar/VanChartRadarPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/radar/VanChartRadarPlotPane.java @@ -59,6 +59,9 @@ public class VanChartRadarPlotPane extends AbstractVanChartTypePane { } Plot cloned = null; + if (null == newPlot) { + return cloned; + } try { cloned = (Plot)newPlot.clone(); } catch (CloneNotSupportedException e) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/range/component/LegendGradientBar.java b/designer-chart/src/main/java/com/fr/van/chart/range/component/LegendGradientBar.java index 72ea983fdd..6b09d4e1bc 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/range/component/LegendGradientBar.java +++ b/designer-chart/src/main/java/com/fr/van/chart/range/component/LegendGradientBar.java @@ -13,6 +13,7 @@ import com.fr.design.style.color.ColorSelectDialog; import com.fr.design.style.color.ColorSelectable; import com.fr.plugin.chart.range.GradualIntervalConfig; import com.fr.plugin.chart.range.glyph.GradualColorDist; +import com.fr.stable.AssistUtils; import javax.swing.JComponent; import javax.swing.event.ChangeEvent; @@ -224,7 +225,7 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI //防止位置重复,设置偏移 private int setOffset(int x, int index, int offset) { for (int i = 0; i < selectColorPointBtnList.size(); i++){ - if (i != index && x == selectColorPointBtnList.get(i).getX()){ + if (i != index && AssistUtils.equals(x, selectColorPointBtnList.get(i).getX())) { if (x >= (min+max)/2) { x -= offset; x = setOffset(x, index, offset+OFFSETSTEP); diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterPlotPane.java index e0de77fc86..c175f92f7a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterPlotPane.java @@ -61,6 +61,9 @@ public class VanChartScatterPlotPane extends AbstractVanChartTypePane { } } Plot cloned = null; + if (null == newPlot) { + return cloned; + } try { cloned = (Plot)newPlot.clone(); } catch (CloneNotSupportedException e) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/type/VanChartStructureTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/type/VanChartStructureTypePane.java index 39d024c3f1..ac3d35432a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/type/VanChartStructureTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/type/VanChartStructureTypePane.java @@ -57,6 +57,9 @@ public class VanChartStructureTypePane extends AbstractVanChartTypePane { } Plot cloned = null; + if (null == newPlot) { + return cloned; + } try { cloned = (Plot)newPlot.clone(); } catch (CloneNotSupportedException e) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/treemap/VanChartTreeMapPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/treemap/VanChartTreeMapPlotPane.java index b21f9dc79a..4d27559f9f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/treemap/VanChartTreeMapPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/treemap/VanChartTreeMapPlotPane.java @@ -45,6 +45,9 @@ public class VanChartTreeMapPlotPane extends VanChartMultiPiePlotPane { } Plot cloned = null; + if (null == newPlot) { + return cloned; + } try { cloned = (Plot)newPlot.clone(); } catch (CloneNotSupportedException e) { diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/AdapterBus.java b/designer-form/src/main/java/com/fr/design/designer/beans/AdapterBus.java index 0133c7a9e2..a34d2afa1d 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/AdapterBus.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/AdapterBus.java @@ -41,6 +41,9 @@ public class AdapterBus { */ public static ComponentAdapter getComponentAdapter(FormDesigner designer, JComponent creator) { JComponent jcomponent = getJComponent(creator); + if (null == jcomponent) { + return null; + } ComponentAdapter adapter = (ComponentAdapter) jcomponent.getClientProperty("component.adapter"); if (adapter == null) { adapter = new CompositeComponentAdapter(designer, creator); diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java b/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java index 14a5e3c969..ecf6234776 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java @@ -176,16 +176,21 @@ public class XChartEditor extends XBorderStyleWidgetCreator { * @return 控件. */ public JComponent createToolPane(final BaseJForm jform, final FormDesigner formDesigner) { - getDesignerEditorTarget().addStopEditingListener(new PropertyChangeAdapter() { - public void propertyChange() { - JComponent pane = jform.getEditingPane(); - if (pane instanceof BaseChartPropertyPane) { - ((BaseChartPropertyPane) pane).setSupportCellData(true); - ((BaseChartPropertyPane) pane).populateChartPropertyPane(getDesignerEditorTarget().update(), formDesigner); + MiddleChartComponent middleChartComponent = getDesignerEditorTarget(); + if (null != middleChartComponent) { + middleChartComponent.addStopEditingListener(new PropertyChangeAdapter() { + public void propertyChange() { + JComponent pane = jform.getEditingPane(); + if (pane instanceof BaseChartPropertyPane) { + ((BaseChartPropertyPane) pane).setSupportCellData(true); + MiddleChartComponent middleChartComponent = getDesignerEditorTarget(); + if (null != middleChartComponent) { + ((BaseChartPropertyPane) pane).populateChartPropertyPane(middleChartComponent.update(), formDesigner); + } + } } - } - }); - + }); + } if (isEditing){ final BaseChartPropertyPane propertyPane = DesignModuleFactory.getChartPropertyPane(); SwingUtilities.invokeLater(new Runnable() { @@ -193,7 +198,10 @@ public class XChartEditor extends XBorderStyleWidgetCreator { public void run() { if (getDesignerEditor().getEditorTarget() != null) { propertyPane.setSupportCellData(true); - propertyPane.populateChartPropertyPane(getDesignerEditorTarget().update(), formDesigner); + MiddleChartComponent middleChartComponent = getDesignerEditorTarget(); + if (null != middleChartComponent) { + propertyPane.populateChartPropertyPane(middleChartComponent.update(), formDesigner); + } } } }); diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java index b219530f7f..56fcf64866 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -31,6 +31,7 @@ import com.fr.general.FRScreen; import com.fr.general.IOUtils; import com.fr.share.ShareConstants; +import com.fr.stable.AssistUtils; import com.fr.stable.Constants; import javax.swing.Icon; @@ -108,7 +109,7 @@ public class XWAbsoluteLayout extends XLayoutContainer { Toolkit toolkit = Toolkit.getDefaultToolkit(); Dimension scrnsize = toolkit.getScreenSize(); double screenValue = FRScreen.getByDimension(scrnsize).getValue(); - if (screenValue != FormArea.DEFAULT_SLIDER) { + if (!AssistUtils.equals(screenValue, FormArea.DEFAULT_SLIDER)) { this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER); } } @@ -167,7 +168,7 @@ public class XWAbsoluteLayout extends XLayoutContainer { * 界面容器大小不是默认的时,处理控件的BoundsWidget,且避免出现空隙 */ private Rectangle dealWidgetBound(Rectangle rec) { - if (containerPercent == 1.0) { + if (AssistUtils.equals(1.0, containerPercent)) { return rec; } rec.x = (int) (rec.x / containerPercent); @@ -244,7 +245,7 @@ public class XWAbsoluteLayout extends XLayoutContainer { @Override public void updateChildBound(int minHeight) { double prevContainerPercent = FRScreen.getByDimension(toData().getDesigningResolution()).getValue() / FormArea.DEFAULT_SLIDER; - if (toData().getCompState() == 0 && prevContainerPercent != containerPercent) { + if (toData().getCompState() == 0 && !AssistUtils.equals(containerPercent, prevContainerPercent)) { for (int i = 0; i < this.getComponentCount(); i++) { XCreator creator = getXCreator(i); Rectangle rec = new Rectangle(creator.getBounds()); diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java index 8d3d75a358..714bd0a2ea 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java @@ -21,6 +21,7 @@ import com.fr.form.ui.container.WLayout; import com.fr.general.FRLogger; import com.fr.general.FRScreen; import com.fr.stable.ArrayUtils; +import com.fr.stable.AssistUtils; import edu.emory.mathcs.backport.java.util.Arrays; import javax.swing.JOptionPane; @@ -72,7 +73,7 @@ public class XWFitLayout extends XLayoutContainer { Toolkit toolkit = Toolkit.getDefaultToolkit(); Dimension scrnsize = toolkit.getScreenSize(); double screenValue = FRScreen.getByDimension(scrnsize).getValue(); - if(screenValue != FormArea.DEFAULT_SLIDER){ + if (!AssistUtils.equals(FormArea.DEFAULT_SLIDER, screenValue)) { this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER); } } @@ -717,7 +718,7 @@ public class XWFitLayout extends XLayoutContainer { * 界面容器大小不是默认的时,处理控件的BoundsWidget,且避免出现空隙 */ private Rectangle dealWidgetBound(Rectangle rec) { - if (containerPercent == 1.0) { + if (AssistUtils.equals(1.0, containerPercent)) { return rec; } rec.x = (int) (rec.x/containerPercent); @@ -731,7 +732,7 @@ public class XWFitLayout extends XLayoutContainer { * 界面容器大小不是默认的时,恢复组件实际大小 */ private Rectangle dealWgtBound(Rectangle rec) { - if (containerPercent == 1.0) { + if (AssistUtils.equals(1.0, containerPercent)) { return rec; } rec.x = (int) (rec.x * containerPercent); From fd4471bd17395b417c1f28c00ba79170a27e594c Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Sun, 8 Sep 2019 20:36:47 +0800 Subject: [PATCH 14/29] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=EF=BC=8Cs?= =?UTF-8?q?onar=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/layout/TableLayout.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/layout/TableLayout.java b/designer-base/src/main/java/com/fr/design/layout/TableLayout.java index 8d1668297b..961d3e23e3 100644 --- a/designer-base/src/main/java/com/fr/design/layout/TableLayout.java +++ b/designer-base/src/main/java/com/fr/design/layout/TableLayout.java @@ -322,7 +322,7 @@ public class TableLayout implements LayoutManager2, Serializable { this row/column. */ public static final double MINIMUM = -3.0; - final double epsilon = 0.0000001; + public static final double EPSILON = 0.0000001; //****************************************************************************** //** Constructors *** @@ -1808,8 +1808,8 @@ public class TableLayout implements LayoutManager2, Serializable { for (counter = entry.cr1[z]; counter <= entry.cr2[z]; counter++) if (crSpec[z][counter] >= 1.0) scalableSize -= crSpec[z][counter]; - else if (Math.abs(crSpec[z][counter] - PREFERRED) < epsilon || - Math.abs(crSpec[z][counter] - MINIMUM) < epsilon) { + else if (Math.abs(crSpec[z][counter] - PREFERRED) < EPSILON || + Math.abs(crSpec[z][counter] - MINIMUM) < EPSILON) { scalableSize -= crPrefMin[counter]; } @@ -1825,13 +1825,13 @@ public class TableLayout implements LayoutManager2, Serializable { // Add scaled size to relativeWidth relativeSize += crSpec[z][counter]; // Cr is fill - else if (Math.abs(crSpec[z][counter] - FILL) < epsilon && Math.abs(fillSizeRatio - 0.0) >= epsilon) + else if (Math.abs(crSpec[z][counter] - FILL) < EPSILON && Math.abs(fillSizeRatio - 0.0) >= EPSILON) // Add fill size to relativeWidth relativeSize += fillSizeRatio; } // Determine the total scaled size as estimated by this component - if (Math.abs(relativeSize - 0) < epsilon) + if (Math.abs(relativeSize - 0) < EPSILON) temp = 0; else temp = (int) (scalableSize / relativeSize + 0.5); @@ -1852,8 +1852,8 @@ public class TableLayout implements LayoutManager2, Serializable { if (crSpec[z][counter] >= 1.0) totalSize += (int) (crSpec[z][counter] + 0.5); // Is the current cr a preferred/minimum size - else if (Math.abs(crSpec[z][counter] - PREFERRED) < epsilon|| - Math.abs(crSpec[z][counter] - MINIMUM) < epsilon) { + else if (Math.abs(crSpec[z][counter] - PREFERRED) < EPSILON|| + Math.abs(crSpec[z][counter] - MINIMUM) < EPSILON) { // Add preferred/minimum width totalSize += crPrefMin[counter]; } From 67e2846e79bd3fe29934703bc04881e812392cfa Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Mon, 9 Sep 2019 14:32:08 +0800 Subject: [PATCH 15/29] =?UTF-8?q?REPORT-21689=20REPORT-20981=20=E6=B0=B4?= =?UTF-8?q?=E5=8D=B0=E5=AF=86=E5=BA=A6=E5=A2=9E=E5=8A=A0=E4=B8=AA=E6=9C=80?= =?UTF-8?q?=E5=B0=8F=E5=80=BC=E9=99=90=E5=88=B6=EF=BC=8C=E5=AF=86=E5=BA=A6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=8D=E8=83=BD=E5=B0=8F=E4=BA=8E100/50;?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E7=89=88=E6=9C=AC=E7=AE=A1=E7=90=86=E5=87=8F?= =?UTF-8?q?=E5=B0=91=E7=A3=81=E7=9B=98=E5=8D=A0=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/vcs/common/VcsHelper.java | 2 +- .../src/main/java/com/fr/design/report/WatermarkPane.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index 7dea041554..97b572a11c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -147,7 +147,7 @@ public class VcsHelper implements JTemplateActionListener { if (needDeleteVersion(oldEntity)) { operator.deleteVersion(oldEntity.getFilename(), oldEntity.getVersion()); } - operator.gc(true); + operator.gc(); } }).start(); diff --git a/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java b/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java index 40fe942d23..a7f78e1170 100644 --- a/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java +++ b/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java @@ -113,8 +113,8 @@ public class WatermarkPane extends BasicPane { formulaPane = new TinyFormulaPane(); fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); fontSizeComboBox.setEditable(true); - horizontalGapSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, 200); - verticalGapSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, 100); + horizontalGapSpinner = new UnsignedIntUISpinner(100, Integer.MAX_VALUE, 1, 200); + verticalGapSpinner = new UnsignedIntUISpinner(50, Integer.MAX_VALUE, 1, 100); horizontalGapSpinner.setPreferredSize(SPINNER_DIMENSION); verticalGapSpinner.setPreferredSize(SPINNER_DIMENSION); JPanel fontSizeTypePane = new JPanel(new BorderLayout(10,0)); From 2312a7d05f66964d2afb5d4eda5288a504312b5f Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Mon, 9 Sep 2019 14:45:04 +0800 Subject: [PATCH 16/29] =?UTF-8?q?REPORT-20981=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E7=AE=A1=E7=90=86=E5=87=8F=E5=B0=91=E7=A3=81?= =?UTF-8?q?=E7=9B=98=E5=8D=A0=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/vcs/common/VcsHelper.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index 97b572a11c..4f447eaef0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -147,7 +147,9 @@ public class VcsHelper implements JTemplateActionListener { if (needDeleteVersion(oldEntity)) { operator.deleteVersion(oldEntity.getFilename(), oldEntity.getVersion()); } - operator.gc(); + if (GcConfig.getInstance().isGcEnable()) { + operator.gc(); + } } }).start(); From abafae544c43762cf6d02cf5034f1ca2b71e570b Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Mon, 9 Sep 2019 14:51:12 +0800 Subject: [PATCH 17/29] =?UTF-8?q?REPORT-20981=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E7=AE=A1=E7=90=86=E5=87=8F=E5=B0=91=E7=A3=81?= =?UTF-8?q?=E7=9B=98=E5=8D=A0=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/actions/file/PreferencePane.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 81b66451a8..5fa6c18621 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -325,6 +325,12 @@ public class PreferencePane extends BasicPane { tryGc(); } }); + gcEnableCheckBox.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + gcButton.setEnabled(gcEnableCheckBox.isSelected() ? true : false); + } + }); //集群下禁用 if (FineClusterConfig.getInstance().isCluster()) { From a8c1d63c359b0aa575ea4f6802e22783f5fae9cc Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Mon, 9 Sep 2019 16:15:55 +0800 Subject: [PATCH 18/29] =?UTF-8?q?REPORT-20981=20=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E4=B8=8D=E8=A6=81=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/PreferencePane.java | 26 +++---------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 5fa6c18621..a994711ebc 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -184,9 +184,6 @@ public class PreferencePane extends BasicPane { private JProgressBar gcProgressBar; private Timer gcProgressTimer; private UIButton gcOkButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK")); - private UIButton gcCancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel")); - - public PreferencePane() { this.initComponents(); @@ -328,7 +325,7 @@ public class PreferencePane extends BasicPane { gcEnableCheckBox.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { - gcButton.setEnabled(gcEnableCheckBox.isSelected() ? true : false); + gcButton.setEnabled(gcEnableCheckBox.isSelected()); } }); @@ -706,7 +703,7 @@ public class PreferencePane extends BasicPane { saveCommitCheckBox.setSelected(vcsConfigManager.isSaveCommit()); useIntervalCheckBox.setSelected(vcsConfigManager.isUseInterval()); gcEnableCheckBox.setSelected(GcConfig.getInstance().isGcEnable()); - + gcButton.setEnabled(gcEnableCheckBox.isSelected()); supportCellEditorDefCheckBox.setSelected(designerEnvManager.isSupportCellEditorDef()); isDragPermitedCheckBox.setSelected(designerEnvManager.isDragPermited()); @@ -887,14 +884,12 @@ public class PreferencePane extends BasicPane { } private void tryGc() { - //停止gc线程时使用 - final String uuid = String.valueOf(UUID.randomUUID()); final SwingWorker worker = new SwingWorker() { private long size = 0; @Override protected Boolean doInBackground() { - size = WorkContext.getCurrent().get(VcsOperator.class).immediatelyGc(uuid); + size = WorkContext.getCurrent().get(VcsOperator.class).immediatelyGc(); return true; } @@ -913,7 +908,6 @@ public class PreferencePane extends BasicPane { if (null != gcDialog) { gcDialog.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News")); } - gcDialogDownPane.remove(gcCancelButton); gcDialogDownPane.revalidate(); gcDialogDownPane.repaint(); gcDialogDownPane.add(gcOkButton); @@ -927,19 +921,6 @@ public class PreferencePane extends BasicPane { gcDialog.dispose(); } }); - gcCancelButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - stopGcProgressTimer(); - - //中断gc 线程 - if (StringUtils.isNotEmpty(uuid)) { - WorkContext.getCurrent().get(VcsOperator.class).cancelImmediatelyGc(uuid); - } - gcDialog.dispose(); - worker.cancel(true); - } - }); gcDialog.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { @@ -969,7 +950,6 @@ public class PreferencePane extends BasicPane { //中下 gcDialogDownPane = new JPanel(); gcDialogDownPane.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 0)); - gcDialogDownPane.add(gcCancelButton); jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); jp.add(gcUpPane); From a7c7f062d11573c1fb46176de670d77c6c686764 Mon Sep 17 00:00:00 2001 From: zheng Date: Mon, 9 Sep 2019 18:06:13 +0800 Subject: [PATCH 19/29] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=AF=84=E5=AE=A1?= =?UTF-8?q?=E5=87=BA=E7=9A=84=E4=B8=A4=E4=B8=AA=E9=97=AE=E9=A2=98=201.demo?= =?UTF-8?q?path=E6=94=BE=E5=88=B0typeUI=E6=8E=A5=E5=8F=A3=E4=B8=AD=202.typ?= =?UTF-8?q?epane.tipPath=20=E9=BB=98=E8=AE=A4=E8=B0=83=E7=94=A81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 107 ++++++++++++++---- .../com/fr/design/chart/ChartTypePane.java | 2 +- .../design/chart/fun/ChartTypeUIProvider.java | 16 ++- .../chart/fun/impl/AbstractChartTypeUI.java | 27 +++-- ...bstractIndependentChartUIWithAPILevel.java | 5 + ...mmonTypePane.java => DefaultTypePane.java} | 4 +- .../AreaIndependentVanChartInterface.java | 10 ++ .../bar/BarIndependentVanChartInterface.java | 10 ++ .../BubbleIndependentVanChartInterface.java | 9 ++ .../ColumnIndependentVanChartInterface.java | 10 ++ .../CustomIndependentVanChartInterface.java | 10 ++ .../DrillMapIndependentVanChartInterface.java | 9 ++ .../FunnelIndependentVanChartInterface.java | 7 ++ .../GanttIndependentVanChartInterface.java | 7 ++ .../GaugeIndependentVanChartInterface.java | 11 ++ .../HeatMapIndependentVanChartInterface.java | 7 ++ .../LineIndependentVanChartInterface.java | 9 ++ .../map/MapIndependentVanChartInterface.java | 12 ++ .../MultiPieIndependentVanChartInterface.java | 7 ++ .../pie/PieIndependentVanChartInterface.java | 10 ++ .../RadarIndependentVanChartInterface.java | 8 ++ .../ScatterIndependentVanChartInterface.java | 7 ++ ...StructureIndependentVanChartInterface.java | 9 ++ .../TreeMapIndependentVanChartInterface.java | 7 ++ ...WordCloudIndependentVanChartInterface.java | 7 ++ 25 files changed, 291 insertions(+), 36 deletions(-) rename designer-chart/src/main/java/com/fr/design/chartx/impl/{CommonTypePane.java => DefaultTypePane.java} (90%) diff --git a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java index f0d012544d..b931aa9910 100644 --- a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java @@ -4,6 +4,7 @@ import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.chart.charttypes.ChartTypeManager; +import com.fr.chart.fun.ChartTypeProvider; import com.fr.chartx.attr.ChartProvider; import com.fr.common.annotations.Compatible; import com.fr.design.beans.BasicBeanPane; @@ -39,10 +40,12 @@ import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPa import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.module.DesignModuleFactory; +import com.fr.extended.chart.AbstractChart; import com.fr.form.ui.ChartEditor; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; import com.fr.invoke.Reflect; +import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.PiePlot4VanChart; import com.fr.plugin.chart.area.VanChartAreaPlot; @@ -325,9 +328,62 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr return StringUtils.EMPTY; } - public String[] getSubName(String id) { + public String[] getDemoImagePath(String chartID) { + + if (chartTypeInterfaces != null) { + ChartTypeUIProvider provider = getChartTypeInterface(chartID); + if (provider != null) { + String[] result = null; + try { + result = provider.getDemoImagePath(); + } catch (Throwable e) { + //do nothing + } + return ArrayUtils.isEmpty(result) ? getCompatibleDemoImagePath(chartID) : result; + } + } + + return new String[0]; + } + + private String[] getCompatibleDemoImagePath(String chartID) { + String[] result = null; + try { + //AbstractIndependentChartsProvider + ChartTypeProvider chartTypeProvider = Reflect.on(ChartTypeManager.getInstanceWithCheck()).call("getChartType", chartID).get(); + result = new String[]{ + Reflect.on(chartTypeProvider).call("getChartImagePath").get() + }; + + if (ArrayUtils.isNotEmpty(result)) { + return result; + } + } catch (Exception e) { + //do nothing + } + + try { + //兼容 图表类型选择界面会调到这边 + ChartProvider[] charts = ChartTypeManager.getInstanceWithCheck().getChartTypes(chartID); + result = new String[charts.length]; + for (int i = 0; i < charts.length; i++) { + //Chart && AbstractChart + ChartProvider chart = charts[i]; + if (!(chart instanceof AbstractChart)) {//扩展图表 + chart = Reflect.on(chart).field("subChart").get(); + } + result[i] = Reflect.on(chart).call("demoImagePath").get(); + } + } catch (Exception e) { + //do nothing + } + + return new String[0]; + } + + public String[] getSubName(String chartID) { if (chartTypeInterfaces != null) { - ChartTypeUIProvider provider = getChartTypeInterface(id); + ChartTypeUIProvider provider = getChartTypeInterface(chartID); if (provider != null) { String[] subNames = null; try { @@ -335,31 +391,32 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr } catch (Throwable throwable) { //do nothing } - return ArrayUtils.isEmpty(subNames) ? getCompatibleSubName(id, provider) : subNames; + return ArrayUtils.isEmpty(subNames) ? getCompatibleSubName(chartID, provider) : subNames; } } return new String[0]; } //兼容 - private String[] getCompatibleSubName(String id, ChartTypeUIProvider provider) { - ChartProvider[] chartProviders = ChartTypeManager.getInstanceWithCheck().getChartTypes(id); + private String[] getCompatibleSubName(String chartID, ChartTypeUIProvider provider) { + ChartProvider[] chartProviders = ChartTypeManager.getInstanceWithCheck().getChartTypes(chartID); if (chartProviders.length == 1) { - return new String[]{getName(id)}; + return new String[]{getName(chartID)}; } String[] result = new String[chartProviders.length]; for (int i = 0; i < chartProviders.length; i++) { if (chartProviders[i] instanceof Chart) { + //Chart && AbstractChart result[i] = ((Chart) chartProviders[i]).getChartName(); } } return result; } - public String getName(String id) { + public String getName(String chartID) { if (chartTypeInterfaces != null) { - ChartTypeUIProvider provider = getChartTypeInterface(id); + ChartTypeUIProvider provider = getChartTypeInterface(chartID); if (provider != null) { String name = null; try { @@ -368,31 +425,41 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr //do nothing } - return StringUtils.isEmpty(name) ? getCompatibleName(id, provider) : name; + return StringUtils.isEmpty(name) ? getCompatibleName(chartID, provider) : name; } } return StringUtils.EMPTY; } //兼容 - private static String getCompatibleName(String id, ChartTypeUIProvider provider) { + private static String getCompatibleName(String chartID, ChartTypeUIProvider provider) { String result = null; try { - result = Reflect.on(provider).call("getPlotTypeTitle4PopupWindow").get(); + //AbstractIndependentChartsProvider + ChartTypeProvider chartTypeProvider = Reflect.on(ChartTypeManager.getInstanceWithCheck()).call("getChartType", chartID).get(); + result = Reflect.on(chartTypeProvider).call("getChartName").get();//国际化的key + result = InterProviderFactory.getProvider().getLocText(result); + if (StringUtils.isNotEmpty(result)) { + return result; + } } catch (Exception e) { //do nothing } - if (StringUtils.isNotEmpty(result)) { - return result; - } - ChartProvider chartProvider = ChartTypeManager.getInstanceWithCheck().getChartTypes(id)[0]; - if (chartProvider instanceof Chart) { - result = ((Chart) chartProvider).getChartName(); - } - if (StringUtils.isNotEmpty(result)) { - return result; + + try { + ChartProvider chartProvider = ChartTypeManager.getInstanceWithCheck().getChartTypes(chartID)[0]; + if (chartProvider instanceof Chart) { + //AbstractExtendedChartUIProvider + result = ((Chart) chartProvider).getChartName(); + } + if (StringUtils.isNotEmpty(result) && !"Charts".equals(result)) { + return result; + } + + } catch (Exception e) { + //do nothing } return provider.getPlotTypePane().title4PopupWindow(); diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java index d349b39678..eb17cc41f8 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java @@ -94,7 +94,7 @@ public class ChartTypePane extends ChartCommonWizardPane { int main_index = mainTypeList.getSelectedIndex(); String id = ChartTypePane.this.chartIDs[main_index]; - String[] demoImagePath = ChartTypeManager.getInstanceWithCheck().getDemoImagePath(id); + String[] demoImagePath = ChartTypeInterfaceManager.getInstance().getDemoImagePath(id); String[] subName = ChartTypeInterfaceManager.getInstance().getSubName(id); ChartTypePane.this.iconListModel.clear(); diff --git a/designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java b/designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java index 80256b617c..586b3fc6ad 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java +++ b/designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java @@ -19,7 +19,7 @@ import com.fr.stable.fun.Level; * Created by eason on 14/12/29. * * @since 8.0 - * 自定义图表类型设设计界面接口 + * 自定义 图表类型 界面接口 */ public interface ChartTypeUIProvider extends Level { @@ -66,8 +66,18 @@ public interface ChartTypeUIProvider extends Level { String[] getSubName(); /** - * 图标路径 - * 表单 工具栏 拖拽图表小图标 + * 图表 demo图片路径 + * 400*225 + * 1.图表选择界面的图的路径 原样渲染 + * 2.图表属性第一个界面 类型界面 缩放渲染 + * + * @return demo图片路径 + */ + String[] getDemoImagePath(); + + /** + * 小图标路径 + * 表单 工具栏 图表小图标 * 16*16 * * @return 图标路径 diff --git a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java index a4a7b56117..86d7ee9fab 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java +++ b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java @@ -5,6 +5,7 @@ import com.fr.design.beans.BasicBeanPane; import com.fr.design.chart.fun.ChartTypeUIProvider; import com.fr.design.chartx.impl.AbstractDataPane; import com.fr.design.chartx.impl.AbstractOtherPane; +import com.fr.design.chartx.impl.DefaultTypePane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.ChartEditPane; @@ -13,6 +14,7 @@ import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.stable.fun.impl.AbstractProvider; /** @@ -20,6 +22,11 @@ import com.fr.stable.fun.impl.AbstractProvider; */ public abstract class AbstractChartTypeUI extends AbstractProvider implements ChartTypeUIProvider { + @Override + public AbstractChartTypePane getPlotTypePane() { + return new DefaultTypePane(); + } + @Override public abstract AbstractDataPane getChartDataPane(AttributeChangeListener listener); @@ -31,6 +38,16 @@ public abstract class AbstractChartTypeUI extends AbstractProvider implements Ch return new String[]{getName()}; } + @Override + public int currentAPILevel() { + return CURRENT_API_LEVEL; + } + + @Override + public String mark4Provider() { + return getClass().getName(); + } + @Override public boolean needChartChangePane() { return false; @@ -51,16 +68,6 @@ public abstract class AbstractChartTypeUI extends AbstractProvider implements Ch return false; } - @Override - public int currentAPILevel() { - return CURRENT_API_LEVEL; - } - - @Override - public String mark4Provider() { - return getClass().getName(); - } - @Override public ChartEditPane getChartEditPane(String plotID) { return new ChartEditPane(); diff --git a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java index 38f4ab0a65..f754a028e6 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java +++ b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java @@ -48,6 +48,11 @@ public abstract class AbstractIndependentChartUIWithAPILevel implements ChartTyp return new String[0]; } + @Override + public String[] getDemoImagePath() { + return new String[0]; + } + /** * 是否使用默认的界面,为了避免界面来回切换 * @return 是否使用默认的界面 diff --git a/designer-chart/src/main/java/com/fr/design/chartx/impl/CommonTypePane.java b/designer-chart/src/main/java/com/fr/design/chartx/impl/DefaultTypePane.java similarity index 90% rename from designer-chart/src/main/java/com/fr/design/chartx/impl/CommonTypePane.java rename to designer-chart/src/main/java/com/fr/design/chartx/impl/DefaultTypePane.java index 24d9bf95dc..07db589a9f 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/impl/CommonTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/impl/DefaultTypePane.java @@ -10,11 +10,11 @@ import com.fr.design.mainframe.chart.gui.type.ChartImagePane; /** * Created by shine on 2019/09/04. */ -public class CommonTypePane extends AbstractChartTypePane { +public class DefaultTypePane extends AbstractChartTypePane { @Override protected String[] getTypeIconPath() { - return new String[0]; + return ChartTypeInterfaceManager.getInstance().getDemoImagePath(getPlotID()); } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/area/AreaIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/area/AreaIndependentVanChartInterface.java index 79d12301ed..23bd47004c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/area/AreaIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/area/AreaIndependentVanChartInterface.java @@ -35,6 +35,16 @@ public class AreaIndependentVanChartInterface extends AbstractMultiCategoryVanCh }; } + @Override + public String[] getDemoImagePath() { + return new String[]{ + "com/fr/plugin/chart/demo/image/14.png", + "com/fr/plugin/chart/demo/image/15.png", + "com/fr/plugin/chart/demo/image/16.png", + "com/fr/plugin/chart/demo/image/17.png" + }; + } + @Override public AbstractChartTypePane getPlotTypePane() { return new VanChartAreaPlotPane(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/bar/BarIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/bar/BarIndependentVanChartInterface.java index 813698c19e..0321132b32 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/bar/BarIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/bar/BarIndependentVanChartInterface.java @@ -37,6 +37,16 @@ public class BarIndependentVanChartInterface extends AbstractMultiCategoryVanCha }; } + @Override + public String[] getDemoImagePath() { + return new String[]{ + "com/fr/plugin/chart/demo/image/7.png", + "com/fr/plugin/chart/demo/image/8.png", + "com/fr/plugin/chart/demo/image/9.png", + "com/fr/plugin/chart/demo/image/10.png", + }; + } + @Override public String getIconPath() { return "com/fr/design/images/form/toolbar/bar.png"; diff --git a/designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java index 86522174c6..8e732b406e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java @@ -35,6 +35,15 @@ public class BubbleIndependentVanChartInterface extends AbstractIndependentVanCh Toolkit.i18nText("Fine-Design_Chart_New_Force_Bubble") }; } + + @Override + public String[] getDemoImagePath() { + return new String[]{ + "com/fr/plugin/chart/demo/image/26.png", + "com/fr/plugin/chart/demo/image/27.png" + }; + } + /** * 图表的类型定义界面类型,就是属性表的第一个界面 * diff --git a/designer-chart/src/main/java/com/fr/van/chart/column/ColumnIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/column/ColumnIndependentVanChartInterface.java index d85cfc5fc9..ebecf18caa 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/column/ColumnIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/column/ColumnIndependentVanChartInterface.java @@ -31,6 +31,16 @@ public class ColumnIndependentVanChartInterface extends AbstractMultiCategoryVan }; } + @Override + public String[] getDemoImagePath() { + return new String[]{ + "com/fr/plugin/chart/demo/image/3.png", + "com/fr/plugin/chart/demo/image/4.png", + "com/fr/plugin/chart/demo/image/5.png", + "com/fr/plugin/chart/demo/image/6.png", + }; + } + @Override public String getIconPath() { return "com/fr/design/images/form/toolbar/column.png"; diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/CustomIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/custom/CustomIndependentVanChartInterface.java index 2d376f89bd..ffb44ca326 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/CustomIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/CustomIndependentVanChartInterface.java @@ -30,6 +30,16 @@ public class CustomIndependentVanChartInterface extends AbstractIndependentVanCh }; } + @Override + public String[] getDemoImagePath() { + return new String[]{ + "com/fr/plugin/chart/demo/image/28.png", + "com/fr/plugin/chart/demo/image/29.png", + "com/fr/plugin/chart/demo/image/30.png", + "com/fr/plugin/chart/demo/image/31.png" + }; + } + /** * 图表的类型定义界面类型,就是属性表的第一个界面 * diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/DrillMapIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/DrillMapIndependentVanChartInterface.java index efa2eb684b..f74706b9ad 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/DrillMapIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/DrillMapIndependentVanChartInterface.java @@ -31,6 +31,15 @@ public class DrillMapIndependentVanChartInterface extends MapIndependentVanChart }; } + @Override + public String[] getDemoImagePath() { + return new String[]{ + "com/fr/plugin/chart/demo/image/37.png", + "com/fr/plugin/chart/demo/image/38.png", + "com/fr/plugin/chart/demo/image/39.png" + }; + } + /** * 图标路径 * diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/FunnelIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/FunnelIndependentVanChartInterface.java index 2b5a28db19..5496959700 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/FunnelIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/FunnelIndependentVanChartInterface.java @@ -31,6 +31,13 @@ public class FunnelIndependentVanChartInterface extends AbstractIndependentVanCh return Toolkit.i18nText("Fine-Design_Chart_New_Funnel"); } + @Override + public String[] getDemoImagePath() { + return new String[]{ + "com/fr/plugin/chart/demo/image/41.png" + }; + } + /** * 图表的类型定义界面类型,就是属性表的第一个界面 * diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/GanttIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/GanttIndependentVanChartInterface.java index b840c925b3..9bc3ce1232 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/GanttIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/GanttIndependentVanChartInterface.java @@ -33,6 +33,13 @@ public class GanttIndependentVanChartInterface extends AbstractIndependentVanCha return Toolkit.i18nText("Fine-Design_Chart_New_Gantt"); } + @Override + public String[] getDemoImagePath() { + return new String[]{ + "com/fr/plugin/chart/demo/image/44.png" + }; + } + @Override public AbstractChartTypePane getPlotTypePane() { return new VanChartGanttPlotPane(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/gauge/GaugeIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/gauge/GaugeIndependentVanChartInterface.java index 8a9c6cde13..af4aa2c8ff 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gauge/GaugeIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gauge/GaugeIndependentVanChartInterface.java @@ -48,6 +48,17 @@ public class GaugeIndependentVanChartInterface extends AbstractIndependentVanCha }; } + @Override + public String[] getDemoImagePath() { + return new String[]{ + "com/fr/plugin/chart/demo/image/18.png", + "com/fr/plugin/chart/demo/image/19.png", + "com/fr/plugin/chart/demo/image/20.png", + "com/fr/plugin/chart/demo/image/21.png", + "com/fr/plugin/chart/demo/image/22.png" + }; + } + @Override public AbstractChartTypePane getPlotTypePane() { return new VanChartGaugePlotPane(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/HeatMapIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/HeatMapIndependentVanChartInterface.java index 2bb347d4f1..2d07fda4df 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/HeatMapIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/HeatMapIndependentVanChartInterface.java @@ -38,6 +38,13 @@ public class HeatMapIndependentVanChartInterface extends MapIndependentVanChartI return Toolkit.i18nText("Fine-Design_Chart_New_HeatMap"); } + @Override + public String[] getDemoImagePath() { + return new String[]{ + "com/fr/plugin/chart/demo/image/42.png" + }; + } + public AbstractChartTypePane getPlotTypePane() { return new VanChartHeatMapTypePane(); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/line/LineIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/line/LineIndependentVanChartInterface.java index 171e72ac22..739e87f14f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/line/LineIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/line/LineIndependentVanChartInterface.java @@ -31,6 +31,15 @@ public class LineIndependentVanChartInterface extends AbstractMultiCategoryVanCh }; } + @Override + public String[] getDemoImagePath() { + return new String[]{ + "com/fr/plugin/chart/demo/image/11.png", + "com/fr/plugin/chart/demo/image/12.png", + "com/fr/plugin/chart/demo/image/13.png" + }; + } + @Override public AbstractChartTypePane getPlotTypePane() { return new VanChartLinePlotPane(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/MapIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/map/MapIndependentVanChartInterface.java index a84a56e6fc..76deff2d3f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/MapIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/MapIndependentVanChartInterface.java @@ -48,6 +48,18 @@ public class MapIndependentVanChartInterface extends AbstractIndependentVanChart }; } + + @Override + public String[] getDemoImagePath() { + return new String[]{ + "com/fr/plugin/chart/demo/image/33.png", + "com/fr/plugin/chart/demo/image/34.png", + "com/fr/plugin/chart/demo/image/35.png", + "com/fr/plugin/chart/demo/image/36.png" + }; + } + + /** * 图表的类型定义界面类型,就是属性表的第一个界面 * diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java index 3d72cd3d77..d6fe79390d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java @@ -29,6 +29,13 @@ public class MultiPieIndependentVanChartInterface extends AbstractIndependentVan return Toolkit.i18nText("Fine-Design_Chart_New_MultiPie"); } + @Override + public String[] getDemoImagePath() { + return new String[]{ + "com/fr/plugin/chart/demo/image/32.png" + }; + } + // @Override // public ChartDataPane getChartDataPane(AttributeChangeListener listener) { // return new AbstractDataPane(listener) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/PieIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/pie/PieIndependentVanChartInterface.java index 4e37c53c1c..06841c0c92 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/PieIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/PieIndependentVanChartInterface.java @@ -38,6 +38,16 @@ public class PieIndependentVanChartInterface extends AbstractIndependentVanChart }; } + @Override + public String[] getDemoImagePath() { + return new String[]{ + "com/fr/plugin/chart/demo/image/0.png", + "com/fr/plugin/chart/demo/image/1.png", + "com/fr/plugin/chart/demo/image/2.png" + }; + } + + @Override public AbstractChartTypePane getPlotTypePane() { return new VanChartPiePlotPane(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/radar/RadarIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/radar/RadarIndependentVanChartInterface.java index 547b2d4a73..21784c522b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/radar/RadarIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/radar/RadarIndependentVanChartInterface.java @@ -30,6 +30,14 @@ public class RadarIndependentVanChartInterface extends AbstractIndependentVanCha }; } + @Override + public String[] getDemoImagePath() { + return new String[]{ + "com/fr/plugin/chart/demo/image/23.png", + "com/fr/plugin/chart/demo/image/24.png" + }; + } + @Override public AbstractChartTypePane getPlotTypePane() { return new VanChartRadarPlotPane(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java index 8374a78795..263ce191af 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java @@ -40,6 +40,13 @@ public class ScatterIndependentVanChartInterface extends AbstractIndependentVanC return Toolkit.i18nText("Fine-Design_Chart_New_Scatter"); } + @Override + public String[] getDemoImagePath() { + return new String[]{ + "com/fr/plugin/chart/demo/image/25.png" + }; + } + /** * 图标路径 * diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/StructureIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/StructureIndependentVanChartInterface.java index 15d9cacf64..6be8c692ba 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/StructureIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/StructureIndependentVanChartInterface.java @@ -46,6 +46,15 @@ public class StructureIndependentVanChartInterface extends AbstractIndependentVa }; } + @Override + public String[] getDemoImagePath() { + return new String[]{ + "com/fr/plugin/chart/demo/image/45.png", + "com/fr/plugin/chart/demo/image/46.png", + "com/fr/plugin/chart/demo/image/47.png" + }; + } + @Override public String getIconPath() { return "com/fr/design/images/form/toolbar/structure.png"; diff --git a/designer-chart/src/main/java/com/fr/van/chart/treemap/TreeMapIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/treemap/TreeMapIndependentVanChartInterface.java index 021062fe62..2b6589ed84 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/treemap/TreeMapIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/treemap/TreeMapIndependentVanChartInterface.java @@ -28,6 +28,13 @@ public class TreeMapIndependentVanChartInterface extends MultiPieIndependentVanC return Toolkit.i18nText("Fine-Design_Chart_New_TreeMap"); } + @Override + public String[] getDemoImagePath() { + return new String[]{ + "com/fr/plugin/chart/demo/image/40.png" + }; + } + @Override public String getIconPath() { return "com/fr/design/images/form/toolbar/treeMap.png"; diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java index 71c67be912..62356028fc 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java @@ -40,6 +40,13 @@ public class WordCloudIndependentVanChartInterface extends AbstractIndependentVa return Toolkit.i18nText("Fine-Design_Chart_Word_Cloud"); } + @Override + public String[] getDemoImagePath() { + return new String[]{ + "com/fr/plugin/chart/demo/image/43.png" + }; + } + /** * 图标路径 * From f5be6a0a94a5c6d484dd0847025cf04aef253760 Mon Sep 17 00:00:00 2001 From: zheng Date: Tue, 10 Sep 2019 10:17:35 +0800 Subject: [PATCH 20/29] image icon --- .../chart/gui/type/ChartImagePane.java | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/ChartImagePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/ChartImagePane.java index 3433da4e28..584d7fd1d6 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/ChartImagePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/ChartImagePane.java @@ -5,9 +5,13 @@ import com.fr.design.constants.UIConstants; import com.fr.design.gui.ilable.UILabel; import com.fr.general.IOUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; import java.awt.event.MouseEvent; +import java.awt.image.BufferedImage; public class ChartImagePane extends ChartSelectDemoPane { private static final long serialVersionUID = -2785128245790568603L; @@ -33,9 +37,18 @@ public class ChartImagePane extends ChartSelectDemoPane { constructImagePane(fullIconPath, tipName, isDrawRightLine); } - private void constructImagePane(String fullIconPath, String tipName, boolean isDrawRightLine){ - - UILabel image = new UILabel(IOUtils.readIcon(fullIconPath)); + private void constructImagePane(final String fullIconPath, String tipName, boolean isDrawRightLine) { + + UILabel image = new UILabel() { + @Override + public void paint(Graphics g) { + super.paint(g); + + BufferedImage image1 = IOUtils.readImageWithCache(fullIconPath); + g.drawImage(image1, 0, 0, IMAGE_WIDTH, IMAGE_HIGTH, null); + } + }; + this.setLayout(new BorderLayout()); this.add(image, BorderLayout.CENTER); addMouseListener(this); From 2c3b24af3c827d6f045f0970c61f0a36e2379ed9 Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Tue, 10 Sep 2019 10:41:39 +0800 Subject: [PATCH 21/29] =?UTF-8?q?REPORT-20981=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E7=AE=A1=E7=90=86=E5=87=8F=E5=B0=91=E7=A3=81?= =?UTF-8?q?=E7=9B=98=E5=8D=A0=E7=94=A8=EF=BC=88=E8=BF=9C=E7=A8=8B=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E6=9B=B4=E6=96=B0jar=E6=97=B6=EF=BC=8C=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E7=9B=B8=E5=BA=94=E4=BF=A1=E6=81=AF=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/PreferencePane.java | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index a994711ebc..968d395f4b 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -897,17 +897,13 @@ public class PreferencePane extends BasicPane { protected void done() { try { get(); - } catch (InterruptedException | ExecutionException e) { + } catch (ExecutionException e) { + updateGcDialogPanelInfo(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Vcs_Need_Update_Remote_Server_Jar")); + return; + } catch (InterruptedException e) { FineLoggerFactory.getLogger().error(e, e.getMessage()); } - stopGcProgressTimer(); - gcMessage.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Vcs_Reduce_File_Size") + fileSizeConvert(size)); - if (null != gcProgressBar) { - gcProgressBarPanel.remove(gcProgressBar); - } - if (null != gcDialog) { - gcDialog.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News")); - } + updateGcDialogPanelInfo(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Vcs_Reduce_File_Size") + fileSizeConvert(size)); gcDialogDownPane.revalidate(); gcDialogDownPane.repaint(); gcDialogDownPane.add(gcOkButton); @@ -932,6 +928,22 @@ public class PreferencePane extends BasicPane { gcDialog.dispose(); } + /** + * gc 后更新进度条面板信息 + * + * @param message + */ + private void updateGcDialogPanelInfo(String message) { + stopGcProgressTimer(); + gcMessage.setText(message); + if (null != gcProgressBar) { + gcProgressBarPanel.remove(gcProgressBar); + } + if (null != gcDialog) { + gcDialog.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News")); + } + } + /** * 初始化 gc 对话框 */ From 2ebff9157db0753821b7d6eaeff3ceb4414946ef Mon Sep 17 00:00:00 2001 From: jinbokai Date: Tue, 10 Sep 2019 14:17:36 +0800 Subject: [PATCH 22/29] REPORT-20328 sonar --- .../ui/rsyntaxtextarea/RSyntaxTextArea.java | 10 +---- .../gui/syntax/ui/rsyntaxtextarea/Style.java | 17 +++++---- .../ui/rsyntaxtextarea/SyntaxScheme.java | 23 +++++------ .../folding/HtmlFoldParser.java | 4 +- .../syntax/ui/rtextarea/RTextAreaBase.java | 38 ++++--------------- .../gui/syntax/ui/rtextarea/SearchEngine.java | 5 ++- ...olatileImageBackgroundPainterStrategy.java | 7 +++- 7 files changed, 40 insertions(+), 64 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextArea.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextArea.java index 3d04602f28..30fc7b8717 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextArea.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextArea.java @@ -3016,11 +3016,6 @@ private boolean fractionalFontMetricsEnabled; return he; } - private final boolean equal(LinkGeneratorResult e1, - LinkGeneratorResult e2) { - return e1.getSourceOffset()==e2.getSourceOffset(); - } - @Override public void mouseClicked(MouseEvent e) { if (getHyperlinksEnabled() && isScanningForLinks && @@ -3080,8 +3075,7 @@ private boolean fractionalFontMetricsEnabled; isLinkAtOffset(RSyntaxTextArea.this, offs); if (newResult!=null) { // Repaint if we're at a new link now. - if (linkGeneratorResult==null || - !equal(newResult, linkGeneratorResult)) { + if (linkGeneratorResult==null || newResult.getSourceOffset() != linkGeneratorResult.getSourceOffset()) { repaint(); } linkGeneratorResult = newResult; @@ -3120,4 +3114,4 @@ private boolean fractionalFontMetricsEnabled; } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/Style.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/Style.java index 496537ae01..0824ceafce 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/Style.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/Style.java @@ -9,6 +9,7 @@ */ package com.fr.design.gui.syntax.ui.rsyntaxtextarea; +import com.fr.log.FineLoggerFactory; import java.awt.Color; import java.awt.Font; import java.awt.FontMetrics; @@ -123,15 +124,15 @@ public class Style implements Cloneable { Style clone = null; try { clone = (Style)super.clone(); + clone.foreground = foreground; + clone.background = background; + clone.font = font; + clone.underline = underline; + clone.fontMetrics = fontMetrics; } catch (CloneNotSupportedException cnse) { // Never happens - cnse.printStackTrace(); - return null; + FineLoggerFactory.getLogger().error(cnse.getMessage(), cnse); + clone = null; } - clone.foreground = foreground; - clone.background = background; - clone.font = font; - clone.underline = underline; - clone.fontMetrics = fontMetrics; return clone; } @@ -193,4 +194,4 @@ public class Style implements Cloneable { } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxScheme.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxScheme.java index 621aeb5459..dbaaf4c6f3 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxScheme.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxScheme.java @@ -9,6 +9,7 @@ */ package com.fr.design.gui.syntax.ui.rsyntaxtextarea; +import com.fr.log.FineLoggerFactory; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; @@ -121,17 +122,17 @@ public class SyntaxScheme implements Cloneable, TokenTypes { public Object clone() { SyntaxScheme shcs = null; try { - shcs = (SyntaxScheme)super.clone(); - } catch (CloneNotSupportedException cnse) { // Never happens - cnse.printStackTrace(); - return null; - } - shcs.styles = new Style[styles.length]; - for (int i=0; i or %> - else if (t.startsWith(LANG_END[language])) { + else if (currentFold != null && t.startsWith(LANG_END[language])) { int phpEnd = t.getEndOffset() - 1; currentFold.setEndOffset(phpEnd); Fold parentFold = currentFold.getParent(); @@ -400,4 +400,4 @@ public class HtmlFoldParser implements FoldParser { } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java index 334d342556..01c9238c66 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java @@ -723,37 +723,13 @@ int currentCaretY; // Used to know when to rehighlight current line. // If we're wrapping lines we need to check the actual y-coordinate // of the caret, not just the line number, since a single logical // line can span multiple physical lines. - if (getLineWrap()) { - try { - Rectangle temp = modelToView(dot); - if (temp!=null) { - currentCaretY = temp.y; - } - } catch (BadLocationException ble) { - ble.printStackTrace(); // Should never happen. + try { + Rectangle temp = modelToView(dot); + if (temp != null) { + currentCaretY = temp.y; } - } - - // No line wrap - we can simply check the line number (quicker). - else { -// Document doc = getDocument(); -// if (doc!=null) { -// Element map = doc.getDefaultRootElement(); -// int caretLine = map.getElementIndex(dot); -// Rectangle alloc = ((RTextAreaUI)getUI()). -// getVisibleEditorRect(); -// if (alloc!=null) -// currentCaretY = alloc.y + caretLine*lineHeight; -// } -// Modified for code folding requirements -try { - Rectangle temp = modelToView(dot); - if (temp!=null) { - currentCaretY = temp.y; - } -} catch (BadLocationException ble) { - ble.printStackTrace(); // Should never happen. -} + } catch (BadLocationException ble) { + ble.printStackTrace(); // Should never happen. } // Repaint current line (to fill in entire highlight), and old line @@ -1211,4 +1187,4 @@ try { } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/SearchEngine.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/SearchEngine.java index 23cf929644..3bda042ce1 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/SearchEngine.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/SearchEngine.java @@ -25,6 +25,7 @@ import javax.swing.text.Caret; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.DocumentRange; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.folding.FoldManager; +import org.jetbrains.annotations.NotNull; /** @@ -174,6 +175,7 @@ public class SearchEngine { * @param forward Whether we're searching forward or backward. * @return The character sequence. */ + @NotNull private static CharSequence getFindInCharSequence(RTextArea textArea, int start, boolean forward) { RDocument doc = (RDocument)textArea.getDocument(); @@ -752,7 +754,6 @@ public class SearchEngine { int start = makeMarkAndDotEqual(textArea, forward); CharSequence findIn = getFindInCharSequence(textArea, start, forward); - if (findIn==null) return new SearchResult(); int markAllCount = 0; if (context.getMarkAll()) { @@ -1014,4 +1015,4 @@ public class SearchEngine { } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/VolatileImageBackgroundPainterStrategy.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/VolatileImageBackgroundPainterStrategy.java index c7be420de9..f08ab22c3d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/VolatileImageBackgroundPainterStrategy.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/VolatileImageBackgroundPainterStrategy.java @@ -103,6 +103,9 @@ public class VolatileImageBackgroundPainterStrategy } finally { tracker.removeImage(i, 1); } + if(bgImage == null) { + continue; + } bgImage.getGraphics().drawImage(i, 0,0, null); tracker.addImage(bgImage, 0); try { @@ -114,7 +117,7 @@ public class VolatileImageBackgroundPainterStrategy } finally { tracker.removeImage(bgImage, 0); } - } while (bgImage.contentsLost()); + } while (bgImage != null && bgImage.contentsLost()); } // End of if (master!=null). else { bgImage = null; @@ -137,4 +140,4 @@ public class VolatileImageBackgroundPainterStrategy } -} \ No newline at end of file +} From ee19b29f7834dde2d047bfec5ea63fec5bab4794 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Wed, 11 Sep 2019 09:16:41 +0800 Subject: [PATCH 23/29] =?UTF-8?q?sonar=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/gui/frpane/CommitTabbedPane.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/CommitTabbedPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/CommitTabbedPane.java index 85dbdbe5c4..afbf43c305 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/CommitTabbedPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/CommitTabbedPane.java @@ -296,7 +296,7 @@ public class CommitTabbedPane extends JComponent implements MouseListener, Mous double[] x = {startX, startX, startX + tabWidth, startX + tabWidth, startX}; double[] y = {-1, getHeight(), getHeight(), -1, -1}; RoundRectangle2D.Double rect1 = new RoundRectangle2D.Double(startX, 1, this.getWidth(), this.getHeight(), 7, 7); - g2d.setPaint(new GradientPaint(1, 1, new Color(255, 255, 255), 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND)); + g2d.setPaint(new GradientPaint(1, 1, new Color(255, 255, 255), 1, getHeight() - 1f, UIConstants.NORMAL_BACKGROUND)); GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length); generalPath.moveTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); @@ -345,9 +345,9 @@ public class CommitTabbedPane extends JComponent implements MouseListener, Mous double[] x = {startX, startX, startX + tabWidth, startX + tabWidth, startX}; double[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1}; if (selfIndex == mouseOveredIndex) { - g2d.setPaint(new GradientPaint(1, 1, new Color(255, 255, 255), 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND)); + g2d.setPaint(new GradientPaint(1, 1, new Color(255, 255, 255), 1, getHeight() - 1f, UIConstants.NORMAL_BACKGROUND)); } else { - g2d.setPaint(new GradientPaint(1, 1, UIConstants.NORMAL_BACKGROUND, 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND)); + g2d.setPaint(new GradientPaint(1, 1, UIConstants.NORMAL_BACKGROUND, 1, getHeight() - 1f, UIConstants.NORMAL_BACKGROUND)); } From 6e3d656b8c2fbc456f04dbbc40c96f768df08dd6 Mon Sep 17 00:00:00 2001 From: Maksim Date: Wed, 11 Sep 2019 10:47:16 +0800 Subject: [PATCH 24/29] =?UTF-8?q?REPORT-20323=20sonar=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/cell/style/AlignmentAction.java | 6 ++++-- .../fr/design/actions/cell/style/ReportFontSizeAction.java | 3 ++- .../java/com/fr/design/dscolumn/DSColumnAdvancedPane.java | 6 +----- .../com/fr/design/dscolumn/SelectedDataColumnPane.java | 2 +- .../java/com/fr/design/javascript/ListenerEditPane.java | 5 +++-- .../com/fr/design/mainframe/AuthorityEditToolBarPane.java | 7 ++++--- .../java/com/fr/design/mainframe/FormatBrushAction.java | 2 +- .../src/main/java/com/fr/design/mainframe/JWorkBook.java | 5 +++-- .../com/fr/design/mainframe/SheetAuthorityEditPane.java | 3 ++- 9 files changed, 21 insertions(+), 18 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java index df56afc581..8dab29a0d2 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java @@ -110,8 +110,10 @@ public class AlignmentAction extends ButtonGroupAction implements StyleActionInt group.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Left"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Right")}); } for (int i = 0; i < 3; i++) { - group.getButton(i).setRoundBorder(true, UIConstants.ARC); - group.getButton(i).setBorderPainted(true); + if (group != null) { + group.getButton(i).setRoundBorder(true, UIConstants.ARC); + group.getButton(i).setBorderPainted(true); + } } return group; } diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontSizeAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontSizeAction.java index 7a3563be46..5a19a507bd 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontSizeAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontSizeAction.java @@ -15,6 +15,7 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.mainframe.ElementCasePane; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; +import com.fr.stable.AssistUtils; /** @@ -51,7 +52,7 @@ public class ReportFontSizeAction extends AbstractStyleAction { if (style.getFRFont().getSize() == defStyle.getFRFont().getSize()) { style = StyleUtils.setReportFontSize(style, defStyle.getFRFont().getSize()); } - if (selectedFontSize == style.getFRFont().getSize()) { + if (AssistUtils.equals(selectedFontSize, style.getFRFont().getSize())){ return style; } style = StyleUtils.setReportFontSize(style, selectedFontSize); diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java index 7f86dd2eea..0941b4b220 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java @@ -247,11 +247,7 @@ public class DSColumnAdvancedPane extends BasicPane { this.sortOrderComboBox.setSortOrder(new SortOrder(sort)); String sortFormula = dSColumn.getSortFormula(); - if (sortFormula != null && sortFormula.length() >= 1) { - sortFormulaTextField.setText(sortFormula); - } else { - sortFormulaTextField.setText(sortFormula); - } + sortFormulaTextField.setText(sortFormula); } public void update(CellElement cellElement) { diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java index 2707685b52..ad670abf33 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java @@ -263,7 +263,7 @@ public class SelectedDataColumnPane extends BasicPane { SimpleDSColumn simpleDSColumn = updateColumnPane(); dsColumn.setDSName(Objects.requireNonNull(simpleDSColumn).getDsName()); - dsColumn.setColumn(simpleDSColumn.getColumn()); + dsColumn.setColumn(Objects.requireNonNull(simpleDSColumn).getColumn()); dsColumn.setParameters((ps != null && ps.length > 0) ? ps : null); } diff --git a/designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java b/designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java index 91ccd38028..5f1f941faa 100644 --- a/designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java +++ b/designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java @@ -140,10 +140,11 @@ public class ListenerEditPane extends BasicBeanPane { @Override public void populateBean(Listener listener) { - this.listener = listener; - if (this.listener == null) { + if (listener == null){ this.listener = new Listener(); + return; } + this.listener = listener; this.nameText.setText(listener.getEventName()); JavaScript js = listener.getAction(); for (int i = 0; i < this.cards.size(); i++) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityEditToolBarPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityEditToolBarPane.java index f6f2b7a10b..6224bcfebe 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityEditToolBarPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityEditToolBarPane.java @@ -13,6 +13,7 @@ import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.webattr.ToolBarButton; import com.fr.general.ComparatorUtils; +import com.fr.stable.StringUtils; import javax.swing.*; @@ -204,7 +205,7 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane { public void populateType() { - if (name.getText() == "") { + if (StringUtils.isEmpty(name.getText())) { type.setText(""); } else { type.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Toolbar_Button")); @@ -218,7 +219,7 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane { names += "," + buttonlists.get(i).getNameOption().optionName(); } } - if (names != "") { + if (StringUtils.isNotEmpty(names)) { names = names.substring(1); } name.setText(names); @@ -226,7 +227,7 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane { public void populateCheckPane() { checkPane.removeAll(); - if (name.getText() == "") { + if (StringUtils.isEmpty(name.getText())) { return; } double f = TableLayout.FILL; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java b/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java index 56d4d33ece..76298161f0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java @@ -157,7 +157,7 @@ public class FormatBrushAction extends ElementCaseAction { } Style style = cellElement.getStyle(); if (style == null) { - style = style.DEFAULT_STYLE; + style = Style.DEFAULT_STYLE; } referencedStyle[i][j] = style; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index e5cb04b0fa..f7e9ed7659 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -89,6 +89,7 @@ import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.poly.PolyWorkSheet; import com.fr.report.worksheet.WorkSheet; import com.fr.stable.ArrayUtils; +import com.fr.stable.AssistUtils; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.module.Module; @@ -469,7 +470,7 @@ public class JWorkBook extends JTemplate { double creatorWidth = blockCreator.getEditorBounds().width; double areaHeight = polyDezi.polyArea.getHeight(); double areaWidth = polyDezi.polyArea.getWidth(); - if (creatorWidth == 0 || creatorHeight == 0) { + if(AssistUtils.equals(creatorWidth,0) || AssistUtils.equals(creatorHeight,0)){ return resolution; } double time = (areaHeight / creatorHeight) < (areaWidth / creatorWidth) ? (areaHeight / creatorHeight) : (areaWidth / creatorWidth); @@ -486,7 +487,7 @@ public class JWorkBook extends JTemplate { int row = reportPane.getSelection().getSelectedRows()[0]; double rowLength = reportPane.getSelection().getSelectedRows().length; double rowExtent = reportPane.getGrid().getVerticalExtent(); - if (columnLength == 0 || rowLength == 0) { + if(AssistUtils.equals(columnLength,0) || AssistUtils.equals(rowLength,0)){ return resolution; } double time = (columnExtent / columnLength) < (rowExtent / rowLength) ? (columnExtent / columnLength) : (rowExtent / rowLength); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/SheetAuthorityEditPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/SheetAuthorityEditPane.java index e3a9ff86db..f559c828fc 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/SheetAuthorityEditPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/SheetAuthorityEditPane.java @@ -13,6 +13,7 @@ import com.fr.general.ComparatorUtils; import com.fr.main.impl.WorkBook; import com.fr.privilege.finegrain.WorkSheetPrivilegeControl; import com.fr.report.worksheet.WorkSheet; +import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; @@ -115,7 +116,7 @@ public class SheetAuthorityEditPane extends AuthorityEditPane { populateName(); populateType(); checkPane.removeAll(); - if (name.getText() == "") { + if (StringUtils.isEmpty(name.getText())){ return; } checkPane.add(populateCheckPane(), BorderLayout.CENTER); From 08f98ea0f2bc5f0be43bb2ece31993d182837446 Mon Sep 17 00:00:00 2001 From: author Date: Wed, 11 Sep 2019 10:55:01 +0800 Subject: [PATCH 25/29] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=EF=BC=8Cs?= =?UTF-8?q?onar=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/FormArea.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java index b42d1b41ef..991240b9c0 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java @@ -23,6 +23,7 @@ import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.main.mobile.FormMobileAttr; import com.fr.form.ui.container.WBorderLayout; import com.fr.general.FRScreen; +import com.fr.stable.AssistUtils; import javax.swing.JComponent; @@ -226,7 +227,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent { // slidePane.populateBean(screenValue); if (root.acceptType(XWFitLayout.class)) { XWFitLayout layout = (XWFitLayout) root; - if (screenValue != DEFAULT_SLIDER) { + if ( !AssistUtils.equals(screenValue, DEFAULT_SLIDER) ) { reCalculateRoot(screenValue, true); } else { // 组件间隔啊 @@ -354,7 +355,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent { // double value = slidePane.updateBean(); //重置滑块的值为默认值100 START_VALUE = DEFAULT_SLIDER; - if (screenValue == DEFAULT_SLIDER) { + if ( AssistUtils.equals(screenValue, DEFAULT_SLIDER) ) { layout.getParent().setSize(width, height + designer.getParaHeight()); FormArea.this.validate(); } else { @@ -370,7 +371,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent { * @param value */ private void reCalculateRoot(double value, boolean needCalculateParaHeight) { - if (value == START_VALUE) { + if ( AssistUtils.equals(value, START_VALUE) ) { return; } double percent = (value - START_VALUE) / START_VALUE; @@ -734,15 +735,15 @@ public class FormArea extends JComponent implements ScrollRulerComponent { this.horicalMax = (int) totalSize.getHeight(); // 撤销时会refreshRoot,导致layout大小变为默认大小 // 按照之前设置的宽高和百分比重置下容器size - if (width != widthPane.getValue()) { + if ( !AssistUtils.equals(width, widthPane.getValue()) ) { widthPane.setValue(width); reCalculateWidth((int) width); } - if (height != heightPane.getValue()) { + if ( !AssistUtils.equals(height, heightPane.getValue()) ) { heightPane.setValue(height); reCalculateHeight((int) height); } - if (designer.getRootComponent().acceptType(XWFitLayout.class) && slide == DEFAULT_SLIDER) { + if (designer.getRootComponent().acceptType(XWFitLayout.class) && AssistUtils.equals(slide, DEFAULT_SLIDER) ) { XWFitLayout layout = (XWFitLayout) designer.getRootComponent(); // 撤销时先refreshRoot了,此处去掉内边距再增加间隔 layout.moveContainerMargin(); @@ -817,6 +818,9 @@ public class FormArea extends JComponent implements ScrollRulerComponent { Rectangle rec = new Rectangle(left + (right - DESIGNERWIDTH) / 2, TOPGAP, right, bottom); //是否为表单 if (isValid) { + if (hbarPreferredSize == null) { + throw new IllegalArgumentException("hbarPreferredSize can not be null!"); + } int maxHeight = bottom - hbarPreferredSize.height - resize.height - TOPGAP * 2; int maxWidth = right - vbarPreferredSize.width; DESIGNERWIDTH = DESIGNERWIDTH > maxWidth ? maxWidth : DESIGNERWIDTH; From c45dca28b587d89bb53843f84a5de3e1788b643e Mon Sep 17 00:00:00 2001 From: richie Date: Wed, 11 Sep 2019 11:55:38 +0800 Subject: [PATCH 26/29] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E4=B8=BA=E4=BA=86=E8=83=BD=E6=8F=90=E4=BE=9BSDK=E5=81=9A?= =?UTF-8?q?=E7=9A=84=E6=8E=A7=E4=BB=B6=E7=BB=93=E6=9E=84=E4=BF=AE=E6=94=B9?= =?UTF-8?q?(=E7=BB=AD)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/designer/creator/XCheckBox.java | 95 +++++++++---------- .../design/designer/creator/XDateEditor.java | 9 +- .../fr/design/gui/xpane/ToolTipEditor.java | 4 +- .../mainframe/FormDesignerDropTarget.java | 24 +++-- .../component/FormWidgetValuePane.java | 10 +- 5 files changed, 71 insertions(+), 71 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCheckBox.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCheckBox.java index ab74ccd984..da9b7c9552 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCheckBox.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCheckBox.java @@ -7,13 +7,12 @@ import com.fr.design.form.util.XCreatorConstants; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.mainframe.widget.editors.WidgetValueEditor; import com.fr.form.ui.CheckBox; -import com.fr.form.ui.WidgetValue; +import com.fr.form.ui.concept.data.ValueInitializer; import com.fr.stable.ArrayUtils; import com.fr.stable.core.PropertyChangeAdapter; -import javax.swing.BorderFactory; -import javax.swing.JComponent; -import java.awt.Dimension; +import javax.swing.*; +import java.awt.*; import java.beans.IntrospectionException; /** @@ -21,72 +20,72 @@ import java.beans.IntrospectionException; * @since 6.5.3 */ public class XCheckBox extends XWidgetCreator { - + public XCheckBox(CheckBox widget, Dimension initSize) { super(widget, initSize); } @Override - public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), new CRPropertyDescriptor[] { - new CRPropertyDescriptor("text", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Text")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") - .setPropertyChangeListener(new PropertyChangeAdapter() { + public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { + return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), new CRPropertyDescriptor[]{ + new CRPropertyDescriptor("text", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Text")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") + .setPropertyChangeListener(new PropertyChangeAdapter() { - @Override - public void propertyChange() { - ((UICheckBox) editor).setText(((CheckBox) data).getText()); - } - }), - new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Value")).setEditorClass(WidgetValueEditor.class) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") - .setPropertyChangeListener(new PropertyChangeAdapter() { + @Override + public void propertyChange() { + ((UICheckBox) editor).setText(((CheckBox) data).getText()); + } + }), + new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Value")).setEditorClass(WidgetValueEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") + .setPropertyChangeListener(new PropertyChangeAdapter() { - @Override - public void propertyChange() { - WidgetValue value = ((CheckBox) data).getWidgetValue(); - if (value != null && value.getValue() instanceof Boolean) { - ((UICheckBox) editor).setSelected((Boolean) value.getValue()); - } - } - }), - new CRPropertyDescriptor("fontSize", this.data.getClass(), "getFontSize", "setFontSize") - .setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Font_Size")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") - }); - } + @Override + public void propertyChange() { + ValueInitializer value = ((CheckBox) data).getWidgetValue(); + if (value != null && value.getValue() instanceof Boolean) { + ((UICheckBox) editor).setSelected((Boolean) value.getValue()); + } + } + }), + new CRPropertyDescriptor("fontSize", this.data.getClass(), "getFontSize", "setFontSize") + .setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Font_Size")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") + }); + } @Override protected JComponent initEditor() { if (editor == null) { editor = new UICheckBox(); - editor.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); + editor.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); } return editor; } @Override protected void initXCreatorProperties() { - super.initXCreatorProperties(); - UICheckBox jCheckBox = (UICheckBox) editor; - CheckBox check = (CheckBox) data; - jCheckBox.setText(check.getText()); - if (check.getWidgetValue() != null && check.getWidgetValue().getValue() instanceof Boolean) { - jCheckBox.setSelected((Boolean) check.getWidgetValue().getValue()); - } - } + super.initXCreatorProperties(); + UICheckBox jCheckBox = (UICheckBox) editor; + CheckBox check = (CheckBox) data; + jCheckBox.setText(check.getText()); + if (check.getWidgetValue() != null && check.getWidgetValue().getValue() instanceof Boolean) { + jCheckBox.setSelected((Boolean) check.getWidgetValue().getValue()); + } + } @Override protected String getIconName() { return "check_box_16.png"; } - public void firePropertyChange(){ - ((UICheckBox) editor).setText(((CheckBox) data).getText()); - WidgetValue value = ((CheckBox) data).getWidgetValue(); - if (value != null && value.getValue() instanceof Boolean) { - ((UICheckBox) editor).setSelected((Boolean) value.getValue()); - } - } + public void firePropertyChange() { + ((UICheckBox) editor).setText(((CheckBox) data).getText()); + ValueInitializer value = ((CheckBox) data).getWidgetValue(); + if (value != null && value.getValue() instanceof Boolean) { + ((UICheckBox) editor).setSelected((Boolean) value.getValue()); + } + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XDateEditor.java b/designer-form/src/main/java/com/fr/design/designer/creator/XDateEditor.java index c6ec47a3bc..38da20da62 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XDateEditor.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XDateEditor.java @@ -12,15 +12,14 @@ import com.fr.design.mainframe.widget.editors.WidgetValueEditor; import com.fr.design.mainframe.widget.renderer.DateCellRenderer; import com.fr.form.ui.DateEditor; import com.fr.form.ui.WidgetValue; +import com.fr.form.ui.concept.data.ValueInitializer; import com.fr.general.DateUtils; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; import com.fr.stable.core.PropertyChangeAdapter; -import javax.swing.JComponent; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; +import javax.swing.*; +import java.awt.*; import java.beans.IntrospectionException; import java.util.Date; @@ -84,7 +83,7 @@ public class XDateEditor extends XDirectWriteEditor { private void initFieldText() { DateEditor dateEditor = (DateEditor) data; if (dateEditor.getWidgetValue() != null) { - WidgetValue widgetValue = dateEditor.getWidgetValue(); + ValueInitializer widgetValue = dateEditor.getWidgetValue(); //控件值.toString String valueStr = widgetValue.toString(); //控件值 diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/ToolTipEditor.java b/designer-form/src/main/java/com/fr/design/gui/xpane/ToolTipEditor.java index 91bfbf0b09..e2a78e7d2e 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/ToolTipEditor.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/ToolTipEditor.java @@ -15,7 +15,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.ui.DataControl; import com.fr.form.ui.EditorHolder; import com.fr.form.ui.Widget; -import com.fr.form.ui.WidgetValue; +import com.fr.form.ui.WidgetValueUtils; import com.fr.general.Background; import com.fr.general.GeneralContext; import com.fr.plugin.context.PluginContext; @@ -77,7 +77,7 @@ public class ToolTipEditor extends JWindow { createWidget.setWidgetName(widget.getWidgetName()); createWidget.setEnabled(widget.isEnabled()); createWidget.setVisible(widget.isVisible()); - WidgetValue.convertWidgetValue((DataControl) createWidget, widget.getWidgetValue().getValue()); + WidgetValueUtils.convertWidgetValue((DataControl) createWidget, widget.getWidgetValue().getValue()); XCreator creator = null; creator = parent.replace(createWidget, holder); Component designer = holder.getDesignerEditor().getEditorTarget().getParent(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerDropTarget.java index 4e7ea5ae6c..f7faf9d60a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerDropTarget.java @@ -6,10 +6,11 @@ import com.fr.form.ui.DataControl; import com.fr.form.ui.IframeEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.WidgetValue; +import com.fr.form.ui.concept.data.ValueInitializer; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; -import java.awt.Point; +import java.awt.*; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; @@ -31,7 +32,8 @@ public class FormDesignerDropTarget extends DropTargetAdapter { /** * 响应拖拽进入事件 - * @param dtde 需要被处理的拖拽事件 + * + * @param dtde 需要被处理的拖拽事件 */ public void dragEnter(DropTargetDragEvent dtde) { dtde.acceptDrag(dtde.getDropAction()); @@ -39,6 +41,7 @@ public class FormDesignerDropTarget extends DropTargetAdapter { /** * 处理拖拽经过事件 + * * @param dtde 需要被处理的拖拽事件 */ public void dragOver(DropTargetDragEvent dtde) { @@ -52,7 +55,8 @@ public class FormDesignerDropTarget extends DropTargetAdapter { /** * 处理拖拽释放事件 - * @param dtde 需要被处理的拖拽事件 + * + * @param dtde 需要被处理的拖拽事件 */ public void drop(DropTargetDropEvent dtde) { Transferable tr = dtde.getTransferable(); @@ -75,22 +79,16 @@ public class FormDesignerDropTarget extends DropTargetAdapter { if (!(widget instanceof DataControl)) { return; } - WidgetValue oldvalue = ((DataControl) widget).getWidgetValue(); - WidgetValue newValue = new WidgetValue(new DataBinding((String[][]) o)); - if (!ComparatorUtils.equals(oldvalue, newValue)) { + ValueInitializer oldValue = ((DataControl) widget).getWidgetValue(); + ValueInitializer newValue = new WidgetValue(new DataBinding((String[][]) o)); + if (!ComparatorUtils.equals(oldValue, newValue)) { ((DataControl) widget).setWidgetValue(newValue); designer.fireTargetModified(); } creator.rebuid(); designer.getSelectionModel().setSelectedCreator(creator); - } catch (UnsupportedFlavorException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } catch (IOException e) { + } catch (UnsupportedFlavorException | IOException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } - - private void setSrcForIframeEditor() { - - } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/FormWidgetValuePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/FormWidgetValuePane.java index cdf8c28f2b..6943085ecf 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/FormWidgetValuePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/FormWidgetValuePane.java @@ -1,7 +1,11 @@ package com.fr.design.widget.ui.designer.component; import com.fr.design.constants.LayoutConstants; -import com.fr.design.editor.editor.*; +import com.fr.design.editor.editor.BooleanEditor; +import com.fr.design.editor.editor.DateEditor; +import com.fr.design.editor.editor.DoubleEditor; +import com.fr.design.editor.editor.Editor; +import com.fr.design.editor.editor.FormulaEditor; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.mainframe.widget.editors.DataBindingEditor; import com.fr.design.mainframe.widget.editors.DataTableEditor; @@ -9,9 +13,9 @@ import com.fr.design.mainframe.widget.editors.ServerDataBindingEditor; import com.fr.design.mainframe.widget.editors.ServerDataTableEditor; import com.fr.form.ui.DataControl; import com.fr.form.ui.WidgetValue; +import com.fr.form.ui.concept.data.ValueInitializer; import com.fr.general.ComparatorUtils; - import javax.swing.*; import java.awt.*; @@ -112,7 +116,7 @@ public class FormWidgetValuePane extends JPanel { } public void populate(DataControl ob) { - WidgetValue widgetValue = ob.getWidgetValue(); + ValueInitializer widgetValue = ob.getWidgetValue(); if (widgetValue != null) { for (int i = 0; i < editor.length; i++) { if (editor[i].accept(widgetValue.getValue())) { From b36f0f8bfe387b604d8a09f874dbee9a37d3a627 Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Thu, 12 Sep 2019 09:22:44 +0800 Subject: [PATCH 27/29] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=EF=BC=8Cs?= =?UTF-8?q?onar=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/layout/TableLayout.java | 13 ++++++------- .../mainframe/vcs/ui/FileVersionCellEditor.java | 3 ++- .../mainframe/vcs/ui/FileVersionCellRender.java | 3 ++- .../style/background/gradient/GradientBar.java | 3 ++- .../java/com/fr/design/utils/gui/GUICoreUtils.java | 9 +++++---- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/layout/TableLayout.java b/designer-base/src/main/java/com/fr/design/layout/TableLayout.java index 961d3e23e3..f8134be1fd 100644 --- a/designer-base/src/main/java/com/fr/design/layout/TableLayout.java +++ b/designer-base/src/main/java/com/fr/design/layout/TableLayout.java @@ -322,7 +322,6 @@ public class TableLayout implements LayoutManager2, Serializable { this row/column. */ public static final double MINIMUM = -3.0; - public static final double EPSILON = 0.0000001; //****************************************************************************** //** Constructors *** @@ -1808,8 +1807,8 @@ public class TableLayout implements LayoutManager2, Serializable { for (counter = entry.cr1[z]; counter <= entry.cr2[z]; counter++) if (crSpec[z][counter] >= 1.0) scalableSize -= crSpec[z][counter]; - else if (Math.abs(crSpec[z][counter] - PREFERRED) < EPSILON || - Math.abs(crSpec[z][counter] - MINIMUM) < EPSILON) { + else if (AssistUtils.equals(crSpec[z][counter], PREFERRED) || + AssistUtils.equals(crSpec[z][counter], MINIMUM)) { scalableSize -= crPrefMin[counter]; } @@ -1825,13 +1824,13 @@ public class TableLayout implements LayoutManager2, Serializable { // Add scaled size to relativeWidth relativeSize += crSpec[z][counter]; // Cr is fill - else if (Math.abs(crSpec[z][counter] - FILL) < EPSILON && Math.abs(fillSizeRatio - 0.0) >= EPSILON) + else if (AssistUtils.equals(crSpec[z][counter], FILL) && !AssistUtils.equals(fillSizeRatio, 0.0)) // Add fill size to relativeWidth relativeSize += fillSizeRatio; } // Determine the total scaled size as estimated by this component - if (Math.abs(relativeSize - 0) < EPSILON) + if (AssistUtils.equals(relativeSize, 0)) temp = 0; else temp = (int) (scalableSize / relativeSize + 0.5); @@ -1852,8 +1851,8 @@ public class TableLayout implements LayoutManager2, Serializable { if (crSpec[z][counter] >= 1.0) totalSize += (int) (crSpec[z][counter] + 0.5); // Is the current cr a preferred/minimum size - else if (Math.abs(crSpec[z][counter] - PREFERRED) < EPSILON|| - Math.abs(crSpec[z][counter] - MINIMUM) < EPSILON) { + else if (AssistUtils.equals(crSpec[z][counter], PREFERRED) || + AssistUtils.equals(crSpec[z][counter], MINIMUM)) { // Add preferred/minimum width totalSize += crPrefMin[counter]; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java index 125d4bc4e0..bf5b8ba45b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java @@ -10,6 +10,7 @@ import com.fr.design.mainframe.vcs.common.VcsCacheFileNodeFile; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; import com.fr.report.entity.VcsEntity; +import com.fr.stable.AssistUtils; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.server.vcs.VcsOperator; @@ -67,7 +68,7 @@ public class FileVersionCellEditor extends AbstractCellEditor implements TableCe } double height = editor.getPreferredSize().getHeight(); - if (table.getRowHeight(row) != height) { + if (!AssistUtils.equals(table.getRowHeight(row), height)) { table.setRowHeight(row, (int) height + VcsHelper.OFFSET); } return editor; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java index 40fa02c1fe..d97e1efb1b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe.vcs.ui; import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.report.entity.VcsEntity; +import com.fr.stable.AssistUtils; import javax.swing.JPanel; import javax.swing.JTable; @@ -34,7 +35,7 @@ public class FileVersionCellRender implements TableCellRenderer { editor.setBackground(isSelected ? TABLE_SELECT_BACKGROUND : TREE_BACKGROUND); double height = editor.getPreferredSize().getHeight(); - if (table.getRowHeight(row) != height) { + if (!AssistUtils.equals(table.getRowHeight(row), height)) { table.setRowHeight(row, (int) height + VcsHelper.OFFSET); } return editor; diff --git a/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java b/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java index 2ce1a0bc3a..b197a3d396 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java +++ b/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java @@ -29,6 +29,7 @@ import com.fr.design.style.color.ColorSelectConfigManager; import com.fr.design.style.color.ColorSelectDetailPane; import com.fr.design.style.color.ColorSelectDialog; import com.fr.design.style.color.ColorSelectable; +import com.fr.stable.AssistUtils; /** * TODO:面板缩放的功能没有考虑(就是尾值过大,导致超过界面显示的情况),原来的那个实现完全是个BUG。要缩放的情况也比较少,就干脆以后弄吧 @@ -217,7 +218,7 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl * @return 同上 */ public boolean isOriginalPlace() { - return startLabel.getValue() == min && endLabel.getValue() == max; + return AssistUtils.equals(startLabel.getValue(), min) && AssistUtils.equals(endLabel.getValue(), max); } /** diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java index c8c0561c90..c306375096 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java @@ -31,6 +31,7 @@ import com.fr.design.style.color.ColorFactory; import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectable; import com.fr.general.FRFont; +import com.fr.stable.AssistUtils; import com.fr.stable.Constants; import com.fr.stable.OperatingSystem; import com.fr.stable.StringUtils; @@ -890,10 +891,10 @@ public final class GUICoreUtils { * @return 同上 */ public static boolean isTheSameRect(Rectangle oneRect, Rectangle otherRect) { - return oneRect.getX() == otherRect.getX() - && oneRect.getY() == otherRect.getY() - && oneRect.getWidth() == otherRect.getWidth() - && oneRect.getHeight() == otherRect.getHeight(); + return AssistUtils.equals(oneRect.getX(), otherRect.getX()) + && AssistUtils.equals(oneRect.getY(), otherRect.getY()) + && AssistUtils.equals(oneRect.getWidth(), otherRect.getWidth()) + && AssistUtils.equals(oneRect.getHeight(), otherRect.getHeight()); } /** From 0b7a73d83288966ab43abe8b7c11ea5526303408 Mon Sep 17 00:00:00 2001 From: pengda Date: Thu, 12 Sep 2019 10:53:33 +0800 Subject: [PATCH 28/29] =?UTF-8?q?sonar=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?,=E6=97=A0jira=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/cell/settingpane/CellStylePane.java | 3 ++- .../mainframe/form/FormReportComponentComposite.java | 3 ++- .../com/fr/grid/AbstractGridHeaderMouseHandler.java | 12 +++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java index 1487908e77..3706778609 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java @@ -102,7 +102,8 @@ public class CellStylePane extends AbstractCellAttrPane { } Style style = cellElement.getStyle(); if (style == null) { - style = style.DEFAULT_STYLE; + style = Style.DEFAULT_STYLE; + } style = stylePane.updateStyle(style); cellElement.setStyle(style); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java index 17f4bf348f..a31dea5b30 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java @@ -19,6 +19,7 @@ import com.fr.grid.Grid; import com.fr.grid.GridUtils; import com.fr.report.ReportHelper; import com.fr.report.worksheet.FormElementCase; +import com.fr.stable.AssistUtils; import javax.swing.*; import javax.swing.event.ChangeEvent; @@ -128,7 +129,7 @@ public class FormReportComponentComposite extends JComponent implements TargetMo int row = reportPane.getSelection().getSelectedRows()[0]; double rowLength = reportPane.getSelection().getSelectedRows().length; double rowExtent = reportPane.getGrid().getVerticalExtent(); - if (columnLength == 0 || rowLength == 0) { + if (AssistUtils.equals(columnLength, 0d) || AssistUtils.equals(rowLength, 0d)) { return ScreenResolution.getScreenResolution(); } double time = (columnExtent / columnLength) < (rowExtent / rowLength) ? (columnExtent / columnLength) : (rowExtent / rowLength); diff --git a/designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java b/designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java index 6c9363b9fc..3873ae2e7f 100644 --- a/designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java +++ b/designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java @@ -112,14 +112,18 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter { if (between(evt, tmpSize1, tmpSize2)) { if (index >= dragIndex) { try { - method.invoke(report, dragIndex, FU.valueOfPix(evtOffset(evt, oldEndValueSize), resolution)); + if(method != null) { + method.invoke(report, dragIndex, FU.valueOfPix(evtOffset(evt, oldEndValueSize), resolution)); + } } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } //sizeList.set(dragIndex, FU.valueOfPix(evtOffset(evt, oldEndValueSize), resolution)); } else { try { - method.invoke(report, index, FU.valueOfPix(evtOffset(evt, (int) tmpSize1), resolution)); + if(method != null) { + method.invoke(report, index, FU.valueOfPix(evtOffset(evt, (int) tmpSize1), resolution)); + } } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -127,7 +131,9 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter { // from all to do. for (int h = (dragIndex - 1); h > index; h--) { try { - method.invoke(report, h, UNIT.ZERO); + if(method != null) { + method.invoke(report, h, UNIT.ZERO); + } } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } From 4f6f05beccafcadf7b6128c8e168440c3ab7dbdf Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Thu, 12 Sep 2019 15:18:21 +0800 Subject: [PATCH 29/29] =?UTF-8?q?REPORT-21800=20=E6=B0=B4=E5=8D=B0?= =?UTF-8?q?=E5=AF=86=E5=BA=A6=E6=A1=86=E6=9C=80=E5=B0=8F=E9=99=90=E5=88=B6?= =?UTF-8?q?=E6=9C=89=E9=97=AE=E9=A2=98=EF=BC=8C=E5=88=A0=E6=8E=89=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E8=BE=93=E5=85=A5=E7=9A=84=E8=AF=9D=EF=BC=8C=E5=B0=B1?= =?UTF-8?q?=E6=98=AF=E5=B0=8F=E4=BA=8E100=EF=BC=8C=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=89=8B=E5=8A=A8=E8=BE=93=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/ispinner/UnsignedIntUISpinner.java | 43 ++++++++++++++++++- .../gui/itextfield/UIIntNumberField.java | 26 ++++++++--- 2 files changed, 61 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/ispinner/UnsignedIntUISpinner.java b/designer-base/src/main/java/com/fr/design/gui/ispinner/UnsignedIntUISpinner.java index 0a04eabf55..1515477a3d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ispinner/UnsignedIntUISpinner.java +++ b/designer-base/src/main/java/com/fr/design/gui/ispinner/UnsignedIntUISpinner.java @@ -3,6 +3,9 @@ package com.fr.design.gui.ispinner; import com.fr.design.gui.itextfield.UIIntNumberField; import com.fr.design.gui.itextfield.UINumberField; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; + /** * Created by IntelliJ IDEA. * Author : Hugh.C @@ -11,21 +14,59 @@ import com.fr.design.gui.itextfield.UINumberField; */ public class UnsignedIntUISpinner extends UISpinner { + private double minValue; + private double maxValue; public UnsignedIntUISpinner(double minValue, double maxValue, double dierta) { super(minValue, maxValue, dierta); + this.minValue = minValue; + this.maxValue = maxValue; } public UnsignedIntUISpinner(double minValue, double maxValue, double dierta, double defaultValue) { super(minValue, maxValue, dierta, defaultValue); + this.minValue = minValue; + this.maxValue = maxValue; } @Override protected UINumberField initNumberField() { - return new UIIntNumberField() { + final UIIntNumberField numberField = new UIIntNumberField() { public boolean shouldResponseChangeListener() { return false; } + + public NumberDocument createNumberDocument() { + return new NumberDocument() { + public boolean isContinueInsertWhenOverMaxOrMinValue() { + return true; + } + }; + } }; + numberField.addFocusListener(new FocusListener() { + @Override + public void focusGained(FocusEvent e) { + + } + + /** + * 失去焦点后再做范围限制、不然最小值为 100 时,输个 1 都不让.... + * @param e + */ + @Override + public void focusLost(FocusEvent e) { + double value = numberField.getValue(); + if (!isOverMaxOrMinValue(value)) { + return; + } + numberField.setValue(value < minValue ? minValue : maxValue); + } + + private boolean isOverMaxOrMinValue(double value) { + return value < minValue || value > maxValue; + } + }); + return numberField; } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/UIIntNumberField.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/UIIntNumberField.java index 59e5e8825e..37b1e74e4a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itextfield/UIIntNumberField.java +++ b/designer-base/src/main/java/com/fr/design/gui/itextfield/UIIntNumberField.java @@ -1,11 +1,10 @@ package com.fr.design.gui.itextfield; -import com.fr.design.gui.itextfield.UINumberField; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.PlainDocument; -import java.awt.*; +import java.awt.Toolkit; /** * Created with IntelliJ IDEA. @@ -15,11 +14,11 @@ import java.awt.*; * To change this template use File | Settings | File Templates. */ public class UIIntNumberField extends UINumberField { - public void setFieldDocument(){ - setDocument(new NumberDocument()); + public void setFieldDocument() { + setDocument(createNumberDocument()); } - class NumberDocument extends PlainDocument { + public class NumberDocument extends PlainDocument { public NumberDocument() { } @@ -33,17 +32,30 @@ public class UIIntNumberField extends UINumberField { String strNew = str.substring(0, offset) + s + str.substring(offset, getLength()); - if (isOverMaxOrMinValue(strNew)) { + if (isOverMaxOrMinValue(strNew) && !isContinueInsertWhenOverMaxOrMinValue()) { Toolkit.getDefaultToolkit().beep(); return; } - setisContentChanged(true); + setisContentChanged(true); super.insertString(offset, s, a); } + /** + * 是否继续插入输入的字符 - 当超出范围时 + * + * @return true : 继续插入输入的字符 + */ + public boolean isContinueInsertWhenOverMaxOrMinValue() { + return false; + } + private boolean isOverMaxOrMinValue( String strNew) { return (Double.parseDouble(strNew)getMaxValue()); } } + + public NumberDocument createNumberDocument() { + return new NumberDocument(); + } } \ No newline at end of file