From 5114201a35b2eb23a98e9e1d59d88cb7ed2de28f Mon Sep 17 00:00:00 2001 From: zheng Date: Wed, 28 Aug 2019 17:49:49 +0800 Subject: [PATCH 001/150] =?UTF-8?q?CHART-10225=20=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E7=BC=A9=E6=94=BE=20=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bar/BarIndependentVanChartInterface.java | 15 +- .../BubbleIndependentVanChartInterface.java | 9 +- .../bubble/VanChartBubbleInteractivePane.java | 29 --- .../chart/bubble/VanChartBubblePlotPane.java | 6 +- .../other/VanChartInteractivePane.java | 173 ++------------ .../VanChartInteractivePaneWithMapZoom.java | 14 +- .../designer/other/zoom/MapZoomPane.java | 47 ++++ .../chart/designer/other/zoom/ZoomPane.java | 224 ++++++++++++++++++ .../other/zoom/ZoomPaneWithOutMode.java | 17 ++ .../type/AbstractVanChartTypePane.java | 4 +- .../ScatterIndependentVanChartInterface.java | 8 +- ...StructureIndependentVanChartInterface.java | 15 +- .../AbstractMultiCategoryVanChartUI.java | 26 ++ ...WordCloudIndependentVanChartInterface.java | 13 +- 14 files changed, 376 insertions(+), 224 deletions(-) delete mode 100644 designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleInteractivePane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/MapZoomPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPaneWithOutMode.java 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..3a6dbf807e 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 @@ -1,5 +1,6 @@ package com.fr.van.chart.bar; +import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.condition.ConditionAttributesPane; @@ -9,7 +10,9 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.van.chart.column.VanChartColumnConditionPane; import com.fr.van.chart.column.VanChartColumnSeriesPane; +import com.fr.van.chart.designer.other.VanChartInteractivePane; import com.fr.van.chart.designer.other.VanChartOtherPane; +import com.fr.van.chart.designer.other.zoom.ZoomPane; import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.vanchart.AbstractMultiCategoryVanChartUI; @@ -41,7 +44,17 @@ public class BarIndependentVanChartInterface extends AbstractMultiCategoryVanCha */ public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ VanChartStylePane stylePane = new VanChartBarStylePane(listener); - VanChartOtherPane otherPane = new VanChartOtherPane(); + VanChartOtherPane otherPane = new VanChartOtherPane() { + @Override + protected BasicBeanPane createInteractivePane() { + return new VanChartInteractivePane() { + @Override + protected ZoomPane createZoomPane() { + return new ZoomPane(); + } + }; + } + }; return new AbstractChartAttrPane[]{stylePane, otherPane}; } 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..107734af5a 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 @@ -14,7 +14,9 @@ import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.plugin.chart.bubble.VanChartBubblePlot; import com.fr.van.chart.bubble.data.VanChartBubblePlotTableDataContentPane; +import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; import com.fr.van.chart.designer.other.VanChartOtherPane; +import com.fr.van.chart.designer.other.zoom.ZoomPane; import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; @@ -70,7 +72,12 @@ public class BubbleIndependentVanChartInterface extends AbstractIndependentVanCh VanChartStylePane stylePane = new VanChartBubbleStylePane(listener); VanChartOtherPane otherPane = new VanChartOtherPane(){ protected BasicBeanPane createInteractivePane() { - return new VanChartBubbleInteractivePane(); + return new VanChartInteractivePaneWithOutSort() { + @Override + protected ZoomPane createZoomPane() { + return new ZoomPane(); + } + }; } }; return new AbstractChartAttrPane[]{stylePane, otherPane}; diff --git a/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleInteractivePane.java deleted file mode 100644 index 7dad3847a0..0000000000 --- a/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleInteractivePane.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.fr.van.chart.bubble; - -import com.fr.chart.chartattr.Plot; - -import com.fr.plugin.chart.base.VanChartConstants; -import com.fr.plugin.chart.bubble.VanChartBubblePlot; -import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; - -/** - * Created by Mitisky on 16/3/31. - */ -public class VanChartBubbleInteractivePane extends VanChartInteractivePaneWithOutSort { - protected String[] getNameArray() { - Plot plot = chart.getPlot(); - if(plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble()) { - return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_XY_Axis"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")}; - } - return super.getNameArray(); - } - - protected String[] getValueArray() { - Plot plot = chart.getPlot(); - if(plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble()) { - return new String[]{VanChartConstants.ZOOM_TYPE_XY, VanChartConstants.ZOOM_TYPE_NONE}; - } - return super.getValueArray(); - } - -} 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..f8fbd2a274 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 @@ -6,10 +6,9 @@ import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionCollection; +import com.fr.chartx.attr.ZoomAttribute; 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; import com.fr.plugin.chart.bubble.VanChartBubblePlot; import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel; @@ -145,8 +144,7 @@ public class VanChartBubblePlotPane extends AbstractVanChartTypePane { */ @Override protected void resetChartAttr4SamePlot(Chart chart){ - VanChartZoom vanChartZoom = new VanChartZoom(); - ((VanChart)chart).setVanChartZoom(vanChartZoom); + ((VanChart) chart).setZoomAttribute(new ZoomAttribute()); //重置监控刷新选项 resetRefreshMoreLabelAttr((VanChart)chart); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java index 664b3d8cf6..ee7dff9dc5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java @@ -1,40 +1,28 @@ package com.fr.van.chart.designer.other; -import com.fr.base.BaseFormula; -import com.fr.base.Utils; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; -import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; - import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; import com.fr.plugin.chart.axis.type.AxisPlotType; import com.fr.plugin.chart.base.RefreshMoreLabel; -import com.fr.plugin.chart.base.VanChartConstants; import com.fr.plugin.chart.base.VanChartTools; -import com.fr.plugin.chart.base.VanChartZoom; import com.fr.plugin.chart.vanchart.VanChart; -import com.fr.stable.StableUtils; import com.fr.van.chart.custom.component.VanChartHyperLinkPane; import com.fr.van.chart.designer.AbstractVanChartScrollPane; import com.fr.van.chart.designer.PlotFactory; import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.other.zoom.ZoomPane; -import javax.swing.BorderFactory; import javax.swing.JPanel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import java.awt.BorderLayout; import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; public class VanChartInteractivePane extends AbstractVanChartScrollPane { @@ -53,14 +41,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { private AutoRefreshPane autoRefreshPane; - private UIButtonGroup zoomWidget; - protected UIButtonGroup zoomGesture;//地图手势缩放 - private UIButtonGroup zoomResize; - private TinyFormulaPane from; - private TinyFormulaPane to; - private UIButtonGroup zoomType; - private JPanel changeEnablePane; - private JPanel zoomTypePane; + private ZoomPane zoomPane; protected VanChartHyperLinkPane superLink; @@ -111,54 +92,15 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { } protected JPanel createZoomPane(double[] row, double[] col, VanChartPlot plot) { - if (!plot.isSupportZoomDirection()) { + zoomPane = createZoomPane(); + if (zoomPane == null) { return null; } - zoomWidget = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); - zoomResize = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Change"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Non_Adjustment")}); - from = new TinyFormulaPane(); - to = new TinyFormulaPane(); - zoomType = new UIButtonGroup(getNameArray(), getValueArray()); - zoomGesture = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); - - JPanel zoomWidgetPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Zoom_Widget"), zoomWidget); - JPanel zoomGesturePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_ZoomGesture"), zoomGesture); - - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Boundary")), zoomResize}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_From")), from}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_To")), to}, - }; - - double f = TableLayout.FILL; - double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; - double[] columnSize = {f, e}; - changeEnablePane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, columnSize); - changeEnablePane.setBorder(BorderFactory.createEmptyBorder(10,12,0,0)); - zoomTypePane = getzoomTypePane(zoomType); - JPanel panel = createZoomPaneContent(zoomWidgetPane, zoomGesturePane, changeEnablePane, zoomTypePane, plot); - zoomWidget.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - checkZoomPane(); - } - }); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Zoom"), panel); - } - - - protected JPanel getzoomTypePane(UIButtonGroup zoomType) { - return TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Zoom_Direction"), zoomType); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Zoom"), zoomPane); } - protected JPanel createZoomPaneContent(JPanel zoomWidgetPane, JPanel zoomGesturePane, JPanel changeEnablePane, JPanel zoomTypePane, VanChartPlot plot) { - JPanel panel = new JPanel(new BorderLayout(0, 4)); - if (plot.isSupportZoomCategoryAxis()) {//支持缩放控件 - panel.add(zoomWidgetPane, BorderLayout.NORTH); - panel.add(changeEnablePane, BorderLayout.CENTER); - } - panel.add(zoomTypePane, BorderLayout.SOUTH); - return panel; + protected ZoomPane createZoomPane() { + return null; } private JPanel createAxisRotationPane(double[] row, double[] col, VanChartPlot plot){ @@ -167,12 +109,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { } axisRotation = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); - axisRotation.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - checkZoomEnabled(); - } - }); + Component[][] components = new Component[][]{ new Component[]{null,null}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Reversal")),axisRotation} @@ -181,28 +118,6 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis"), panel); } - private void checkZoomEnabled() { - if (zoomWidget != null && axisRotation != null) { - if (axisRotation.getSelectedIndex() == 0) { - //只有开启坐标轴翻转,才需要将缩放控件强制关闭。 - zoomWidget.setSelectedIndex(1); - } - checkZoomPane(); - zoomWidget.setEnabled(axisRotation.getSelectedIndex() == 1); - } - } - - - protected String[] getNameArray() { - return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_X_Axis"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Y_Axis") - ,com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_XY_Axis"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")}; - } - - protected String[] getValueArray() { - return new String[]{VanChartConstants.ZOOM_TYPE_X, VanChartConstants.ZOOM_TYPE_Y - ,VanChartConstants.ZOOM_TYPE_XY, VanChartConstants.ZOOM_TYPE_NONE}; - - } protected JPanel createToolBarPane(double[] row, double[] col){ isSort = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Sort")); @@ -263,27 +178,21 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { } - private void checkZoomPane() { - boolean zoomWidgetEnabled = zoomWidget.getSelectedIndex() == 0; - changeEnablePane.setVisible(zoomWidgetEnabled); - zoomType.setEnabled(!zoomWidgetEnabled); - } - @Override public void populateBean(Chart chart) { if (chart == null || chart.getPlot() == null) { return; } this.chart = chart; - VanChartPlot plot = (VanChartPlot)chart.getPlot(); + VanChartPlot plot = chart.getPlot(); if(interactivePane == null){ this.remove(leftcontentPane); reLayoutContentPane(plot); } - if(plot.isSupportZoomDirection()){//支持缩放方向=方向+控件 - populateChartZoom((VanChart)chart); - checkZoomPane(); + + if (zoomPane != null) { + zoomPane.populateBean(((VanChart) chart).getZoomAttribute()); } if (plot.getAxisPlotType() == AxisPlotType.RECTANGLE){ @@ -295,8 +204,6 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { populateAutoRefresh((VanChart)chart); populateHyperlink(plot); - - checkZoomEnabled(); } @@ -312,27 +219,6 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { collapse.setSelected(vanChartTools.isHidden()); } - private void populateChartZoom(VanChart chart) { - VanChartZoom zoom = chart.getVanChartZoom(); - if(zoom == null){ - zoom = new VanChartZoom(); - } - zoomWidget.setSelectedIndex(zoom.isZoomVisible() ? 0 : 1); - zoomGesture.setSelectedIndex(zoom.isZoomGesture() ? 0 : 1); - zoomResize.setSelectedIndex(zoom.isZoomResize() ? 0 : 1); - if (zoom.getFrom() instanceof BaseFormula) { - from.populateBean(((BaseFormula) zoom.getFrom()).getContent()); - } else { - from.populateBean(Utils.objectToString(zoom.getFrom())); - } - if (zoom.getTo() instanceof BaseFormula) { - to.populateBean(((BaseFormula) zoom.getTo()).getContent()); - } else { - to.populateBean(Utils.objectToString(zoom.getTo())); - } - zoomType.setSelectedItem(zoom.getZoomType()); - } - private void populateChartAxisRotation(VanChartPlot plot) { axisRotation.setSelectedIndex(plot.isAxisRotation() ? 0 : 1); } @@ -366,11 +252,12 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { return; } - VanChartPlot plot = (VanChartPlot)chart.getPlot(); + VanChartPlot plot = chart.getPlot(); - if(plot.isSupportZoomDirection()){ - updateChartZoom((VanChart)chart); + if (zoomPane != null) { + ((VanChart) chart).setZoomAttribute(zoomPane.updateBean()); } + if(plot.getAxisPlotType() == AxisPlotType.RECTANGLE){ updateChartAxisRotation((VanChart)chart); } @@ -393,34 +280,6 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { chart.setVanChartTools(vanChartTools); } - private void updateChartZoom(VanChart chart) { - VanChartZoom zoom = chart.getVanChartZoom(); - if(zoom == null){ - zoom = new VanChartZoom(); - chart.setVanChartZoom(zoom); - } - zoom.setZoomVisible(zoomWidget.getSelectedIndex() == 0); - zoom.setZoomGesture(zoomGesture.getSelectedIndex() == 0); - zoom.setZoomResize(zoomResize.getSelectedIndex() == 0); - String fromString = from.updateBean(); - Object fromObject; - if (StableUtils.maybeFormula(fromString)) { - fromObject = BaseFormula.createFormulaBuilder().build(fromString); - } else { - fromObject = fromString; - } - zoom.setFrom(fromObject); - String toString = to.updateBean(); - Object toObject; - if (StableUtils.maybeFormula(toString)) { - toObject = BaseFormula.createFormulaBuilder().build(toString); - } else { - toObject = toString; - } - zoom.setTo(toObject); - zoom.setZoomType(zoomType.getSelectedItem()); - } - private void updateChartAxisRotation(VanChart chart) { //坐标轴和plot都需要这个属性,因为坐标轴和plot是分开画的 VanChartPlot plot = (VanChartPlot) chart.getPlot(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePaneWithMapZoom.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePaneWithMapZoom.java index ec1ed0d9db..3b4352b7a2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePaneWithMapZoom.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePaneWithMapZoom.java @@ -1,19 +1,15 @@ package com.fr.van.chart.designer.other; -import com.fr.plugin.chart.attr.plot.VanChartPlot; - -import javax.swing.JPanel; -import java.awt.BorderLayout; +import com.fr.van.chart.designer.other.zoom.MapZoomPane; +import com.fr.van.chart.designer.other.zoom.ZoomPane; /** * Created by mengao on 2017/4/7. */ public class VanChartInteractivePaneWithMapZoom extends VanChartInteractivePaneWithOutSort { + @Override - protected JPanel createZoomPaneContent(JPanel zoomWidgetPane, JPanel zoomGesturePane, JPanel changeEnablePane, JPanel zoomTypePane, VanChartPlot plot) { - JPanel panel = new JPanel(new BorderLayout(0, 4)); - panel.add(zoomWidgetPane, BorderLayout.NORTH); - panel.add(zoomGesturePane, BorderLayout.CENTER); - return panel; + protected ZoomPane createZoomPane() { + return new MapZoomPane(); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/MapZoomPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/MapZoomPane.java new file mode 100644 index 0000000000..22395cd9e5 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/MapZoomPane.java @@ -0,0 +1,47 @@ +package com.fr.van.chart.designer.other.zoom; + +import com.fr.chartx.attr.ZoomAttribute; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; + +import java.awt.Component; + +/** + * Created by shine on 2019/08/28. + */ +public class MapZoomPane extends ZoomPane { + + private UIButtonGroup mapZoomWidget;//地图缩放控件 + private UIButtonGroup gestureZoomGroup;//地图手势缩放 + + @Override + protected Component[][] getSouthComps() { + mapZoomWidget = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open") + , Toolkit.i18nText("Fine-Design_Chart_Close")}, new Boolean[]{true, false}); + + gestureZoomGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open") + , Toolkit.i18nText("Fine-Design_Chart_Close")}, new Boolean[]{true, false}); + + + return new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Zoom_Widget")), mapZoomWidget}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_ZoomGesture")), gestureZoomGroup} + }; + } + + @Override + public void populateBean(ZoomAttribute ob) { + super.populateBean(ob); + mapZoomWidget.setSelectedItem(ob.isMapZoomWidget()); + gestureZoomGroup.setSelectedItem(ob.isGestureZoom()); + } + + @Override + public ZoomAttribute updateBean() { + ZoomAttribute zoomAttribute = super.updateBean(); + zoomAttribute.setMapZoomWidget(mapZoomWidget.getSelectedItem()); + zoomAttribute.setGestureZoom(gestureZoomGroup.getSelectedItem()); + return zoomAttribute; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPane.java new file mode 100644 index 0000000000..23fe491bd5 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPane.java @@ -0,0 +1,224 @@ +package com.fr.van.chart.designer.other.zoom; + +import com.fr.chartx.attr.ZoomAttribute; +import com.fr.chartx.attr.ZoomInitialDisplayType; +import com.fr.chartx.attr.ZoomModeType; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.extended.chart.StringFormula; +import com.fr.general.ComparatorUtils; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Arrays; + +/** + * Created by shine on 2019/08/28. + */ +public class ZoomPane extends BasicBeanPane { + + private UIButtonGroup modeTypeButtonGroup; + + private JPanel customModePane; + private UIComboBox initialDisplayTypeComboBox; + private JPanel initialDisplayCardPane; + private UISpinner topCategorySpinner; + private TinyFormulaPane leftFormulaPane; + private TinyFormulaPane rightFormulaPane; + + private UIButtonGroup selectionZoomGroup; + + public ZoomPane() { + initComponent(); + } + + private void initComponent() { + + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; + double p = TableLayout.PREFERRED; + double[] columnSize = {f, e}; + + JPanel northPane = createNorthPane(f, p); + + initCustomModePane(columnSize, p); + + JPanel southPane = createSouthPane(f, p); + + this.setLayout(new BorderLayout(0, 6)); + + if (northPane != null) { + this.add(northPane, BorderLayout.NORTH); + } + if (customModePane != null) { + this.add(customModePane, BorderLayout.CENTER); + } + if (southPane != null) { + this.add(southPane, BorderLayout.SOUTH); + } + } + + protected JPanel createNorthPane(double f, double p) { + modeTypeButtonGroup = new UIButtonGroup(new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Mode_Auto"), + Toolkit.i18nText("Fine-Design_Chart_Mode_Custom"), + Toolkit.i18nText("Fine-Design_Chart_Close") + }, new ZoomModeType[]{ZoomModeType.AUTO, ZoomModeType.CUSTOM, ZoomModeType.CLOSE}); + + modeTypeButtonGroup.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + checkCustomModePane(); + } + }); + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Zoom_Mode_type")), modeTypeButtonGroup} + }; + return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p} + , new double[]{f, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}); + } + + private JPanel createSouthPane(double f, double p) { + + Component[][] components = getSouthComps(); + + double[] rows = new double[components.length]; + Arrays.fill(rows, p); + + return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rows + , new double[]{f, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}); + } + + protected Component[][] getSouthComps() { + selectionZoomGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open") + , Toolkit.i18nText("Fine-Design_Chart_Close")}, new Boolean[]{true, false}); + + return new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Selection_Zoom")), selectionZoomGroup} + }; + } + + protected void initCustomModePane(double[] columnSize, double p) { + initialDisplayTypeComboBox = new UIComboBox(new ZoomInitialDisplayType[]{ + ZoomInitialDisplayType.TOP_CATEGORY, + ZoomInitialDisplayType.LEFT_RIGHT_BOUNDARY}); + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_InitialDisplay")), initialDisplayTypeComboBox} + }; + JPanel northPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p}, columnSize); + + + initInitialDisplayCardPane(columnSize, p); + + customModePane = new JPanel(new BorderLayout(0, 6)); + customModePane.add(northPane, BorderLayout.NORTH); + customModePane.add(initialDisplayCardPane, BorderLayout.CENTER); + customModePane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); + } + + private void initInitialDisplayCardPane(double[] columnSize, double p) { + topCategorySpinner = new UISpinner(1, Integer.MAX_VALUE, 1); + Component[][] components1 = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Category_Number")), topCategorySpinner} + }; + final JPanel topPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components1, new double[]{p}, columnSize); + + + leftFormulaPane = new TinyFormulaPane(); + rightFormulaPane = new TinyFormulaPane(); + Component[][] components2 = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Left_Boundary")), leftFormulaPane}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Right_Boundary")), rightFormulaPane} + }; + final JPanel leftRightPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components2, new double[]{p, p}, columnSize); + + initialDisplayCardPane = new JPanel(new CardLayout()) { + @Override + public Dimension getPreferredSize() { + return initialDisplayTypeComboBox.getSelectedIndex() == 0 ? topPane.getPreferredSize() : leftRightPane.getPreferredSize(); + } + }; + initialDisplayCardPane.add(topPane, ZoomInitialDisplayType.TOP_CATEGORY.toString()); + initialDisplayCardPane.add(leftRightPane, ZoomInitialDisplayType.LEFT_RIGHT_BOUNDARY.toString()); + initialDisplayTypeComboBox.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkInitialDisplayCardPane(); + } + }); + } + + private void checkCustomModePane() { + customModePane.setVisible(modeTypeButtonGroup.getSelectedItem() == ZoomModeType.CUSTOM); + } + + private void checkInitialDisplayCardPane() { + CardLayout cardLayout = (CardLayout) initialDisplayCardPane.getLayout(); + if (ComparatorUtils.equals(initialDisplayTypeComboBox.getSelectedItem(), ZoomInitialDisplayType.TOP_CATEGORY)) { + cardLayout.show(initialDisplayCardPane, ZoomInitialDisplayType.TOP_CATEGORY.toString()); + } else { + cardLayout.show(initialDisplayCardPane, ZoomInitialDisplayType.LEFT_RIGHT_BOUNDARY.toString()); + } + } + + + @Override + public void populateBean(ZoomAttribute ob) { + modeTypeButtonGroup.setSelectedItem(ob.getModeType()); + + initialDisplayTypeComboBox.setSelectedItem(ob.getInitialDisplayType()); + + topCategorySpinner.setValue(ob.getTopCategory()); + + if (ob.getLeft() != null) { + leftFormulaPane.populateBean(ob.getLeft().getContent()); + } + if (ob.getRight() != null) { + rightFormulaPane.populateBean(ob.getRight().getContent()); + } + + selectionZoomGroup.setSelectedItem(ob.isSelectionZoom()); + + checkInitialDisplayCardPane(); + checkCustomModePane(); + } + + @Override + public ZoomAttribute updateBean() { + ZoomAttribute zoomAttribute = new ZoomAttribute(); + + zoomAttribute.setModeType(modeTypeButtonGroup.getSelectedItem()); + + zoomAttribute.setInitialDisplayType((ZoomInitialDisplayType) initialDisplayTypeComboBox.getSelectedItem()); + + zoomAttribute.setTopCategory((int) topCategorySpinner.getValue()); + + zoomAttribute.setLeft(new StringFormula(leftFormulaPane.updateBean())); + zoomAttribute.setRight(new StringFormula(rightFormulaPane.updateBean())); + + zoomAttribute.setSelectionZoom(selectionZoomGroup.getSelectedItem()); + + return zoomAttribute; + } + + @Override + protected String title4PopupWindow() { + return null; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPaneWithOutMode.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPaneWithOutMode.java new file mode 100644 index 0000000000..caa443c14f --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPaneWithOutMode.java @@ -0,0 +1,17 @@ +package com.fr.van.chart.designer.other.zoom; + +import javax.swing.JPanel; + +/** + * Created by shine on 2019/08/28. + */ +public class ZoomPaneWithOutMode extends ZoomPane { + @Override + protected JPanel createNorthPane(double f, double p) { + return null; + } + + @Override + protected void initCustomModePane(double[] columnSize, double p) { + } +} 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..87e5f2413e 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.chartx.attr.ZoomAttribute; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.MultilineLabel; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; @@ -16,7 +17,6 @@ import com.fr.js.NameJavaScriptGroup; import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.base.VanChartTools; -import com.fr.plugin.chart.base.VanChartZoom; import com.fr.plugin.chart.vanchart.VanChart; import javax.swing.JPanel; @@ -100,7 +100,7 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane createInteractivePane() { - return new VanChartInteractivePaneWithOutSort(); + return new VanChartInteractivePaneWithOutSort() { + @Override + protected ZoomPane createZoomPane() { + return new ZoomPane(); + } + }; } }; 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..9562289c10 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 @@ -11,10 +11,10 @@ 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; +import com.fr.van.chart.designer.other.zoom.ZoomPane; +import com.fr.van.chart.designer.other.zoom.ZoomPaneWithOutMode; import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.structure.desinger.data.StructurePlotReportDataContentPane; import com.fr.van.chart.structure.desinger.data.StructurePlotTableDataContentPane; @@ -61,16 +61,9 @@ public class StructureIndependentVanChartInterface extends AbstractIndependentVa return new VanChartInteractivePaneWithOutSort(){ @Override - protected String[] getNameArray() { - return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_XY_Axis"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")}; - - } - - @Override - protected String[] getValueArray() { - return new String[]{VanChartConstants.ZOOM_TYPE_XY, VanChartConstants.ZOOM_TYPE_NONE}; + protected ZoomPane createZoomPane() { + return new ZoomPaneWithOutMode(); } - }; } }; diff --git a/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java b/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java index 9dfac7c2c1..0d1f99d356 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java +++ b/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java @@ -1,6 +1,10 @@ package com.fr.van.chart.vanchart; +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.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.report.CategoryPlotReportDataContentPane; @@ -9,6 +13,10 @@ import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContent import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.van.chart.designer.data.VanChartMoreCateReportDataContentPane; import com.fr.van.chart.designer.data.VanChartMoreCateTableDataContentPane; +import com.fr.van.chart.designer.other.VanChartInteractivePane; +import com.fr.van.chart.designer.other.VanChartOtherPane; +import com.fr.van.chart.designer.other.zoom.ZoomPane; +import com.fr.van.chart.designer.style.VanChartStylePane; /** * Created by mengao on 2017/7/6. @@ -28,4 +36,22 @@ public abstract class AbstractMultiCategoryVanChartUI extends AbstractIndepende } return new VanChartMoreCateReportDataContentPane(parent); } + + @Override + public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener) { + + VanChartStylePane stylePane = new VanChartStylePane(listener); + VanChartOtherPane otherPane = new VanChartOtherPane() { + @Override + protected BasicBeanPane createInteractivePane() { + return new VanChartInteractivePane() { + @Override + protected ZoomPane createZoomPane() { + return new ZoomPane(); + } + }; + } + }; + return new AbstractChartAttrPane[]{stylePane, otherPane}; + } } 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 1b270b90b7..429e8aa431 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 @@ -11,9 +11,10 @@ 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; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; import com.fr.van.chart.designer.other.VanChartOtherPane; +import com.fr.van.chart.designer.other.zoom.ZoomPane; +import com.fr.van.chart.designer.other.zoom.ZoomPaneWithOutMode; import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; import com.fr.van.chart.wordcloud.designer.other.VanChartWordCloudConditionPane; @@ -72,14 +73,8 @@ public class WordCloudIndependentVanChartInterface extends AbstractIndependentVa return new VanChartInteractivePaneWithOutSort(){ @Override - protected String[] getNameArray() { - return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_XY_Axis"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")}; - } - - @Override - protected String[] getValueArray() { - return new String[]{VanChartConstants.ZOOM_TYPE_XY, VanChartConstants.ZOOM_TYPE_NONE}; - + protected ZoomPane createZoomPane() { + return new ZoomPaneWithOutMode(); } }; } From d4cf35db8f022401f6036d5cdd0f0b1471a1dce3 Mon Sep 17 00:00:00 2001 From: zheng Date: Thu, 29 Aug 2019 11:16:01 +0800 Subject: [PATCH 002/150] =?UTF-8?q?CHART-10225=20=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=AD=96=E7=95=A5=20=E5=B1=9E=E6=80=A7=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/VanChartPlotLegendPane.java | 48 ++--------- .../style/VanChartRangeLegendPane.java | 19 +---- .../designer/style/VanChartTitlePane.java | 45 +++------- .../style/axis/VanChartBaseAxisPane.java | 48 ++--------- .../designer/style/component/LimitPane.java | 85 +++++++++++++++++++ 5 files changed, 115 insertions(+), 130 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/style/component/LimitPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java index d3a437ef25..2d4245148a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java @@ -8,12 +8,11 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; - +import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.plugin.chart.attr.VanChartLegend; import com.fr.stable.Constants; @@ -21,8 +20,8 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartFloatPositionPane; import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutImagePane; import com.fr.van.chart.designer.component.border.VanChartBorderWithRadiusPane; +import com.fr.van.chart.designer.style.component.LimitPane; -import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JPanel; import javax.swing.event.ChangeEvent; @@ -55,11 +54,8 @@ public class VanChartPlotLegendPane extends BasicPane { protected UIButtonGroup location; protected UIToggleButton customFloatPositionButton; protected VanChartFloatPositionPane customFloatPositionPane; - protected UIButtonGroup limitSize; - protected UISpinner maxProportion; - private UILabel limitSizeTitle; - private JPanel maxProportionPane; + private LimitPane limitPane; //高亮显示的按钮 protected UIButtonGroup highlightButton; @@ -232,25 +228,8 @@ public class VanChartPlotLegendPane extends BasicPane { } protected JPanel createDisplayStrategy(){ - maxProportion = new UISpinner(0,100,1,30); - limitSize = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); - limitSizeTitle = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion")); - - - JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"),limitSize); - maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"),maxProportion,TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); - maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); - JPanel panel = new JPanel(new BorderLayout()); - panel.add(limitSizePane, BorderLayout.NORTH); - panel.add(maxProportionPane, BorderLayout.CENTER); - - limitSize.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - checkMaxProPortionUse(); - } - }); - return panel; + limitPane = new LimitPane(false); + return limitPane; } private JPanel createHighlightPane(){ @@ -276,15 +255,8 @@ public class VanChartPlotLegendPane extends BasicPane { //检查显示策略界面是否可用 protected void checkDisplayStrategyUse() { - limitSize.setEnabled(!customFloatPositionButton.isSelected()); - checkMaxProPortionUse(); - } - - //检查最大显示占比是否可用 - private void checkMaxProPortionUse() { - maxProportion.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled()); - maxProportionPane.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled()); - + GUICoreUtils.setEnabled(limitPane, !customFloatPositionButton.isSelected()); + limitPane.checkMaxProPortionUse(); } protected void checkBoxUse() { @@ -315,8 +287,7 @@ public class VanChartPlotLegendPane extends BasicPane { legend.setPosition(-1); } legend.setFloating(customFloatPositionButton.isSelected()); - legend.setLimitSize(limitSize.getSelectedIndex() == 0); - legend.setMaxHeight(maxProportion.getValue()); + legend.setLimitAttribute(limitPane.updateBean()); legend.setFloatPercentX(customFloatPositionPane.getFloatPosition_x()); legend.setFloatPercentY(customFloatPositionPane.getFloatPosition_y()); if(highlightButton != null && highlightButton.getSelectedItem() != null){ @@ -336,8 +307,7 @@ public class VanChartPlotLegendPane extends BasicPane { customFloatPositionButton.setSelected(legend.isFloating()); customFloatPositionPane.setFloatPosition_x(legend.getFloatPercentX()); customFloatPositionPane.setFloatPosition_y(legend.getFloatPercentY()); - limitSize.setSelectedIndex(legend.isLimitSize() ? 0 : 1); - maxProportion.setValue(legend.getMaxHeight()); + limitPane.populateBean(legend.getLimitAttribute()); if(highlightButton != null){ highlightButton.setSelectedItem(legend.isHighlight()); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java index 39d0b8f1bd..4e8f3fd852 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java @@ -192,26 +192,13 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { public void populateBean(VanChartLegend legend) { VanChartRangeLegend scatterLegend = (VanChartRangeLegend)legend; if (scatterLegend != null) { - isLegendVisible.setSelected(scatterLegend.isLegendVisible()); - textAttrPane.populate(scatterLegend.getFRFont()); - borderPane.populate(scatterLegend); - backgroundPane.populate(scatterLegend); - if(!scatterLegend.isFloating()){ - location.setSelectedItem(scatterLegend.getPosition()); - } - customFloatPositionButton.setSelected(scatterLegend.isFloating()); - customFloatPositionPane.setFloatPosition_x(scatterLegend.getFloatPercentX()); - customFloatPositionPane.setFloatPosition_y(scatterLegend.getFloatPercentY()); - limitSize.setSelectedIndex(scatterLegend.isLimitSize() ? 0 : 1); - maxProportion.setValue(scatterLegend.getMaxHeight()); + + super.populateBean(scatterLegend); + //范围图例部分 legendTypeButton.setSelectedItem(scatterLegend.getLegendType()); gradualLegendPane.populate(scatterLegend.getGradualLegend()); sectionLegendPane.populate(scatterLegend.getSectionLegend()); - - if(highlightButton != null){ - highlightButton.setSelectedItem(legend.isHighlight()); - } } checkAllUse(); this.checkHighlightVisible(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java index c99dccace9..01610a2457 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java @@ -11,12 +11,11 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; - +import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.plugin.chart.attr.VanChartTitle; import com.fr.plugin.chart.vanchart.VanChart; @@ -27,8 +26,8 @@ import com.fr.van.chart.designer.AbstractVanChartScrollPane; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartFloatPositionPane; import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutShadowWithRadiusPane; +import com.fr.van.chart.designer.style.component.LimitPane; -import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JPanel; import javax.swing.SwingConstants; @@ -60,9 +59,8 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { private UIToggleButton useHtml; private UIToggleButton customFloatPositionButton; private VanChartFloatPositionPane customFloatPositionPane; - private UIButtonGroup limitSize; - private UISpinner maxProportion; - private JPanel maxProportionPane; + + private LimitPane limitPane; protected VanChartStylePane parent; @@ -171,24 +169,8 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { } private JPanel createDisplayStrategy(){ - maxProportion = new UISpinner(0,100,1,30); - limitSize = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); - - JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"),limitSize); - maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"),maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); - maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); - JPanel panel = new JPanel(new BorderLayout()); - panel.add(limitSizePane, BorderLayout.NORTH); - panel.add(maxProportionPane, BorderLayout.CENTER); - - limitSize.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - checkMaxProPortionUse(); - } - }); - - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel); + limitPane = new LimitPane(); + return limitPane; } private void initPositionListener(){ @@ -250,15 +232,10 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { //检查显示策略界面是否可用 private void checkDisplayStrategyUse() { - limitSize.setEnabled(!customFloatPositionButton.isSelected()); - checkMaxProPortionUse(); + GUICoreUtils.setEnabled(limitPane, !customFloatPositionButton.isSelected()); + limitPane.checkMaxProPortionUse(); } - //检查最大显示占比是否可用 - private void checkMaxProPortionUse() { - maxProportion.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled()); - maxProportionPane.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled()); - } /** * 弹出框的界面标题 @@ -301,8 +278,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { customFloatPositionButton.setSelected(title.isFloating()); customFloatPositionPane.setFloatPosition_x(title.getFloatPercentX()); customFloatPositionPane.setFloatPosition_y(title.getFloatPercentY()); - limitSize.setSelectedIndex(title.isLimitSize() ? 0 : 1); - maxProportion.setValue(title.getMaxHeight()); + limitPane.populateBean(title.getLimitAttribute()); checkAllUse(); } @@ -335,8 +311,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { } title.setUseHtml(useHtml.isSelected()); title.setFloating(customFloatPositionButton.isSelected()); - title.setLimitSize(limitSize.getSelectedIndex() == 0); - title.setMaxHeight(maxProportion.getValue()); + title.setLimitAttribute(limitPane.updateBean()); title.setFloatPercentX(customFloatPositionPane.getFloatPosition_x()); title.setFloatPercentY(customFloatPositionPane.getFloatPosition_y()); textAttrPane.update(textAttr); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java index ac88b9be4d..051a131dee 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java @@ -12,7 +12,6 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.style.FormatPane; import com.fr.design.layout.TableLayout; @@ -31,6 +30,7 @@ import com.fr.stable.StableUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartHtmlLabelPane; import com.fr.van.chart.designer.style.VanChartStylePane; +import com.fr.van.chart.designer.style.component.LimitPane; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -71,9 +71,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected UIButtonGroup position; protected UIButtonGroup reversed; - protected UIButtonGroup axisLimitSize; - protected UISpinner maxProportion; - protected JPanel maxProportionPane; + private LimitPane limitPane; protected UIButtonGroup valueFormatStyle; protected FormatPane valueFormat; @@ -286,24 +284,8 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } protected JPanel createDisplayStrategy(double[] row, double[] col){ - maxProportion = new UISpinner(0,100,1,30); - axisLimitSize = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); - - JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"),axisLimitSize); - maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"),maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); - maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); - JPanel panel = new JPanel(new BorderLayout()); - panel.add(limitSizePane, BorderLayout.NORTH); - panel.add(maxProportionPane, BorderLayout.CENTER); - - axisLimitSize.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - checkMaxProPortionUse(); - } - }); - - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel); + limitPane = new LimitPane(); + return limitPane; } protected JPanel createValueStylePane(){ @@ -360,7 +342,6 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected void checkAllUse() { checkCardPane(); checkLabelPane(); - checkMaxProPortionUse(); } protected void checkCardPane() { @@ -392,12 +373,6 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } } - //检查最大显示占比是否可用 - private void checkMaxProPortionUse() { - if(maxProportionPane != null && axisLimitSize != null){ - maxProportionPane.setVisible(axisLimitSize.getSelectedIndex() == 0 && axisLimitSize.isEnabled()); - } - } /** * 是否是指定类型 @@ -516,13 +491,9 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { //显示策略 private void populateDisplayStrategy(VanChartAxis axis) { - if(axisLimitSize != null){ - axisLimitSize.setSelectedIndex(axis.isLimitSize() ? 0 : 1); + if (limitPane != null) { + limitPane.populateBean(axis.getLimitAttribute()); } - if(maxProportion != null){ - maxProportion.setValue(axis.getMaxHeight()); - } - } //格式 @@ -637,11 +608,8 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { //显示策略 private void updateDisplayStrategy(VanChartAxis axis){ - if(axisLimitSize != null){ - axis.setLimitSize(axisLimitSize.getSelectedIndex() == 0); - } - if(maxProportion != null){ - axis.setMaxHeight(maxProportion.getValue()); + if (limitPane != null) { + axis.setLimitAttribute(limitPane.updateBean()); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/component/LimitPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/component/LimitPane.java new file mode 100644 index 0000000000..4fd8c77d4b --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/component/LimitPane.java @@ -0,0 +1,85 @@ +package com.fr.van.chart.designer.style.component; + +import com.fr.chartx.attr.LimitAttribute; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.i18n.Toolkit; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * Created by shine on 2019/08/28. + */ +public class LimitPane extends BasicBeanPane { + + private UIButtonGroup autoCustomTypeGroup; + private UISpinner maxProportion; + private JPanel maxProportionPane; + + public LimitPane() { + this(true); + } + + public LimitPane(boolean hasTitle) { + initComponent(hasTitle); + } + + private void initComponent(boolean hasTitle) { + maxProportion = new UISpinner(0, 100, 1, 30); + autoCustomTypeGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Mode_Auto") + , Toolkit.i18nText("Fine-Design_Chart_Mode_Custom")}, new Boolean[]{true, false}); + + JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Area_Size"), autoCustomTypeGroup); + maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"), maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); + maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); + JPanel panel = new JPanel(new BorderLayout()); + panel.add(limitSizePane, BorderLayout.NORTH); + panel.add(maxProportionPane, BorderLayout.CENTER); + + autoCustomTypeGroup.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkMaxProPortionUse(); + } + }); + + this.setLayout(new BorderLayout()); + if (hasTitle) { + JPanel contentPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel); + this.add(contentPane); + } else { + this.add(panel); + } + } + + //检查最大显示占比是否可用 + public void checkMaxProPortionUse() { + maxProportion.setVisible(!autoCustomTypeGroup.getSelectedItem() && autoCustomTypeGroup.isEnabled()); + maxProportionPane.setVisible(!autoCustomTypeGroup.getSelectedItem() && autoCustomTypeGroup.isEnabled()); + } + + @Override + public void populateBean(LimitAttribute ob) { + autoCustomTypeGroup.setSelectedItem(ob.isAuto()); + maxProportion.setValue(ob.getMaxSize()); + } + + @Override + public LimitAttribute updateBean() { + LimitAttribute attribute = new LimitAttribute(); + attribute.setAuto(autoCustomTypeGroup.getSelectedItem()); + attribute.setMaxSize(maxProportion.getValue()); + return attribute; + } + + @Override + protected String title4PopupWindow() { + return null; + } +} From 9dc8f78f3301664ffed4008d2fdd23fccb116e1b Mon Sep 17 00:00:00 2001 From: zheng Date: Thu, 29 Aug 2019 15:06:42 +0800 Subject: [PATCH 003/150] =?UTF-8?q?CHART-10225=20=E5=85=BC=E5=AE=B9=20?= =?UTF-8?q?=E4=BE=BF=E7=AD=BE=E9=87=8D=E5=8F=A0=E7=AD=96=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../label/VanChartPlotLabelDetailPane.java | 64 ++++++++++++++++--- 1 file changed, 54 insertions(+), 10 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java index 012c410a89..48c45eb46c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java @@ -5,20 +5,23 @@ import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIToggleButton; +import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.style.color.ColorSelectBox; - import com.fr.plugin.chart.attr.plot.VanChartLabelPositionPlot; import com.fr.plugin.chart.base.AttrLabelDetail; import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.OverlapHandleType; import com.fr.stable.Constants; import com.fr.van.chart.designer.PlotFactory; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.VanChartStylePane; +import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; @@ -38,7 +41,10 @@ public class VanChartPlotLabelDetailPane extends BasicPane { protected BasicBeanPane dataLabelContentPane; protected UIButtonGroup position; - protected UIButtonGroup autoAdjust; + + private UIButtonGroup allowOverlap; + private UIComboBox overlapHandleType; + protected UIToggleButton tractionLine; protected UIButtonGroup style; @@ -118,8 +124,11 @@ public class VanChartPlotLabelDetailPane extends BasicPane { } position = new UIButtonGroup(names, values); - autoAdjust = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_On"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); + allowOverlap = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_YES"), + Toolkit.i18nText("Fine-Design_Chart_NO")}, new Boolean[]{true, false}); + overlapHandleType = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Chart_Label_OverlapHide"), + Toolkit.i18nText("Fine-Design_Chart_Label_OverlapAdjust")}); Component[][] comps = new Component[2][2]; @@ -134,13 +143,33 @@ public class VanChartPlotLabelDetailPane extends BasicPane { panel.add(tractionLinePane, BorderLayout.SOUTH); initPositionListener(); } else if(PlotFactory.plotAutoAdjustLabelPosition(plot)){ - panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Auto_Adjust"),autoAdjust), BorderLayout.SOUTH); + panel.add(createOverlapLabelPane(), BorderLayout.SOUTH); } return panel; } return new JPanel(); } + private JPanel createOverlapLabelPane() { + allowOverlap.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + checkOverlap(); + } + }); + + JPanel north = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Label_AllowOverlap"), allowOverlap); + JPanel center = new JPanel(new BorderLayout()); + center.add(overlapHandleType, BorderLayout.CENTER); + center.setBorder(BorderFactory.createEmptyBorder(0, 78, 0, 0)); + + JPanel result = new JPanel(new BorderLayout(0, 6)); + result.add(north, BorderLayout.NORTH); + result.add(center, BorderLayout.CENTER); + + return result; + } + protected JPanel getLabelPositionPane (Component[][] comps, double[] row, double[] col){ JPanel panel = TableLayoutHelper.createTableLayoutPane(comps,row,col); return createTableLayoutPaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout"), panel); @@ -208,10 +237,16 @@ public class VanChartPlotLabelDetailPane extends BasicPane { private void checkAllUse() { checkStyleUse(); - if(tractionLine == null){ - return; + checkOverlap(); + if (tractionLine != null) { + checkPositionEnabled(); + } + } + + private void checkOverlap() { + if (overlapHandleType != null && allowOverlap != null) { + overlapHandleType.setVisible(!allowOverlap.getSelectedItem()); } - checkPositionEnabled(); } private void checkStyleUse() { @@ -235,8 +270,11 @@ public class VanChartPlotLabelDetailPane extends BasicPane { if(tractionLine != null){ tractionLine.setSelected(detail.isShowGuidLine()); } - if(autoAdjust != null){ - autoAdjust.setSelectedIndex(detail.isAutoAdjust() == true ? 0 : 1); + if (allowOverlap != null) { + allowOverlap.setSelectedItem(detail.isAllowOverlap()); + } + if (overlapHandleType != null) { + overlapHandleType.setSelectedIndex(detail.getOverlapHandleType() == OverlapHandleType.HIDE ? 0 : 1); } style.setSelectedIndex(detail.isCustom() ? 1 : 0); textFontPane.populate(detail.getTextAttr()); @@ -259,7 +297,13 @@ public class VanChartPlotLabelDetailPane extends BasicPane { position.setSelectedItem(detail.getPosition()); } - detail.setAutoAdjust(autoAdjust != null && autoAdjust.getSelectedItem()); + if (allowOverlap != null) { + detail.setAllowOverlap(allowOverlap.getSelectedItem()); + } + + if (overlapHandleType != null) { + detail.setOverlapHandleType(overlapHandleType.getSelectedIndex() == 0 ? OverlapHandleType.HIDE : OverlapHandleType.ADJUST); + } if(tractionLine != null){ detail.setShowGuidLine(tractionLine.isSelected() && detail.getPosition() == Constants.OUTSIDE); From 10d1c04355fc0e480e407e403d82c9aa58f08544 Mon Sep 17 00:00:00 2001 From: zheng Date: Thu, 29 Aug 2019 20:01:41 +0800 Subject: [PATCH 004/150] =?UTF-8?q?CHART-10225=20=E8=BD=B4=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E9=87=8D=E5=8F=A0=E7=AD=96=E7=95=A5=20=E5=85=BC?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/axis/VanChartBaseAxisPane.java | 128 +++++++++++++----- .../style/axis/VanChartTimeAxisPane.java | 5 +- .../style/axis/VanChartValueAxisPane.java | 5 +- 3 files changed, 101 insertions(+), 37 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java index 051a131dee..1d7c7c8c91 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java @@ -12,8 +12,9 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.style.FormatPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.PaneTitleConstants; @@ -22,11 +23,13 @@ import com.fr.design.style.color.ColorSelectBox; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.plugin.chart.attr.axis.VanChartAxis; +import com.fr.plugin.chart.base.OverlapHandleType; import com.fr.plugin.chart.base.VanChartConstants; import com.fr.plugin.chart.type.AxisTickLineType; import com.fr.stable.Constants; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartHtmlLabelPane; import com.fr.van.chart.designer.style.VanChartStylePane; @@ -36,6 +39,8 @@ import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JPanel; import javax.swing.SwingConstants; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Component; @@ -58,10 +63,14 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected UIButtonGroup showLabel; protected ChartTextAttrPane labelTextAttrPane; protected UINumberDragPane labelTextRotation; + + private UIButtonGroup overlapHandleTypeGroup; protected UIButtonGroup labelGapStyle; - protected UITextField labelGapValue; - protected JPanel labelPanel; + protected UISpinner labelGapValue; + protected JPanel labelPanel; + private JPanel labelGapStylePane; + private JPanel labelGapValuePane; protected LineComboBox axisLineStyle; protected ColorSelectBox axisLineColor; @@ -77,7 +86,6 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected FormatPane valueFormat; protected JPanel centerPane; private VanChartHtmlLabelPane htmlLabelPane; - private JPanel labelGapValuePane; public VanChartBaseAxisPane(){ this(true); @@ -164,32 +172,22 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } protected JPanel createLabelPane(double[] row, double[] col){ + double p = TableLayout.PREFERRED; showLabel = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Show"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hidden")}); labelTextAttrPane = getChartTextAttrPane(); - labelTextRotation = new UINumberDragPane(-ROTATION_MAX,ROTATION_MAX); - labelGapStyle = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Fixed")}); - labelGapValue = new UITextField(); - Component[][] gapComponents = new Component[][]{ - new Component[]{ - FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TextRotation")), - UIComponentUtils.wrapWithBorderLayoutPane(labelTextRotation) - }, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Label_Interval")), labelGapStyle}, - }; - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(gapComponents, row, col); - labelGapValuePane= TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText(""),labelGapValue, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); - JPanel gapPanel = new JPanel(new BorderLayout()); - gapPanel.add(panel, BorderLayout.CENTER); - gapPanel.add(labelGapValuePane, BorderLayout.SOUTH); + JPanel rotationPane = createLabelRotationPane(col); + JPanel overlapPane = createLabelOverlapPane(); + - Component[][] components = new Component[][]{ + Component[][] components = new Component[][]{ new Component[]{labelTextAttrPane, null}, - new Component[]{gapPanel,null}, + new Component[]{rotationPane, null}, + new Component[]{overlapPane, null}, }; JPanel showLabelPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label"),showLabel); - labelPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); + labelPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p, p}, col); labelPanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,0)); showLabel.addActionListener(new ActionListener() { @Override @@ -197,16 +195,61 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { checkLabelPane(); } }); + JPanel jPanel = new JPanel(new BorderLayout()); + jPanel.add(showLabelPane, BorderLayout.NORTH); + jPanel.add(labelPanel, BorderLayout.CENTER); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_LABEL_TITLE, jPanel); + } + + private JPanel createLabelRotationPane(double[] col) { + labelTextRotation = new UINumberDragPane(-ROTATION_MAX, ROTATION_MAX); + + Component[][] gapComponents = new Component[][]{ + new Component[]{ + FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TextRotation")), + UIComponentUtils.wrapWithBorderLayoutPane(labelTextRotation) + } + }; + return TableLayout4VanChartHelper.createGapTableLayoutPane(gapComponents, new double[]{TableLayout.PREFERRED}, col); + } + + private JPanel createLabelOverlapPane() { + + labelGapStyle = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), Toolkit.i18nText("Fine-Design_Chart_Fixed")}); + labelGapStylePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Label_Interval"), labelGapStyle, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); + + labelGapValue = new UISpinner(0, Integer.MAX_VALUE, 1, 1); + labelGapValuePane = TableLayout4VanChartHelper.createGapTableLayoutPane(StringUtils.EMPTY, labelGapValue, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); + + JPanel panel = new JPanel(new BorderLayout(0, 0)); + addOverlapGroupButton(panel); + panel.add(labelGapStylePane, BorderLayout.CENTER); + panel.add(labelGapValuePane, BorderLayout.SOUTH); + labelGapStyle.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { checkLabelGapValuePane(); } }); - JPanel jPanel = new JPanel(new BorderLayout()); - jPanel.add(showLabelPane, BorderLayout.NORTH); - jPanel.add(labelPanel, BorderLayout.CENTER); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_LABEL_TITLE, jPanel); + + return panel; + } + + protected void addOverlapGroupButton(JPanel panel) { + overlapHandleTypeGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Label_OverlapAbbreviate"), Toolkit.i18nText("Fine-Design_Chart_Label_OverlapInterval")}, + new OverlapHandleType[]{OverlapHandleType.ABBREVIATE, OverlapHandleType.INTERVAL}); + JPanel north = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Label_WhenOverlap"), overlapHandleTypeGroup, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); + + panel.add(north, BorderLayout.NORTH); + + overlapHandleTypeGroup.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + checkLabelGapAndStylePane(); + } + }); + } protected ChartTextAttrPane getChartTextAttrPane(){ @@ -362,14 +405,27 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { labelPanel.setVisible(enabled); } if(enabled){ - checkLabelGapValuePane(); + checkLabelGapAndStylePane(); } } } + private void checkLabelGapAndStylePane() { + if (overlapHandleTypeGroup != null && labelGapStylePane != null) { + boolean visible = overlapHandleTypeGroup.getSelectedItem() == OverlapHandleType.INTERVAL; + + labelGapStylePane.setVisible(visible); + } + checkLabelGapValuePane(); + } + protected void checkLabelGapValuePane() { - if(labelGapValuePane != null && labelGapStyle != null){ - labelGapValuePane.setVisible(labelGapStyle.getSelectedIndex() == 1); + if (labelGapValuePane != null && labelGapStyle != null) { + boolean visible = labelGapStyle.getSelectedIndex() == 1; + if (overlapHandleTypeGroup != null) { + visible = visible && overlapHandleTypeGroup.getSelectedItem() == OverlapHandleType.INTERVAL; + } + labelGapValuePane.setVisible(visible); } } @@ -452,11 +508,14 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { if(labelTextRotation != null){ labelTextRotation.populateBean((double)labelTextAttr.getRotation()); } + if (overlapHandleTypeGroup != null) { + overlapHandleTypeGroup.setSelectedItem(axis.getOverlapHandleType()); + } if(labelGapStyle != null){ labelGapStyle.setSelectedIndex(axis.isAutoLabelGap() ? 0 : 1); } if(labelGapValue != null){ - labelGapValue.setText(axis.getLabelNumber().getContent()); + labelGapValue.setValue(axis.getIntervalNumber()); } } @@ -568,15 +627,14 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { if(labelTextRotation != null){ labelTextAttr.setRotation(labelTextRotation.updateBean().intValue()); } + if (overlapHandleTypeGroup != null) { + axis.setOverlapHandleType(overlapHandleTypeGroup.getSelectedItem()); + } if(labelGapStyle != null){ axis.setAutoLabelGap(labelGapStyle.getSelectedIndex() == 0); } if(labelGapValue != null){ - if(axis.isAutoLabelGap()){ - axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build("1")); - } else { - axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build(labelGapValue.getText())); - } + axis.setIntervalNumber((int) labelGapValue.getValue()); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java index 3a43866a23..b3d9e35f1f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java @@ -17,7 +17,6 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.general.DateUtils; import com.fr.log.FineLoggerFactory; - import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartTimeAxis; import com.fr.plugin.chart.base.VanChartConstants; @@ -80,6 +79,10 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane { return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } + @Override + protected void addOverlapGroupButton(JPanel panel) { + } + private JPanel createValueDefinition(){ timeMinMaxValuePane = new TimeMinMaxValuePane(); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), timeMinMaxValuePane); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartValueAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartValueAxisPane.java index 39ae32372f..4e09524685 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartValueAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartValueAxisPane.java @@ -7,7 +7,6 @@ import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; - import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartValueAxis; import com.fr.stable.StringUtils; @@ -61,6 +60,10 @@ public class VanChartValueAxisPane extends VanChartBaseAxisPane { return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } + @Override + protected void addOverlapGroupButton(JPanel panel) { + } + protected JPanel createMinMaxValuePane(double[] row, double[] col){ JPanel panel = createCommenValuePane(row,col); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), panel); From bdf6cae85e5b0a9de5823f462343327f6c89a297 Mon Sep 17 00:00:00 2001 From: zheng Date: Mon, 2 Sep 2019 15:50:41 +0800 Subject: [PATCH 005/150] =?UTF-8?q?CHART-10225=20=E5=85=BC=E5=AE=B9=20?= =?UTF-8?q?=E6=8A=98=E7=BA=BF=E7=B1=BB=E5=9E=8B=E5=92=8C=E7=BA=BF=E5=AE=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/component/LineTypeComboBox.java | 85 ++++++++++++++++ .../component/VanChartLineTypePane.java | 99 +++++++++++++------ .../component/VanChartLineWidthPane.java | 25 ++--- .../VanChartScatterLineTypePane.java | 25 ++--- 4 files changed, 169 insertions(+), 65 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java new file mode 100644 index 0000000000..00408aca0c --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java @@ -0,0 +1,85 @@ +package com.fr.van.chart.designer.component; + +import com.fr.base.FRContext; +import com.fr.base.GraphHelper; +import com.fr.base.ScreenResolution; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.icombobox.UIComboBoxRenderer; +import com.fr.design.i18n.Toolkit; +import com.fr.general.FRFont; +import com.fr.plugin.chart.type.LineType; +import com.fr.stable.Constants; + +import javax.swing.JLabel; +import javax.swing.JList; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; + +/** + * Created by shine on 2019/08/30. + */ +public class LineTypeComboBox extends UIComboBox { + + public LineTypeComboBox(LineType[] lineType) { + super(lineType); + + this.setRenderer(new CellRenderer()); + } + + private class CellRenderer extends UIComboBoxRenderer { + + private LineType lineType; + + public Component getListCellRendererComponent( + JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + + JLabel comp = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + this.lineType = (LineType) value; + comp.setText(null); + return comp; + } + + public void paint(Graphics g) { + super.paint(g); + Graphics2D g2d = (Graphics2D) g; + + Dimension d = getSize(); + g2d.setColor(getForeground()); + + switch (this.lineType) { + case NONE: + FRFont font = FRContext.getDefaultValues().getFRFont(); + int resolution = ScreenResolution.getScreenResolution(); + Font rfont = font.applyResolutionNP(resolution); + g2d.setFont(rfont); + FontMetrics fm = GraphHelper.getFontMetrics(rfont); + GraphHelper.drawString(g2d, Toolkit.i18nText("Fine-Design_Report_None"), 4, (d.height - fm.getHeight()) / 2 + fm.getAscent()); + break; + case NORMAL: + GraphHelper.drawLine(g2d, 4, d.height / 2, d.width - 8, d.height / 2); + break; + case DASH: + GraphHelper.drawLine(g2d, 4, d.height / 2, d.width - 8, d.height / 2, Constants.LINE_DASH); + break; + default: + break; + + } + } + + public Dimension getPreferredSize() { + return new Dimension(60, 16); + } + + public Dimension getMinimumSize() { + return getPreferredSize(); + } + + } + + +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java index 78f93162f8..f095b385a7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java @@ -2,21 +2,24 @@ package com.fr.van.chart.designer.component; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButtonGroup; -import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; - import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; +import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.base.VanChartAttrLine; import com.fr.plugin.chart.type.LineStyle; -import com.fr.stable.Constants; -import com.fr.stable.CoreConstants; +import com.fr.plugin.chart.type.LineType; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Arrays; /** * line相关设置 @@ -24,64 +27,99 @@ import java.awt.Component; public class VanChartLineTypePane extends BasicPane { private static final long serialVersionUID = -6581862503009962973L; - protected LineComboBox lineWidth;//线型 + private LineTypeComboBox lineTypeComboBox;//线型 + private UISpinner lineWidthSpinner;//线宽 protected UIButtonGroup lineStyle;//形态 - protected UIButtonGroup nullValueBreak;//空值断开 + private UIButtonGroup nullValueBreak;//空值断开 public VanChartLineTypePane() { - lineWidth = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); + lineTypeComboBox = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH}); + + lineWidthSpinner = new UISpinner(0.5, Integer.MAX_VALUE, 0.5, 2); createLineStyle(); - nullValueBreak = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); + nullValueBreak = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open"), Toolkit.i18nText("Fine-Design_Chart_Close")}); + + lineTypeComboBox.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkLineWidth(); + } + }); - this.setLayout(new BorderLayout()); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - this.add(createContentPane(p, f), BorderLayout.CENTER); + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + + Component[] lineTypeComponent = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), lineTypeComboBox}, + lineWidthComponent = new Component[]{ + FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Width")), + UIComponentUtils.wrapWithBorderLayoutPane(lineWidthSpinner)}, + lineStyleComponent = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style_Present")), lineStyle}, + nullValueBreakComponent = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break")), nullValueBreak}; + + Component[][] components = createContentComponent(lineTypeComponent, lineWidthComponent, lineStyleComponent, nullValueBreakComponent); + + double[] row = new double[components.length]; + Arrays.fill(row, p); + double[] col = {f, e}; + + JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); + + this.setLayout(new BorderLayout()); + this.add(contentPane, BorderLayout.CENTER); + } + + private JPanel createTypeAndWidthPane() { + //todo@shinerefactor:当前兼容工作到这边,因为finekit和移动端,暂停 + JPanel panel = new JPanel(new BorderLayout(0, 6)); + + + return panel; } protected void createLineStyle() { - String[] textArray = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Normal_Line"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_StepLine"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_CurveLine")}; + String[] textArray = new String[]{Toolkit.i18nText("Fine-Design_Chart_Normal_Line"), + Toolkit.i18nText("Fine-Design_Chart_StepLine"), Toolkit.i18nText("Fine-Design_Chart_CurveLine")}; lineStyle = new UIButtonGroup(textArray, LineStyle.values()); } - protected JPanel createContentPane(double p, double f) { - double[] row = {p, p, p, p}; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] col = {f, e}; - - Component[][] components = new Component[][]{ + protected Component[][] createContentComponent(Component[] lineTypeComponent, Component[] lineWidthComponent, + Component[] lineStyleComponent, Component[] nullValueBreakComponent) { + return new Component[][]{ new Component[]{null,null}, - new Component[]{ - FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")), - UIComponentUtils.wrapWithBorderLayoutPane(lineWidth) - }, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Present")),lineStyle}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break")),nullValueBreak}, + lineTypeComponent, + lineWidthComponent, + lineStyleComponent, + nullValueBreakComponent }; + } - return TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); + private void checkLineWidth() { + if (lineWidthSpinner != null && lineTypeComboBox != null) { + lineWidthSpinner.setVisible(!ComparatorUtils.equals(lineTypeComboBox.getSelectedItem(), LineType.NONE)); + } } public void checkLarge(boolean large){ if(large){ - lineWidth.setSelectedLineStyle(Constants.LINE_NONE); + lineTypeComboBox.setSelectedItem(LineType.NONE); } - lineWidth.setEnabled(!large); + lineTypeComboBox.setEnabled(!large); lineStyle.setEnabled(!large); } protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line"); + return Toolkit.i18nText("Fine-Design_Chart_Line"); } public void populate(VanChartAttrLine line) { if (line == null) { line = initVanChartAttrLine(); } - lineWidth.setSelectedLineStyle(line.getLineWidth()); + lineTypeComboBox.setSelectedItem(line.getLineType()); + lineWidthSpinner.setValue(line.getLineWidth()); lineStyle.setSelectedItem(line.getLineStyle()); nullValueBreak.setSelectedIndex(line.isNullValueBreak() ? 0 : 1); } @@ -92,7 +130,8 @@ public class VanChartLineTypePane extends BasicPane { public VanChartAttrLine update() { VanChartAttrLine line = new VanChartAttrLine(); - line.setLineWidth(lineWidth.getSelectedLineStyle()); + line.setLineType((LineType) lineTypeComboBox.getSelectedItem()); + line.setLineWidth(lineWidthSpinner.getValue()); line.setLineStyle(lineStyle.getSelectedItem()); line.setNullValueBreak(nullValueBreak.getSelectedIndex() == 0); return line; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineWidthPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineWidthPane.java index 72ee1666ae..91e5612d10 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineWidthPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineWidthPane.java @@ -1,30 +1,19 @@ package com.fr.van.chart.designer.component; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.TableLayoutHelper; - -import com.fr.van.chart.designer.TableLayout4VanChartHelper; - -import javax.swing.JPanel; import java.awt.Component; /** - * 线-线型 + * 线型+线宽+空值断开 */ public class VanChartLineWidthPane extends VanChartLineTypePane { private static final long serialVersionUID = 4537158946119294689L; - protected JPanel createContentPane(double p, double f) { - double[] row = {p, p, p}; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] col = {f, e}; - - Component[][] components = new Component[][]{ - new Component[]{null,null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")), lineWidth}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break")), nullValueBreak}, + @Override + protected Component[][] createContentComponent(Component[] lineTypeComponent, Component[] lineWidthComponent, Component[] lineStyleComponent, Component[] nullValueBreakComponent) { + return new Component[][]{ + lineTypeComponent, + lineWidthComponent, + nullValueBreakComponent }; - - return TableLayoutHelper.createTableLayoutPane(components, row, col); } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/component/VanChartScatterLineTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/component/VanChartScatterLineTypePane.java index b9dac828c6..9e00449fbc 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/component/VanChartScatterLineTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/component/VanChartScatterLineTypePane.java @@ -1,16 +1,11 @@ package com.fr.van.chart.scatter.component; import com.fr.design.gui.ibutton.UIButtonGroup; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.TableLayoutHelper; - import com.fr.plugin.chart.base.VanChartAttrLine; import com.fr.plugin.chart.type.LineStyle; -import com.fr.stable.Constants; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.plugin.chart.type.LineType; import com.fr.van.chart.designer.component.VanChartLineTypePane; -import javax.swing.JPanel; import java.awt.Component; /** @@ -26,24 +21,20 @@ public class VanChartScatterLineTypePane extends VanChartLineTypePane { } @Override - protected JPanel createContentPane(double p, double f) { - double[] row = {p,p,p}; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] col = {f, e}; - Component[][] components = new Component[][]{ - new Component[]{null,null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")), lineWidth}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Present")), lineStyle}, + protected Component[][] createContentComponent(Component[] lineTypeComponent, Component[] lineWidthComponent, Component[] lineStyleComponent, Component[] nullValueBreakComponent) { + return new Component[][]{ + new Component[]{null, null}, + lineTypeComponent, + lineWidthComponent, + lineStyleComponent }; - - return TableLayoutHelper.createTableLayoutPane(components, row, col); } @Override protected VanChartAttrLine initVanChartAttrLine() { VanChartAttrLine attrLine = new VanChartAttrLine(); //默认为无线型,且默認空值不斷開 - attrLine.setLineWidth(Constants.LINE_NONE); + attrLine.setLineType(LineType.NONE); attrLine.setNullValueBreak(false); return attrLine; } From 862cbf69eab0a888c7823cd7362f5bb880fef0bc Mon Sep 17 00:00:00 2001 From: shine Date: Tue, 24 Sep 2019 16:54:44 +0800 Subject: [PATCH 006/150] =?UTF-8?q?CHART-10225=20=E6=8A=98=E7=8E=B0?= =?UTF-8?q?=E7=BA=BF=E5=9E=8B=20=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/component/LineTypeComboBox.java | 2 +- .../component/VanChartLineTypePane.java | 64 +++++++++++++------ .../component/VanChartLineWidthPane.java | 4 +- .../VanChartScatterLineTypePane.java | 9 +-- 4 files changed, 48 insertions(+), 31 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java index 00408aca0c..0b3bc7571a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java @@ -30,7 +30,7 @@ public class LineTypeComboBox extends UIComboBox { this.setRenderer(new CellRenderer()); } - private class CellRenderer extends UIComboBoxRenderer { + private static class CellRenderer extends UIComboBoxRenderer { private LineType lineType; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java index f095b385a7..1fe987f1ab 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java @@ -32,10 +32,11 @@ public class VanChartLineTypePane extends BasicPane { protected UIButtonGroup lineStyle;//形态 private UIButtonGroup nullValueBreak;//空值断开 + private JPanel lineWidthPane; + public VanChartLineTypePane() { - lineTypeComboBox = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH}); - lineWidthSpinner = new UISpinner(0.5, Integer.MAX_VALUE, 0.5, 2); + JPanel typeAndWidthPane = createTypeAndWidthPane(); createLineStyle(); @@ -52,14 +53,10 @@ public class VanChartLineTypePane extends BasicPane { double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - Component[] lineTypeComponent = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), lineTypeComboBox}, - lineWidthComponent = new Component[]{ - FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Width")), - UIComponentUtils.wrapWithBorderLayoutPane(lineWidthSpinner)}, - lineStyleComponent = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style_Present")), lineStyle}, + Component[] lineStyleComponent = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style_Present")), lineStyle}, nullValueBreakComponent = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break")), nullValueBreak}; - Component[][] components = createContentComponent(lineTypeComponent, lineWidthComponent, lineStyleComponent, nullValueBreakComponent); + Component[][] components = createContentComponent(lineStyleComponent, nullValueBreakComponent); double[] row = new double[components.length]; Arrays.fill(row, p); @@ -67,16 +64,45 @@ public class VanChartLineTypePane extends BasicPane { JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); - this.setLayout(new BorderLayout()); + this.setLayout(new BorderLayout(0, 6)); + this.add(typeAndWidthPane, BorderLayout.NORTH); this.add(contentPane, BorderLayout.CENTER); } private JPanel createTypeAndWidthPane() { - //todo@shinerefactor:当前兼容工作到这边,因为finekit和移动端,暂停 - JPanel panel = new JPanel(new BorderLayout(0, 6)); + lineTypeComboBox = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH}); + + lineWidthSpinner = new UISpinner(0.5, Integer.MAX_VALUE, 0.5, 2); + + lineTypeComboBox.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkLineWidth(); + } + }); + + Component[][] lineTypeComps = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), lineTypeComboBox} + }; + Component[][] lineWidthComps = new Component[][]{ + new Component[]{ + FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Width")), + UIComponentUtils.wrapWithBorderLayoutPane(lineWidthSpinner)} + }; + + double p = TableLayout.PREFERRED, f = TableLayout.FILL, e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double[] row = {p}, col = {f, e}; + + JPanel lineTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(lineTypeComps, row, col); + lineWidthPane = TableLayout4VanChartHelper.createGapTableLayoutPane(lineWidthComps, row, col); + + JPanel contentPane = new JPanel(new BorderLayout(0, 6)); + + contentPane.add(lineTypePane, BorderLayout.CENTER); + contentPane.add(lineWidthPane, BorderLayout.SOUTH); - return panel; + return contentPane; } protected void createLineStyle() { @@ -85,25 +111,21 @@ public class VanChartLineTypePane extends BasicPane { lineStyle = new UIButtonGroup(textArray, LineStyle.values()); } - protected Component[][] createContentComponent(Component[] lineTypeComponent, Component[] lineWidthComponent, - Component[] lineStyleComponent, Component[] nullValueBreakComponent) { + protected Component[][] createContentComponent(Component[] lineStyleComponent, Component[] nullValueBreakComponent) { return new Component[][]{ - new Component[]{null,null}, - lineTypeComponent, - lineWidthComponent, lineStyleComponent, nullValueBreakComponent }; } private void checkLineWidth() { - if (lineWidthSpinner != null && lineTypeComboBox != null) { - lineWidthSpinner.setVisible(!ComparatorUtils.equals(lineTypeComboBox.getSelectedItem(), LineType.NONE)); + if (lineWidthPane != null && lineTypeComboBox != null) { + lineWidthPane.setVisible(!ComparatorUtils.equals(lineTypeComboBox.getSelectedItem(), LineType.NONE)); } } - public void checkLarge(boolean large){ - if(large){ + public void checkLarge(boolean large) { + if (large) { lineTypeComboBox.setSelectedItem(LineType.NONE); } lineTypeComboBox.setEnabled(!large); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineWidthPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineWidthPane.java index 91e5612d10..48f622654e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineWidthPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineWidthPane.java @@ -9,10 +9,8 @@ public class VanChartLineWidthPane extends VanChartLineTypePane { private static final long serialVersionUID = 4537158946119294689L; @Override - protected Component[][] createContentComponent(Component[] lineTypeComponent, Component[] lineWidthComponent, Component[] lineStyleComponent, Component[] nullValueBreakComponent) { + protected Component[][] createContentComponent(Component[] lineStyleComponent, Component[] nullValueBreakComponent) { return new Component[][]{ - lineTypeComponent, - lineWidthComponent, nullValueBreakComponent }; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/component/VanChartScatterLineTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/component/VanChartScatterLineTypePane.java index 9e00449fbc..7ac507408b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/component/VanChartScatterLineTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/component/VanChartScatterLineTypePane.java @@ -16,23 +16,20 @@ public class VanChartScatterLineTypePane extends VanChartLineTypePane { @Override protected void createLineStyle() { String[] textArray = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Normal_Line"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_CurveLine")}; + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_CurveLine")}; lineStyle = new UIButtonGroup(textArray, new LineStyle[]{LineStyle.NORMAL, LineStyle.CURVE}); } @Override - protected Component[][] createContentComponent(Component[] lineTypeComponent, Component[] lineWidthComponent, Component[] lineStyleComponent, Component[] nullValueBreakComponent) { + protected Component[][] createContentComponent(Component[] lineStyleComponent, Component[] nullValueBreakComponent) { return new Component[][]{ - new Component[]{null, null}, - lineTypeComponent, - lineWidthComponent, lineStyleComponent }; } @Override protected VanChartAttrLine initVanChartAttrLine() { - VanChartAttrLine attrLine = new VanChartAttrLine(); + VanChartAttrLine attrLine = new VanChartAttrLine(); //默认为无线型,且默認空值不斷開 attrLine.setLineType(LineType.NONE); attrLine.setNullValueBreak(false); From 73adc78d181cb9f67703402704d9a936f404503d Mon Sep 17 00:00:00 2001 From: shine Date: Wed, 25 Sep 2019 18:41:17 +0800 Subject: [PATCH 007/150] =?UTF-8?q?CHART-10225=20=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=EF=BC=9A=E5=A4=A7=E6=95=B0=E6=8D=AE=E7=9B=B8?= =?UTF-8?q?=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/area/VanChartAreaSeriesPane.java | 7 +- .../bar/BarIndependentVanChartInterface.java | 12 +- .../BubbleIndependentVanChartInterface.java | 23 ++- .../bubble/VanChartBubbleSeriesPane.java | 28 +-- .../fr/van/chart/designer/PlotFactory.java | 121 +++++------ .../other/VanChartInteractivePane.java | 172 +++++++++++----- .../VanChartAbstractPlotSeriesPane.java | 189 +++++++----------- .../VanChartDrillMapInteractivePane.java | 38 ++-- .../HeatMapIndependentVanChartInterface.java | 18 +- .../chart/line/VanChartLineSeriesPane.java | 9 +- .../van/chart/map/VanChartMapSeriesPane.java | 159 +++++---------- .../other/VanChartMapInteractivePane.java | 27 +-- .../pane/VanChartLineMapConditionPane.java | 3 +- .../ScatterIndependentVanChartInterface.java | 18 +- .../scatter/VanChartScatterSeriesPane.java | 22 +- .../AbstractMultiCategoryVanChartUI.java | 18 +- 16 files changed, 425 insertions(+), 439 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java index abf6ca31ce..d8b3b6de5f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java @@ -15,15 +15,15 @@ public class VanChartAreaSeriesPane extends VanChartLineSeriesPane { private static final long serialVersionUID = 5497989595104913025L; - public VanChartAreaSeriesPane(ChartStylePane parent, Plot plot){ + public VanChartAreaSeriesPane(ChartStylePane parent, Plot plot) { super(parent, plot); } - protected JPanel getContentInPlotType(){ + protected JPanel getContentInPlotType() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - double[] row = {p,p,p,p,p,p,p}; + double[] row = {p, p, p, p, p, p, p}; double[] col = {f}; Component[][] components = new Component[][]{ @@ -32,7 +32,6 @@ public class VanChartAreaSeriesPane extends VanChartLineSeriesPane { new Component[]{createMarkerPane()}, new Component[]{createAreaFillColorPane()}, new Component[]{createStackedAndAxisPane()}, - new Component[]{createLargeDataModelPane()}, new Component[]{createTrendLinePane()}, }; 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 2dbae99a27..63a8e7640c 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 @@ -60,19 +60,20 @@ public class BarIndependentVanChartInterface extends AbstractMultiCategoryVanCha return new VanChartBarPlotPane(); } - public ConditionAttributesPane getPlotConditionPane(Plot plot){ + public ConditionAttributesPane getPlotConditionPane(Plot plot) { return new VanChartColumnConditionPane(plot); } - public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot) { return new VanChartColumnSeriesPane(parent, plot); } /** * 图表的属性界面数组 + * * @return 属性界面 */ - public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ + public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener) { VanChartStylePane stylePane = new VanChartBarStylePane(listener); VanChartOtherPane otherPane = new VanChartOtherPane() { @Override @@ -82,6 +83,11 @@ public class BarIndependentVanChartInterface extends AbstractMultiCategoryVanCha protected ZoomPane createZoomPane() { return new ZoomPane(); } + + @Override + protected boolean isCurrentChartSupportLargeDataMode() { + return true; + } }; } }; 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 ec4fc55854..6041f7e6fa 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 @@ -65,22 +65,23 @@ public class BubbleIndependentVanChartInterface extends AbstractIndependentVanCh public String getIconPath() { return "com/fr/design/images/form/toolbar/bubble.png"; } + @Override - public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot) { return new VanChartBubbleSeriesPane(parent, plot); } @Override - public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ - if(((VanChartBubblePlot) plot).isForceBubble()){ + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { + if (((VanChartBubblePlot) plot).isForceBubble()) { return super.getTableDataSourcePane(plot, parent); } return new VanChartBubblePlotTableDataContentPane(parent); } @Override - public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ - if(((VanChartBubblePlot) plot).isForceBubble()){ + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { + if (((VanChartBubblePlot) plot).isForceBubble()) { return super.getReportDataSourcePane(plot, parent); } return new BubblePlotReportDataContentPane(parent); @@ -88,24 +89,30 @@ public class BubbleIndependentVanChartInterface extends AbstractIndependentVanCh /** * 图表的属性界面数组 + * * @return 属性界面 */ - public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ + public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener) { VanChartStylePane stylePane = new VanChartBubbleStylePane(listener); - VanChartOtherPane otherPane = new VanChartOtherPane(){ + VanChartOtherPane otherPane = new VanChartOtherPane() { protected BasicBeanPane createInteractivePane() { return new VanChartInteractivePaneWithOutSort() { @Override protected ZoomPane createZoomPane() { return new ZoomPane(); } + + @Override + protected boolean isCurrentChartSupportLargeDataMode() { + return true; + } }; } }; return new AbstractChartAttrPane[]{stylePane, otherPane}; } - public ConditionAttributesPane getPlotConditionPane(Plot plot){ + public ConditionAttributesPane getPlotConditionPane(Plot plot) { return new VanChartBubbleConditionPane(plot); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java index 01c72649d6..b966cc6f98 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java @@ -6,8 +6,6 @@ import com.fr.design.beans.BasicBeanPane; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; - -import com.fr.plugin.chart.bubble.VanChartBubblePlot; import com.fr.plugin.chart.bubble.attr.VanChartAttrBubble; import com.fr.van.chart.bubble.component.VanChartBubblePane; import com.fr.van.chart.custom.component.VanChartCustomAxisConditionPane; @@ -44,35 +42,31 @@ public class VanChartBubbleSeriesPane extends VanChartAbstractPlotSeriesPane { new Component[]{null} }; - if (!((VanChartBubblePlot)plot).isForceBubble()) { - components[3] = new Component[]{createLargeDataModelPane()}; - } - contentPane = TableLayoutHelper.createTableLayoutPane(components, row, col); return contentPane; } //设置色彩面板内容 @Override - protected void setColorPaneContent (JPanel panel) { + protected void setColorPaneContent(JPanel panel) { panel.add(createAlphaPane(), BorderLayout.CENTER); } @Override //堆积和坐标轴设置(自定义柱形图等用到) protected JPanel createStackedAndAxisPane() { - stackAndAxisEditPane = new VanChartStackedAndAxisListControlPane(){ + stackAndAxisEditPane = new VanChartStackedAndAxisListControlPane() { @Override protected Class getStackAndAxisPaneClass() { return VanChartCustomAxisConditionPane.class; } @Override - public String getPaneTitle(){ + public String getPaneTitle() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Axis"); } }; - stackAndAxisEditExpandablePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(stackAndAxisEditPane.getPaneTitle(), stackAndAxisEditPane); + stackAndAxisEditExpandablePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(stackAndAxisEditPane.getPaneTitle(), stackAndAxisEditPane); return stackAndAxisEditExpandablePane; } @@ -81,18 +75,18 @@ public class VanChartBubbleSeriesPane extends VanChartAbstractPlotSeriesPane { return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Bubble"), bubblePane); } - protected void populateCondition(ConditionAttr defaultAttr){ - super.populateCondition(defaultAttr); - if(bubblePane != null) { - VanChartAttrBubble attrBubble = (VanChartAttrBubble) defaultAttr.getExisted(VanChartAttrBubble.class); + protected void populateCondition(ConditionAttr defaultAttr) { + super.populateCondition(defaultAttr); + if (bubblePane != null) { + VanChartAttrBubble attrBubble = defaultAttr.getExisted(VanChartAttrBubble.class); bubblePane.populateBean(attrBubble); } } - protected void updateCondition(ConditionAttr defaultAttr){ + protected void updateCondition(ConditionAttr defaultAttr) { super.updateCondition(defaultAttr); - if(bubblePane != null){ - VanChartAttrBubble attrBubble = (VanChartAttrBubble) defaultAttr.getExisted(VanChartAttrBubble.class); + if (bubblePane != null) { + VanChartAttrBubble attrBubble = defaultAttr.getExisted(VanChartAttrBubble.class); if (attrBubble != null) { defaultAttr.remove(attrBubble); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java b/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java index 7c46b8b085..15598f3181 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java @@ -7,7 +7,6 @@ import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.style.FormatPane; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; - import com.fr.plugin.chart.area.VanChartAreaPlot; import com.fr.plugin.chart.bubble.VanChartBubblePlot; import com.fr.plugin.chart.column.VanChartColumnPlot; @@ -86,14 +85,15 @@ public class PlotFactory { autoAdjustLabelPlots.add(VanChartStructurePlot.class); } - public static boolean plotAutoAdjustLabelPosition(Plot plot){ + public static boolean plotAutoAdjustLabelPosition(Plot plot) { return autoAdjustLabelPlots.contains(plot.getClass()); } + /** - * * 标签Map */ private static Map, Class> labelMap = new HashMap, Class>(); + static { labelMap.put(VanChartGaugePlot.class, VanChartGaugePlotLabelPane.class); labelMap.put(VanChartScatterPlot.class, VanChartScatterPlotLabelPane.class); @@ -104,6 +104,7 @@ public class PlotFactory { * 图例Map */ private static Map, Class> legendMap = new HashMap, Class>(); + static { legendMap.put(VanChartGaugePlot.class, VanLegendPaneWidthOutHighlight.class); legendMap.put(VanChartMultiPiePlot.class, VanLegendPaneWidthOutHighlight.class); @@ -119,6 +120,7 @@ public class PlotFactory { * 数据点提示Map */ private static Map, Class> toolTipMap = new HashMap, Class>(); + static { toolTipMap.put(VanChartGaugePlot.class, VanChartGaugePlotTooltipPane.class); toolTipMap.put(VanChartScatterPlot.class, VanChartScatterPlotTooltipPane.class); @@ -156,18 +158,19 @@ public class PlotFactory { } - /** * 监控刷新 自动数据点提示Map */ private static Map, Class> refreshToolTipMap = new HashMap, Class>(); + static { refreshToolTipMap.put(VanChartGaugePlot.class, VanChartGaugePlotRefreshTooltipPane.class); refreshToolTipMap.put(VanChartBubblePlot.class, VanChartBubbleRefreshTooltipPane.class); } + private static Map, Class> refreshTooltipContentMap = new HashMap, Class>(); static { @@ -186,18 +189,19 @@ public class PlotFactory { /** * 根据图表类型创建标签界面 - * @param plot 图表 + * + * @param plot 图表 * @param stylePane 样式界面 * @return 标签界面 */ public static VanChartPlotLabelPane createPlotLabelPane(Plot plot, VanChartStylePane stylePane) { Class key = plot.getClass(); - if(labelMap.containsKey(key)){ - try{ + if (labelMap.containsKey(key)) { + try { Class cl = labelMap.get(key); - Constructor constructor = cl.getConstructor(Plot.class, VanChartStylePane.class); + Constructor constructor = cl.getConstructor(Plot.class, VanChartStylePane.class); return constructor.newInstance(plot, stylePane); - } catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -206,18 +210,19 @@ public class PlotFactory { /** * 根据图表类型创建图例界面 - * @param plot 图表 + * + * @param plot 图表 * @param stylePane 样式界面 * @return 图例界面 */ public static VanChartPlotLegendPane createPlotLegendPane(Plot plot, VanChartStylePane stylePane) { Class key = plot.getClass(); - if(legendMap.containsKey(key)){ - try{ + if (legendMap.containsKey(key)) { + try { Class cl = legendMap.get(key); - Constructor constructor = cl.getConstructor(VanChartStylePane.class); + Constructor constructor = cl.getConstructor(VanChartStylePane.class); return constructor.newInstance(stylePane); - } catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -226,18 +231,19 @@ public class PlotFactory { /** * 根据图表类型创建数据点提示界面 - * @param plot 图表 + * + * @param plot 图表 * @param stylePane 样式界面 * @return 数据点提示界面 */ - public static VanChartPlotTooltipPane createPlotTooltipPane(Plot plot, VanChartStylePane stylePane) { + public static VanChartPlotTooltipPane createPlotTooltipPane(Plot plot, VanChartStylePane stylePane) { Class key = plot.getClass(); - if(toolTipMap.containsKey(key)){ - try{ + if (toolTipMap.containsKey(key)) { + try { Class cl = toolTipMap.get(key); - Constructor constructor = cl.getConstructor(Plot.class, VanChartStylePane.class); + Constructor constructor = cl.getConstructor(Plot.class, VanChartStylePane.class); return constructor.newInstance(plot, stylePane); - } catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -246,19 +252,20 @@ public class PlotFactory { /** * 根据图表类型创建标签的具体内容界面.分类名系列名等 - * @param plot 图表 - * @param parent 样式界面 + * + * @param plot 图表 + * @param parent 样式界面 * @param showOnPane formatpane用到 * @return 标签的具体内容界面 */ - public static VanChartTooltipContentPane createPlotLabelContentPane(Plot plot, VanChartStylePane parent, JPanel showOnPane){ + public static VanChartTooltipContentPane createPlotLabelContentPane(Plot plot, VanChartStylePane parent, JPanel showOnPane) { Class key = plot.getClass(); - if(labelContentMap.containsKey(key)){ - try{ + if (labelContentMap.containsKey(key)) { + try { Class cl = labelContentMap.get(key); - Constructor constructor = cl.getConstructor(VanChartStylePane.class, JPanel.class); + Constructor constructor = cl.getConstructor(VanChartStylePane.class, JPanel.class); return constructor.newInstance(parent, showOnPane); - } catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -267,19 +274,20 @@ public class PlotFactory { /** * 根据图表类型创建数据点提示的具体内容界面.分类名系列名等 - * @param plot 图表 - * @param parent 样式界面 + * + * @param plot 图表 + * @param parent 样式界面 * @param showOnPane formatpane用到 * @return 数据点提示的具体内容界面 */ - public static VanChartTooltipContentPane createPlotTooltipContentPane(Plot plot, VanChartStylePane parent, JPanel showOnPane){ + public static VanChartTooltipContentPane createPlotTooltipContentPane(Plot plot, VanChartStylePane parent, JPanel showOnPane) { Class key = plot.getClass(); - if(tooltipContentMap.containsKey(key)){ - try{ + if (tooltipContentMap.containsKey(key)) { + try { Class cl = tooltipContentMap.get(key); - Constructor constructor = cl.getConstructor(VanChartStylePane.class, JPanel.class); + Constructor constructor = cl.getConstructor(VanChartStylePane.class, JPanel.class); return constructor.newInstance(parent, showOnPane); - } catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -287,56 +295,59 @@ public class PlotFactory { } - /** * 根据图表类型创建数据点提示界面 + * * @param plot 图表 * @return 数据点提示界面 */ public static VanChartPlotTooltipPane createPlotRefreshTooltipPane(Plot plot) { Class key = plot.getClass(); - if(refreshToolTipMap.containsKey(key)){ - try{ + if (refreshToolTipMap.containsKey(key)) { + try { Class cl = refreshToolTipMap.get(key); - Constructor constructor = cl.getConstructor(Plot.class); + Constructor constructor = cl.getConstructor(Plot.class); return constructor.newInstance(plot); - } catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } return new VanChartPlotRefreshTooltipPane(plot); } + /** * 根据图表类型创建监控刷新中数据点提示的具体内容界面.分类名系列名等 - * @param plot 图表 - * @param parent 交互属性界面 + * + * @param plot 图表 + * @param parent 交互属性界面 * @param showOnPane formatpane用到 * @return 数据点提示的具体内容界面 */ - public static VanChartTooltipContentPane createPlotRefreshTooltipContentPane(Plot plot, VanChartStylePane parent, JPanel showOnPane){ + public static VanChartTooltipContentPane createPlotRefreshTooltipContentPane(Plot plot, VanChartStylePane parent, JPanel showOnPane) { Class key = plot.getClass(); - if(refreshTooltipContentMap.containsKey(key)){ - try{ + if (refreshTooltipContentMap.containsKey(key)) { + try { Class cl = refreshTooltipContentMap.get(key); - Constructor constructor = cl.getConstructor(VanChartStylePane.class, JPanel.class); + Constructor constructor = cl.getConstructor(VanChartStylePane.class, JPanel.class); return constructor.newInstance(parent, showOnPane); - } catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } return new VanChartRefreshTooltipContentPane(parent, showOnPane); } - public static FormatPane createAutoFormatPane(){ - FormatPane formatPane = new FormatPane(){ - protected Component[][] getComponent (JPanel fontPane, JPanel centerPane, JPanel typePane) { + public static FormatPane createAutoFormatPane() { + FormatPane formatPane = new FormatPane() { + protected Component[][] getComponent(JPanel fontPane, JPanel centerPane, JPanel typePane) { typePane.setBorder(BorderFactory.createEmptyBorder()); return new Component[][]{ - new Component[]{typePane,null}, + new Component[]{typePane, null}, new Component[]{centerPane, null}, }; } - protected UIComboBoxRenderer createComBoxRender(){ + + protected UIComboBoxRenderer createComBoxRender() { return new UIComboBoxRenderer() { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { @@ -361,12 +372,8 @@ public class PlotFactory { /** * 判断是否为大数据模式 */ - public static boolean largeDataModel(Plot plot){ - return plot != null && plot.getDataProcessor().getMark() == LargeDataModel.MARK; - } - - public static boolean lineMapLargeModel(Plot plot){ - return plot instanceof VanChartMapPlot && ((VanChartMapPlot) plot).getLineMapDataProcessor().getMark() == LargeDataModel.MARK; + public static boolean largeDataModel(Plot plot) { + return plot != null && plot.convertDataProcessor().getMark() == LargeDataModel.MARK; } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java index ee7dff9dc5..c26f90bc15 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java @@ -2,10 +2,15 @@ package com.fr.van.chart.designer.other; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.attr.LargeDataAttribute; +import com.fr.chartx.attr.LargeDataModeType; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.plugin.chart.attr.axis.VanChartAxis; @@ -22,7 +27,10 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.other.zoom.ZoomPane; import javax.swing.JPanel; +import java.awt.BorderLayout; import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; public class VanChartInteractivePane extends AbstractVanChartScrollPane { @@ -34,6 +42,10 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { protected UICheckBox fullScreenDisplay; protected UIToggleButton collapse; + protected VanChart chart; + private UIComboBox largeDataMode; + private UISpinner largeModeThresholdNumber; + protected UIButtonGroup isChartAnimation; //坐标轴翻转属性 @@ -44,12 +56,12 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { private ZoomPane zoomPane; protected VanChartHyperLinkPane superLink; - - protected Chart chart; + private JPanel largeModeThresholdNumberPane; protected JPanel interactivePane; /** * 界面标题. + * * @return 返回标题. */ @@ -63,7 +75,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { return new JPanel(); } - private void reLayoutContentPane(VanChartPlot plot){ + private void reLayoutContentPane(VanChartPlot plot) { if (interactivePane != null) { interactivePane.removeAll(); } @@ -71,26 +83,64 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { reloaPane(interactivePane); } - protected JPanel getInteractivePane(VanChartPlot plot){ + protected JPanel getInteractivePane(VanChartPlot plot) { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double[] columnSize = {f, e}; - double[] rowSize = {p,p,p,p,p,p}; + double[] rowSize = {p, p, p, p, p, p}; Component[][] components = new Component[][]{ - new Component[]{createToolBarPane(getToolBarRowSize(), columnSize),null}, - new Component[]{createAnimationPane(),null}, - new Component[]{createAxisRotationPane(new double[]{p,p}, columnSize, plot),null}, - new Component[]{createZoomPane(new double[]{p,p,p}, columnSize, plot),null}, - new Component[]{createAutoRefreshPane(plot),null}, - new Component[]{createHyperlinkPane(),null} + new Component[]{createToolBarPane(getToolBarRowSize(), columnSize), null}, + new Component[]{createLargeDataModePane(), null}, + new Component[]{createAnimationPane(), null}, + new Component[]{createAxisRotationPane(new double[]{p, p}, columnSize, plot), null}, + new Component[]{createZoomPane(new double[]{p, p, p}, columnSize, plot), null}, + new Component[]{createAutoRefreshPane(plot), null}, + new Component[]{createHyperlinkPane(), null} }; return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } + private JPanel createLargeDataModePane() { + if (!isCurrentChartSupportLargeDataMode()) { + return null; + } + largeDataMode = new UIComboBox(new LargeDataModeType[]{LargeDataModeType.CLOSE, LargeDataModeType.OPEN_BEYOND_THRESHOLD}); + largeModeThresholdNumber = new UISpinner(0, Integer.MAX_VALUE, 100, chart.getPlot().getLargeDataAttribute().getLargeModeThresholdNumber()); + + largeDataMode.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkLargeDataMode(); + } + }); + + Component[][] comps1 = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Large_Model")), largeDataMode} + }; + Component[][] comps2 = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Threshold_Number")), largeModeThresholdNumber} + }; + + double[] row = {TableLayout.PREFERRED}, col = {TableLayout.FILL, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}; + + + JPanel contentPane = new JPanel(new BorderLayout(0, 6)); + + contentPane.add(TableLayout4VanChartHelper.createGapTableLayoutPane(comps1, row, col), BorderLayout.CENTER); + largeModeThresholdNumberPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps2, row, col); + contentPane.add(largeModeThresholdNumberPane, BorderLayout.SOUTH); + + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Large_Data"), contentPane); + } + + protected boolean isCurrentChartSupportLargeDataMode() { + return false; + } + protected JPanel createZoomPane(double[] row, double[] col, VanChartPlot plot) { zoomPane = createZoomPane(); if (zoomPane == null) { @@ -103,23 +153,23 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { return null; } - private JPanel createAxisRotationPane(double[] row, double[] col, VanChartPlot plot){ - if (!(plot.getAxisPlotType() == AxisPlotType.RECTANGLE)){ + private JPanel createAxisRotationPane(double[] row, double[] col, VanChartPlot plot) { + if (!(plot.getAxisPlotType() == AxisPlotType.RECTANGLE)) { return null; } axisRotation = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); Component[][] components = new Component[][]{ - new Component[]{null,null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Reversal")),axisRotation} + new Component[]{null, null}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Reversal")), axisRotation} }; JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis"), panel); } - protected JPanel createToolBarPane(double[] row, double[] col){ + protected JPanel createToolBarPane(double[] row, double[] col) { isSort = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Sort")); exportImages = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Export_Image")); fullScreenDisplay = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_FullScreen_Display")); @@ -131,17 +181,17 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_ToolBar"), panel); } - protected double[] getToolBarRowSize () { + protected double[] getToolBarRowSize() { double p = TableLayout.PREFERRED; - return new double[]{p,p,p,p,p}; + return new double[]{p, p, p, p, p}; } protected Component[][] createToolBarComponents() { return new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content")),isSort}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content")), isSort}, new Component[]{null, exportImages}, new Component[]{null, fullScreenDisplay}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout")),collapse}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout")), collapse}, }; } @@ -149,18 +199,18 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { return new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content")), exportImages}, new Component[]{null, fullScreenDisplay}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout")),collapse} + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout")), collapse} }; } - protected JPanel createAnimationPane(){ + protected JPanel createAnimationPane() { isChartAnimation = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Animation_Effects"), isChartAnimation); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Animation"), panel); } - protected JPanel createAutoRefreshPane(VanChartPlot plot){ + protected JPanel createAutoRefreshPane(VanChartPlot plot) { autoRefreshPane = getMoreLabelPane(plot); @@ -169,7 +219,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { protected AutoRefreshPane getMoreLabelPane(VanChartPlot plot) { boolean isLargeModel = largeModel(plot); - return new AutoRefreshPane((VanChart) chart, isLargeModel); + return new AutoRefreshPane(chart, isLargeModel); } protected JPanel createHyperlinkPane() { @@ -177,31 +227,35 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Insert_Hyperlink"), superLink); } + private void checkLargeDataMode() { + largeModeThresholdNumberPane.setVisible(largeDataMode.getSelectedItem() == LargeDataModeType.OPEN_BEYOND_THRESHOLD); + } @Override public void populateBean(Chart chart) { if (chart == null || chart.getPlot() == null) { return; } - this.chart = chart; + this.chart = (VanChart) chart; VanChartPlot plot = chart.getPlot(); - if(interactivePane == null){ + if (interactivePane == null) { this.remove(leftcontentPane); reLayoutContentPane(plot); } if (zoomPane != null) { - zoomPane.populateBean(((VanChart) chart).getZoomAttribute()); + zoomPane.populateBean(this.chart.getZoomAttribute()); } - if (plot.getAxisPlotType() == AxisPlotType.RECTANGLE){ + if (plot.getAxisPlotType() == AxisPlotType.RECTANGLE) { populateChartAxisRotation(plot); } - populateChartTools((VanChart) chart); - populateChartAnimate(chart, plot); - populateAutoRefresh((VanChart)chart); + populateChartTools(this.chart); + populateLargeMode(plot); + populateChartAnimate(this.chart, plot); + populateAutoRefresh(this.chart); populateHyperlink(plot); } @@ -219,12 +273,21 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { collapse.setSelected(vanChartTools.isHidden()); } + private void populateLargeMode(Plot plot) { + if (largeDataMode != null) { + LargeDataAttribute attribute = plot.getLargeDataAttribute(); + + largeDataMode.setSelectedItem(attribute.getLargeDataModeType()); + largeModeThresholdNumber.setValue(attribute.getLargeModeThresholdNumber()); + } + } + private void populateChartAxisRotation(VanChartPlot plot) { axisRotation.setSelectedIndex(plot.isAxisRotation() ? 0 : 1); } private void populateChartAnimate(Chart chart, Plot plot) { - if(plot.isSupportAnimate()) { + if (plot.isSupportAnimate()) { isChartAnimation.setSelectedIndex(chart.isJSDraw() ? 0 : 1); isChartAnimation.setEnabled(!largeModel(plot)); } @@ -235,11 +298,11 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { } protected void populateAutoRefresh(VanChart chart) { - VanChartPlot plot = (VanChartPlot)chart.getPlot(); + VanChartPlot plot = chart.getPlot(); RefreshMoreLabel refreshMoreLabel = chart.getRefreshMoreLabel(); - if(refreshMoreLabel == null) { - refreshMoreLabel = new RefreshMoreLabel(((VanChartPlot)chart.getPlot()).getAutoAttrTooltip()); + if (refreshMoreLabel == null) { + refreshMoreLabel = new RefreshMoreLabel(((VanChartPlot) chart.getPlot()).getAutoAttrTooltip()); } autoRefreshPane.populateBean(refreshMoreLabel); @@ -252,22 +315,24 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { return; } + VanChart vanChart = (VanChart) chart; VanChartPlot plot = chart.getPlot(); if (zoomPane != null) { - ((VanChart) chart).setZoomAttribute(zoomPane.updateBean()); + vanChart.setZoomAttribute(zoomPane.updateBean()); } - if(plot.getAxisPlotType() == AxisPlotType.RECTANGLE){ - updateChartAxisRotation((VanChart)chart); + if (plot.getAxisPlotType() == AxisPlotType.RECTANGLE) { + updateChartAxisRotation(vanChart); } - updateChartTools((VanChart)chart); - updateChartAnimate(chart, plot); - updateAutoRefresh((VanChart)chart); + updateChartTools(vanChart); + updateChartAnimate(vanChart, plot); + updateLargeData(plot); + updateAutoRefresh(vanChart); updateHyperlink(plot); } - protected void updateHyperlink(Plot plot){ + protected void updateHyperlink(Plot plot) { superLink.update(plot); } @@ -282,7 +347,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { private void updateChartAxisRotation(VanChart chart) { //坐标轴和plot都需要这个属性,因为坐标轴和plot是分开画的 - VanChartPlot plot = (VanChartPlot) chart.getPlot(); + VanChartPlot plot = chart.getPlot(); plot.setAxisRotation(axisRotation.getSelectedIndex() == 0); //同时更新坐标轴旋转属性 for (VanChartAxis axis : ((VanChartRectanglePlot) plot).getXAxisList()) { @@ -294,14 +359,23 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { } //更新数据表属性 - if (plot.isAxisRotation()){ + if (plot.isAxisRotation()) { plot.getDataSheet().setVisible(false); } } + private void updateLargeData(Plot plot) { + if (largeDataMode != null) { + LargeDataAttribute attribute = new LargeDataAttribute(); + attribute.setLargeDataModeType((LargeDataModeType) largeDataMode.getSelectedItem()); + attribute.setLargeModeThresholdNumber(largeModeThresholdNumber.getValue()); + plot.setLargeDataAttribute(attribute); + } + } + private void updateChartAnimate(Chart chart, Plot plot) { - if(plot.isSupportAnimate()) { - chart.setJSDraw(isChartAnimation.getSelectedIndex()==0); + if (plot.isSupportAnimate()) { + chart.setJSDraw(isChartAnimation.getSelectedIndex() == 0); } } @@ -309,15 +383,15 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { private void updateAutoRefresh(VanChart chart) { RefreshMoreLabel refreshMoreLabel = chart.getRefreshMoreLabel(); - if(refreshMoreLabel == null) { - refreshMoreLabel = new RefreshMoreLabel(((VanChartPlot)chart.getPlot()).getAutoAttrTooltip()); + if (refreshMoreLabel == null) { + refreshMoreLabel = new RefreshMoreLabel(((VanChartPlot) chart.getPlot()).getAutoAttrTooltip()); chart.setRefreshMoreLabel(refreshMoreLabel); } autoRefreshPane.updateBean(refreshMoreLabel); } @Override - public Chart updateBean() { + public VanChart updateBean() { return null; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java index efc91258a0..1b9d15ea6b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java @@ -1,8 +1,5 @@ package com.fr.van.chart.designer.style.series; -import com.fr.base.chart.chartdata.model.DataProcessor; -import com.fr.base.chart.chartdata.model.LargeDataModel; -import com.fr.base.chart.chartdata.model.NormalDataModel; import com.fr.chart.base.AttrAlpha; import com.fr.chart.base.AttrBorder; import com.fr.chart.base.ChartConstants; @@ -10,11 +7,9 @@ import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionCollection; import com.fr.design.gui.frpane.UINumberDragPane; -import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane; import com.fr.design.mainframe.chart.gui.style.series.AbstractPlotSeriesPane; - import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; @@ -28,6 +23,7 @@ import com.fr.plugin.chart.base.VanChartAttrTrendLine; import com.fr.plugin.chart.map.line.condition.AttrLineEffect; import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel; import com.fr.van.chart.custom.style.VanChartCustomStylePane; +import com.fr.van.chart.designer.PlotFactory; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartAreaSeriesFillColorPane; import com.fr.van.chart.designer.component.VanChartBeautyPane; @@ -41,8 +37,6 @@ import com.fr.van.chart.pie.RadiusCardLayoutPane; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import java.awt.BorderLayout; /** @@ -73,11 +67,9 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP private RadiusCardLayoutPane radiusPane;//半径设置界面 private JPanel radiusPaneWithTitle; - private UIButtonGroup largeDataModelGroup;//大数据模式 - protected JPanel contentPane; - public VanChartAbstractPlotSeriesPane(ChartStylePane parent, Plot plot){ + public VanChartAbstractPlotSeriesPane(ChartStylePane parent, Plot plot) { super(parent, plot); } @@ -110,17 +102,17 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP } //获取颜色面板 - protected JPanel getColorPane () { + protected JPanel getColorPane() { JPanel panel = new JPanel(new BorderLayout()); stylePane = createStylePane(); setColorPaneContent(panel); JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color"), panel); - panel.setBorder(BorderFactory.createEmptyBorder(10,5,0,0)); + panel.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); return panel.getComponentCount() == 0 ? null : colorPane; } //设置色彩面板内容 - protected void setColorPaneContent (JPanel panel) { + protected void setColorPaneContent(JPanel panel) { if (stylePane != null) { panel.add(stylePane, BorderLayout.CENTER); } @@ -165,57 +157,28 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP protected JPanel createRadiusPane() { radiusPane = initRadiusPane(); radiusPaneWithTitle = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Radius_Set"), radiusPane); - return ((VanChartPlot)plot).isInCustom() ? null : radiusPaneWithTitle; - } - - protected JPanel createLargeDataModelPane() { - largeDataModelGroup = createLargeDataModelGroup(); - largeDataModelGroup.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - checkLarge(); - } - }); - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Large_Model"), largeDataModelGroup); - return createLargeDataModelPane(panel); - } - - protected void checkLarge() { - if(largeModel()) { - AttrLabel attrLabel = ((VanChartPlot) plot).getAttrLabelFromConditionCollection(); - if (attrLabel == null) { - attrLabel = ((VanChartPlot) this.plot).getDefaultAttrLabel(); - ConditionAttr defaultAttr = plot.getConditionCollection().getDefaultAttr(); - defaultAttr.addDataSeriesCondition(attrLabel); - } - attrLabel.setEnable(false); - - resetCustomCondition(plot.getConditionCollection()); - } - - - checkCompsEnabledWithLarge(); + return ((VanChartPlot) plot).isInCustom() ? null : radiusPaneWithTitle; } - protected void checkCompsEnabledWithLarge() { - if(markerPane != null && largeDataModelGroup != null){ - markerPane.checkLargePlot(largeModel()); + protected void checkCompsEnabledWithLarge(Plot plot) { + if (markerPane != null) { + markerPane.checkLargePlot(largeModel(plot)); } } protected void checkLinePane() { - if(lineTypePane != null && largeDataModelGroup != null){ - lineTypePane.checkLarge(largeModel()); + if (lineTypePane != null) { + lineTypePane.checkLarge(largeModel(plot)); } } - protected boolean largeModel() { - return largeDataModelGroup != null && largeDataModelGroup.getSelectedIndex() == 0; + protected boolean largeModel(Plot plot) { + return PlotFactory.largeDataModel(plot); } protected void resetCustomCondition(ConditionCollection conditionCollection) { - for(int i = 0, len = conditionCollection.getConditionAttrSize(); i < len; i++){ + for (int i = 0, len = conditionCollection.getConditionAttrSize(); i < len; i++) { ConditionAttr conditionAttr = conditionCollection.getConditionAttr(i); conditionAttr.remove(AttrLabel.class); conditionAttr.remove(ScatterAttrLabel.class); @@ -223,23 +186,12 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP conditionAttr.remove(AttrLineEffect.class); VanChartAttrMarker attrMarker = conditionAttr.getExisted(VanChartAttrMarker.class); - if(attrMarker != null && !attrMarker.isCommon()){ + if (attrMarker != null && !attrMarker.isCommon()) { conditionAttr.remove(VanChartAttrMarker.class); } } } - protected JPanel createLargeDataModelPane(JPanel jPanel) { - JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Large_Data"), jPanel); - return panel; - } - - protected UIButtonGroup createLargeDataModelGroup() { - String[] strings = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}; - DataProcessor[] values = new DataProcessor[]{new LargeDataModel(), new NormalDataModel()}; - return new UIButtonGroup(strings, values); - } - protected RadiusCardLayoutPane initRadiusPane() { return new RadiusCardLayoutPane(); } @@ -258,7 +210,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP //堆积和坐标轴设置(自定义柱形图等用到) protected JPanel createStackedAndAxisPane() { stackAndAxisEditPane = new VanChartStackedAndAxisListControlPane(); - stackAndAxisEditExpandablePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(stackAndAxisEditPane.getPaneTitle(), stackAndAxisEditPane); + stackAndAxisEditExpandablePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(stackAndAxisEditPane.getPaneTitle(), stackAndAxisEditPane); return stackAndAxisEditExpandablePane; } @@ -272,7 +224,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP * 更新Plot的属性到系列界面 */ public void populateBean(Plot plot) { - if(plot == null) { + if (plot == null) { return; } @@ -280,24 +232,20 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP super.populateBean(plot);//配色 - if(stylePane != null){//风格 + if (stylePane != null) {//风格 stylePane.populateBean(plot.getPlotStyle()); } - if(largeDataModelGroup != null){ - largeDataModelGroup.setSelectedItem(plot.getDataProcessor()); - } - - if(stackAndAxisEditPane != null && plot instanceof VanChartRectanglePlot){//堆积和坐标轴 - VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot)plot; - if(rectanglePlot.isCustomChart()){ + if (stackAndAxisEditPane != null && plot instanceof VanChartRectanglePlot) {//堆积和坐标轴 + VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot) plot; + if (rectanglePlot.isCustomChart()) { stackAndAxisEditPane.populate(rectanglePlot); } else { removeStackWholePane(); } } - if(radiusPane != null && plot instanceof VanChartRadiusPlot){ + if (radiusPane != null && plot instanceof VanChartRadiusPlot) { radiusPane.populateBean(plot); checkRadiusPane(plot); } @@ -306,17 +254,18 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP checkAreaSeriesFillColorPane(plot.getPlotStyle()); - checkCompsEnabledWithLarge(); + checkCompsEnabledWithLarge(plot); } /** * radius界面是否显示 + * * @param plot */ private void checkRadiusPane(Plot plot) { radiusPaneWithTitle.setVisible(true); - if (plot instanceof VanChartPlot){ - if (((VanChartPlot) plot).isInCustom()){ + if (plot instanceof VanChartPlot) { + if (((VanChartPlot) plot).isInCustom()) { radiusPaneWithTitle.setVisible(false); } } @@ -326,7 +275,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP * 保存 系列界面的属性到Plot */ public void updateBean(Plot plot) { - if(plot == null) { + if (plot == null) { return; } @@ -335,22 +284,18 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP super.updateBean(plot);//配色 - if(stylePane != null){//风格 + if (stylePane != null) {//风格 plot.setPlotStyle(stylePane.updateBean()); } - if(largeDataModelGroup != null){ - plot.setDataProcessor(largeDataModelGroup.getSelectedItem()); - } - - if(stackAndAxisEditPane != null && plot instanceof VanChartRectanglePlot){//堆积和坐标轴 - VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot)plot; - if(rectanglePlot.isCustomChart()){ + if (stackAndAxisEditPane != null && plot instanceof VanChartRectanglePlot) {//堆积和坐标轴 + VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot) plot; + if (rectanglePlot.isCustomChart()) { stackAndAxisEditPane.update(rectanglePlot); } } - if (radiusPane != null && plot instanceof VanChartRadiusPlot){ + if (radiusPane != null && plot instanceof VanChartRadiusPlot) { radiusPane.updateBean(plot); checkRadiusPane(plot); } @@ -360,47 +305,47 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP checkAreaSeriesFillColorPane(plot.getPlotStyle()); } - protected void checkoutMapType(Plot plot){ + protected void checkoutMapType(Plot plot) { } - protected void checkAreaSeriesFillColorPane(int plotStyle){ + protected void checkAreaSeriesFillColorPane(int plotStyle) { if (areaSeriesFillColorPane != null) { areaSeriesFillColorPane.checkoutAlpha(plotStyle == ChartConstants.STYLE_NONE); } } - protected void populateCondition(ConditionAttr defaultAttr){ - if(trendLinePane != null){//趋势线 - VanChartAttrTrendLine attrTrendLine =(VanChartAttrTrendLine)defaultAttr.getExisted(VanChartAttrTrendLine.class); + protected void populateCondition(ConditionAttr defaultAttr) { + if (trendLinePane != null) {//趋势线 + VanChartAttrTrendLine attrTrendLine = defaultAttr.getExisted(VanChartAttrTrendLine.class); trendLinePane.populate(attrTrendLine); } - if(lineTypePane != null){//线-线型、控制断开等 - VanChartAttrLine attrLine = (VanChartAttrLine)defaultAttr.getExisted(VanChartAttrLine.class); + if (lineTypePane != null) {//线-线型、控制断开等 + VanChartAttrLine attrLine = defaultAttr.getExisted(VanChartAttrLine.class); lineTypePane.populate(attrLine); } - if(markerPane != null){//标记点 - VanChartAttrMarker attrMarker = (VanChartAttrMarker)defaultAttr.getExisted(VanChartAttrMarker.class); + if (markerPane != null) {//标记点 + VanChartAttrMarker attrMarker = defaultAttr.getExisted(VanChartAttrMarker.class); markerPane.populate(attrMarker); } - if(areaSeriesFillColorPane != null){//填充颜色 - AttrAreaSeriesFillColorBackground seriesFillColorBackground = (AttrAreaSeriesFillColorBackground)defaultAttr.getExisted(AttrAreaSeriesFillColorBackground.class); + if (areaSeriesFillColorPane != null) {//填充颜色 + AttrAreaSeriesFillColorBackground seriesFillColorBackground = defaultAttr.getExisted(AttrAreaSeriesFillColorBackground.class); areaSeriesFillColorPane.populate(seriesFillColorBackground); } - if(borderPane != null){//边框 - AttrBorder attrBorder = (AttrBorder)defaultAttr.getExisted(AttrBorder.class); - if(attrBorder != null){ + if (borderPane != null) {//边框 + AttrBorder attrBorder = defaultAttr.getExisted(AttrBorder.class); + if (attrBorder != null) { borderPane.populate(attrBorder); } } populateAlpha(defaultAttr); } - protected void populateAlpha(ConditionAttr defaultAttr){ - if(transparent != null){//不透明度 - AttrAlpha attrAlpha = (AttrAlpha)defaultAttr.getExisted(AttrAlpha.class); - if(attrAlpha != null){ + protected void populateAlpha(ConditionAttr defaultAttr) { + if (transparent != null) {//不透明度 + AttrAlpha attrAlpha = defaultAttr.getExisted(AttrAlpha.class); + if (attrAlpha != null) { transparent.populateBean(attrAlpha.getAlpha() * VanChartAttrHelper.PERCENT); } else { //初始值为100 @@ -409,35 +354,35 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP } } - protected void updateCondition(ConditionAttr defaultAttr){ - if(trendLinePane != null){ + protected void updateCondition(ConditionAttr defaultAttr) { + if (trendLinePane != null) { VanChartAttrTrendLine newTrendLine = trendLinePane.update(); - VanChartAttrTrendLine attrTrendLine =(VanChartAttrTrendLine)defaultAttr.getExisted(VanChartAttrTrendLine.class); + VanChartAttrTrendLine attrTrendLine = defaultAttr.getExisted(VanChartAttrTrendLine.class); defaultAttr.remove(attrTrendLine); defaultAttr.addDataSeriesCondition(newTrendLine); } - if(lineTypePane != null){ - VanChartAttrLine attrLine = (VanChartAttrLine)defaultAttr.getExisted(VanChartAttrLine.class); + if (lineTypePane != null) { + VanChartAttrLine attrLine = defaultAttr.getExisted(VanChartAttrLine.class); defaultAttr.remove(attrLine); defaultAttr.addDataSeriesCondition(lineTypePane.update()); } - if(markerPane != null){ + if (markerPane != null) { VanChartAttrMarker newMarker = markerPane.update(); - VanChartAttrMarker attrMarker = (VanChartAttrMarker)defaultAttr.getExisted(VanChartAttrMarker.class); + VanChartAttrMarker attrMarker = defaultAttr.getExisted(VanChartAttrMarker.class); defaultAttr.remove(attrMarker); defaultAttr.addDataSeriesCondition(newMarker); } - if(areaSeriesFillColorPane != null){ + if (areaSeriesFillColorPane != null) { AttrAreaSeriesFillColorBackground newFillColorBackground = areaSeriesFillColorPane.update(); AttrAreaSeriesFillColorBackground oldFillColorBackground = defaultAttr.getExisted(AttrAreaSeriesFillColorBackground.class); - if(oldFillColorBackground != null){ + if (oldFillColorBackground != null) { defaultAttr.remove(oldFillColorBackground); } defaultAttr.addDataSeriesCondition(newFillColorBackground); } - if(borderPane != null){ - AttrBorder attrBorder = (AttrBorder)defaultAttr.getExisted(AttrBorder.class); - if(attrBorder == null){ + if (borderPane != null) { + AttrBorder attrBorder = defaultAttr.getExisted(AttrBorder.class); + if (attrBorder == null) { attrBorder = new AttrBorder(); defaultAttr.addDataSeriesCondition(attrBorder); } @@ -446,14 +391,14 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP updateAlpha(defaultAttr); } - protected void updateAlpha(ConditionAttr defaultAttr){ - if(transparent != null){ - AttrAlpha attrAlpha = (AttrAlpha)defaultAttr.getExisted(AttrAlpha.class); - if(attrAlpha == null){ + protected void updateAlpha(ConditionAttr defaultAttr) { + if (transparent != null) { + AttrAlpha attrAlpha = defaultAttr.getExisted(AttrAlpha.class); + if (attrAlpha == null) { attrAlpha = new AttrAlpha(); defaultAttr.addDataSeriesCondition(attrAlpha); } - attrAlpha.setAlpha((float)(transparent.updateBean()/VanChartAttrHelper.PERCENT)); + attrAlpha.setAlpha((float) (transparent.updateBean() / VanChartAttrHelper.PERCENT)); } } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java index 7868c4aafc..1f705c9c94 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java @@ -6,9 +6,9 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; - import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; +import com.fr.plugin.chart.vanchart.VanChart; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.background.VanChartBackgroundPaneWithOutImageAndShadow; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithMapZoom; @@ -32,31 +32,31 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith private JPanel drillPane; @Override - protected JPanel getInteractivePane(VanChartPlot plot){ + protected JPanel getInteractivePane(VanChartPlot plot) { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double[] columnSize = {f, e}; double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p}; Component[][] components = new Component[][]{ - new Component[]{createToolBarPane(new double[]{p, p, p}, columnSize),null}, - new Component[]{createAnimationPane(),null}, - new Component[]{createZoomPane(new double[]{p,p,p}, columnSize, plot),null}, + new Component[]{createToolBarPane(new double[]{p, p, p}, columnSize), null}, + new Component[]{createAnimationPane(), null}, + new Component[]{createZoomPane(new double[]{p, p, p}, columnSize, plot), null}, new Component[]{createDrillToolsPane(), null}, - new Component[]{createAutoRefreshPane(plot),null}, - new Component[]{createHyperlinkPane(),null} + new Component[]{createAutoRefreshPane(plot), null}, + new Component[]{createHyperlinkPane(), null} }; - return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } private JPanel createDrillToolsPane() { openOrClose = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); JPanel openOrClosePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Drill_Dir"), openOrClose); - textAttrPane = new ChartTextAttrPane(){ + textAttrPane = new ChartTextAttrPane() { @Override - protected JPanel getContentPane (JPanel buttonPane) { + protected JPanel getContentPane(JPanel buttonPane) { double p = TableLayout.PREFERRED; double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; double[] columnSize = {e}; @@ -80,7 +80,7 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {f}; - double[] rowSize = {p,p,p,p,p,p}; + double[] rowSize = {p, p, p, p, p, p}; Component[][] components = new Component[][]{ new Component[]{null}, new Component[]{createTitlePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), textAttrPane)}, @@ -88,7 +88,7 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith new Component[]{createTitlePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Select_Color"), selectBackgroundPane)}, new Component[]{catalogSuperLink} }; - drillPane = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + drillPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel panel = new JPanel(new BorderLayout()); panel.add(openOrClosePane, BorderLayout.NORTH); @@ -102,13 +102,13 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith }); JPanel panel1 = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Drill"), panel); - panel.setBorder(BorderFactory.createEmptyBorder(10,5,0,0)); + panel.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); return panel1; } private JPanel createTitlePane(String title, Component component) { JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(title, component, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); - panel.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); + panel.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); return panel; } @@ -123,9 +123,9 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith if (chart == null || chart.getPlot() == null) { return; } - this.chart = chart; - VanChartPlot plot = (VanChartPlot)chart.getPlot(); - if(plot instanceof VanChartDrillMapPlot){ + this.chart = (VanChart) chart; + VanChartPlot plot = chart.getPlot(); + if (plot instanceof VanChartDrillMapPlot) { DrillMapTools drillMapTools = ((VanChartDrillMapPlot) plot).getDrillMapTools(); openOrClose.setSelectedIndex(drillMapTools.isEnable() ? 0 : 1); textAttrPane.populate(drillMapTools.getTextAttr()); @@ -145,9 +145,9 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith return; } - VanChartPlot plot = (VanChartPlot) chart.getPlot(); + VanChartPlot plot = chart.getPlot(); - if(plot instanceof VanChartDrillMapPlot){ + if (plot instanceof VanChartDrillMapPlot) { DrillMapTools drillMapTools = ((VanChartDrillMapPlot) plot).getDrillMapTools(); drillMapTools.setEnable(openOrClose.getSelectedIndex() == 0); drillMapTools.setTextAttr(textAttrPane.update()); 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 2d07fda4df..657580f5cd 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 @@ -50,27 +50,33 @@ public class HeatMapIndependentVanChartInterface extends MapIndependentVanChartI } @Override - protected boolean areaPlot(Plot plot){ + protected boolean areaPlot(Plot plot) { return false; } - public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot) { return new VanChartHeatMapSeriesPane(parent, plot); } - public ConditionAttributesPane getPlotConditionPane(Plot plot){ + public ConditionAttributesPane getPlotConditionPane(Plot plot) { return new VanChartHeatMapConditionPane(plot); } /** * 图表的属性界面数组 + * * @return 属性界面 */ - public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ + public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener) { VanChartStylePane stylePane = new VanChartMapStylePane(listener); - VanChartOtherPane otherPane = new VanChartOtherPane(){ + VanChartOtherPane otherPane = new VanChartOtherPane() { protected BasicBeanPane createInteractivePane() { - return new VanChartInteractivePaneWithMapZoom(); + return new VanChartInteractivePaneWithMapZoom() { + @Override + protected boolean isCurrentChartSupportLargeDataMode() { + return true; + } + }; } }; return new AbstractChartAttrPane[]{stylePane, otherPane}; diff --git a/designer-chart/src/main/java/com/fr/van/chart/line/VanChartLineSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/line/VanChartLineSeriesPane.java index 21d5b60d37..5f37e3563c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/line/VanChartLineSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/line/VanChartLineSeriesPane.java @@ -12,24 +12,23 @@ import java.awt.Component; /** * 折线图的系列界面 */ -public class VanChartLineSeriesPane extends VanChartAbstractPlotSeriesPane{ +public class VanChartLineSeriesPane extends VanChartAbstractPlotSeriesPane { private static final long serialVersionUID = 5595016643808487932L; - public VanChartLineSeriesPane(ChartStylePane parent, Plot plot){ + public VanChartLineSeriesPane(ChartStylePane parent, Plot plot) { super(parent, plot); } - protected JPanel getContentInPlotType(){ + protected JPanel getContentInPlotType() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - double[] row = {p,p,p,p,p,p,p,p}; + double[] row = {p, p, p, p, p, p, p, p}; double[] col = {f}; Component[][] components = new Component[][]{ new Component[]{createLineTypePane()}, new Component[]{createMarkerPane()}, new Component[]{createStackedAndAxisPane()}, - new Component[]{createLargeDataModelPane()}, new Component[]{createTrendLinePane()}, }; diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java index df23244ccb..d9f5cc0e58 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java @@ -1,6 +1,5 @@ package com.fr.van.chart.map; -import com.fr.base.chart.chartdata.model.DataProcessor; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.design.gui.frpane.UINumberDragPane; @@ -12,7 +11,6 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.style.color.ColorSelectBox; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; - import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.base.AttrBorderWithAlpha; import com.fr.plugin.chart.base.AttrEffect; @@ -21,7 +19,6 @@ import com.fr.plugin.chart.base.VanChartAttrMarker; import com.fr.plugin.chart.bubble.attr.VanChartAttrBubble; import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; import com.fr.plugin.chart.map.VanChartMapPlot; -import com.fr.plugin.chart.map.attr.AttrMapLabel; import com.fr.plugin.chart.map.line.condition.AttrCurve; import com.fr.plugin.chart.map.line.condition.AttrLineEffect; import com.fr.plugin.chart.type.MapMarkerType; @@ -79,7 +76,6 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { //line private VanChartCurvePane curvePane; private VanChartLineMapEffectPane lineMapEffectPane; - private UIButtonGroup lineMapLargeDataModelGroup;//大数据模式 private MapType mapType = MapType.AREA; @@ -87,53 +83,20 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { super(parent, plot); } - @Override - protected void checkLarge() { - if(largeModel()) { - if(plot instanceof VanChartMapPlot) { - ConditionAttr defaultAttr = plot.getConditionCollection().getDefaultAttr(); - AttrMapLabel attrMapLabel = defaultAttr.getExisted(AttrMapLabel.class); - if(attrMapLabel == null){ - attrMapLabel = new AttrMapLabel(); - defaultAttr.addDataSeriesCondition(attrMapLabel); - } - attrMapLabel.getPointLabel().setEnable(false); - - resetCustomCondition(((VanChartMapPlot) plot).getPointConditionCollection()); - } - } - - checkPointCompsEnabledWithLarge(); + protected void checkCompsEnabledWithLarge(Plot plot) { + checkPointCompsEnabledWithLarge(plot); + checkLineCompsEnabledWithLarge(plot); } - protected void checkCompsEnabledWithLarge() { - checkPointCompsEnabledWithLarge(); - checkLineCompsEnabledWithLarge(); - } - - private void checkPointCompsEnabledWithLarge() { - if(pointEffectPane != null) { - GUICoreUtils.setEnabled(pointEffectPane, !largeModel()); + private void checkPointCompsEnabledWithLarge(Plot plot) { + if (pointEffectPane != null) { + GUICoreUtils.setEnabled(pointEffectPane, !largeModel(plot)); } } - private boolean lineMapLargeModel() { - return lineMapLargeDataModelGroup != null && lineMapLargeDataModelGroup.getSelectedIndex() == 0; - } - - private void checkLineMapLarge() { - if(lineMapLargeModel()) { - if(plot instanceof VanChartMapPlot) { - resetCustomCondition(((VanChartMapPlot) plot).getLineConditionCollection()); - } - } - - checkLineCompsEnabledWithLarge(); - } - - private void checkLineCompsEnabledWithLarge() { - if(lineMapEffectPane != null) { - GUICoreUtils.setEnabled(lineMapEffectPane, !lineMapLargeModel()); + private void checkLineCompsEnabledWithLarge(Plot plot) { + if (lineMapEffectPane != null) { + GUICoreUtils.setEnabled(lineMapEffectPane, !largeModel(plot)); } } @@ -195,7 +158,6 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { Component[][] components = new Component[][]{ new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle((com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")), createPointAlphaPane())}, new Component[]{createMarkerComPane()}, - new Component[]{createLargeDataModelPane()}, new Component[]{createPointEffectPane()}, }; @@ -212,25 +174,12 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { Component[][] components = new Component[][]{ new Component[]{createCurvePane()}, - new Component[]{createLineMapLargeDataModelPane()}, new Component[]{createAnimationPane()} }; return TableLayoutHelper.createTableLayoutPane(components, row, col); } - private JPanel createLineMapLargeDataModelPane() { - lineMapLargeDataModelGroup = createLargeDataModelGroup(); - lineMapLargeDataModelGroup.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - checkLineMapLarge(); - } - }); - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Large_Model"), lineMapLargeDataModelGroup); - return createLargeDataModelPane(panel); - } - private Component createCurvePane() { curvePane = new VanChartCurvePane(); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Curve"), curvePane); @@ -257,8 +206,8 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { commonMarkerPane = new VanChartMapScatterMarkerPane(); commonMarkerPane.setBorder(TableLayout4VanChartHelper.SECOND_EDIT_AREA_BORDER); - bubblePane = new VanChartBubblePane(){ - protected JPanel getContentPane () { + bubblePane = new VanChartBubblePane() { + protected JPanel getContentPane() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; @@ -304,7 +253,7 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { JPanel pointPane = createPointPane(); JPanel linePane = createLinePane(); - JPanel panel = createGroupPane(plot, areaPane, pointPane, linePane); + JPanel panel = createGroupPane(plot, areaPane, pointPane, linePane); return panel; } @@ -313,7 +262,7 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { JPanel panel; if (ComparatorUtils.equals(plot.getClass(), VanChartDrillMapPlot.class)) { panel = createDrillMapCustomGroupPane(areaPane, pointPane); - }else { + } else { panel = createMapCustomGroupPane(areaPane, pointPane, linePane); } return panel; @@ -334,7 +283,7 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { public void stateChanged(ChangeEvent e) { if (areaPointAndLineGroup.getSelectedIndex() == 0) { cardLayout.show(centerPane, AREA_STRING); - } else if (areaPointAndLineGroup.getSelectedIndex() == 1){ + } else if (areaPointAndLineGroup.getSelectedIndex() == 1) { cardLayout.show(centerPane, POINT_STRING); } else { cardLayout.show(centerPane, LINE_STRING); @@ -375,36 +324,30 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { } public void populateBean(Plot plot) { - if(plot != null && plot instanceof VanChartMapPlot){ - if(markerTypeCom != null){ + if (plot != null && plot instanceof VanChartMapPlot) { + if (markerTypeCom != null) { markerTypeCom.setSelectedItem(((VanChartMapPlot) plot).getMapMarkerType().toLocalString()); } - if(nullValueColorBox != null){ + if (nullValueColorBox != null) { nullValueColorBox.setSelectObject(((VanChartMapPlot) plot).getNullValueColor()); } - if(lineMapLargeDataModelGroup != null){ - lineMapLargeDataModelGroup.setSelectedItem(((VanChartMapPlot) plot).getLineMapDataProcessor()); - } } super.populateBean(plot); } public void updateBean(Plot plot) { - if(plot != null && plot instanceof VanChartMapPlot){ - if(markerTypeCom != null){ + if (plot != null && plot instanceof VanChartMapPlot) { + if (markerTypeCom != null) { ((VanChartMapPlot) plot).setMapMarkerType(MapMarkerType.parseInt(markerTypeCom.getSelectedIndex())); } - if(nullValueColorBox != null){ + if (nullValueColorBox != null) { ((VanChartMapPlot) plot).setNullValueColor(nullValueColorBox.getSelectObject()); } - if(lineMapLargeDataModelGroup != null){ - ((VanChartMapPlot) plot).setLineMapDataProcessor(lineMapLargeDataModelGroup.getSelectedItem()); - } } super.updateBean(plot); } - @Override + @Override protected void populateCondition(ConditionAttr defaultAttr) { switch (mapType) { case AREA: @@ -427,50 +370,50 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { protected void populateArea(ConditionAttr defaultAttr) { populateAlpha(defaultAttr); if (borderWithAlphaPane != null) { - AttrBorderWithAlpha attrBorderWithAlpha = (AttrBorderWithAlpha) defaultAttr.getExisted(AttrBorderWithAlpha.class); + AttrBorderWithAlpha attrBorderWithAlpha = defaultAttr.getExisted(AttrBorderWithAlpha.class); borderWithAlphaPane.populate(attrBorderWithAlpha); } } private void populatePoint(ConditionAttr defaultAttr) { - if(pointAlphaPane != null){ - AttrMarkerAlpha attrAlpha = (AttrMarkerAlpha)defaultAttr.getExisted(AttrMarkerAlpha.class); + if (pointAlphaPane != null) { + AttrMarkerAlpha attrAlpha = defaultAttr.getExisted(AttrMarkerAlpha.class); double alpha = VanChartAttrHelper.PERCENT * (attrAlpha == null ? 1 : attrAlpha.getAlpha()); pointAlphaPane.populateBean(alpha); } - if(pointEffectPane != null){ + if (pointEffectPane != null) { AttrEffect attrEffect = defaultAttr.getExisted(AttrEffect.class); - if(attrEffect == null){//老的模板做界面上的兼容 + if (attrEffect == null) {//老的模板做界面上的兼容 attrEffect = new AttrEffect(3.2); attrEffect.setEnabled(false); } pointEffectPane.populateBean(attrEffect); } - VanChartAttrMarker attrMarker = (VanChartAttrMarker) defaultAttr.getExisted(VanChartAttrMarker.class); - if(commonMarkerPane != null) { + VanChartAttrMarker attrMarker = defaultAttr.getExisted(VanChartAttrMarker.class); + if (commonMarkerPane != null) { commonMarkerPane.populateBean(attrMarker); } - if(imageMarkerPane != null) { + if (imageMarkerPane != null) { imageMarkerPane.populateBean(attrMarker); } - if(bubblePane != null) { - VanChartAttrBubble attrBubble = (VanChartAttrBubble) defaultAttr.getExisted(VanChartAttrBubble.class); + if (bubblePane != null) { + VanChartAttrBubble attrBubble = defaultAttr.getExisted(VanChartAttrBubble.class); bubblePane.populateBean(attrBubble); } } private void populateLine(ConditionAttr defaultAttr) { - if (curvePane != null){ - if (defaultAttr.getExisted(AttrCurve.class) == null){ + if (curvePane != null) { + if (defaultAttr.getExisted(AttrCurve.class) == null) { defaultAttr.addDataSeriesCondition(new AttrCurve()); } - curvePane.populateBean((AttrCurve) defaultAttr.getExisted(AttrCurve.class)); + curvePane.populateBean(defaultAttr.getExisted(AttrCurve.class)); } - if (lineMapEffectPane != null){ - if (defaultAttr.getExisted(AttrLineEffect.class) == null){ + if (lineMapEffectPane != null) { + if (defaultAttr.getExisted(AttrLineEffect.class) == null) { defaultAttr.addDataSeriesCondition(new AttrLineEffect()); } AttrLineEffect attrLineEffect = defaultAttr.getExisted(AttrLineEffect.class); @@ -498,40 +441,40 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { } } - protected void checkoutMapType(Plot plot){ - this.mapType = ((VanChartMapPlot)plot).getMapType(); + protected void checkoutMapType(Plot plot) { + this.mapType = ((VanChartMapPlot) plot).getMapType(); } protected void updateArea(ConditionAttr defaultAttr) { updateAlpha(defaultAttr); if (borderWithAlphaPane != null) { - AttrBorderWithAlpha attrBorderWithAlpha = (AttrBorderWithAlpha) defaultAttr.getExisted(AttrBorderWithAlpha.class); + AttrBorderWithAlpha attrBorderWithAlpha = defaultAttr.getExisted(AttrBorderWithAlpha.class); defaultAttr.remove(attrBorderWithAlpha); defaultAttr.addDataSeriesCondition(borderWithAlphaPane.update()); } } private void updatePoint(ConditionAttr defaultAttr) { - if(pointAlphaPane != null){ - AttrMarkerAlpha attrAlpha = (AttrMarkerAlpha)defaultAttr.getExisted(AttrMarkerAlpha.class); - if(attrAlpha == null){ + if (pointAlphaPane != null) { + AttrMarkerAlpha attrAlpha = defaultAttr.getExisted(AttrMarkerAlpha.class); + if (attrAlpha == null) { attrAlpha = new AttrMarkerAlpha(); defaultAttr.addDataSeriesCondition(attrAlpha); } - attrAlpha.setAlpha((float)(pointAlphaPane.updateBean()/VanChartAttrHelper.PERCENT)); + attrAlpha.setAlpha((float) (pointAlphaPane.updateBean() / VanChartAttrHelper.PERCENT)); } - if(pointEffectPane != null){ + if (pointEffectPane != null) { AttrEffect attrEffect = defaultAttr.getExisted(AttrEffect.class); defaultAttr.remove(attrEffect); defaultAttr.addDataSeriesCondition(pointEffectPane.updateBean()); } - VanChartAttrMarker attrMarker = (VanChartAttrMarker) defaultAttr.getExisted(VanChartAttrMarker.class); + VanChartAttrMarker attrMarker = defaultAttr.getExisted(VanChartAttrMarker.class); defaultAttr.remove(attrMarker); - VanChartAttrBubble attrBubble = (VanChartAttrBubble) defaultAttr.getExisted(VanChartAttrBubble.class); + VanChartAttrBubble attrBubble = defaultAttr.getExisted(VanChartAttrBubble.class); defaultAttr.remove(attrBubble); - if(markerTypeCom != null) { + if (markerTypeCom != null) { if (markerTypeCom.getSelectedIndex() == 1) { defaultAttr.addDataSeriesCondition(commonMarkerPane.updateBean()); } else if (markerTypeCom.getSelectedIndex() == 2) { @@ -543,17 +486,17 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { } private void updateLine(ConditionAttr defaultAttr) { - if(curvePane != null){ + if (curvePane != null) { AttrCurve attrCurve = defaultAttr.getExisted(AttrCurve.class); - if(attrCurve != null){ + if (attrCurve != null) { defaultAttr.remove(AttrCurve.class); } attrCurve = curvePane.updateBean(); defaultAttr.addDataSeriesCondition(attrCurve); } - if (lineMapEffectPane != null){ + if (lineMapEffectPane != null) { AttrLineEffect attrLineEffect = defaultAttr.getExisted(AttrLineEffect.class); - if (attrLineEffect != null){ + if (attrLineEffect != null) { defaultAttr.remove(AttrLineEffect.class); } attrLineEffect = (AttrLineEffect) lineMapEffectPane.updateBean(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java index 2419604142..3eede87c3f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java @@ -1,12 +1,9 @@ package com.fr.van.chart.map.designer.other; import com.fr.chart.chartattr.Plot; - import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.map.VanChartMapPlot; import com.fr.plugin.chart.type.MapType; -import com.fr.plugin.chart.vanchart.VanChart; -import com.fr.van.chart.designer.PlotFactory; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.other.AutoRefreshPane; import com.fr.van.chart.designer.other.AutoRefreshPaneWithoutTooltip; @@ -20,11 +17,13 @@ import javax.swing.JPanel; public class VanChartMapInteractivePane extends VanChartInteractivePaneWithMapZoom { private static final int HYPERLINK_LEFT_GAP = 36; private VanChartMapHyperLinkPane hyperlinkPane; + @Override protected JPanel createHyperlinkPane() { hyperlinkPane = new VanChartMapHyperLinkPane(); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Insert_Hyperlink"), hyperlinkPane); } + @Override protected void populateHyperlink(Plot plot) { hyperlinkPane.populateBean(plot); @@ -36,26 +35,22 @@ public class VanChartMapInteractivePane extends VanChartInteractivePaneWithMapZo } @Override - protected boolean largeModel(Plot plot) { - if(plot instanceof VanChartMapPlot){ - VanChartMapPlot mapPlot = (VanChartMapPlot)plot; - switch (mapPlot.getMapType()){ - case LINE: - return PlotFactory.lineMapLargeModel(mapPlot); - default: - return PlotFactory.largeDataModel(mapPlot); - } + protected boolean isCurrentChartSupportLargeDataMode() { + if (this.chart == null || this.chart.getPlot() == null) { + return false; } - return false; + VanChartMapPlot mapPlot = this.chart.getPlot(); + + return mapPlot.getMapType() == MapType.POINT || mapPlot.getMapType() == MapType.LINE; } protected AutoRefreshPane getMoreLabelPane(VanChartPlot plot) { boolean isLargeModel = largeModel(plot); - VanChartMapPlot mapPlot = (VanChartMapPlot)plot; + VanChartMapPlot mapPlot = (VanChartMapPlot) plot; if (mapPlot.getMapType().equals(MapType.LINE)) { - return new AutoRefreshPaneWithoutTooltip((VanChart) chart, isLargeModel); + return new AutoRefreshPaneWithoutTooltip(chart, isLargeModel); } - return new AutoRefreshPane((VanChart) chart, isLargeModel); + return new AutoRefreshPane(chart, isLargeModel); } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartLineMapConditionPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartLineMapConditionPane.java index b6862a38e2..28e12ef1e5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartLineMapConditionPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartLineMapConditionPane.java @@ -46,7 +46,7 @@ public class VanChartLineMapConditionPane extends DataSeriesConditionPane { classPaneMap.put(AttrFloatColor.class, new VanChartFloatColorConditionPane(this)); classPaneMap.put(AttrCurve.class, new VanChartCurveConditionPane(this)); classPaneMap.put(AttrTooltip.class, new VanChartLineMapTooltipConditionPane(this, plot)); - if(!PlotFactory.lineMapLargeModel(plot)){ + if (!PlotFactory.largeDataModel(plot)) { classPaneMap.put(AttrLineEffect.class, new VanChartLineEffectConditionPane(this, EffectHelper.getLineMapDefaultLineEffect())); } } @@ -56,6 +56,7 @@ public class VanChartLineMapConditionPane extends DataSeriesConditionPane { /** * 返回图表class对象 + * * @return class对象 */ public Class class4Correspond() { 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 dbcbac3ac9..ebd81f4f00 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 @@ -57,18 +57,19 @@ public class ScatterIndependentVanChartInterface extends AbstractIndependentVanC public String getIconPath() { return "com/fr/design/images/form/toolbar/scatter.png"; } + @Override - public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot) { return new VanChartScatterSeriesPane(parent, plot); } @Override - public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { return new VanChartScatterPlotTableDataContentPane(parent); } @Override - public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { return new BubblePlotReportDataContentPane(parent); } @@ -77,9 +78,9 @@ public class ScatterIndependentVanChartInterface extends AbstractIndependentVanC * 图表的属性界面数组 * @return 属性界面 */ - public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ + public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener) { VanChartStylePane stylePane = new VanChartScatterStylePane(listener); - VanChartOtherPane otherPane = new VanChartOtherPane(){ + VanChartOtherPane otherPane = new VanChartOtherPane() { @Override protected BasicBeanPane createInteractivePane() { return new VanChartInteractivePaneWithOutSort() { @@ -87,6 +88,11 @@ public class ScatterIndependentVanChartInterface extends AbstractIndependentVanC protected ZoomPane createZoomPane() { return new ZoomPane(); } + + @Override + protected boolean isCurrentChartSupportLargeDataMode() { + return true; + } }; } @@ -94,7 +100,7 @@ public class ScatterIndependentVanChartInterface extends AbstractIndependentVanC return new AbstractChartAttrPane[]{stylePane, otherPane}; } - public ConditionAttributesPane getPlotConditionPane(Plot plot){ + public ConditionAttributesPane getPlotConditionPane(Plot plot) { return new VanChartScatterConditionPane(plot); } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java index 456c6a135d..e523a590d0 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java @@ -5,7 +5,6 @@ import com.fr.design.beans.BasicBeanPane; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; - import com.fr.van.chart.custom.component.VanChartCustomAxisConditionPane; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartLineTypePane; @@ -20,19 +19,19 @@ import java.awt.Component; /** * 散点图的系列界面 */ -public class VanChartScatterSeriesPane extends VanChartAbstractPlotSeriesPane{ +public class VanChartScatterSeriesPane extends VanChartAbstractPlotSeriesPane { private static final long serialVersionUID = 5595016643808487932L; - public VanChartScatterSeriesPane(ChartStylePane parent, Plot plot){ + public VanChartScatterSeriesPane(ChartStylePane parent, Plot plot) { super(parent, plot); } - protected JPanel getContentInPlotType(){ + protected JPanel getContentInPlotType() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - double[] row = {p,p,p,p,p,p,p,p,p,p}; + double[] row = {p, p, p, p, p, p, p, p, p, p}; double[] col = {f}; Component[][] components = new Component[][]{ @@ -40,7 +39,6 @@ public class VanChartScatterSeriesPane extends VanChartAbstractPlotSeriesPane{ new Component[]{createLineTypePane()}, new Component[]{createMarkerPane()}, new Component[]{createStackedAndAxisPane()}, - new Component[]{createLargeDataModelPane()}, new Component[]{createTrendLinePane()}, }; @@ -49,25 +47,25 @@ public class VanChartScatterSeriesPane extends VanChartAbstractPlotSeriesPane{ } //设置色彩面板内容 - protected void setColorPaneContent (JPanel panel) { + protected void setColorPaneContent(JPanel panel) { panel.add(createAlphaPane(), BorderLayout.CENTER); } @Override //堆积和坐标轴设置(自定义柱形图等用到) protected JPanel createStackedAndAxisPane() { - stackAndAxisEditPane = new VanChartStackedAndAxisListControlPane(){ + stackAndAxisEditPane = new VanChartStackedAndAxisListControlPane() { @Override protected Class getStackAndAxisPaneClass() { return VanChartCustomAxisConditionPane.class; } @Override - public String getPaneTitle(){ + public String getPaneTitle() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Axis"); } }; - stackAndAxisEditExpandablePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(stackAndAxisEditPane.getPaneTitle(), stackAndAxisEditPane); + stackAndAxisEditExpandablePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(stackAndAxisEditPane.getPaneTitle(), stackAndAxisEditPane); return stackAndAxisEditExpandablePane; } @@ -77,8 +75,8 @@ public class VanChartScatterSeriesPane extends VanChartAbstractPlotSeriesPane{ } @Override - protected void checkCompsEnabledWithLarge() { - super.checkCompsEnabledWithLarge(); + protected void checkCompsEnabledWithLarge(Plot plot) { + super.checkCompsEnabledWithLarge(this.plot); checkLinePane(); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java b/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java index 0d1f99d356..9b9d7cd430 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java +++ b/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java @@ -21,17 +21,18 @@ import com.fr.van.chart.designer.style.VanChartStylePane; /** * Created by mengao on 2017/7/6. */ -public abstract class AbstractMultiCategoryVanChartUI extends AbstractIndependentVanChartUI { - public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ +public abstract class AbstractMultiCategoryVanChartUI extends AbstractIndependentVanChartUI { + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { //自定义组合图特殊处理 - if (((VanChartPlot)plot).isInCustom() && ((VanChartPlot)plot).getCustomType().equals("CUSTOM")) { + if (((VanChartPlot) plot).isInCustom() && ((VanChartPlot) plot).getCustomType().equals("CUSTOM")) { return new CategoryPlotTableDataContentPane(parent); } - return new VanChartMoreCateTableDataContentPane(parent); } + return new VanChartMoreCateTableDataContentPane(parent); + } - public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { //自定义组合图特殊处理 - if (((VanChartPlot)plot).isInCustom() && ((VanChartPlot)plot).getCustomType().equals("CUSTOM")) { + if (((VanChartPlot) plot).isInCustom() && ((VanChartPlot) plot).getCustomType().equals("CUSTOM")) { return new CategoryPlotReportDataContentPane(parent); } return new VanChartMoreCateReportDataContentPane(parent); @@ -49,6 +50,11 @@ public abstract class AbstractMultiCategoryVanChartUI extends AbstractIndepende protected ZoomPane createZoomPane() { return new ZoomPane(); } + + @Override + protected boolean isCurrentChartSupportLargeDataMode() { + return true; + } }; } }; From 9ce28c7b1cdefa8707cb944ad84c9ca7e85c4ae6 Mon Sep 17 00:00:00 2001 From: shine Date: Wed, 25 Sep 2019 18:52:16 +0800 Subject: [PATCH 008/150] =?UTF-8?q?=E5=A4=A7=E6=95=B0=E6=8D=AE=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=20reset=E4=B8=80=E4=BA=9B=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../other/VanChartInteractivePane.java | 41 +++++++++++++++++++ .../VanChartAbstractPlotSeriesPane.java | 14 ------- 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java index c26f90bc15..04b91b4398 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java @@ -2,6 +2,8 @@ package com.fr.van.chart.designer.other; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.chart.chartglyph.ConditionCollection; import com.fr.chartx.attr.LargeDataAttribute; import com.fr.chartx.attr.LargeDataModeType; import com.fr.design.gui.ibutton.UIButtonGroup; @@ -17,8 +19,13 @@ import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; import com.fr.plugin.chart.axis.type.AxisPlotType; +import com.fr.plugin.chart.base.AttrEffect; +import com.fr.plugin.chart.base.AttrLabel; import com.fr.plugin.chart.base.RefreshMoreLabel; +import com.fr.plugin.chart.base.VanChartAttrMarker; import com.fr.plugin.chart.base.VanChartTools; +import com.fr.plugin.chart.map.line.condition.AttrLineEffect; +import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel; import com.fr.plugin.chart.vanchart.VanChart; import com.fr.van.chart.custom.component.VanChartHyperLinkPane; import com.fr.van.chart.designer.AbstractVanChartScrollPane; @@ -229,6 +236,40 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { private void checkLargeDataMode() { largeModeThresholdNumberPane.setVisible(largeDataMode.getSelectedItem() == LargeDataModeType.OPEN_BEYOND_THRESHOLD); + + resetAttr(); + } + + private void resetAttr() { + if (largeDataMode.getSelectedItem() == LargeDataModeType.OPEN_BEYOND_THRESHOLD) { + VanChartPlot plot = this.chart.getPlot(); + + AttrLabel attrLabel = plot.getAttrLabelFromConditionCollection(); + if (attrLabel == null) { + attrLabel = plot.getDefaultAttrLabel(); + ConditionAttr defaultAttr = plot.getConditionCollection().getDefaultAttr(); + defaultAttr.addDataSeriesCondition(attrLabel); + } + attrLabel.setEnable(false); + + resetCustomCondition(plot.getConditionCollection()); + } + } + + + private void resetCustomCondition(ConditionCollection conditionCollection) { + for (int i = 0, len = conditionCollection.getConditionAttrSize(); i < len; i++) { + ConditionAttr conditionAttr = conditionCollection.getConditionAttr(i); + conditionAttr.remove(AttrLabel.class); + conditionAttr.remove(ScatterAttrLabel.class); + conditionAttr.remove(AttrEffect.class); + conditionAttr.remove(AttrLineEffect.class); + + VanChartAttrMarker attrMarker = conditionAttr.getExisted(VanChartAttrMarker.class); + if (attrMarker != null && !attrMarker.isCommon()) { + conditionAttr.remove(VanChartAttrMarker.class); + } + } } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java index 1b9d15ea6b..6dfc4f6f32 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java @@ -177,20 +177,6 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP return PlotFactory.largeDataModel(plot); } - protected void resetCustomCondition(ConditionCollection conditionCollection) { - for (int i = 0, len = conditionCollection.getConditionAttrSize(); i < len; i++) { - ConditionAttr conditionAttr = conditionCollection.getConditionAttr(i); - conditionAttr.remove(AttrLabel.class); - conditionAttr.remove(ScatterAttrLabel.class); - conditionAttr.remove(AttrEffect.class); - conditionAttr.remove(AttrLineEffect.class); - - VanChartAttrMarker attrMarker = conditionAttr.getExisted(VanChartAttrMarker.class); - if (attrMarker != null && !attrMarker.isCommon()) { - conditionAttr.remove(VanChartAttrMarker.class); - } - } - } protected RadiusCardLayoutPane initRadiusPane() { return new RadiusCardLayoutPane(); From b8c636268f4279cb0b7f2a7757d916beec820551 Mon Sep 17 00:00:00 2001 From: shine Date: Thu, 26 Sep 2019 19:33:23 +0800 Subject: [PATCH 009/150] =?UTF-8?q?CHART-4027=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E7=95=8C=E9=9D=A2=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 32 +++--- .../component/AbstractMultiComponentPane.java | 11 ++- .../component/AbstractSingleFilterPane.java | 33 ++++--- .../component/CategorySeriesFilterPane.java | 98 +++++++++++++++++++ .../component/MultiTinyFormulaPane.java | 6 ++ .../diff/MultiCategoryCellDataFieldsPane.java | 76 ++++---------- .../diff/MultiCategoryDataSetFieldsPane.java | 81 +++++---------- .../diff/StructureCellDataFieldsPane.java | 2 +- .../diff/StructureDataSetFieldsPane.java | 2 +- ...terface.java => VanColumnChartTypeUI.java} | 26 +++-- ...face.java => VanStructureChartTypeUI.java} | 17 +++- 11 files changed, 221 insertions(+), 163 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/component/CategorySeriesFilterPane.java rename designer-chart/src/main/java/com/fr/van/chart/column/{ColumnIndependentVanChartInterface.java => VanColumnChartTypeUI.java} (70%) rename designer-chart/src/main/java/com/fr/van/chart/structure/desinger/{StructureIndependentVanChartInterface.java => VanStructureChartTypeUI.java} (86%) 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 b9950256f3..ebe7abbeb3 100644 --- a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java @@ -11,6 +11,18 @@ import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.chart.fun.ChartTypeUIProvider; import com.fr.design.chart.gui.ChartWidgetOption; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.gui.core.WidgetOption; +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.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.design.module.DesignModuleFactory; import com.fr.design.type.ui.AreaChartTypeUI; import com.fr.design.type.ui.BarChartTypeUI; import com.fr.design.type.ui.BubbleChartTypeUI; @@ -28,18 +40,6 @@ import com.fr.design.type.ui.RadarChartTypeUI; import com.fr.design.type.ui.RangeChartTypeUI; import com.fr.design.type.ui.StockChartTypeUI; import com.fr.design.type.ui.XYScatterChartTypeUI; -import com.fr.design.condition.ConditionAttributesPane; -import com.fr.design.gui.core.WidgetOption; -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.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.design.module.DesignModuleFactory; import com.fr.extended.chart.AbstractChart; import com.fr.form.ui.ChartEditor; import com.fr.general.GeneralContext; @@ -80,7 +80,7 @@ import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import com.fr.van.chart.area.AreaIndependentVanChartInterface; import com.fr.van.chart.bar.BarIndependentVanChartInterface; import com.fr.van.chart.bubble.BubbleIndependentVanChartInterface; -import com.fr.van.chart.column.ColumnIndependentVanChartInterface; +import com.fr.van.chart.column.VanColumnChartTypeUI; import com.fr.van.chart.custom.CustomIndependentVanChartInterface; import com.fr.van.chart.drillmap.DrillMapIndependentVanChartInterface; import com.fr.van.chart.funnel.designer.FunnelIndependentVanChartInterface; @@ -93,7 +93,7 @@ import com.fr.van.chart.multilayer.MultiPieIndependentVanChartInterface; import com.fr.van.chart.pie.PieIndependentVanChartInterface; import com.fr.van.chart.radar.RadarIndependentVanChartInterface; import com.fr.van.chart.scatter.ScatterIndependentVanChartInterface; -import com.fr.van.chart.structure.desinger.StructureIndependentVanChartInterface; +import com.fr.van.chart.structure.desinger.VanStructureChartTypeUI; import com.fr.van.chart.treemap.TreeMapIndependentVanChartInterface; import com.fr.van.chart.wordcloud.designer.WordCloudIndependentVanChartInterface; @@ -182,7 +182,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr private static void readVanChart() { addChartTypeInterface(VAN_CHART_PRIORITY, PiePlot4VanChart.VAN_CHART_PIE_PLOT, new PieIndependentVanChartInterface()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID, new ColumnIndependentVanChartInterface()); + addChartTypeInterface(VAN_CHART_PRIORITY, VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID, new VanColumnChartTypeUI()); addChartTypeInterface(VAN_CHART_PRIORITY, VanChartColumnPlot.VAN_CHART_BAR_PLOT_ID, new BarIndependentVanChartInterface()); addChartTypeInterface(VAN_CHART_PRIORITY, VanChartLinePlot.VAN_CHART_LINE_PLOT, new LineIndependentVanChartInterface()); addChartTypeInterface(VAN_CHART_PRIORITY, VanChartAreaPlot.VAN_CHART_AREA_PLOT_ID, new AreaIndependentVanChartInterface()); @@ -199,7 +199,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr addChartTypeInterface(VAN_CHART_PRIORITY, VanChartHeatMapPlot.VAN_CHART_HEAT_MAP_ID, new HeatMapIndependentVanChartInterface()); addChartTypeInterface(VAN_CHART_PRIORITY, VanChartWordCloudPlot.WORD_CLOUD_PLOT_ID, new WordCloudIndependentVanChartInterface()); addChartTypeInterface(VAN_CHART_PRIORITY, VanChartGanttPlot.VAN_CHART_GANTT_PLOT_ID, new GanttIndependentVanChartInterface()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartStructurePlot.STRUCTURE_PLOT_ID, new StructureIndependentVanChartInterface()); + addChartTypeInterface(VAN_CHART_PRIORITY, VanChartStructurePlot.STRUCTURE_PLOT_ID, new VanStructureChartTypeUI()); } diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java index 2a8154d7bb..410ec00b04 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java @@ -24,7 +24,6 @@ import java.util.List; * 一列组件 可增可删,通过JComponent后面的加减button增删。 */ public abstract class AbstractMultiComponentPane extends JPanel { - private static final int COM_W = 96; private static final int H = 20; private static final int ICON_W = 20; @@ -50,7 +49,7 @@ public abstract class AbstractMultiComponentPane extends J label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); firstFieldComponent = createFirstFieldComponent(); - firstFieldComponent.setPreferredSize(new Dimension(COM_W, H)); + firstFieldComponent.setPreferredSize(new Dimension(componentWidth(), H)); addButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); addButton.setPreferredSize(new Dimension(ICON_W, H)); @@ -64,7 +63,7 @@ public abstract class AbstractMultiComponentPane extends J }); final JPanel panel = new JPanel(); - panel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 2)); + panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 2)); panel.add(label); panel.add(firstFieldComponent); @@ -78,6 +77,10 @@ public abstract class AbstractMultiComponentPane extends J this.add(boxPane, BorderLayout.CENTER); } + protected int componentWidth() { + return 96; + } + private JPanel addComboBoxAndButtonToBox(T uiComboBox, UIButton uiButton) { final JPanel panel = new JPanel(); panel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 2)); @@ -93,7 +96,7 @@ public abstract class AbstractMultiComponentPane extends J private void addNewComboBox() { final T comboBox = createOtherFieldComponent(); - comboBox.setPreferredSize(new Dimension(COM_W, H)); + comboBox.setPreferredSize(new Dimension(componentWidth(), H)); UIButton delButton = new UIButton(IOUtils.readIcon("com/fr/design/images/toolbarbtn/close.png")); delButton.setPreferredSize(new Dimension(ICON_W, H)); diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractSingleFilterPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractSingleFilterPane.java index 7c494aac1e..487c6cf135 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractSingleFilterPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractSingleFilterPane.java @@ -2,10 +2,12 @@ package com.fr.design.chartx.component; import com.fr.base.Utils; import com.fr.chartx.data.field.DataFilterProperties; -import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.mainframe.chart.gui.data.PresentComboBox; import com.fr.design.mainframe.chart.gui.style.AbstractChartTabPane; @@ -22,7 +24,7 @@ import java.awt.Dimension; /** * Created by shine on 2019/07/18. */ -public abstract class AbstractSingleFilterPane extends AbstractChartTabPane { +public abstract class AbstractSingleFilterPane extends AbstractChartTabPane implements UIObserver { private static final int FIL_HEIGHT = 150; @@ -34,14 +36,12 @@ public abstract class AbstractSingleFilterPane extends AbstractChartTabPane categoryList = fieldCollection.getCategoryList(); + if (!categoryList.isEmpty()) { + populateCategory(categoryList.get(0).getFilterProperties()); + } + } + + public void updateMultiCategoryFieldCollection(MultiCategoryColumnFieldCollection fieldCollection) { + + SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = fieldCollection.getSeriesValueCorrelationDefinition(); + if (seriesValueCorrelationDefinition != null) { + seriesValueCorrelationDefinition.setFilterProperties(updateSeries()); + } + + List categoryList = fieldCollection.getCategoryList(); + if (!categoryList.isEmpty()) { + categoryList.get(0).setFilterProperties(updateCategory()); + } + } + + private void populateSeries(DataFilterProperties series) { + seriesFilterPane.populateBean(series); + + } + + private void populateCategory(DataFilterProperties category) { + categoryFilterPane.populateBean(category); + + } + + private DataFilterProperties updateSeries() { + return seriesFilterPane.updateBean(); + + } + + private DataFilterProperties updateCategory() { + return categoryFilterPane.updateBean(); + } + + +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MultiTinyFormulaPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MultiTinyFormulaPane.java index 5e56b967c4..6a32cba2b2 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MultiTinyFormulaPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MultiTinyFormulaPane.java @@ -8,6 +8,12 @@ import com.fr.design.formula.TinyFormulaPane; * Created by shine on 2019/4/12. */ public class MultiTinyFormulaPane extends AbstractMultiComponentPane { + + @Override + protected int componentWidth() { + return 116; + } + @Override protected TinyFormulaPane createFirstFieldComponent() { return new TinyFormulaPane(); diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryCellDataFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryCellDataFieldsPane.java index 3645a08db7..c4d133a635 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryCellDataFieldsPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryCellDataFieldsPane.java @@ -1,14 +1,14 @@ package com.fr.design.chartx.fields.diff; import com.fr.chartx.data.field.ColumnField; -import com.fr.chartx.data.field.SeriesValueCorrelationDefinition; import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; -import com.fr.design.chartx.component.AbstractSingleFilterPane; +import com.fr.design.chartx.component.CategorySeriesFilterPane; import com.fr.design.chartx.component.MultiTinyFormulaPane; import com.fr.design.formula.TinyFormulaPane; -import com.fr.van.chart.map.designer.VanChartGroupPane; +import javax.swing.BorderFactory; import javax.swing.JPanel; +import java.awt.BorderLayout; import java.util.List; /** @@ -18,43 +18,21 @@ public class MultiCategoryCellDataFieldsPane extends AbstractCellDataFieldsWithS private MultiTinyFormulaPane multiCategoryPane; - private AbstractSingleFilterPane seriesFilterPane; - private AbstractSingleFilterPane categoryFilterPane; - - private void createMultiFormulaPane() { - if (multiCategoryPane == null) { - multiCategoryPane = new MultiTinyFormulaPane(); - } - } - - @Override - protected JPanel createNorthPane() { - - createMultiFormulaPane(); - - return multiCategoryPane; - } + private CategorySeriesFilterPane filterPane; @Override - protected JPanel createSouthPane() { - if (seriesFilterPane == null) { - seriesFilterPane = new AbstractSingleFilterPane() { - @Override - public String title4PopupWindow() { - //todo@shinerefactor - return "series"; - } - }; - categoryFilterPane = new AbstractSingleFilterPane() { - @Override - public String title4PopupWindow() { - return "category"; - } - }; - } - return new VanChartGroupPane(new String[]{seriesFilterPane.title4PopupWindow(), categoryFilterPane.title4PopupWindow()} - , new JPanel[]{seriesFilterPane, categoryFilterPane}) { - }; + protected void initComponents() { + multiCategoryPane = new MultiTinyFormulaPane(); + filterPane = new CategorySeriesFilterPane(); + + JPanel northPane = new JPanel(new BorderLayout(0, 6)); + northPane.add(multiCategoryPane, BorderLayout.NORTH); + northPane.add(createCenterPane(), BorderLayout.CENTER); + northPane.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 8)); + + this.setLayout(new BorderLayout(0, 6)); + this.add(northPane, BorderLayout.NORTH); + this.add(filterPane, BorderLayout.CENTER); } @Override @@ -64,9 +42,6 @@ public class MultiCategoryCellDataFieldsPane extends AbstractCellDataFieldsWithS @Override protected TinyFormulaPane[] formulaPanes() { - - createMultiFormulaPane(); - List list = multiCategoryPane.componentList(); return list.toArray(new TinyFormulaPane[list.size()]); } @@ -80,15 +55,7 @@ public class MultiCategoryCellDataFieldsPane extends AbstractCellDataFieldsWithS populateSeriesValuePane(multiCategoryColumnFieldCollection); - SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = multiCategoryColumnFieldCollection.getSeriesValueCorrelationDefinition(); - if (seriesValueCorrelationDefinition != null) { - seriesFilterPane.populateBean(seriesValueCorrelationDefinition.getFilterProperties()); - - } - - if (categoryList != null && !categoryList.isEmpty()) { - categoryFilterPane.populateBean(categoryList.get(0).getFilterProperties()); - } + filterPane.populateMultiCategoryFieldCollection(multiCategoryColumnFieldCollection); } @Override @@ -101,14 +68,7 @@ public class MultiCategoryCellDataFieldsPane extends AbstractCellDataFieldsWithS updateSeriesValuePane(fieldCollection); - SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = fieldCollection.getSeriesValueCorrelationDefinition(); - if (seriesValueCorrelationDefinition != null) { - seriesValueCorrelationDefinition.setFilterProperties(seriesFilterPane.updateBean()); - } - - if (categoryList != null && !categoryList.isEmpty()) { - categoryList.get(0).setFilterProperties(categoryFilterPane.updateBean()); - } + filterPane.updateMultiCategoryFieldCollection(fieldCollection); return fieldCollection; } diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java index 5b18d8ae83..911db920ca 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java @@ -1,14 +1,15 @@ package com.fr.design.chartx.fields.diff; import com.fr.chartx.data.field.ColumnField; -import com.fr.chartx.data.field.SeriesValueCorrelationDefinition; import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; -import com.fr.design.chartx.component.AbstractSingleFilterPane; +import com.fr.design.chartx.component.CategorySeriesFilterPane; import com.fr.design.chartx.component.MultiComboBoxPane; import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.van.chart.map.designer.VanChartGroupPane; +import javax.swing.BorderFactory; import javax.swing.JPanel; +import javax.swing.JSeparator; +import java.awt.BorderLayout; import java.util.List; @@ -19,8 +20,23 @@ public class MultiCategoryDataSetFieldsPane extends AbstractDataSetFieldsWithSer private MultiComboBoxPane multiCategoryPane; - private AbstractSingleFilterPane seriesFilterPane; - private AbstractSingleFilterPane categoryFilterPane; + private CategorySeriesFilterPane filterPane; + + @Override + protected void initComponents() { + multiCategoryPane = new MultiComboBoxPane(); + filterPane = new CategorySeriesFilterPane(); + + JPanel northPane = new JPanel(new BorderLayout(0, 6)); + northPane.add(multiCategoryPane, BorderLayout.NORTH); + northPane.add(new JSeparator(), BorderLayout.CENTER); + northPane.add(createCenterPane(), BorderLayout.SOUTH); + northPane.setBorder(BorderFactory.createEmptyBorder(4, 24, 0, 15)); + + this.setLayout(new BorderLayout(0, 6)); + this.add(northPane, BorderLayout.NORTH); + this.add(filterPane, BorderLayout.CENTER); + } @Override protected String[] fieldLabels() { @@ -29,44 +45,10 @@ public class MultiCategoryDataSetFieldsPane extends AbstractDataSetFieldsWithSer @Override protected UIComboBox[] filedComboBoxes() { - List list = initMultiCategoryPane().componentList(); + List list = multiCategoryPane.componentList(); return list.toArray(new UIComboBox[list.size()]); } - private MultiComboBoxPane initMultiCategoryPane() { - if (multiCategoryPane == null) { - multiCategoryPane = new MultiComboBoxPane(); - } - return multiCategoryPane; - } - - @Override - protected JPanel createNorthPane() { - return initMultiCategoryPane(); - } - - @Override - protected JPanel createSouthPane() { - if (seriesFilterPane == null) { - seriesFilterPane = new AbstractSingleFilterPane() { - @Override - public String title4PopupWindow() { - //todo@shinerefactor - return "series"; - } - }; - categoryFilterPane = new AbstractSingleFilterPane() { - @Override - public String title4PopupWindow() { - return "category"; - } - }; - } - return new VanChartGroupPane(new String[]{seriesFilterPane.title4PopupWindow(), categoryFilterPane.title4PopupWindow()} - , new JPanel[]{seriesFilterPane, categoryFilterPane}) { - }; - } - @Override public void refreshBoxListWithSelectTableData(List columnNameList) { super.refreshBoxListWithSelectTableData(columnNameList); @@ -81,15 +63,7 @@ public class MultiCategoryDataSetFieldsPane extends AbstractDataSetFieldsWithSer populateSeriesValuePane(multiCategoryColumnFieldCollection); - SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = multiCategoryColumnFieldCollection.getSeriesValueCorrelationDefinition(); - if (seriesValueCorrelationDefinition != null) { - seriesFilterPane.populateBean(seriesValueCorrelationDefinition.getFilterProperties()); - - } - - if (categoryList != null && !categoryList.isEmpty()) { - categoryFilterPane.populateBean(categoryList.get(0).getFilterProperties()); - } + filterPane.populateMultiCategoryFieldCollection(multiCategoryColumnFieldCollection); } @Override @@ -102,14 +76,7 @@ public class MultiCategoryDataSetFieldsPane extends AbstractDataSetFieldsWithSer updateSeriesValuePane(columnFieldCollection); - SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = columnFieldCollection.getSeriesValueCorrelationDefinition(); - if (seriesValueCorrelationDefinition != null) { - seriesValueCorrelationDefinition.setFilterProperties(seriesFilterPane.updateBean()); - } - - if (categoryList != null && !categoryList.isEmpty()) { - categoryList.get(0).setFilterProperties(categoryFilterPane.updateBean()); - } + filterPane.updateMultiCategoryFieldCollection(columnFieldCollection); return columnFieldCollection; } diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/StructureCellDataFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/StructureCellDataFieldsPane.java index 87ff4d3954..b9db310625 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/StructureCellDataFieldsPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/StructureCellDataFieldsPane.java @@ -59,7 +59,7 @@ public class StructureCellDataFieldsPane extends AbstractCellDataFieldsPane Date: Thu, 10 Oct 2019 17:15:00 +0800 Subject: [PATCH 010/150] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=EF=BC=8Csonar=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 --- .../src/main/java/com/fr/design/gui/itable/UITable.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/itable/UITable.java b/designer-base/src/main/java/com/fr/design/gui/itable/UITable.java index ca214c4241..e5dcd7fd14 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itable/UITable.java +++ b/designer-base/src/main/java/com/fr/design/gui/itable/UITable.java @@ -291,8 +291,7 @@ public class UITable extends JTable implements UIObserver { * */ public TableCellEditor getDefaultEditor(Class columnClass) { - columnClass = UITable.class; - return super.getDefaultEditor(columnClass); + return super.getDefaultEditor(UITable.class); } @Override @@ -300,8 +299,7 @@ public class UITable extends JTable implements UIObserver { * */ public TableCellRenderer getDefaultRenderer(Class columnClass) { - columnClass = UITable.class; - return super.getDefaultRenderer(columnClass); + return super.getDefaultRenderer(UITable.class); } /** From 8de350eeedb08bbcdc3f907b21f9dbf73a9215b7 Mon Sep 17 00:00:00 2001 From: Bryant Date: Thu, 10 Oct 2019 19:21:33 +0800 Subject: [PATCH 011/150] =?UTF-8?q?KERNEL-418=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/update/actions/RecoverForDesigner.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/update/actions/RecoverForDesigner.java b/designer-base/src/main/java/com/fr/design/update/actions/RecoverForDesigner.java index 60decb8735..d4f878f5f9 100644 --- a/designer-base/src/main/java/com/fr/design/update/actions/RecoverForDesigner.java +++ b/designer-base/src/main/java/com/fr/design/update/actions/RecoverForDesigner.java @@ -3,6 +3,7 @@ package com.fr.design.update.actions; import com.fr.decision.update.backup.Recover; import com.fr.decision.update.data.UpdateConstants; import com.fr.decision.update.exception.UpdateException; +import com.fr.general.CommonIOUtils; import com.fr.general.GeneralUtils; import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; @@ -24,11 +25,11 @@ public class RecoverForDesigner implements Recover { @Override public boolean recover() { try{ - IOUtils.copyFilesInDirByPath(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNERBACKUPPATH), + CommonIOUtils.copyFilesInDirByPath(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNERBACKUPPATH), StableUtils.pathJoin(StableUtils.getInstallHome(), ProjectConstants.LIB_NAME)); return true; - } catch (IOException ignore) { - FineLoggerFactory.getLogger().error("Recover error for designer"); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage() + "Recover error for designer"); return false; } } From ec1802622f4eaa498b704cb63303a3a0830e3254 Mon Sep 17 00:00:00 2001 From: jinbokai Date: Sat, 12 Oct 2019 09:42:12 +0800 Subject: [PATCH 012/150] =?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 --- .../design/gui/ibutton/UISliderButtonUI.java | 14 ++++++------- .../fr/design/gui/ibutton/UITabButton.java | 6 +++--- .../fr/design/gui/ibutton/UIToggleButton.java | 4 ++-- .../fr/design/gui/icombobox/LineComboBox.java | 21 ++++++++----------- 4 files changed, 21 insertions(+), 24 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java index 6a92f5057b..6b406588b6 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java @@ -176,11 +176,11 @@ public class UISliderButtonUI extends BasicButtonUI { private void fillNormal(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) { GradientPaint gp; if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { - gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1f, UIConstants.AUTHORITY_DARK_BLUE); + gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1F, UIConstants.AUTHORITY_DARK_BLUE); } else if (isPressedPainted) { - gp = new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, height - 1, UIConstants.SELECT_TAB); + gp = new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, height - 1F, UIConstants.SELECT_TAB); }else{ - gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1, UIConstants.POP_DIALOG_BORDER); + gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1F, UIConstants.POP_DIALOG_BORDER); } fillPaint(g2d, x, y, width, height, isRound, rectDirection, gp, UIConstants.ARC); @@ -189,11 +189,11 @@ public class UISliderButtonUI extends BasicButtonUI { private void fillRollOver(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) { GradientPaint gp; if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { - gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.HOVER_BLUE); + gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1F, UIConstants.HOVER_BLUE); } else if (isPressedPainted) { - gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1, UIConstants.POP_DIALOG_BORDER); + gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1F, UIConstants.POP_DIALOG_BORDER); }else { - gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1, UIConstants.POP_DIALOG_BORDER); + gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1F, UIConstants.POP_DIALOG_BORDER); } fillPaint(g2d, x, y, width, height, isRound, rectDirection, gp, UIConstants.ARC); } @@ -225,4 +225,4 @@ public class UISliderButtonUI extends BasicButtonUI { g2d.setColor(oldColor); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UITabButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UITabButton.java index 4e50dd9942..ce609cde88 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UITabButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UITabButton.java @@ -162,12 +162,12 @@ public class UITabButton extends UILabel implements UISelectedComponent { Color blue = UIConstants.LIGHT_BLUE; g2d.setColor(blue); g2d.fillRect(0, 1, w - 1, h / 2); - GradientPaint gp = new GradientPaint(1, 1, UIConstants.OCEAN_BLUE, 1, h - 1, blue); + GradientPaint gp = new GradientPaint(1, 1, UIConstants.OCEAN_BLUE, 1, h - 1F, blue); g2d.setPaint(gp); g2d.fillRect(0, h / 2, w - 1, h / 2); this.setForeground(UIConstants.FONT_COLOR); } else if (!isSelected() && !isRollover) { - GradientPaint gp = new GradientPaint(1, 1, TOP, 1, h - 1, DOWN); + GradientPaint gp = new GradientPaint(1, 1, TOP, 1, h - 1F, DOWN); g2d.setPaint(gp); g2d.fillRect(0, h / 2, w - 1, h / 2); this.setForeground(UIConstants.FONT_COLOR); @@ -178,4 +178,4 @@ public class UITabButton extends UILabel implements UISelectedComponent { } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java index 45c878419e..2ba4f02439 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java @@ -220,7 +220,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{ protected void paintOtherBorder(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setStroke(UIConstants.BS); - Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1, getHeight() - 1, UIConstants.ARC, UIConstants.ARC); + Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1F, getHeight() - 1F, UIConstants.ARC, UIConstants.ARC); g2d.setColor(UIConstants.LINE_COLOR); g2d.draw(shape); } @@ -252,4 +252,4 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{ return true; } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java index 74cd42a7ef..ca4eddfe3e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java @@ -3,6 +3,11 @@ */ package com.fr.design.gui.icombobox; +import com.fr.base.FRContext; +import com.fr.base.GraphHelper; +import com.fr.base.ScreenResolution; +import com.fr.general.FRFont; +import com.fr.stable.Constants; import java.awt.Component; import java.awt.Dimension; import java.awt.Font; @@ -11,18 +16,10 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.GeneralPath; import java.awt.geom.Point2D; - import javax.swing.DefaultComboBoxModel; import javax.swing.JLabel; import javax.swing.JList; -import com.fr.base.FRContext; -import com.fr.base.GraphHelper; -import com.fr.base.ScreenResolution; -import com.fr.general.FRFont; - -import com.fr.stable.Constants; - /** * Combobox for selecting line styles. @@ -88,13 +85,13 @@ public class LineComboBox extends UIComboBox { FontMetrics fm = GraphHelper.getFontMetrics(rfont); if (style == Constants.LINE_NONE) { //draw "none" string - GraphHelper.drawString(g2d, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None"), 4, (d.height - fm.getHeight()) / 2 + fm.getAscent()); + GraphHelper.drawString(g2d, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None"), 4, (d.height - fm.getHeight()) / 2D + fm.getAscent()); } else { - GraphHelper.drawLine(g2d, 4, d.height / 2, d.width - 8, d.height / 2, style); + GraphHelper.drawLine(g2d, 4, d.height / 2D, d.width - 8D, d.height / 2D, style); } if(isShowAxisWithLineStyle()) { // 带有坐标轴箭头的样式. - drawArrow(g2d, new Point2D.Double(4, d.height / 2), new Point2D.Double(d.width - 8, d.height/2)); + drawArrow(g2d, new Point2D.Double(4, d.height / 2D), new Point2D.Double(d.width - 8D, d.height / 2D)); } } @@ -142,4 +139,4 @@ public class LineComboBox extends UIComboBox { private int style = Constants.LINE_NONE; } -} \ No newline at end of file +} From d58cb4991c427cb97aa73f4f3e17afdebdf7f86d Mon Sep 17 00:00:00 2001 From: Lanlan Date: Sat, 12 Oct 2019 13:58:24 +0800 Subject: [PATCH 013/150] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20sonar?= =?UTF-8?q?=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 --- .../gui/icombobox/UIComboBoxButton.java | 4 +- .../icontainer/UIModeControlContainer.java | 2 +- .../design/gui/imenu/UIBasicMenuItemUI.java | 42 +----------------- .../fr/design/gui/imenutable/UIMenuTable.java | 3 +- .../gui/iprogressbar/UIProgressBorder.java | 2 + .../gui/iscrollbar/UIBasicScrollBarUI.java | 44 ------------------- .../fr/design/gui/iscrollbar/UISBChooser.java | 1 + 7 files changed, 8 insertions(+), 90 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java index 9f96f655eb..6130050dc2 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java @@ -172,11 +172,9 @@ public class UIComboBoxButton extends JButton { } c.setBackground(UIManager.getColor("ComboBox.focusBackground")); if (c instanceof JComponent) { - mustResetOpaque = true; JComponent jc = (JComponent) c; - savedOpaque = jc.isOpaque(); + jc.isOpaque(); jc.setOpaque(true); - paintFocus = true; } } else { c.setForeground(comboBox.getForeground()); diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java index eadb94109f..4d844336f1 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java @@ -46,7 +46,7 @@ public class UIModeControlContainer extends JLayeredPane { private boolean isHideMode = false; private boolean isSheeetCovered = false; - private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 30 / 100.0F); + private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f); public UIModeControlContainer() { this(new JPanel(), new JPanel()); diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java index 844120c51b..a14de81c55 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java @@ -287,7 +287,7 @@ public class UIBasicMenuItemUI extends MenuItemUI { View v = (View) c.getClientProperty(BasicHTML.propertyKey); if (v != null) { d = getPreferredSize(c); - d.width -= v.getPreferredSpan(View.X_AXIS) - v.getMinimumSpan(View.X_AXIS); + d.width -= (double) v.getPreferredSpan(View.X_AXIS) - (double) v.getMinimumSpan(View.X_AXIS); } return d; } @@ -345,7 +345,7 @@ public class UIBasicMenuItemUI extends MenuItemUI { View v = (View) c.getClientProperty(BasicHTML.propertyKey); if (v != null) { d = getPreferredSize(c); - d.width += v.getMaximumSpan(View.X_AXIS) - v.getPreferredSpan(View.X_AXIS); + d.width += (double) v.getMaximumSpan(View.X_AXIS) - (double) v.getPreferredSpan(View.X_AXIS); } return d; } @@ -816,7 +816,6 @@ public class UIBasicMenuItemUI extends MenuItemUI { // get Accelerator text KeyStroke accelerator = b.getAccelerator(); String acceleratorText = ""; - drawMenu(acceleratorText, accelerator, c, ic, maxValue, offset, paintIcon, b); String text = layoutMenuItem(fm, b.getText(), fmAccel, acceleratorText, ic, null, arrowIcon, b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect, @@ -834,43 +833,6 @@ public class UIBasicMenuItemUI extends MenuItemUI { g.setFont(holdf); } - private void drawMenu(String acceleratorText, KeyStroke accelerator, JComponent c, - Icon ic, int maxValue, int offset, Icon paintIcon, JMenuItem b) { - if (accelerator != null) { - int modifiers = accelerator.getModifiers(); - if (modifiers > 0) { - acceleratorText = KeyEvent.getKeyModifiersText(modifiers); - //acceleratorText += "-"; - acceleratorText += acceleratorDelimiter; - } - - int keyCode = accelerator.getKeyCode(); - if (keyCode != 0) { - acceleratorText += KeyEvent.getKeyText(keyCode); - } else { - acceleratorText += accelerator.getKeyChar(); - } - } - if (!isTopLevelMenu()) { - if (c instanceof JCheckBoxMenuItem || c instanceof JRadioButtonMenuItem) { - ic = checkIcon; - if (checkIcon.getIconWidth() < maxValue) { - ic = new EmptyIcon(maxValue, checkIcon.getIconHeight()); - offset = (maxValue - checkIcon.getIconWidth()) / 2; - } - paintIcon = null; - } else if (c instanceof JMenuItem) { - if (ic == null || ic.getIconWidth() < maxValue) { - int height = (ic == null) ? 2 : b.getIcon().getIconHeight(); - int width = (ic == null) ? 2 : b.getIcon().getIconWidth(); - offset = (maxValue - width) / 2; - ic = new EmptyIcon(maxValue, height); - } - } - } - } - - private void drawAccText(String acceleratorText, Graphics g, JComponent p, ButtonModel model, FontMetrics fmAccel, JComponent c) { if (acceleratorText != null && !ComparatorUtils.equals(acceleratorText, "")) { //Get the maxAccWidth from the parent to calculate the offset. diff --git a/designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTable.java b/designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTable.java index d950e91ed7..938e0caccc 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTable.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTable.java @@ -157,8 +157,7 @@ public class UIMenuTable extends JTable { @Override public TableCellRenderer getDefaultRenderer(Class columnClass) { - columnClass = UITable.class; - return super.getDefaultRenderer(columnClass); + return super.getDefaultRenderer(UITable.class); } private class UITableRender implements TableCellRenderer { diff --git a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/UIProgressBorder.java b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/UIProgressBorder.java index c4df50e82a..30074f5638 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/UIProgressBorder.java +++ b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/UIProgressBorder.java @@ -72,6 +72,7 @@ public class UIProgressBorder extends UIRoundedBorder { g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } + @SuppressWarnings("squid:S2164") private void paintBorderShadow(Graphics2D g2, int shadowWidth, int x, int y, int width, int height) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); shadowWidth = Math.max(shadowWidth, 2); @@ -85,6 +86,7 @@ public class UIProgressBorder extends UIRoundedBorder { } } + @SuppressWarnings("squid:S2164") private static Color getMixedColor(Color c1, float pct1, Color c2, float pct2) { float[] clr1 = c1.getComponents(null); float[] clr2 = c2.getComponents(null); diff --git a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIBasicScrollBarUI.java b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIBasicScrollBarUI.java index 851f907977..821ebbc335 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIBasicScrollBarUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIBasicScrollBarUI.java @@ -165,50 +165,6 @@ public class UIBasicScrollBarUI extends BasicScrollBarUI { // drawColorAndLength(g, t, x2, y2, color); } - private void drawColorAndLength(Graphics g, Rectangle t, int x2, int y2, Color color) { - - if (scrollbar.getOrientation() == JScrollBar.VERTICAL) { - int y1 = t.y + (t.height) / 2 - 4; - y2 = Math.min(y1 + 8, t.y + t.height - 5); - - int y = y1; - // we take only saturation & brightness and apply them - // to the background color (normal/rollover/pressed) - g.setColor(UISBChooser.getAdjustedColor(color, 0, 71)); - while (y < y2) { - g.drawLine(5, y, 11, y); - y += 2; - } - - y = y1 + 1; - g.setColor(UISBChooser.getAdjustedColor(color, 0, -13)); - while (y < y2) { - g.drawLine(6, y, 12, y); - y += 2; - } - } else { - int x1 = t.x + (t.width) / 2 - 4; - x2 = Math.min(x1 + 8, t.x + t.width - 5); - - int x = x1 + 1; - // we take only saturation & brightness and apply them - // to the background color (normal/rollover/pressed) - g.setColor(UISBChooser.getAdjustedColor(color, 0, 71)); - while (x < x2) { - g.drawLine(x, 5, x, 11); - x += 2; - } - - x = x1; - g.setColor(UISBChooser.getAdjustedColor(color, 0, -13)); - while (x < x2) { - g.drawLine(x, 6, x, 12); - x += 2; - } - } - } - - private void drawVertical(Graphics g, Rectangle t, int xs, int ys, int x2, Color pressedColor, Color rolloverColor, Color normalColor) { diff --git a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java index a6ba742830..ebc311dfd3 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java +++ b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java @@ -90,6 +90,7 @@ public class UISBChooser extends JDialog { (frame.getHeight() - getSize().height) / 2); } + @SuppressWarnings("squid:S1226") private void initP3(JPanel p3, JPanel p1) { p3 = new JPanel(new FlowLayout(FlowLayout.LEFT, 3, 8)); p3.add(new JLabel("R:")); From dfa8cbe4920bbbf11a2cd88238c799a9bd9e2023 Mon Sep 17 00:00:00 2001 From: kerry Date: Sat, 12 Oct 2019 14:51:26 +0800 Subject: [PATCH 014/150] =?UTF-8?q?REPORT-20327=20=20sonar=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/dialog/JWizardPanel.java | 2 +- .../fr/design/file/MutilTempalteTabPane.java | 12 +++--- .../style/color/CustomChooserPanel.java | 40 +++++++++---------- .../src/main/java/com/fr/grid/GridUI.java | 4 +- .../com/fr/start/fx/PrismImageLoader2.java | 2 +- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java b/designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java index ce3a2f9da6..c4762f2557 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java +++ b/designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java @@ -168,7 +168,7 @@ public class JWizardPanel extends BasicPane { public void addNotify() { if (firstNotify) { Font font = stepTitleLabel.getFont(); - font = font.deriveFont(Font.BOLD, font.getSize() * 14 / 10.0F); + font = font.deriveFont(Font.BOLD, (float) (font.getSize() * 14 / 10.0D)); stepTitleLabel.setFont(font); firstNotify = false; } diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index 5a722239c6..e83cc85d4e 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -398,8 +398,8 @@ public class MutilTempalteTabPane extends JComponent { //画下面的那条线 if (templateStartX < maxWidth) { GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, 2); - generalPath.moveTo((float) templateStartX, getHeight() - 1.0F); - generalPath.lineTo((float) maxWidth, getHeight() - 1.0F); + generalPath.moveTo((float) templateStartX, (float) (getHeight() - 1.0D)); + generalPath.lineTo((float) maxWidth, (float) (getHeight() - 1.0D)); g2d.fill(generalPath); //TODO hzzz delete // g2d.setPaint(UIConstants.LINE_COLOR); @@ -409,7 +409,7 @@ public class MutilTempalteTabPane extends JComponent { private void paintDefaultBackground(Graphics2D g2d) { //画默认背景 - g2d.setPaint(new GradientPaint(1, 1, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND, 1, getHeight() - 1.0F, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND)); + g2d.setPaint(new GradientPaint(1, 1, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND, 1, (float) (getHeight() - 1.0D), UIConstants.TEMPLATE_TAB_PANE_BACKGROUND)); g2d.fillRect(0, 0, getWidth(), getHeight()); } @@ -535,7 +535,7 @@ public class MutilTempalteTabPane extends JComponent { double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX}; double[] y = {1, getHeight() + 1, getHeight() + 1, 1, 1}; RoundRectangle2D.Double rect1 = new RoundRectangle2D.Double(templateStartX, 1, this.getWidth(), this.getHeight(), 7, 7); - g2d.setPaint(new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, getHeight() - 1.0F, UIConstants.SELECT_TAB)); + g2d.setPaint(new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, (float) (getHeight() - 1.0D), UIConstants.SELECT_TAB)); //选了30度和60度的特殊角度的x,y作为经过的两个点的坐标 double specialLocation1 = 2.5; double specialLocation2 = 4.330127; @@ -590,9 +590,9 @@ public class MutilTempalteTabPane extends JComponent { double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX}; double[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1}; if (selfIndex == mouseOveredIndex) { - g2d.setPaint(new GradientPaint(1, 1, UIConstants.HOVER_BLUE, 1, getHeight() - 1.0F, UIConstants.HOVER_BLUE)); + g2d.setPaint(new GradientPaint(1, 1, UIConstants.HOVER_BLUE, 1, (float) (getHeight() - 1.0D), UIConstants.HOVER_BLUE)); } else { - g2d.setPaint(new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, getHeight() - 1.0F, UIConstants.SHADOW_GREY)); + g2d.setPaint(new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, (float) (getHeight() - 1.0D), UIConstants.SHADOW_GREY)); } diff --git a/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java b/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java index 79ecdc9461..c7cf4f7831 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java +++ b/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java @@ -332,8 +332,8 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec * @param p The point where the MouseEvent occurred. */ private void updateS(Point p) { - float h = p.x * 1f / IMG_WIDTH; - float b = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT; + double h = p.x * 1D / IMG_WIDTH; + double b = (IMG_HEIGHT - p.y * 1D) / IMG_HEIGHT; internalChange = true; hSpinner.setValue(new Integer((int) (h * H_MAX))); @@ -349,8 +349,8 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec * @param p The point where the MouseEvent occurred. */ private void updateB(Point p) { - float h = p.x * 1f / IMG_WIDTH; - float s = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT; + double h = p.x * 1D / IMG_WIDTH; + double s = (IMG_HEIGHT - p.y * 1D) / IMG_HEIGHT; internalChange = true; hSpinner.setValue(new Integer((int) (h * H_MAX))); @@ -523,9 +523,9 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec private void adjustHSLValue(float[] hsbVals) { if (!spinnerTrigger) { - hSpinner.setValue(new Integer((int) (hsbVals[0] * HSPINNER_VALUE))); - sSpinner.setValue(new Integer((int) (hsbVals[1] * SSPINNER_VALUE))); - bSpinner.setValue(new Integer((int) (hsbVals[2] * LSPINNER_VALUE))); + hSpinner.setValue(new Integer((int) ((double) hsbVals[0] * HSPINNER_VALUE))); + sSpinner.setValue(new Integer((int) ((double) hsbVals[1] * SSPINNER_VALUE))); + bSpinner.setValue(new Integer((int) ((double) hsbVals[2] * LSPINNER_VALUE))); } switch (locked) { case HLOCKED: @@ -534,9 +534,9 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec } if (!handlingMouse) { gradientPoint.x = (int) ((1 - - ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE) * IMG_WIDTH); + - ((Number) sSpinner.getValue()).intValue() / (double) SSPINNER_VALUE) * IMG_WIDTH); gradientPoint.y = (int) ((1 - - ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE) * IMG_HEIGHT); + - ((Number) bSpinner.getValue()).intValue() / (double) LSPINNER_VALUE) * IMG_HEIGHT); } break; case SLOCKED: @@ -544,9 +544,9 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec slider.setValue(((Number) sSpinner.getValue()).intValue()); } if (!handlingMouse) { - gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE * IMG_WIDTH); + gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / (double) HSPINNER_VALUE * IMG_WIDTH); gradientPoint.y = (int) ((1 - - ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE) * IMG_HEIGHT); + - ((Number) bSpinner.getValue()).intValue() / (double) LSPINNER_VALUE) * IMG_HEIGHT); } break; case BLOCKED: @@ -554,18 +554,18 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec slider.setValue(((Number) bSpinner.getValue()).intValue()); } if (!handlingMouse) { - gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE * IMG_WIDTH); + gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / (double) HSPINNER_VALUE * IMG_WIDTH); gradientPoint.y = (int) ((1 - - ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE) * IMG_HEIGHT); + - ((Number) sSpinner.getValue()).intValue() / (double) SSPINNER_VALUE) * IMG_HEIGHT); } break; } } private void updateImageAndTrack() { - float h = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE; - float s = ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE; - float b = ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE; + float h = (float) (((Number) hSpinner.getValue()).intValue() / (double) HSPINNER_VALUE); + float s = (float) (((Number) sSpinner.getValue()).intValue() / (double) SSPINNER_VALUE); + float b = (float) (((Number) bSpinner.getValue()).intValue() / (double) LSPINNER_VALUE); spinnerTrigger = true; getColorSelectionModel().setSelectedColor(new Color(Color.HSBtoRGB(h, s, b))); @@ -837,12 +837,12 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec private void updateHLockImage() { int index = 0; int[] pix = new int[IMG_WIDTH * IMG_HEIGHT]; - float hValue = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE; + float hValue = (float)(((Number) hSpinner.getValue()).intValue() / (double) HSPINNER_VALUE ); for (int j = 0; j < IMG_HEIGHT; j++) { for (int i = 0; i < IMG_WIDTH; i++) { - pix[index++] = Color.HSBtoRGB(hValue, (IMG_WIDTH - i * 1f) / IMG_WIDTH, - (IMG_HEIGHT - j * 1f) / IMG_HEIGHT) | (BINARY_FOR_EIGHT << TWENTY_FOUR); + pix[index++] = Color.HSBtoRGB(hValue, (float) ((IMG_WIDTH - i * 1D) / IMG_WIDTH), + (float) ((IMG_HEIGHT - j * 1D) / IMG_HEIGHT)) | (BINARY_FOR_EIGHT << TWENTY_FOUR); } } @@ -1076,4 +1076,4 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec public void colorSetted(ColorCell cc) { } -} \ No newline at end of file +} 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 0ccff309f6..f1f0a293da 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridUI.java @@ -1209,7 +1209,7 @@ public class GridUI extends ComponentUI { * @return 有效返回true */ public static boolean validate(Rectangle2D rect) { - return rect != null && rect.getX() != INVALID_INTEGER; + return rect != null && ComparatorUtils.equals(rect.getX(), INVALID_INTEGER); } @@ -1268,4 +1268,4 @@ public class GridUI extends ComponentUI { paginateLineList.add(new Line2D.Double(0, sumHeight, width, sumHeight)); } } -} \ 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 89509b9942..4529465c7a 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 @@ -141,7 +141,7 @@ class PrismImageLoader2 implements com.sun.javafx.tk.ImageLoader { ImageFrame imageFrame = loader.load(i, w, h, preserveRatio, smooth); images[i] = convert(imageFrame); synchronized (this) { - this.notify(); + notifyAll(); } } } catch (ImageStorageException e) { From b549b39027dedef7b7b197ad5b8879d559011ff9 Mon Sep 17 00:00:00 2001 From: pengda Date: Sun, 13 Oct 2019 23:11:53 +0800 Subject: [PATCH 015/150] =?UTF-8?q?sonar=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D,=E6=97=A0jira=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/loghandler/LogHandlerBarUI.java | 2 +- .../com/fr/design/mainframe/vcs/ui/FileVersionDialog.java | 2 +- .../style/background/impl/PatternBackgroundPane.java | 6 +++--- .../style/background/impl/TextureBackgroundPane.java | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java index 5a4ba1edaf..a41f03a9db 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java @@ -69,7 +69,7 @@ public class LogHandlerBarUI extends ComponentUI implements MouseListener, Focus int w = button.getWidth(); int h = button.getHeight(); Graphics2D g2d = (Graphics2D) g; - GradientPaint gp = new GradientPaint(1, 1, darkColor, 1, h - 1, darkColor); + GradientPaint gp = new GradientPaint(1, 1, darkColor, 1, h - 1f, darkColor); g2d.setPaint(gp); g2d.fillRect(0, 0, w, h); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java index 15d8bae63e..8216ad5735 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java @@ -31,7 +31,7 @@ import java.util.List; public class FileVersionDialog extends UIDialog { - public static final long DELAY = 24 * 60 * 60 * 1000; + public static final long DELAY = 24 * 60 * 60 * 1000L; private UIButton okBtn; private UIButton cancelBtn; private DateEditor dateEditor; diff --git a/designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java index ffb4e1eb0b..886076ca08 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java @@ -159,15 +159,15 @@ public class PatternBackgroundPane extends BPane { Dimension d = getSize(); this.patternBackground.paint(g2d, new Rectangle2D.Double(0, 0, - d.width - 1, d.height - 1)); + d.width - 1d, d.height - 1d)); if (this.pIndex == patternIndex) {// it's selected. g2d.setPaint(new Color(255, 51, 0)); } else { g2d.setPaint(Color.gray); } - GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1, - d.height - 1)); + GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1d, + d.height - 1d)); } public Dimension getPreferredSize() { diff --git a/designer-base/src/main/java/com/fr/design/style/background/impl/TextureBackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/impl/TextureBackgroundPane.java index 8c99a89cdd..3dd59bd5b4 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/impl/TextureBackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/impl/TextureBackgroundPane.java @@ -152,8 +152,8 @@ public class TextureBackgroundPane extends BPane { Dimension d = getSize(); g2d.setPaint(this.buttonTexturePaint); - GraphHelper.fill(g2d, new Rectangle2D.Double(0, 0, d.width - 1, - d.height - 1)); + GraphHelper.fill(g2d, new Rectangle2D.Double(0, 0, d.width - 1d, + d.height - 1d)); if (ComparatorUtils.equals(texturePaint, this.buttonTexturePaint)) {// it's // selected. @@ -161,8 +161,8 @@ public class TextureBackgroundPane extends BPane { } else { g2d.setPaint(Color.gray); } - GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1, - d.height - 1)); + GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1d, + d.height - 1d)); } public Dimension getPreferredSize() { From 6db2cdea8f72331a30f81b0384dc4f82ac2d0229 Mon Sep 17 00:00:00 2001 From: zack Date: Mon, 14 Oct 2019 09:26:21 +0800 Subject: [PATCH 016/150] =?UTF-8?q?REPORT-20318=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 --- .../java/com/fr/design/gui/iscrollbar/UISBChooser.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java index ebc311dfd3..c780eeb2d7 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java +++ b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java @@ -199,6 +199,7 @@ public class UISBChooser extends JDialog { twoColorField.setUpperColor(outColor); } + @SuppressWarnings("squid:S2164") public static Color getAdjustedColor(Color inColor, int sat, int bri) { Color briColor = inColor; @@ -220,9 +221,9 @@ public class UISBChooser extends JDialog { int dg = briColor.getGreen() - satColor.getGreen(); int db = briColor.getBlue() - satColor.getBlue(); - r = briColor.getRed() - (int) Math.round(dr * sat / VALUE * 1.0); - g = briColor.getGreen() - (int) Math.round(dg * sat / VALUE * 1.0); - b = briColor.getBlue() - (int) Math.round(db * sat / VALUE * 1.0); + r = briColor.getRed() - (int) Math.round(dr * sat / (VALUE * 1.0)); + g = briColor.getGreen() - (int) Math.round(dg * sat / (VALUE * 1.0)); + b = briColor.getBlue() - (int) Math.round(db * sat / (VALUE * 1.0)); } else { float d = ColorRoutines.getGreyValue(briColor); float dr = briColor.getRed() - d; From 5064993263743d377f450eca172652358d02d11f Mon Sep 17 00:00:00 2001 From: author Date: Mon, 14 Oct 2019 09:23:50 +0800 Subject: [PATCH 017/150] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=EF=BC=8Csonar=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 --- .../design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java | 2 +- .../gui/syntax/ui/rsyntaxtextarea/TokenIterator.java | 4 ++++ .../gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java | 9 +++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java index 4ee6fe978d..b201365a84 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java @@ -656,7 +656,7 @@ public class SyntaxView extends View implements TabExpander, if (tabSize == 0) return x; int ntabs = (((int) x) - tabBase) / tabSize; - return tabBase + ((ntabs + 1) * tabSize); + return (float) (tabBase + ((ntabs + 1) * tabSize)); } diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/TokenIterator.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/TokenIterator.java index 189501894f..0d3b493dd0 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/TokenIterator.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/TokenIterator.java @@ -9,6 +9,7 @@ package com.fr.design.gui.syntax.ui.rsyntaxtextarea; import java.util.Iterator; +import java.util.NoSuchElementException; /** @@ -73,6 +74,9 @@ class TokenIterator implements Iterator { token = null; } } + else { + throw new NoSuchElementException(); + } return t; } diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java index e99208afc0..97e367ef0c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java @@ -268,7 +268,7 @@ public class WrappedSyntaxView extends BoxView implements TabExpander, if (host.getEOLMarkersVisible()) { g.setColor(host.getForegroundForTokenType(Token.WHITESPACE)); g.setFont(host.getFontForTokenType(Token.WHITESPACE)); - g.drawString("\u00B6", x, y-fontHeight); + g.drawString("\u00B6", x, (float) (y-fontHeight)); } } @@ -458,7 +458,7 @@ public class WrappedSyntaxView extends BoxView implements TabExpander, if (host.getEOLMarkersVisible()) { g.setColor(host.getForegroundForTokenType(Token.WHITESPACE)); g.setFont(host.getFontForTokenType(Token.WHITESPACE)); - g.drawString("\u00B6", x, y-fontHeight); + g.drawString("\u00B6", x, (float) (y-fontHeight)); } } @@ -841,10 +841,11 @@ public class WrappedSyntaxView extends BoxView implements TabExpander, * @return the tab stop, measured in points >= 0 */ public float nextTabStop(float x, int tabOffset) { - if (tabSize == 0) + if (tabSize == 0) { return x; + } int ntabs = ((int) x - tabBase) / tabSize; - return tabBase + ((ntabs + 1) * tabSize); + return (float) (tabBase + ((ntabs + 1) * tabSize)); } From fabde630ff2ceb78f9a7ab8d064b957c8809107b Mon Sep 17 00:00:00 2001 From: Bryant Date: Mon, 14 Oct 2019 17:45:36 +0800 Subject: [PATCH 018/150] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20sonar?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/style/AlignmentPane.java | 14 ++++---- .../gui/syntax/print/RPrintUtilities.java | 36 ++++++++++--------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java b/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java index 9bbca6d2bc..b188cb5aa8 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java @@ -102,7 +102,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal_white.png")}, {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment_white.png")}}; Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT, Integer.valueOf(Constants.DISTRIBUTED), Constants.NULL}; - hAlignmentPane = new UIButtonGroup(hAlignmentIconArray, hAlignment); + hAlignmentPane = new UIButtonGroup<>(hAlignmentIconArray, hAlignment); hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Left"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Right"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Distributed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_DEFAULT")}); hPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); @@ -112,7 +112,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal_white.png")}, {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal_white.png")}}; Integer[] vAlignment = new Integer[]{Constants.TOP, Constants.CENTER, Constants.BOTTOM}; - vAlignmentPane = new UIButtonGroup(vAlignmentIconArray, vAlignment); + vAlignmentPane = new UIButtonGroup<>(vAlignmentIconArray, vAlignment); vAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Top"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Bottom")}); initOtherComponent(); initAllNames(); @@ -174,7 +174,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO } private void initTextRotationCombox() { - ArrayList selectOption = new ArrayList(); + ArrayList selectOption = new ArrayList<>(); selectOption.add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Angle")); VerticalTextProcessor processor = ExtraClassManager.getInstance().getSingle(VerticalTextProcessor.XML_TAG, DefaultVerticalTextProcessor.class); selectOption.addAll(Arrays.asList(processor.getComboxOption())); @@ -343,8 +343,8 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO int rightPadding = indentationUnitProcessor.paddingUnitProcessor(style.getPaddingRight()); // alex:indent - this.leftIndentSpinner.setValue(new Integer(leftPadding)); - this.rightIndentSpinner.setValue(new Integer(rightPadding)); + this.leftIndentSpinner.setValue(leftPadding); + this.rightIndentSpinner.setValue(rightPadding); this.spaceBeforeSpinner.setValue(style.getSpacingBefore()); this.spaceAfterSpinner.setValue(style.getSpacingAfter()); @@ -360,7 +360,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO public Style update(Style style) { // peter:需要判断传递进来的值是否为null. if (style == null) { - return style; + return null; } if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Horizontal"))) { @@ -463,7 +463,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO } /** - * @param name + * @param name 全局名 */ public void setGlobalName(String name) { } diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java b/designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java index 352676010c..ff27b178f4 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java @@ -9,6 +9,8 @@ */ package com.fr.design.gui.syntax.print; +import com.fr.log.FineLoggerFactory; + import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.text.Element; @@ -62,8 +64,8 @@ public abstract class RPrintUtilities { private static int getLineBreakPoint(String line, final int maxCharsPerLine) { int breakPoint = -1; - for (int i=0; i breakPoint) breakPoint = breakCharPos; } @@ -147,11 +149,11 @@ public abstract class RPrintUtilities { int tabIndex = curLineString.indexOf('\t'); while (tabIndex > -1) { int spacesNeeded = tabSizeInSpaces - (tabIndex % tabSizeInSpaces); - String replacementString = ""; + StringBuilder replacementString = new StringBuilder(); for (int i=0; i-1 && pos>currentPos) // currentPos = pos; - if (pos>0 && pos>currentPos & pos!=currentLineString.length()) + if (pos > 0 && pos > currentPos & pos != currentLineString.length()) currentPos = pos; } @@ -440,7 +442,7 @@ public abstract class RPrintUtilities { try { doc.getText(currentLineStart+startingOffset, currentPos, currentLineSeg); } catch (BadLocationException ble) { - System.err.println(ble); + FineLoggerFactory.getLogger().error(ble.getMessage()); return Printable.NO_SUCH_PAGE; } currentLineLengthInPixels = Utilities. @@ -453,12 +455,11 @@ public abstract class RPrintUtilities { try { doc.getText((currentLineStart+startingOffset), currentPos, currentLineSeg); } catch (BadLocationException ble) { - System.err.println("BadLocationException in print (a):"); - System.err.println("==> currentLineStart: " + currentLineStart + - "; startingOffset: " + startingOffset + "; currentPos: " + currentPos); - System.err.println("==> Range: " + (currentLineStart+startingOffset) + " - " + - (currentLineStart+startingOffset+currentPos)); - ble.printStackTrace(); + FineLoggerFactory.getLogger().error("BadLocationException in print (a):" + "==> currentLineStart: " + currentLineStart + + "; startingOffset: " + startingOffset + "; currentPos: " + currentPos + + "==> Range: " + (currentLineStart+startingOffset) + " - " + + (currentLineStart+startingOffset+currentPos)); + FineLoggerFactory.getLogger().error(ble.getMessage()); return Printable.NO_SUCH_PAGE; } @@ -521,7 +522,8 @@ public abstract class RPrintUtilities { return x; int tabSizeInPixels = tabSizeInSpaces * fm.charWidth(' '); int ntabs = (((int) x) - xOffset) / tabSizeInPixels; - return xOffset + ((ntabs + 1) * tabSizeInPixels); + float reFloat = xOffset + ((ntabs + 1) * tabSizeInPixels); + return reFloat; } } From 3bb77f05b1a18cbdc23c00af7c4f41f9e86f0bc8 Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 14 Oct 2019 19:17:39 +0800 Subject: [PATCH 019/150] =?UTF-8?q?CHART-10227=20=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2=20npe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../van/chart/designer/other/VanChartInteractivePane.java | 2 +- .../com/fr/van/chart/designer/other/zoom/ZoomPane.java | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java index 04b91b4398..ba4d944d47 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java @@ -95,7 +95,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double[] columnSize = {f, e}; - double[] rowSize = {p, p, p, p, p, p}; + double[] rowSize = {p, p, p, p, p, p, p}; Component[][] components = new Component[][]{ diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPane.java index 23fe491bd5..1a8f85df5b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPane.java @@ -193,7 +193,9 @@ public class ZoomPane extends BasicBeanPane { rightFormulaPane.populateBean(ob.getRight().getContent()); } - selectionZoomGroup.setSelectedItem(ob.isSelectionZoom()); + if (selectionZoomGroup != null) { + selectionZoomGroup.setSelectedItem(ob.isSelectionZoom()); + } checkInitialDisplayCardPane(); checkCustomModePane(); @@ -212,7 +214,9 @@ public class ZoomPane extends BasicBeanPane { zoomAttribute.setLeft(new StringFormula(leftFormulaPane.updateBean())); zoomAttribute.setRight(new StringFormula(rightFormulaPane.updateBean())); - zoomAttribute.setSelectionZoom(selectionZoomGroup.getSelectedItem()); + if (selectionZoomGroup != null) { + zoomAttribute.setSelectionZoom(selectionZoomGroup.getSelectedItem()); + } return zoomAttribute; } From e60a8923494c369e06dee731a1f251cf31eab5ba Mon Sep 17 00:00:00 2001 From: pengda Date: Tue, 15 Oct 2019 16:25:30 +0800 Subject: [PATCH 020/150] =?UTF-8?q?REPORT-22779=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E5=90=8E=E9=87=8D=E5=90=AF=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/RestartHelper.java | 51 +++---------------- .../fr/start/module/DesignerActivator.java | 4 ++ 2 files changed, 12 insertions(+), 43 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/RestartHelper.java b/designer-base/src/main/java/com/fr/design/RestartHelper.java index 4a0813f320..b49c083e79 100644 --- a/designer-base/src/main/java/com/fr/design/RestartHelper.java +++ b/designer-base/src/main/java/com/fr/design/RestartHelper.java @@ -1,17 +1,15 @@ package com.fr.design; -import com.fr.design.mainframe.DesignerContext; import com.fr.design.os.impl.RestartAction; +import com.fr.design.mainframe.DesignerContext; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; -import com.fr.stable.os.OperatingSystem; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSSupportCenter; - import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -19,8 +17,6 @@ import java.io.IOException; import java.io.RandomAccessFile; import java.nio.channels.FileChannel; import java.nio.channels.FileLock; -import java.util.ArrayList; -import java.util.List; import java.util.Map; import java.util.Properties; @@ -33,8 +29,7 @@ public class RestartHelper { public static final String RECORD_FILE = StableUtils.pathJoin(StableUtils.getInstallHome(), "delete.properties"); public static final String MOVE_FILE = StableUtils.pathJoin(StableUtils.getInstallHome(), "move.properties"); - - + private static OSBasedAction osBasedAction; /** * 把要删除的文件都记录到delete.properties中 * @@ -171,11 +166,10 @@ public class RestartHelper { }catch (Exception e){ FineLoggerFactory.getLogger().error(e.getMessage(), e); } - OSBasedAction osBasedAction = OSSupportCenter.getAction(RestartAction.class); osBasedAction.execute(filesToBeDelete); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); - } finally { + }finally { try { if (null != randomAccessFile) { randomAccessFile.close(); @@ -185,41 +179,12 @@ public class RestartHelper { } DesignerContext.getDesignerFrame().exit(); } - } - /* private static void restartInMacOS(String installHome, String[] filesToBeDelete) throws Exception { - ProcessBuilder builder = new ProcessBuilder(); - List commands = new ArrayList(); - commands.add("open"); - commands.add(installHome + File.separator + "bin" + File.separator + "restart.app"); - if (ArrayUtils.isNotEmpty(filesToBeDelete)) { - commands.add("--args"); - commands.add(StableUtils.join(filesToBeDelete, "+")); - } - builder.command(commands); - builder.start(); } - - private static void restartInWindows(String installHome, String[] filesToBeDelete) throws Exception { - ProcessBuilder builder = new ProcessBuilder(); - List commands = new ArrayList(); - commands.add(installHome + File.separator + "bin" + File.separator + "restart.exe"); - if (ArrayUtils.isNotEmpty(filesToBeDelete)) { - commands.add(StableUtils.join(filesToBeDelete, "+")); - } - builder.command(commands); - builder.start(); + /** + * 提前初始化重启动作 + */ + public static void initRestartAction(){ + osBasedAction = OSSupportCenter.getAction(RestartAction.class); } - - private static void restartInLinux(String installHome, String[] filesToBeDelete) throws Exception { - ProcessBuilder builder = new ProcessBuilder(); - List commands = new ArrayList(); - //现在先写的是restart.sh - commands.add(installHome + File.separator + "bin" + File.separator + "restart.sh"); - if (ArrayUtils.isNotEmpty(filesToBeDelete)) { - commands.add(StableUtils.join(filesToBeDelete, "+")); - } - builder.command(commands); - builder.start(); - }*/ } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 1727906fb0..2ecf939683 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -11,6 +11,7 @@ import com.fr.config.MarketConfig; import com.fr.decision.update.backup.RecoverManager; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.RestartHelper; import com.fr.design.actions.NewFormAction; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.insert.cell.BiasCellAction; @@ -55,6 +56,7 @@ import com.fr.design.mainframe.form.FormReportComponentComposite; import com.fr.design.mainframe.loghandler.DesignerLogAppender; import com.fr.design.mainframe.socketio.DesignerSocketIO; import com.fr.design.module.DesignModuleFactory; +import com.fr.design.os.impl.RestartAction; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.parameter.FormParameterReader; import com.fr.design.parameter.ParameterPropertyPane; @@ -136,9 +138,11 @@ public class DesignerActivator extends Activator { UserInfoPane.getInstance().updateBBSUserInfo(); } }, SupportOSImpl.USERINFOPANE); + storePassport(); AlphaFineHelper.switchConfig4Locale(); RecoverManager.register(new RecoverForDesigner()); + RestartHelper.initRestartAction(); } @Override From 54cb1759072fcf088c529e75a047188726f358f0 Mon Sep 17 00:00:00 2001 From: pengda Date: Tue, 15 Oct 2019 16:29:06 +0800 Subject: [PATCH 021/150] =?UTF-8?q?REPORT-22779=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E5=90=8E=E9=87=8D=E5=90=AF=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/RestartHelper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/RestartHelper.java b/designer-base/src/main/java/com/fr/design/RestartHelper.java index b49c083e79..5720629e79 100644 --- a/designer-base/src/main/java/com/fr/design/RestartHelper.java +++ b/designer-base/src/main/java/com/fr/design/RestartHelper.java @@ -29,7 +29,7 @@ public class RestartHelper { public static final String RECORD_FILE = StableUtils.pathJoin(StableUtils.getInstallHome(), "delete.properties"); public static final String MOVE_FILE = StableUtils.pathJoin(StableUtils.getInstallHome(), "move.properties"); - private static OSBasedAction osBasedAction; + private static OSBasedAction restartAction; /** * 把要删除的文件都记录到delete.properties中 * @@ -166,7 +166,7 @@ public class RestartHelper { }catch (Exception e){ FineLoggerFactory.getLogger().error(e.getMessage(), e); } - osBasedAction.execute(filesToBeDelete); + restartAction.execute(filesToBeDelete); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); }finally { @@ -185,6 +185,6 @@ public class RestartHelper { * 提前初始化重启动作 */ public static void initRestartAction(){ - osBasedAction = OSSupportCenter.getAction(RestartAction.class); + restartAction = OSSupportCenter.getAction(RestartAction.class); } } \ No newline at end of file From 5a71342bc002be3b339c721aec7e4dedf6704669 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 16 Oct 2019 09:14:06 +0800 Subject: [PATCH 022/150] =?UTF-8?q?REPORT-17779=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E8=AE=BE=E8=AE=A1=E5=99=A8=E7=A6=81=E7=94=A8?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E7=BA=A7=E5=88=AB=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/PreferencePane.java | 105 +++++++++++------- 1 file changed, 65 insertions(+), 40 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 d308cbe009..19ee5631ab 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 @@ -46,10 +46,36 @@ 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.event.*; -import java.awt.*; -import java.awt.event.*; +import javax.swing.BorderFactory; +import javax.swing.BoxLayout; +import javax.swing.JDialog; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.KeyStroke; +import javax.swing.SwingUtilities; +import javax.swing.SwingWorker; +import javax.swing.Timer; +import javax.swing.UIManager; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dialog; +import java.awt.Dimension; +import java.awt.FlowLayout; +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.event.WindowAdapter; +import java.awt.event.WindowEvent; import java.io.File; import java.text.DecimalFormat; import java.util.Locale; @@ -61,7 +87,7 @@ import static com.fr.design.i18n.Toolkit.i18nText; /** * 选项对话框 * - * @editor zhou + * @author zhou * @since 2012-3-28下午3:39:48 */ public class PreferencePane extends BasicPane { @@ -144,10 +170,12 @@ 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(); @@ -194,6 +222,7 @@ public class PreferencePane extends BasicPane { oracleSpace = new UICheckBox(i18nText("Fine-Design_Basic_Show_All_Oracle_Tables")); oraclePane.add(oracleSpace); + JPanel debuggerPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Develop_Tools")); openDebugComboBox = new UICheckBox(i18nText("Fine-Design_Basic_Open_Debug_Window")); debuggerPane.add(openDebugComboBox, BorderLayout.CENTER); @@ -213,8 +242,10 @@ public class PreferencePane extends BasicPane { joinProductImproveCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Join_Product_Improve")); improvePane.add(joinProductImproveCheckBox); - if(SupportOSImpl.AUTOPUSHUPDATE.support()){ + if (SupportOSImpl.AUTOPUSHUPDATE.support()) { autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update")); + + improvePane.add(autoPushUpdateCheckBox); } /* @@ -239,7 +270,9 @@ public class PreferencePane extends BasicPane { private void createVcsSettingPane(JPanel generalPane) { JPanel vcsPane = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Vcs_Title")); generalPane.add(vcsPane); + remindVcsLabel = new UILabel(i18nText("Fine-Design_Vcs_Remind")); + remindVcsLabel.setVisible(!VcsHelper.getInstance().needInit()); vcsEnableCheckBox = new UICheckBox(i18nText("Fine-Design_Vcs_SaveAuto")); saveCommitCheckBox = new UICheckBox(i18nText("Fine-Design_Vcs_No_Delete")); @@ -496,23 +529,8 @@ public class PreferencePane extends BasicPane { JPanel logLevelPane = FRGUIPaneFactory.createTitledBorderPane("log" + i18nText("Fine-Design_Basic_Level_Setting")); logPane.add(logLevelPane); logLevelComboBox = new UIComboBox(LOG); + logLevelComboBox.setEnabled(WorkContext.getCurrent().isLocal()); logLevelPane.add(logLevelComboBox); - logLevelComboBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - Configurations.update(new Worker() { - @Override - public void run() { - Log4jConfig.getInstance().setRootLevel((Level) logLevelComboBox.getSelectedItem()); - } - - @Override - public Class[] targets() { - return new Class[]{Log4jConfig.class}; - } - }); - } - }); } private void createLanPane(JPanel generalPane) { @@ -540,8 +558,8 @@ public class PreferencePane extends BasicPane { }); UILabel noticeLabel = new UILabel(i18nText("Fine-Design_Basic_Work_After_Restart_Designer"));//sail:提示重启后生效 double p = TableLayout.PREFERRED; - double rowSize[] = {p}; - double columnSize[] = {p, p, p}; + double[] rowSize = {p}; + double[] columnSize = {p, p, p}; Component[][] components = { {languageLabel, languageComboBox, noticeLabel}, }; @@ -581,7 +599,7 @@ public class PreferencePane extends BasicPane { private void createLengthPane(JPanel advancePane) { double p = TableLayout.PREFERRED; - double rowSize[] = {p}; + double[] rowSize = {p}; // 长度单位选择 JPanel lengthPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Setting_Ruler_Units")); @@ -603,8 +621,8 @@ public class PreferencePane extends BasicPane { private void createServerPane(JPanel advancePane) { double p = TableLayout.PREFERRED; - double rowSize[] = {p}; - double columnSize[] = {p, p, p}; + double[] rowSize = {p}; + double[] columnSize = {p, p, p}; JPanel serverPortPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Web_Preview_Port_Setting")); advancePane.add(serverPortPane); @@ -643,7 +661,7 @@ public class PreferencePane extends BasicPane { /** * The method of populate. * - * @param designerEnvManager + * @param designerEnvManager 设计器环境管理器 */ public void populate(DesignerEnvManager designerEnvManager) { if (designerEnvManager == null) { @@ -705,7 +723,7 @@ public class PreferencePane extends BasicPane { this.pageLengthComboBox.setSelectedIndex(designerEnvManager.getPageLengthUnit()); this.reportLengthComboBox.setSelectedIndex(designerEnvManager.getReportLengthUnit()); - this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort())); + this.portEditor.setValue(designerEnvManager.getEmbedServerPort()); openDebugComboBox.setSelected(designerEnvManager.isOpenDebug()); useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM()); @@ -775,7 +793,7 @@ public class PreferencePane extends BasicPane { designerEnvManager.setPageLengthUnit((short) pageLengthComboBox.getSelectedIndex()); designerEnvManager.setReportLengthUnit((short) reportLengthComboBox.getSelectedIndex()); - designerEnvManager.setJettyServerPort(portEditor.getValue().intValue()); + designerEnvManager.setJettyServerPort(portEditor.getValue()); designerEnvManager.setOpenDebug(openDebugComboBox.isSelected()); @@ -809,17 +827,24 @@ public class PreferencePane extends BasicPane { designerEnvManager.setUndoLimit(MAX_UNDO_LIMIT_50); } - Configurations.update(new Worker() { - @Override - public void run() { - Log4jConfig.getInstance().setRootLevel(((Level) logLevelComboBox.getSelectedItem())); - } + if (WorkContext.getCurrent().isLocal()) { + Configurations.update(new Worker() { + @Override + public void run() { + Level level = (Level) logLevelComboBox.getSelectedItem(); + if (level != null) { + Log4jConfig.getInstance().setRootLevel(level); + } + } - @Override - public Class[] targets() { - return new Class[]{Log4jConfig.class}; - } - }); + @Override + public Class[] targets() { + @SuppressWarnings("unchecked") + Class[] classes = new Class[]{Log4jConfig.class}; + return classes; + } + }); + } Configurations.update(new Worker() { @Override From a022644992ab8169e837aaa57947e7a334dc80a3 Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 18 Oct 2019 14:02:19 +0800 Subject: [PATCH 023/150] =?UTF-8?q?REPORT-20318=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 --- .../design/gui/iscrollbar/UIScrollBarUI.java | 41 ++++++++++--------- .../com/fr/design/layout/TableLayout.java | 6 +-- 2 files changed, 25 insertions(+), 22 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 d3393054ae..949b3958ae 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 @@ -2,6 +2,25 @@ package com.fr.design.gui.iscrollbar; import com.fr.design.constants.UIConstants; import com.fr.stable.StringUtils; +import sun.swing.DefaultLookup; + +import javax.swing.BoundedRangeModel; +import javax.swing.InputMap; +import javax.swing.JComponent; +import javax.swing.JList; +import javax.swing.JScrollBar; +import javax.swing.JScrollPane; +import javax.swing.JViewport; +import javax.swing.LookAndFeel; +import javax.swing.SwingConstants; +import javax.swing.SwingUtilities; +import javax.swing.Timer; +import javax.swing.UIManager; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.ScrollBarUI; +import javax.swing.plaf.UIResource; import java.awt.Color; import java.awt.Component; import java.awt.Container; @@ -22,24 +41,6 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import javax.swing.BoundedRangeModel; -import javax.swing.InputMap; -import javax.swing.JComponent; -import javax.swing.JList; -import javax.swing.JScrollBar; -import javax.swing.JScrollPane; -import javax.swing.JViewport; -import javax.swing.LookAndFeel; -import javax.swing.SwingConstants; -import javax.swing.SwingUtilities; -import javax.swing.Timer; -import javax.swing.UIManager; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.plaf.ComponentUI; -import javax.swing.plaf.ScrollBarUI; -import javax.swing.plaf.UIResource; -import sun.swing.DefaultLookup; /** * Like BasicScrollBarUI,but without two buttons @@ -590,6 +591,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo * will cause a repaint. */ + @SuppressWarnings("squid:S2164") protected void layoutVScrollbar(JScrollBar sb) { Dimension sbSize = sb.getSize(); Insets sbInsets = sb.getInsets(); @@ -672,6 +674,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo * Make sure the thumb fits between the buttons. Note that setting the * thumbs bounds causes a repaint. */ + @SuppressWarnings("squid:S2164") protected void layoutHScrollbar(JScrollBar sb) { Dimension sbSize = sb.getSize(); Insets sbInsets = sb.getInsets(); @@ -1080,7 +1083,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo scrollbar.repaint(); } - + @SuppressWarnings("squid:S2164") private void setValueFrom(MouseEvent e) { boolean active = isThumbRollover(); BoundedRangeModel model = scrollbar.getModel(); 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 f8134be1fd..2cf288da63 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 @@ -1747,7 +1747,7 @@ public class TableLayout implements LayoutManager2, Serializable { for (counter = 0; counter < numCr; counter++) if ((crSpec[z][counter] > 0.0) && (crSpec[z][counter] < 1.0)) fillSizeRatio -= crSpec[z][counter]; - else if (crSpec[z][counter] == FILL) + else if (AssistUtils.equals(crSpec[z][counter], FILL)) numFillSize++; // Adjust fill ratios to reflect number of fill rows/columns @@ -1773,8 +1773,8 @@ public class TableLayout implements LayoutManager2, Serializable { int crPrefMin[] = new int[numCr]; for (counter = 0; counter < numCr; counter++) - if ((crSpec[z][counter] == PREFERRED) || - (crSpec[z][counter] == MINIMUM)) { + if ((AssistUtils.equals(crSpec[z][counter], PREFERRED)) || + (AssistUtils.equals(crSpec[z][counter], MINIMUM))) { crPrefMin[counter] = crSize[z][counter]; } From a822e7f8b0de1b81f7d4208ebc946bd4d73b78ac Mon Sep 17 00:00:00 2001 From: pengda Date: Fri, 18 Oct 2019 15:41:53 +0800 Subject: [PATCH 024/150] =?UTF-8?q?sonar=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D,=E6=97=A0jira=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/PreferencePane.java | 6 --- .../actions/server/ConnectionListAction.java | 43 ------------------- .../actions/server/PluginManagerAction.java | 1 - .../mainframe/loghandler/LogHandlerBarUI.java | 2 +- .../design/scrollruler/VerticalRulerUI.java | 4 +- .../style/color/CustomChooserPanel.java | 4 +- 6 files changed, 5 insertions(+), 55 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 d308cbe009..6e4520eade 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 @@ -217,12 +217,6 @@ public class PreferencePane extends BasicPane { autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update")); improvePane.add(autoPushUpdateCheckBox); } - /* - if (DesignerPushUpdateManager.getInstance().isAutoPushUpdateSupported()) { - autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update")); - improvePane.add(autoPushUpdateCheckBox); - }*/ - JPanel spaceUpPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); spaceUpPane.add(oraclePane, BorderLayout.NORTH); spaceUpPane.add(createMemoryPane(), BorderLayout.CENTER); diff --git a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java index 15c6cb705c..50ecd0ea6d 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java @@ -57,49 +57,6 @@ public class ConnectionListAction extends UpdateAction { osBasedAction.execute(); } - /* private void openDesignDatabaseManager() { - DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); - final ConnectionConfig datasourceManager = ConnectionConfig.getInstance(); - final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() { - public void complete() { - ConnectionConfig connectionConfig = datasourceManager.mirror(); - populate(connectionConfig); - } - - protected void renameConnection(String oldName, String newName) { - datasourceManager.renameConnection(oldName, newName); - } - }; - final BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null); - databaseListDialog.addDialogActionListener(new DialogActionAdapter() { - public void doOk() { - if (!databaseManagerPane.isNamePermitted()) { - databaseListDialog.setDoOKSucceed(false); - return; - } - Configurations.modify(new WorkerFacade(ConnectionConfig.class) { - @Override - public void run() { - databaseManagerPane.update(datasourceManager); - } - }.addCallBack(new CallBackAdaptor() { - @Override - public boolean beforeCommit() { - //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 - return doWithDatasourceManager(datasourceManager, databaseManagerPane, databaseListDialog); - } - - @Override - public void afterCommit() { - DesignerContext.getDesignerBean("databasename").refreshBeanElement(); - } - })); - } - }); - databaseListDialog.setVisible(true); - } -*/ - /** * 更新datasourceManager * diff --git a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java index 7b41f6fd81..d000dbbbb0 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java @@ -16,7 +16,6 @@ import java.awt.event.ActionEvent; * @since 8.0 */ public class PluginManagerAction extends UpdateAction { - private static String PLUGIN_MANAGER_ROUTE = "#management/plugin"; public PluginManagerAction() { this.setMenuKeySet(PLUGIN_MANAGER); this.setName(getMenuKeySet().getMenuKeySetName()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java index a41f03a9db..bbb9eed346 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java @@ -69,7 +69,7 @@ public class LogHandlerBarUI extends ComponentUI implements MouseListener, Focus int w = button.getWidth(); int h = button.getHeight(); Graphics2D g2d = (Graphics2D) g; - GradientPaint gp = new GradientPaint(1, 1, darkColor, 1, h - 1f, darkColor); + GradientPaint gp = new GradientPaint(1, 1, darkColor, 1, (float)(h - 1), darkColor); g2d.setPaint(gp); g2d.fillRect(0, 0, w, h); } diff --git a/designer-base/src/main/java/com/fr/design/scrollruler/VerticalRulerUI.java b/designer-base/src/main/java/com/fr/design/scrollruler/VerticalRulerUI.java index 3e0a9eb068..2cd482e1e3 100644 --- a/designer-base/src/main/java/com/fr/design/scrollruler/VerticalRulerUI.java +++ b/designer-base/src/main/java/com/fr/design/scrollruler/VerticalRulerUI.java @@ -20,7 +20,7 @@ public class VerticalRulerUI extends RulerUI{ @Override protected void paintRuler(Graphics g, int showText, int extra, Dimension size, int ratio) { int k = pxToLength(extra) * ratio; - for (int i = k; i < (pxToLength(size.height + extra) + 1) * ratio; i++) { + for (int i = k; i < (pxToLength( (double)size.height + extra) + 1) * ratio; i++) { g.setColor(BaseRuler.UNIT_SIGN_COLOR); if (i % BaseRuler.SCALE_10 == 0) { double times = (double) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution() / ScreenResolution.getScreenResolution(); @@ -44,7 +44,7 @@ public class VerticalRulerUI extends RulerUI{ @Override protected void paintPTRuler(Graphics g, int extra, Dimension size, int unit) { int k = pxToLength(extra); - for (int i = unit * (k/unit); i < pxToLength(size.height + extra); i += unit) { + for (int i = unit * (k/unit); i < pxToLength((double)size.height + extra); i += unit) { g.setColor(BaseRuler.UNIT_SIGN_COLOR); if (i % BaseRuler.SCALE_100 == 0) { GraphHelper.drawLine(g, size.width, toPX(i) - extra, 0, toPX(i) - extra); diff --git a/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java b/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java index c7cf4f7831..6d8d267445 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java +++ b/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java @@ -314,8 +314,8 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec * @param p The point where the MouseEvent occurred. */ private void updateH(Point p) { - float s = (IMG_WIDTH - p.x * 1f) / IMG_WIDTH; - float b = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT; + double s = (IMG_WIDTH - p.x * 1D) / IMG_WIDTH; + double b = (IMG_HEIGHT - p.y * 1D) / IMG_HEIGHT; // Avoid two changes to the model by changing internalChange to true. internalChange = true; From c8145fabeeb9e4b8d3e481a98cd03530e6285fbb Mon Sep 17 00:00:00 2001 From: Bryant Date: Sun, 20 Oct 2019 15:02:52 +0800 Subject: [PATCH 025/150] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20sonar?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/gui/syntax/print/RPrintUtilities.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java b/designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java index ff27b178f4..500d1312a6 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java @@ -522,8 +522,9 @@ public abstract class RPrintUtilities { return x; int tabSizeInPixels = tabSizeInSpaces * fm.charWidth(' '); int ntabs = (((int) x) - xOffset) / tabSizeInPixels; - float reFloat = xOffset + ((ntabs + 1) * tabSizeInPixels); - return reFloat; + int reFloat = xOffset + ((ntabs + 1) * tabSizeInPixels); + float ans = reFloat; + return ans; } } From c77189c329fc5c94e9300cede69d4f1fb8176af6 Mon Sep 17 00:00:00 2001 From: Bryant Date: Sun, 20 Oct 2019 15:04:38 +0800 Subject: [PATCH 026/150] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20sonar?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/gui/syntax/print/RPrintUtilities.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java b/designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java index 500d1312a6..749bf45408 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java @@ -522,9 +522,8 @@ public abstract class RPrintUtilities { return x; int tabSizeInPixels = tabSizeInSpaces * fm.charWidth(' '); int ntabs = (((int) x) - xOffset) / tabSizeInPixels; - int reFloat = xOffset + ((ntabs + 1) * tabSizeInPixels); - float ans = reFloat; - return ans; + double reFloat = (double) xOffset + (double) ((ntabs + 1) * tabSizeInPixels); + return (float) reFloat; } } From ba6aa472c0a3a8febc7fe8b130496fcf7d972445 Mon Sep 17 00:00:00 2001 From: vito Date: Tue, 22 Oct 2019 16:53:56 +0800 Subject: [PATCH 027/150] =?UTF-8?q?REPORT-23038=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=8F=92=E4=BB=B6=E4=B8=8E=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E6=AD=BB=E9=94=81=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../loghandler/DesignerLogHandler.java | 188 +++++++++--------- 1 file changed, 98 insertions(+), 90 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java index 53802507c8..57d1d457f6 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java @@ -4,6 +4,7 @@ import com.fr.base.BaseUtils; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.ui.util.UIUtil; import com.fr.general.ComparatorUtils; import com.fr.general.log.Log4jConfig; import com.fr.log.FineLoggerFactory; @@ -41,66 +42,66 @@ import java.util.Date; import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; public class DesignerLogHandler { - + private final SimpleDateFormat LOG_SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - + private static final int GAP_X = -150; - + private static final int INFO_GAP_Y = -60; - + private static final int ERRO_GAP_Y = -40; - + private static final int SERVER_GAP_Y = -20; - + public static DesignerLogHandler getInstance() { - + return HOLDER.singleton; } - + private static class HOLDER { - + private static DesignerLogHandler singleton = new DesignerLogHandler(); } - + // 所有的面板 private LogHandlerBar caption; - + private JCheckBoxMenuItem showInfo; - + private JCheckBoxMenuItem showError; - + private JCheckBoxMenuItem showServer; - + private LogHandlerArea logHandlerArea; - + public DesignerLogHandler() { - + logHandlerArea = new LogHandlerArea(); caption = new LogHandlerBar(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Log")); - + caption.addClearListener(new ActionListener() { - + @Override public void actionPerformed(ActionEvent e) { - + logHandlerArea.jTextArea.setText(""); caption.clearMessage(); } }); caption.addSelectedListener(new ActionListener() { - + @Override public void actionPerformed(ActionEvent e) { - + logHandlerArea.jTextArea.requestFocus(); logHandlerArea.jTextArea.selectAll(); } }); ItemListener itemlistener = new ItemListener() { - + @Override public void itemStateChanged(ItemEvent e) { - + logHandlerArea.jTextArea.setText(""); caption.clearMessage(); } @@ -112,12 +113,12 @@ public class DesignerLogHandler { showServer = new JCheckBoxMenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Log_Level_Error"), true); showServer.addItemListener(itemlistener); caption.addSetListener(new ActionListener() { - + @Override public void actionPerformed(ActionEvent e) { - + JPopupMenu jPopupMenu = new JPopupMenu(); - + int logLevelInt = Log4jConfig.getInstance().getRootLevel().toInt(); if (logLevelInt <= DesignerLogger.INFO_INT) { jPopupMenu.add(showInfo); @@ -135,72 +136,73 @@ public class DesignerLogHandler { } }); } - + public JComponent getLogHandlerArea() { - + return logHandlerArea; } - + public JComponent getCaption() { - + return caption; } - + public void printRemoteLog(String message, Level level, Date date) { - + logHandlerArea.printStackTrace(message, level, date); } - + private class LogHandlerArea extends JPanel { - + private static final long serialVersionUID = 8215630927304621660L; - + private JTextPane jTextArea; - + private JPopupMenu popup; - + private UIMenuItem selectAll; - + private UIMenuItem copy; - + private UIMenuItem clear; - + private LogHandlerArea() { - + jTextArea = initLogJTextArea(); this.setLayout(FRGUIPaneFactory.createBorderLayout()); UIScrollPane js = new UIScrollPane(jTextArea); this.add(js, BorderLayout.CENTER); this.setPreferredSize(new Dimension(super.getPreferredSize().width, 150)); - + jTextArea.setEditable(false); jTextArea.setBackground(Color.WHITE); - + popup = new JPopupMenu(); selectAll = new UIMenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select_All")); selectAll.addActionListener(popupListener); selectAll.setIcon(BaseUtils.readIcon("/com/fr/design/images/log/selectedall.png")); popup.add(selectAll); - + copy = new UIMenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy")); copy.addActionListener(popupListener); copy.setIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); popup.add(copy); - + clear = new UIMenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Clear_All")); clear.addActionListener(popupListener); clear.setIcon(BaseUtils.readIcon("/com/fr/design/images/log/clear.png")); popup.add(clear); - + selectAll.setAccelerator(KeyStroke.getKeyStroke('A', DEFAULT_MODIFIER)); copy.setAccelerator(KeyStroke.getKeyStroke('C', DEFAULT_MODIFIER)); clear.setAccelerator(KeyStroke.getKeyStroke('L', DEFAULT_MODIFIER)); - + jTextArea.addMouseListener(new MouseAdapter() { - + // check for right click + @Override public void mousePressed(MouseEvent event) { - + if (event.getButton() == MouseEvent.BUTTON3) { popup.show(jTextArea, event.getX(), event.getY()); checkEnabled(); @@ -208,9 +210,9 @@ public class DesignerLogHandler { } }); } - + private JTextPane initLogJTextArea() { - + final JTextPane resultPane = new JTextPane(); InputMap inputMap = resultPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), DefaultEditorKit.copyAction); @@ -218,18 +220,19 @@ public class DesignerLogHandler { inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_L, DEFAULT_MODIFIER), "clear"); ActionMap actionMap = resultPane.getActionMap(); actionMap.put("clear", new AbstractAction() { - + + @Override public void actionPerformed(ActionEvent evt) { - + resultPane.setText(""); caption.clearMessage(); } }); return resultPane; } - + public void printStackTrace(LoggingEvent event) { - + int intLevel = event.getLevel().toInt(); Date date = new Date(event.getTimeStamp()); ThrowableInformation information = event.getThrowableInformation(); @@ -241,9 +244,9 @@ public class DesignerLogHandler { printMessage(event.getRenderedMessage(), intLevel, date, information == null ? null : information.getThrowable()); } } - + public void printStackTrace(String message, Level level, Date date) { - + int intLevel = level.toInt(); if (intLevel == DesignerLogger.INFO_INT && showInfo.isSelected()) { printMessage(message, intLevel, date); @@ -252,32 +255,36 @@ public class DesignerLogHandler { } else if (intLevel == DesignerLogger.WARN_INT && showServer.isSelected()) { printMessage(message, intLevel, date); } - + } - + private void printMessage(String message, int intLevel, Date date) { - + printMessage(message, intLevel, date, null); } - - private void printMessage(String msg, int intLevel, Date date, Throwable e) { - - this.log(LOG_SIMPLE_DATE_FORMAT.format(date) + "\n", 0); - String message = appendLocaleMark(msg, intLevel); - this.log(message, intLevel); - setMessage(message, intLevel); - if (e == null) { - return; - } - - StackTraceElement[] traceElements = e.getStackTrace(); - for (int i = 0; i < traceElements.length; i++) { - this.log("\t" + "at " + traceElements[i].toString() + "\n", 0); - } + + private void printMessage(final String msg, final int intLevel, final Date date, final Throwable e) { + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + LogHandlerArea.this.log(LOG_SIMPLE_DATE_FORMAT.format(date) + "\n", 0); + String message = appendLocaleMark(msg, intLevel); + LogHandlerArea.this.log(message, intLevel); + setMessage(message, intLevel); + if (e == null) { + return; + } + + StackTraceElement[] traceElements = e.getStackTrace(); + for (StackTraceElement traceElement : traceElements) { + LogHandlerArea.this.log("\t" + "at " + traceElement.toString() + "\n", 0); + } + } + }); } - + private void log(String str, int style) { - + SimpleAttributeSet attrSet = new SimpleAttributeSet(); if (style == DesignerLogger.ERROR_INT) { StyleConstants.setForeground(attrSet, new Color(247, 148, 29)); @@ -299,9 +306,9 @@ public class DesignerLogHandler { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } - + private String appendLocaleMark(String str, int style) { - + if (style == DesignerLogger.ERROR_INT) { str = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert") + ":" + str + "\n"; } else if (style == DesignerLogger.WARN_INT) { @@ -311,9 +318,9 @@ public class DesignerLogHandler { } return str; } - + private void setMessage(String message, int level) { - + LogMessageBar.getInstance().setMessage(message); if (level == DesignerLogger.INFO_INT && showInfo.isSelected()) { caption.infoAdd(); @@ -323,31 +330,32 @@ public class DesignerLogHandler { caption.serverAdd(); } } - + private void checkEnabled() { - + this.selectAll.setEnabled(true); this.copy.setEnabled(true); this.clear.setEnabled(true); - + if (ComparatorUtils.equals(this.jTextArea.getText(), "")) { this.selectAll.setEnabled(false); this.clear.setEnabled(false); } - + if (ComparatorUtils.equals(this.jTextArea.getSelectionStart(), this.jTextArea.getSelectionEnd())) { this.copy.setEnabled(false); } - + if (this.jTextArea.getSelectionStart() == 0 && ComparatorUtils.equals(this.jTextArea.getSelectionEnd(), this.jTextArea.getText().length())) { this.selectAll.setEnabled(false); } } - + ActionListener popupListener = new ActionListener() { - + + @Override public void actionPerformed(ActionEvent evt) { - + if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.selectAll.getText())) { LogHandlerArea.this.jTextArea.selectAll(); } else if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.copy.getText())) { @@ -358,6 +366,6 @@ public class DesignerLogHandler { } } }; - + } } From d9c42530dbcf7377c7c5311ab1e56bd95949e86a Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Fri, 25 Oct 2019 10:41:20 +0800 Subject: [PATCH 028/150] =?UTF-8?q?CHART-4248=20=E6=BC=8F=E6=96=97?= =?UTF-8?q?=E3=80=81=E5=A4=9A=E5=B1=82=E9=A5=BC=E5=9B=BE=E3=80=81=E8=AF=8D?= =?UTF-8?q?=E4=BA=91=E6=95=B0=E6=8D=AE=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fields/diff/FunnelCellDataFieldsPane.java | 55 ++++++++++++++++++ .../fields/diff/FunnelDataSetFieldsPane.java | 57 +++++++++++++++++++ .../diff/MultiPieDataSetFieldsPane.java | 2 + .../design/chartx/impl/AbstractDataPane.java | 6 +- .../FunnelIndependentVanChartInterface.java | 14 +++++ .../MultiPieIndependentVanChartInterface.java | 24 +++++--- ...WordCloudIndependentVanChartInterface.java | 23 +++++--- 7 files changed, 160 insertions(+), 21 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelCellDataFieldsPane.java create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelDataSetFieldsPane.java diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelCellDataFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelCellDataFieldsPane.java new file mode 100644 index 0000000000..de56777440 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelCellDataFieldsPane.java @@ -0,0 +1,55 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; +import com.fr.design.chartx.component.CategorySeriesFilterPane; +import com.fr.design.formula.TinyFormulaPane; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; + +/** + * Created by Wim on 2019/10/23. + */ +public class FunnelCellDataFieldsPane extends AbstractCellDataFieldsWithSeriesValuePane { + + private CategorySeriesFilterPane filterPane; + + @Override + protected void initComponents() { + filterPane = new CategorySeriesFilterPane(); + + JPanel northPane = new JPanel(new BorderLayout(0, 6)); + northPane.add(createCenterPane(), BorderLayout.CENTER); + northPane.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 8)); + + this.setLayout(new BorderLayout(0, 6)); + this.add(northPane, BorderLayout.NORTH); + this.add(filterPane, BorderLayout.CENTER); + } + + @Override + protected String[] fieldLabels() { + return new String[0]; + } + + @Override + protected TinyFormulaPane[] formulaPanes() { + return new TinyFormulaPane[0]; + } + + @Override + public MultiCategoryColumnFieldCollection updateBean() { + MultiCategoryColumnFieldCollection fieldCollection = new MultiCategoryColumnFieldCollection(); + updateSeriesValuePane(fieldCollection); + filterPane.updateMultiCategoryFieldCollection(fieldCollection); + return fieldCollection; + } + + @Override + public void populateBean(MultiCategoryColumnFieldCollection ob) { + populateSeriesValuePane(ob); + filterPane.populateMultiCategoryFieldCollection(ob); + } + +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelDataSetFieldsPane.java new file mode 100644 index 0000000000..0f94683bfe --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelDataSetFieldsPane.java @@ -0,0 +1,57 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; +import com.fr.design.chartx.component.CategorySeriesFilterPane; +import com.fr.design.gui.icombobox.UIComboBox; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.JSeparator; +import java.awt.BorderLayout; + +/** + * Created by Wim on 2019/10/23. + */ +public class FunnelDataSetFieldsPane extends AbstractDataSetFieldsWithSeriesValuePane { + + + private CategorySeriesFilterPane filterPane; + + @Override + protected void initComponents() { + filterPane = new CategorySeriesFilterPane(); + + JPanel northPane = new JPanel(new BorderLayout(0, 6)); + northPane.add(new JSeparator(), BorderLayout.CENTER); + northPane.add(createCenterPane(), BorderLayout.SOUTH); + northPane.setBorder(BorderFactory.createEmptyBorder(4, 24, 0, 15)); + + this.setLayout(new BorderLayout(0, 6)); + this.add(northPane, BorderLayout.NORTH); + this.add(filterPane, BorderLayout.CENTER); + } + + @Override + protected String[] fieldLabels() { + return new String[0]; + } + + @Override + protected UIComboBox[] filedComboBoxes() { + return new UIComboBox[0]; + } + + @Override + public MultiCategoryColumnFieldCollection updateBean() { + MultiCategoryColumnFieldCollection collection = new MultiCategoryColumnFieldCollection(); + updateSeriesValuePane(collection); + filterPane.updateMultiCategoryFieldCollection(collection); + return collection; + } + + @Override + public void populateBean(MultiCategoryColumnFieldCollection ob) { + populateSeriesValuePane(ob); + filterPane.populateMultiCategoryFieldCollection(ob); + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieDataSetFieldsPane.java index 2a299ba6e9..da783cfe2b 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieDataSetFieldsPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieDataSetFieldsPane.java @@ -77,6 +77,7 @@ public class MultiPieDataSetFieldsPane extends AbstractDataSetFieldsPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ return new VanChartMultiPieSeriesPane(parent, plot); 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 ac52506328..9c771ddacc 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,11 +3,16 @@ 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.fields.diff.WordCloudCellDataFieldsPane; +import com.fr.design.chartx.fields.diff.WordCloudDataSetFieldsPane; +import com.fr.design.chartx.impl.AbstractDataPane; +import com.fr.design.chartx.single.SingleDataPane; 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.van.chart.designer.other.VanChartInteractivePaneWithOutSort; @@ -93,13 +98,13 @@ public class WordCloudIndependentVanChartInterface extends AbstractIndependentVa return new AbstractChartAttrPane[]{stylePane, otherPane}; } -// @Override -// public ChartDataPane getChartDataPane(AttributeChangeListener listener) { -// return new AbstractDataPane(listener) { -// @Override -// protected SingleDataPane createSingleDataPane() { -// return new SingleDataPane(new WordCloudDataSetFieldsPane(), new WordCloudCellDataFieldsPane()); -// } -// }; -// } + @Override + public ChartDataPane getChartDataPane(AttributeChangeListener listener) { + return new AbstractDataPane(listener) { + @Override + protected SingleDataPane createSingleDataPane() { + return new SingleDataPane(new WordCloudDataSetFieldsPane(), new WordCloudCellDataFieldsPane()); + } + }; + } } From e6186416bb5de1f655f3fa906591038e709c3663 Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Fri, 25 Oct 2019 11:10:07 +0800 Subject: [PATCH 029/150] =?UTF-8?q?=E6=BC=8F=E6=96=97=E5=9B=BE=20=E5=8D=95?= =?UTF-8?q?=E7=B3=BB=E5=88=97=E8=BF=87=E6=BB=A4=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fields/diff/FunnelCellDataFieldsPane.java | 25 ++++++++++++++----- .../fields/diff/FunnelDataSetFieldsPane.java | 25 ++++++++++++++----- 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelCellDataFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelCellDataFieldsPane.java index de56777440..98dc4226c9 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelCellDataFieldsPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelCellDataFieldsPane.java @@ -1,8 +1,11 @@ package com.fr.design.chartx.fields.diff; +import com.fr.chartx.data.field.SeriesValueCorrelationDefinition; import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; -import com.fr.design.chartx.component.CategorySeriesFilterPane; +import com.fr.design.chartx.component.AbstractSingleFilterPane; import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.i18n.Toolkit; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -13,11 +16,16 @@ import java.awt.BorderLayout; */ public class FunnelCellDataFieldsPane extends AbstractCellDataFieldsWithSeriesValuePane { - private CategorySeriesFilterPane filterPane; + private AbstractSingleFilterPane filterPane; @Override protected void initComponents() { - filterPane = new CategorySeriesFilterPane(); + filterPane = new AbstractSingleFilterPane() { + @Override + public String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Chart_Series"); + } + }; JPanel northPane = new JPanel(new BorderLayout(0, 6)); northPane.add(createCenterPane(), BorderLayout.CENTER); @@ -25,7 +33,10 @@ public class FunnelCellDataFieldsPane extends AbstractCellDataFieldsWithSeriesVa this.setLayout(new BorderLayout(0, 6)); this.add(northPane, BorderLayout.NORTH); - this.add(filterPane, BorderLayout.CENTER); + JPanel contentPane = new JPanel(new BorderLayout()); + contentPane.add(new JPanel(), BorderLayout.NORTH); + contentPane.add(filterPane, BorderLayout.CENTER); + this.add(TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), contentPane), BorderLayout.CENTER); } @Override @@ -42,14 +53,16 @@ public class FunnelCellDataFieldsPane extends AbstractCellDataFieldsWithSeriesVa public MultiCategoryColumnFieldCollection updateBean() { MultiCategoryColumnFieldCollection fieldCollection = new MultiCategoryColumnFieldCollection(); updateSeriesValuePane(fieldCollection); - filterPane.updateMultiCategoryFieldCollection(fieldCollection); + SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = fieldCollection.getSeriesValueCorrelationDefinition(); + filterPane.updateBean(seriesValueCorrelationDefinition.getFilterProperties()); return fieldCollection; } @Override public void populateBean(MultiCategoryColumnFieldCollection ob) { populateSeriesValuePane(ob); - filterPane.populateMultiCategoryFieldCollection(ob); + SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = ob.getSeriesValueCorrelationDefinition(); + filterPane.populateBean(seriesValueCorrelationDefinition.getFilterProperties()); } } diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelDataSetFieldsPane.java index 0f94683bfe..69c3af0196 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelDataSetFieldsPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelDataSetFieldsPane.java @@ -1,8 +1,11 @@ package com.fr.design.chartx.fields.diff; +import com.fr.chartx.data.field.SeriesValueCorrelationDefinition; import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; -import com.fr.design.chartx.component.CategorySeriesFilterPane; +import com.fr.design.chartx.component.AbstractSingleFilterPane; import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.i18n.Toolkit; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -15,11 +18,16 @@ import java.awt.BorderLayout; public class FunnelDataSetFieldsPane extends AbstractDataSetFieldsWithSeriesValuePane { - private CategorySeriesFilterPane filterPane; + private AbstractSingleFilterPane filterPane; @Override protected void initComponents() { - filterPane = new CategorySeriesFilterPane(); + filterPane = new AbstractSingleFilterPane() { + @Override + public String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Chart_Series"); + } + }; JPanel northPane = new JPanel(new BorderLayout(0, 6)); northPane.add(new JSeparator(), BorderLayout.CENTER); @@ -28,7 +36,10 @@ public class FunnelDataSetFieldsPane extends AbstractDataSetFieldsWithSeriesValu this.setLayout(new BorderLayout(0, 6)); this.add(northPane, BorderLayout.NORTH); - this.add(filterPane, BorderLayout.CENTER); + JPanel contentPane = new JPanel(new BorderLayout()); + contentPane.add(new JPanel(), BorderLayout.NORTH); + contentPane.add(filterPane, BorderLayout.CENTER); + this.add(TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), contentPane), BorderLayout.CENTER); } @Override @@ -45,13 +56,15 @@ public class FunnelDataSetFieldsPane extends AbstractDataSetFieldsWithSeriesValu public MultiCategoryColumnFieldCollection updateBean() { MultiCategoryColumnFieldCollection collection = new MultiCategoryColumnFieldCollection(); updateSeriesValuePane(collection); - filterPane.updateMultiCategoryFieldCollection(collection); + SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = collection.getSeriesValueCorrelationDefinition(); + filterPane.updateBean(seriesValueCorrelationDefinition.getFilterProperties()); return collection; } @Override public void populateBean(MultiCategoryColumnFieldCollection ob) { populateSeriesValuePane(ob); - filterPane.populateMultiCategoryFieldCollection(ob); + SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = ob.getSeriesValueCorrelationDefinition(); + filterPane.populateBean(seriesValueCorrelationDefinition.getFilterProperties()); } } From 8c0e683fd33712ded635f1d5d63a98a91bacb333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Mon, 28 Oct 2019 11:40:32 +0800 Subject: [PATCH 030/150] =?UTF-8?q?CHART-10229=20=E5=8D=95=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E6=95=B0=E6=8D=AE=E9=9B=86=E6=95=B0=E6=8D=AE=E6=BA=90?= =?UTF-8?q?=EF=BC=8C=E5=8D=95=E5=85=83=E6=A0=BC=E6=95=B0=E6=8D=AE=E6=BA=90?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF&=E7=BB=84=E5=90=88=E5=9B=BE=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF&=E7=BB=84=E5=90=88=E5=9B=BE=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E9=80=89=E6=8B=A9update=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/chartx/CustomChartDataPane.java | 202 ++++++++++++++++++ .../SingleCategoryCellDataFieldsPane.java | 84 ++++++++ .../diff/SingleCategoryDataSetFieldsPane.java | 88 ++++++++ .../chart/custom/VanChartCustomPlotPane.java | 37 +++- 4 files changed, 406 insertions(+), 5 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/CustomChartDataPane.java create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/fields/diff/SingleCategoryCellDataFieldsPane.java create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/fields/diff/SingleCategoryDataSetFieldsPane.java diff --git a/designer-chart/src/main/java/com/fr/design/chartx/CustomChartDataPane.java b/designer-chart/src/main/java/com/fr/design/chartx/CustomChartDataPane.java new file mode 100644 index 0000000000..44677b627c --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/CustomChartDataPane.java @@ -0,0 +1,202 @@ +package com.fr.design.chartx; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chartx.data.AbstractDataDefinition; +import com.fr.chartx.data.CustomChartDataDefinition; +import com.fr.design.chartx.fields.diff.MultiCategoryCellDataFieldsPane; +import com.fr.design.chartx.fields.diff.MultiCategoryDataSetFieldsPane; +import com.fr.design.chartx.fields.diff.SingleCategoryCellDataFieldsPane; +import com.fr.design.chartx.fields.diff.SingleCategoryDataSetFieldsPane; +import com.fr.design.chartx.single.SingleDataPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.gui.ibutton.UITabGroup; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.custom.CustomPlotFactory; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.custom.type.CustomPlotType; +import com.fr.plugin.chart.custom.type.CustomStyle; +import com.fr.plugin.chart.vanchart.VanChart; +import com.fr.stable.StringUtils; +import com.fr.van.chart.custom.component.VanChartCustomPlotUITabGroup; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Dimension; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2019-10-23 + */ +public class CustomChartDataPane extends ChartDataPane { + + public CustomChartDataPane(AttributeChangeListener listener) { + super(listener); + } + + private VanChartCustomPlot customPlot; + + private CardLayout cardLayout; + private JPanel centerPane; + private List paneList; + private UITabGroup tabPane; + + private String[] nameArray; + + @Override + protected void initContentPane() { + if (customPlot == null) { + return; + } + cardLayout = new CardLayout(); + initPaneList(); + relayoutWhenListChange(); + } + + private void initPaneList() { + + paneList = new ArrayList<>(); + + List customPlotList = customPlot.getCustomPlotList(); + + for (int i = 0; i < customPlotList.size(); i++) { + //根据不同的plot创建不同的数据配置界面 + final VanChartPlot vanChartPlot = customPlotList.get(i); + paneList.add(new AbstractVanSingleDataPane(listener) { + @Override + protected SingleDataPane createSingleDataPane() { + return createSingleDataPaneByPlot(vanChartPlot); + } + }); + } + } + + private SingleDataPane createSingleDataPaneByPlot(VanChartPlot plot) { + CustomPlotType customType = CustomPlotFactory.getCustomType(plot); + switch (customType) { + case RING: + case SLOT: + case CUVETTE: + //todo 仪表板没写好 + return new SingleDataPane(new SingleCategoryDataSetFieldsPane(), new SingleCategoryCellDataFieldsPane()); + case SCATTER: + case BUBBLE: + //todo 散点图没写好 + return new SingleDataPane(new SingleCategoryDataSetFieldsPane(), new SingleCategoryCellDataFieldsPane()); + default: + return StringUtils.equals(CustomStyle.CUSTOM.toString(), plot.getCustomType()) ? + new SingleDataPane(new SingleCategoryDataSetFieldsPane(), new SingleCategoryCellDataFieldsPane()) : + new SingleDataPane(new MultiCategoryDataSetFieldsPane(), new MultiCategoryCellDataFieldsPane()); + } + } + + private void relayoutWhenListChange() { + centerPane = new JPanel(cardLayout) { + @Override + public Dimension getPreferredSize() { + return paneList.get(tabPane.getSelectedIndex()).getPreferredSize(); + } + }; + + //获取tab的标题 + initTabTitle(); + + tabPane = new VanChartCustomPlotUITabGroup(nameArray) { + @Override + public void tabChanged(int index) { + dealWithTabChanged(index); + } + }; + tabPane.setSelectedIndex(0); + tabPane.tabChanged(0); + initLayout(); + } + + private void initTabTitle() { + + if (customPlot == null) { + return; + } + + List customPlotList = customPlot.getCustomPlotList(); + nameArray = new String[Math.min(customPlotList.size(), paneList.size())]; + for (int i = 0; i < nameArray.length; i++) { + JPanel pane = paneList.get(i); + VanChartPlot vanChartPlot = customPlotList.get(i); + CustomPlotType plotType = CustomPlotFactory.getCustomType(vanChartPlot); + + nameArray[i] = CustomPlotFactory.getTitle(plotType); + centerPane.add(pane, nameArray[i]); + } + } + + protected void dealWithTabChanged(int index) { + cardLayout.show(centerPane, nameArray[index]); + } + + private void initLayout() { + JPanel tabPanel = new JPanel(new BorderLayout()); + tabPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, getBackground())); + tabPanel.add(tabPane, BorderLayout.CENTER); + this.setLayout(new BorderLayout(0, 6)); + this.add(tabPanel, BorderLayout.NORTH); + this.add(centerPane, BorderLayout.CENTER); + } + + @Override + public void populate(ChartCollection collection) { + if (collection == null) { + return; + } + VanChart chart = collection.getSelectedChart(VanChart.class); + if (chart == null) { + return; + } + customPlot = chart.getPlot(); + + this.removeAll(); + initContentPane(); + + CustomChartDataDefinition dataSetCollection = (CustomChartDataDefinition) chart.getChartDataDefinition(); + + if (dataSetCollection != null) { + Map customDefinitions = dataSetCollection.getCustomDefinitions(); + for (int i = 0; i < paneList.size(); i++) { + VanChartPlot vanChartPlot = customPlot.getCustomPlotList().get(i); + AbstractDataDefinition dataDefinition = customDefinitions.get(CustomPlotFactory.getCustomType(vanChartPlot)); + if (dataDefinition != null) { + paneList.get(i).populate(dataDefinition); + } + } + } + + this.initAllListeners(); + this.validate(); + } + + + @Override + public void update(ChartCollection collection) { + if (collection == null) { + return; + } + VanChart chart = collection.getSelectedChart(VanChart.class); + if (chart == null) { + return; + } + Map definitions = new HashMap<>(); + for (int i = 0; i < paneList.size(); i++) { + definitions.put(CustomPlotFactory.getCustomType(customPlot.getCustomPlotList().get(i)), paneList.get(i).update()); + } + CustomChartDataDefinition customDefinition = new CustomChartDataDefinition(); + customDefinition.setCustomDefinitions(definitions); + chart.setChartDataDefinition(customDefinition); + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/SingleCategoryCellDataFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/SingleCategoryCellDataFieldsPane.java new file mode 100644 index 0000000000..dc90ee09f0 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/SingleCategoryCellDataFieldsPane.java @@ -0,0 +1,84 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.ColumnField; +import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; +import com.fr.design.chartx.component.CategorySeriesFilterPane; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.utils.gui.GUICoreUtils; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2019-10-24 + */ +public class SingleCategoryCellDataFieldsPane extends AbstractCellDataFieldsWithSeriesValuePane { + + private TinyFormulaPane categoryPane; + + private CategorySeriesFilterPane filterPane; + + @Override + protected void initComponents() { + categoryPane = new TinyFormulaPane(); + filterPane = new CategorySeriesFilterPane(); + + UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Style_Category")); + label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); + + JPanel northPane = new JPanel(new BorderLayout(0, 6)); + northPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryPane, null, null, label, null}), BorderLayout.NORTH); + northPane.add(createCenterPane(), BorderLayout.CENTER); + northPane.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 8)); + + this.setLayout(new BorderLayout(0, 6)); + this.add(northPane, BorderLayout.NORTH); + this.add(filterPane, BorderLayout.CENTER); + } + + @Override + protected String[] fieldLabels() { + return new String[0]; + } + + @Override + protected TinyFormulaPane[] formulaPanes() { + return new TinyFormulaPane[]{categoryPane}; + } + + @Override + public void populateBean(MultiCategoryColumnFieldCollection fieldCollection) { + if (fieldCollection.getCategoryList().size() > 0) { + populateField(categoryPane, fieldCollection.getCategoryList().get(0)); + } + + populateSeriesValuePane(fieldCollection); + + filterPane.populateMultiCategoryFieldCollection(fieldCollection); + } + + @Override + public MultiCategoryColumnFieldCollection updateBean() { + + MultiCategoryColumnFieldCollection fieldCollection = new MultiCategoryColumnFieldCollection(); + fieldCollection.getCategoryList().add(new ColumnField()); + + updateField(categoryPane, fieldCollection.getCategoryList().get(0)); + + updateSeriesValuePane(fieldCollection); + + filterPane.updateMultiCategoryFieldCollection(fieldCollection); + + return fieldCollection; + } + +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/SingleCategoryDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/SingleCategoryDataSetFieldsPane.java new file mode 100644 index 0000000000..07936dfcb2 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/SingleCategoryDataSetFieldsPane.java @@ -0,0 +1,88 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.ColumnField; +import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; +import com.fr.design.chartx.component.CategorySeriesFilterPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.extended.chart.UIComboBoxWithNone; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.JSeparator; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2019-10-24 + */ +public class SingleCategoryDataSetFieldsPane extends AbstractDataSetFieldsWithSeriesValuePane { + + private UIComboBox categoryPane; + + private CategorySeriesFilterPane filterPane; + + @Override + protected void initComponents() { + categoryPane = new UIComboBoxWithNone(); + filterPane = new CategorySeriesFilterPane(); + + UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Style_Category")); + label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); + + JPanel northPane = new JPanel(new BorderLayout(0, 6)); + northPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryPane, null, null, label, null}), BorderLayout.NORTH); + northPane.add(new JSeparator(), BorderLayout.CENTER); + northPane.add(createCenterPane(), BorderLayout.SOUTH); + northPane.setBorder(BorderFactory.createEmptyBorder(4, 24, 0, 15)); + + this.setLayout(new BorderLayout(0, 6)); + this.add(northPane, BorderLayout.NORTH); + this.add(filterPane, BorderLayout.CENTER); + } + + @Override + protected String[] fieldLabels() { + return new String[0]; + } + + @Override + protected UIComboBox[] filedComboBoxes() { + return new UIComboBox[]{categoryPane}; + } + + + @Override + public void populateBean(MultiCategoryColumnFieldCollection columnFieldCollection) { + if (columnFieldCollection.getCategoryList().size() > 0) { + populateField(categoryPane, columnFieldCollection.getCategoryList().get(0)); + } + + populateSeriesValuePane(columnFieldCollection); + + filterPane.populateMultiCategoryFieldCollection(columnFieldCollection); + } + + @Override + public MultiCategoryColumnFieldCollection updateBean() { + + MultiCategoryColumnFieldCollection columnFieldCollection = new MultiCategoryColumnFieldCollection(); + columnFieldCollection.getCategoryList().add(new ColumnField()); + + updateField(categoryPane, columnFieldCollection.getCategoryList().get(0)); + + updateSeriesValuePane(columnFieldCollection); + + filterPane.updateMultiCategoryFieldCollection(columnFieldCollection); + + return columnFieldCollection; + } + +} 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 927fa31485..70431b2e79 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 @@ -6,6 +6,8 @@ import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionCollection; +import com.fr.chartx.data.AbstractDataDefinition; +import com.fr.chartx.data.CustomChartDataDefinition; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.type.ChartImagePane; @@ -24,11 +26,11 @@ import com.fr.van.chart.designer.type.AbstractVanChartTypePane; import javax.swing.JPanel; import javax.swing.JSeparator; +import java.util.HashMap; +import java.util.Map; import java.awt.CardLayout; import java.awt.Component; import java.awt.Dimension; -import java.util.HashMap; -import java.util.Map; /** * Created by Mitisky on 16/2/16. @@ -123,6 +125,7 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane { //如果上次的状态和这次的装填不在同一个页面,说明同一个图表內切换了,需要情況数据配置 if (lastState != chart.getPlot().getDetailType()) { chart.setFilterDefinition(null); + ((VanChart) chart).setChartDataDefinition(null); } Chart[] customChart = CustomIndependentVanChart.CustomVanChartTypes; @@ -137,6 +140,9 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane { dealCustomDefinition(chart); customSelectPane.updateBean(chart); + + //更新新的数据配置 + dealCustomChartDataDefinition(chart); } else if (isSamePlot()) {//如果是同一个图表切换过来,则重置面板 customSelectPane.populateBean(chart); } @@ -150,6 +156,27 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane { } + private void dealCustomChartDataDefinition(Chart chart) { + CustomChartDataDefinition chartDataDefinition = (CustomChartDataDefinition) ((VanChart) chart).getChartDataDefinition(); + + if (chartDataDefinition == null) { + return; + } + + Map customDefinitions = chartDataDefinition.getCustomDefinitions(); + + Map newCustomDefinitions = new HashMap<>(); + + VanChartCustomPlot customPlot = chart.getPlot(); + for (int i = 0; i < customPlot.getCustomPlotList().size(); i++) { + CustomPlotType plotType = CustomPlotFactory.getCustomType(customPlot.getCustomPlotList().get(i)); + AbstractDataDefinition definition = customDefinitions.get(plotType); + newCustomDefinitions.put(plotType, definition); + } + + chartDataDefinition.setCustomDefinitions(newCustomDefinitions); + } + private void dealCustomDefinition(Chart chart) { CustomDefinition definition = (CustomDefinition) chart.getFilterDefinition(); @@ -229,9 +256,9 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane { } Plot cloned = null; try { - if(newPlot != null) { - cloned = (Plot) newPlot.clone(); - } + if (newPlot != null) { + cloned = (Plot) newPlot.clone(); + } } catch (CloneNotSupportedException e) { FineLoggerFactory.getLogger().error("Error In ScatterChart"); } From 7b918fbaaca86251639732776c20111d1c9db66a Mon Sep 17 00:00:00 2001 From: richie Date: Mon, 28 Oct 2019 17:18:16 +0800 Subject: [PATCH 031/150] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E5=BC=80=E6=94=BEAPI=E7=9A=84=E4=B8=80=E4=BA=9B=E9=81=97?= =?UTF-8?q?=E7=95=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/designer/creator/CRPropertyDescriptor.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptor.java b/designer-base/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptor.java index e4729f0709..e2470875d4 100644 --- a/designer-base/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptor.java +++ b/designer-base/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptor.java @@ -4,7 +4,7 @@ package com.fr.design.designer.creator; import com.fr.stable.StringUtils; -import com.fr.stable.core.PropertyChangeAdapter; +import com.fr.stable.core.PropertyChangeListener; import java.beans.IntrospectionException; import java.beans.PropertyDescriptor; @@ -17,7 +17,7 @@ public final class CRPropertyDescriptor extends PropertyDescriptor { public static final String RENDERER = "renderer"; private boolean isSubProperty = false; - private PropertyChangeAdapter l; + private PropertyChangeListener l; public CRPropertyDescriptor(String name, Class beanClass) throws IntrospectionException { super(name, beanClass); @@ -35,7 +35,7 @@ public final class CRPropertyDescriptor extends PropertyDescriptor { return this; } - public CRPropertyDescriptor setPropertyChangeListener(PropertyChangeAdapter l) { + public CRPropertyDescriptor setPropertyChangeListener(PropertyChangeListener l) { this.l = l; return this; } From 93e832c75974b92c2463a509ef9a12c5625bbe84 Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Wed, 30 Oct 2019 07:59:26 +0800 Subject: [PATCH 032/150] =?UTF-8?q?CHART-4248=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/AbstractMultiComponentPane.java | 2 +- .../fields/diff/FunnelCellDataFieldsPane.java | 10 +++++----- .../fields/diff/FunnelDataSetFieldsPane.java | 10 +++++----- .../fr/design/chartx/impl/AbstractDataPane.java | 6 +++--- .../fr/van/chart/column/VanColumnChartTypeUI.java | 15 --------------- .../MultiPieIndependentVanChartInterface.java | 4 ++-- .../vanchart/AbstractIndependentVanChartUI.java | 14 ++++++++++++++ .../vanchart/AbstractMultiCategoryVanChartUI.java | 14 ++++++++++++++ .../WordCloudIndependentVanChartInterface.java | 4 ++-- 9 files changed, 46 insertions(+), 33 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java index 410ec00b04..6474cad0b6 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java @@ -126,7 +126,7 @@ public abstract class AbstractMultiComponentPane extends J } private boolean canAdd() { - return categoryComponentList.size() < 3; + return categoryComponentList.size() < 2; } public List componentList() { diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelCellDataFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelCellDataFieldsPane.java index 98dc4226c9..1e001e5fb7 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelCellDataFieldsPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelCellDataFieldsPane.java @@ -1,7 +1,7 @@ package com.fr.design.chartx.fields.diff; import com.fr.chartx.data.field.SeriesValueCorrelationDefinition; -import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; +import com.fr.chartx.data.field.diff.AbstractColumnFieldCollectionWithSeriesValue; import com.fr.design.chartx.component.AbstractSingleFilterPane; import com.fr.design.formula.TinyFormulaPane; import com.fr.design.i18n.Toolkit; @@ -14,7 +14,7 @@ import java.awt.BorderLayout; /** * Created by Wim on 2019/10/23. */ -public class FunnelCellDataFieldsPane extends AbstractCellDataFieldsWithSeriesValuePane { +public class FunnelCellDataFieldsPane extends AbstractCellDataFieldsWithSeriesValuePane { private AbstractSingleFilterPane filterPane; @@ -50,8 +50,8 @@ public class FunnelCellDataFieldsPane extends AbstractCellDataFieldsWithSeriesVa } @Override - public MultiCategoryColumnFieldCollection updateBean() { - MultiCategoryColumnFieldCollection fieldCollection = new MultiCategoryColumnFieldCollection(); + public AbstractColumnFieldCollectionWithSeriesValue updateBean() { + AbstractColumnFieldCollectionWithSeriesValue fieldCollection = new AbstractColumnFieldCollectionWithSeriesValue(); updateSeriesValuePane(fieldCollection); SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = fieldCollection.getSeriesValueCorrelationDefinition(); filterPane.updateBean(seriesValueCorrelationDefinition.getFilterProperties()); @@ -59,7 +59,7 @@ public class FunnelCellDataFieldsPane extends AbstractCellDataFieldsWithSeriesVa } @Override - public void populateBean(MultiCategoryColumnFieldCollection ob) { + public void populateBean(AbstractColumnFieldCollectionWithSeriesValue ob) { populateSeriesValuePane(ob); SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = ob.getSeriesValueCorrelationDefinition(); filterPane.populateBean(seriesValueCorrelationDefinition.getFilterProperties()); diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelDataSetFieldsPane.java index 69c3af0196..e6adcc2899 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelDataSetFieldsPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelDataSetFieldsPane.java @@ -1,7 +1,7 @@ package com.fr.design.chartx.fields.diff; import com.fr.chartx.data.field.SeriesValueCorrelationDefinition; -import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; +import com.fr.chartx.data.field.diff.AbstractColumnFieldCollectionWithSeriesValue; import com.fr.design.chartx.component.AbstractSingleFilterPane; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.i18n.Toolkit; @@ -15,7 +15,7 @@ import java.awt.BorderLayout; /** * Created by Wim on 2019/10/23. */ -public class FunnelDataSetFieldsPane extends AbstractDataSetFieldsWithSeriesValuePane { +public class FunnelDataSetFieldsPane extends AbstractDataSetFieldsWithSeriesValuePane { private AbstractSingleFilterPane filterPane; @@ -53,8 +53,8 @@ public class FunnelDataSetFieldsPane extends AbstractDataSetFieldsWithSeriesValu } @Override - public MultiCategoryColumnFieldCollection updateBean() { - MultiCategoryColumnFieldCollection collection = new MultiCategoryColumnFieldCollection(); + public AbstractColumnFieldCollectionWithSeriesValue updateBean() { + AbstractColumnFieldCollectionWithSeriesValue collection = new AbstractColumnFieldCollectionWithSeriesValue(); updateSeriesValuePane(collection); SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = collection.getSeriesValueCorrelationDefinition(); filterPane.updateBean(seriesValueCorrelationDefinition.getFilterProperties()); @@ -62,7 +62,7 @@ public class FunnelDataSetFieldsPane extends AbstractDataSetFieldsWithSeriesValu } @Override - public void populateBean(MultiCategoryColumnFieldCollection ob) { + public void populateBean(AbstractColumnFieldCollectionWithSeriesValue ob) { populateSeriesValuePane(ob); SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = ob.getSeriesValueCorrelationDefinition(); filterPane.populateBean(seriesValueCorrelationDefinition.getFilterProperties()); diff --git a/designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractDataPane.java b/designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractDataPane.java index c2a365f2c2..92c9643666 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractDataPane.java @@ -1,12 +1,12 @@ package com.fr.design.chartx.impl; import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.impl.AbstractChartWithData; import com.fr.chartx.data.AbstractDataDefinition; import com.fr.chartx.data.ChartDataDefinitionProvider; import com.fr.design.chartx.single.SingleDataPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.gui.ChartDataPane; -import com.fr.plugin.chart.vanchart.VanChart; import javax.swing.JPanel; import java.awt.BorderLayout; @@ -35,7 +35,7 @@ public abstract class AbstractDataPane extends ChartDataPane { if (collection == null) { return; } - VanChart chart = collection.getSelectedChart(VanChart.class); + AbstractChartWithData chart = collection.getSelectedChart(AbstractChartWithData.class); if (chart == null) { return; } @@ -57,7 +57,7 @@ public abstract class AbstractDataPane extends ChartDataPane { if (collection == null) { return; } - VanChart chart = collection.getSelectedChart(VanChart.class); + AbstractChartWithData chart = collection.getSelectedChart(AbstractChartWithData.class); if (chart == null) { return; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/column/VanColumnChartTypeUI.java b/designer-chart/src/main/java/com/fr/van/chart/column/VanColumnChartTypeUI.java index 11785780b1..0d491f9046 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/column/VanColumnChartTypeUI.java +++ b/designer-chart/src/main/java/com/fr/van/chart/column/VanColumnChartTypeUI.java @@ -2,14 +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.AbstractVanSingleDataPane; -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.condition.ConditionAttributesPane; -import com.fr.design.gui.frpane.AttributeChangeListener; 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.type.AbstractChartTypePane; import com.fr.van.chart.vanchart.AbstractMultiCategoryVanChartUI; @@ -66,13 +60,4 @@ public class VanColumnChartTypeUI extends AbstractMultiCategoryVanChartUI { return new VanChartColumnSeriesPane(parent, plot); } - @Override - public ChartDataPane getChartDataPane(AttributeChangeListener listener) { - return new AbstractVanSingleDataPane(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/multilayer/MultiPieIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java index 1b48056213..9b1aa395f5 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,9 +2,9 @@ package com.fr.van.chart.multilayer; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chartx.AbstractVanSingleDataPane; import com.fr.design.chartx.fields.diff.MultiPieCellDataFieldsPane; import com.fr.design.chartx.fields.diff.MultiPieDataSetFieldsPane; -import com.fr.design.chartx.impl.AbstractDataPane; import com.fr.design.chartx.single.SingleDataPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; @@ -44,7 +44,7 @@ public class MultiPieIndependentVanChartInterface extends AbstractIndependentVan @Override public ChartDataPane getChartDataPane(AttributeChangeListener listener) { - return new AbstractDataPane(listener) { + return new AbstractVanSingleDataPane(listener) { @Override protected SingleDataPane createSingleDataPane() { return new SingleDataPane(new MultiPieDataSetFieldsPane(), new MultiPieCellDataFieldsPane()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractIndependentVanChartUI.java b/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractIndependentVanChartUI.java index e1234c90fe..39e22492f4 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractIndependentVanChartUI.java +++ b/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractIndependentVanChartUI.java @@ -2,6 +2,10 @@ package com.fr.van.chart.vanchart; import com.fr.chart.chartattr.Plot; import com.fr.design.chart.fun.impl.AbstractIndependentChartUIWithAPILevel; +import com.fr.design.chartx.AbstractVanSingleDataPane; +import com.fr.design.chartx.fields.diff.SingleCategoryCellDataFieldsPane; +import com.fr.design.chartx.fields.diff.SingleCategoryDataSetFieldsPane; +import com.fr.design.chartx.single.SingleDataPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; @@ -46,4 +50,14 @@ public abstract class AbstractIndependentVanChartUI extends AbstractIndependentC public int currentAPILevel() { return CURRENT_API_LEVEL; } + + @Override + public ChartDataPane getChartDataPane(AttributeChangeListener listener) { + return new AbstractVanSingleDataPane(listener) { + @Override + protected SingleDataPane createSingleDataPane() { + return new SingleDataPane(new SingleCategoryDataSetFieldsPane(), new SingleCategoryCellDataFieldsPane()); + } + }; + } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java b/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java index 9b9d7cd430..6cd2743fef 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java +++ b/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java @@ -3,6 +3,10 @@ package com.fr.van.chart.vanchart; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chartx.AbstractVanSingleDataPane; +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 com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; @@ -60,4 +64,14 @@ public abstract class AbstractMultiCategoryVanChartUI extends AbstractIndependen }; return new AbstractChartAttrPane[]{stylePane, otherPane}; } + + @Override + public ChartDataPane getChartDataPane(AttributeChangeListener listener) { + return new AbstractVanSingleDataPane(listener) { + @Override + protected SingleDataPane createSingleDataPane() { + return new SingleDataPane(new MultiCategoryDataSetFieldsPane(), new MultiCategoryCellDataFieldsPane()); + } + }; + } } 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 9c771ddacc..b978d9355a 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,9 +3,9 @@ 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.AbstractVanSingleDataPane; import com.fr.design.chartx.fields.diff.WordCloudCellDataFieldsPane; import com.fr.design.chartx.fields.diff.WordCloudDataSetFieldsPane; -import com.fr.design.chartx.impl.AbstractDataPane; import com.fr.design.chartx.single.SingleDataPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.dialog.BasicPane; @@ -100,7 +100,7 @@ public class WordCloudIndependentVanChartInterface extends AbstractIndependentVa @Override public ChartDataPane getChartDataPane(AttributeChangeListener listener) { - return new AbstractDataPane(listener) { + return new AbstractVanSingleDataPane(listener) { @Override protected SingleDataPane createSingleDataPane() { return new SingleDataPane(new WordCloudDataSetFieldsPane(), new WordCloudCellDataFieldsPane()); From 51c0b98170d1fdc6a92a5974360c0041ccc5c2c9 Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Sun, 3 Nov 2019 10:37:53 +0800 Subject: [PATCH 033/150] =?UTF-8?q?CHART-4248=20=E9=87=8D=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E9=9D=9E=E6=8A=BD=E8=B1=A1=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractCellDataFieldsWithSeriesValuePane.java | 8 ++++---- .../diff/AbstractDataSetFieldsWithSeriesValuePane.java | 8 ++++---- .../chartx/fields/diff/FunnelCellDataFieldsPane.java | 10 +++++----- .../chartx/fields/diff/FunnelDataSetFieldsPane.java | 10 +++++----- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AbstractCellDataFieldsWithSeriesValuePane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AbstractCellDataFieldsWithSeriesValuePane.java index 21f86633ac..1ac1952aa0 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AbstractCellDataFieldsWithSeriesValuePane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AbstractCellDataFieldsWithSeriesValuePane.java @@ -1,6 +1,6 @@ package com.fr.design.chartx.fields.diff; -import com.fr.chartx.data.field.diff.AbstractColumnFieldCollectionWithSeriesValue; +import com.fr.chartx.data.field.diff.ColumnFieldCollectionWithSeriesValue; import com.fr.design.chartx.component.CellDataSeriesValueCorrelationPane; import com.fr.design.chartx.fields.AbstractCellDataFieldsPane; @@ -10,7 +10,7 @@ import java.awt.BorderLayout; /** * Created by shine on 2019/6/4. */ -public abstract class AbstractCellDataFieldsWithSeriesValuePane +public abstract class AbstractCellDataFieldsWithSeriesValuePane extends AbstractCellDataFieldsPane { private CellDataSeriesValueCorrelationPane seriesValueFieldsPane; @@ -41,11 +41,11 @@ public abstract class AbstractCellDataFieldsWithSeriesValuePane +public abstract class AbstractDataSetFieldsWithSeriesValuePane extends AbstractDataSetFieldsPane { private SeriesValueFieldComboBoxPane seriesValueFieldComboBoxPane; @@ -61,11 +61,11 @@ public abstract class AbstractDataSetFieldsWithSeriesValuePane { +public class FunnelCellDataFieldsPane extends AbstractCellDataFieldsWithSeriesValuePane { private AbstractSingleFilterPane filterPane; @@ -50,8 +50,8 @@ public class FunnelCellDataFieldsPane extends AbstractCellDataFieldsWithSeriesVa } @Override - public AbstractColumnFieldCollectionWithSeriesValue updateBean() { - AbstractColumnFieldCollectionWithSeriesValue fieldCollection = new AbstractColumnFieldCollectionWithSeriesValue(); + public ColumnFieldCollectionWithSeriesValue updateBean() { + ColumnFieldCollectionWithSeriesValue fieldCollection = new ColumnFieldCollectionWithSeriesValue(); updateSeriesValuePane(fieldCollection); SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = fieldCollection.getSeriesValueCorrelationDefinition(); filterPane.updateBean(seriesValueCorrelationDefinition.getFilterProperties()); @@ -59,7 +59,7 @@ public class FunnelCellDataFieldsPane extends AbstractCellDataFieldsWithSeriesVa } @Override - public void populateBean(AbstractColumnFieldCollectionWithSeriesValue ob) { + public void populateBean(ColumnFieldCollectionWithSeriesValue ob) { populateSeriesValuePane(ob); SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = ob.getSeriesValueCorrelationDefinition(); filterPane.populateBean(seriesValueCorrelationDefinition.getFilterProperties()); diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelDataSetFieldsPane.java index e6adcc2899..c24a23b4e8 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelDataSetFieldsPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelDataSetFieldsPane.java @@ -1,7 +1,7 @@ package com.fr.design.chartx.fields.diff; import com.fr.chartx.data.field.SeriesValueCorrelationDefinition; -import com.fr.chartx.data.field.diff.AbstractColumnFieldCollectionWithSeriesValue; +import com.fr.chartx.data.field.diff.ColumnFieldCollectionWithSeriesValue; import com.fr.design.chartx.component.AbstractSingleFilterPane; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.i18n.Toolkit; @@ -15,7 +15,7 @@ import java.awt.BorderLayout; /** * Created by Wim on 2019/10/23. */ -public class FunnelDataSetFieldsPane extends AbstractDataSetFieldsWithSeriesValuePane { +public class FunnelDataSetFieldsPane extends AbstractDataSetFieldsWithSeriesValuePane { private AbstractSingleFilterPane filterPane; @@ -53,8 +53,8 @@ public class FunnelDataSetFieldsPane extends AbstractDataSetFieldsWithSeriesValu } @Override - public AbstractColumnFieldCollectionWithSeriesValue updateBean() { - AbstractColumnFieldCollectionWithSeriesValue collection = new AbstractColumnFieldCollectionWithSeriesValue(); + public ColumnFieldCollectionWithSeriesValue updateBean() { + ColumnFieldCollectionWithSeriesValue collection = new ColumnFieldCollectionWithSeriesValue(); updateSeriesValuePane(collection); SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = collection.getSeriesValueCorrelationDefinition(); filterPane.updateBean(seriesValueCorrelationDefinition.getFilterProperties()); @@ -62,7 +62,7 @@ public class FunnelDataSetFieldsPane extends AbstractDataSetFieldsWithSeriesValu } @Override - public void populateBean(AbstractColumnFieldCollectionWithSeriesValue ob) { + public void populateBean(ColumnFieldCollectionWithSeriesValue ob) { populateSeriesValuePane(ob); SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = ob.getSeriesValueCorrelationDefinition(); filterPane.populateBean(seriesValueCorrelationDefinition.getFilterProperties()); From c5926c4a0b026fc198494ce97a5220bea50c2e38 Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Mon, 4 Nov 2019 11:27:53 +0800 Subject: [PATCH 034/150] =?UTF-8?q?refactor:=E6=95=A3=E7=82=B9=E5=9B=BE?= =?UTF-8?q?=E6=B0=94=E6=B3=A1=E5=9B=BE=E6=95=B0=E6=8D=AE=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=20CHART-4248?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/chartx/AbstractChartDataPane.java | 2 +- .../chartx/AbstractVanSingleDataPane.java | 7 +- .../fr/design/chartx/CustomChartDataPane.java | 7 +- .../fr/design/chartx/GanttChartDataPane.java | 5 +- .../CellDataSeriesXYValueCorrelationPane.java | 66 +++++++++++++ .../diff/ScatterCellDataFieldsPane.java | 86 +++++++++++++++++ .../fields/diff/ScatterDataSetFieldsPane.java | 95 +++++++++++++++++++ .../mainframe/chart/gui/ChartDataPane.java | 5 + .../BubbleIndependentVanChartInterface.java | 22 +++++ .../FunnelIndependentVanChartInterface.java | 3 +- .../MultiPieIndependentVanChartInterface.java | 3 +- .../ScatterIndependentVanChartInterface.java | 15 +++ .../desinger/VanStructureChartTypeUI.java | 3 +- .../AbstractIndependentVanChartUI.java | 3 +- .../AbstractMultiCategoryVanChartUI.java | 3 +- ...WordCloudIndependentVanChartInterface.java | 3 +- 16 files changed, 313 insertions(+), 15 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/component/CellDataSeriesXYValueCorrelationPane.java create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/fields/diff/ScatterCellDataFieldsPane.java create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/fields/diff/ScatterDataSetFieldsPane.java diff --git a/designer-chart/src/main/java/com/fr/design/chartx/AbstractChartDataPane.java b/designer-chart/src/main/java/com/fr/design/chartx/AbstractChartDataPane.java index 61359d91b7..aa776f4891 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/AbstractChartDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/AbstractChartDataPane.java @@ -32,7 +32,7 @@ public abstract class AbstractChartDataPane { + + @Override + protected FieldEditorComponentWrapper[] createFieldEditorComponentWrappers() { + return new FieldEditorComponentWrapper[]{ + new TinyFormulaPaneEditorComponent(Toolkit.i18nText("Fine-Design_Chart_Series_Name")), + new TinyFormulaPaneEditorComponent(Toolkit.i18nText("Fine-Design_Chart_X_Axis")), + new TinyFormulaPaneEditorComponent(Toolkit.i18nText("Fine-Design_Chart_Y_Axis")), + new TinyFormulaPaneEditorComponent(Toolkit.i18nText("Fine-Design_Chart_Series_Value")) + }; + } + + @Override + protected List covertTBeanToTableModelList(BubbleColumnFieldCollection bubbleColumnFieldCollection) { + List result = new ArrayList<>(); + + List bubbleColumnFieldList = bubbleColumnFieldCollection.getList(); + for (BubbleColumnField field : bubbleColumnFieldList) { + Object[] array = new Object[]{ + field.getSeriesName().getFieldName(), + field.getXField().getFieldName(), + field.getYField().getFieldName(), + field.getValueField().getFieldName() + }; + result.add(array); + } + + return result; + } + + @Override + protected void setTableModelListToTBean(List tableValues, BubbleColumnFieldCollection bubbleColumnFieldCollection) { + List bubbleColumnFieldList = new ArrayList<>(); + for (Object[] oneLine : tableValues) { + BubbleColumnField bubbleColumnField = new BubbleColumnField(); + ColumnField series = new ColumnField(Utils.objectToString(oneLine[0])); + ColumnField xField = new ColumnField(Utils.objectToString(oneLine[1])); + ColumnField yField = new ColumnField(Utils.objectToString(oneLine[2])); + ColumnField value = new ColumnField(Utils.objectToString(oneLine[3])); + bubbleColumnField.setSeriesName(series); + bubbleColumnField.setXField(xField); + bubbleColumnField.setYField(yField); + bubbleColumnField.setValueField(value); + bubbleColumnFieldList.add(bubbleColumnField); + } + + bubbleColumnFieldCollection.setList(bubbleColumnFieldList); + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/ScatterCellDataFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/ScatterCellDataFieldsPane.java new file mode 100644 index 0000000000..920538f431 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/ScatterCellDataFieldsPane.java @@ -0,0 +1,86 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.diff.BubbleColumnFieldCollection; +import com.fr.design.chartx.component.AbstractSingleFilterPane; +import com.fr.design.chartx.component.CellDataSeriesXYValueCorrelationPane; +import com.fr.design.chartx.fields.AbstractCellDataFieldsPane; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.i18n.Toolkit; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.JPanel; +import java.awt.BorderLayout; + +/** + * Created by Wim on 2019/11/04. + */ +public class ScatterCellDataFieldsPane extends AbstractCellDataFieldsPane { + + private CellDataSeriesXYValueCorrelationPane seriesXYValueCorrelationPane; + private AbstractSingleFilterPane filterPane; + + + public CellDataSeriesXYValueCorrelationPane getSeriesXYValueCorrelationPane() { + return seriesXYValueCorrelationPane; + } + + public void setSeriesXYValueCorrelationPane(CellDataSeriesXYValueCorrelationPane seriesXYValueCorrelationPane) { + this.seriesXYValueCorrelationPane = seriesXYValueCorrelationPane; + } + + @Override + protected void initComponents() { + filterPane = new AbstractSingleFilterPane() { + @Override + public String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Chart_Series"); + } + }; + + this.setLayout(new BorderLayout(0, 6)); + this.add(createCenterPane(), BorderLayout.NORTH); + JPanel contentPane = new JPanel(new BorderLayout()); + contentPane.add(new JPanel(), BorderLayout.NORTH); + contentPane.add(filterPane, BorderLayout.CENTER); + this.add(TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), contentPane), BorderLayout.CENTER); + + } + + @Override + protected JPanel createCenterPane() { + JPanel normalCenter = super.createCenterPane(); + seriesXYValueCorrelationPane = new CellDataSeriesXYValueCorrelationPane(); + + if (normalCenter != null) { + JPanel panel = new JPanel(new BorderLayout(0, 6)); + panel.add(normalCenter, BorderLayout.NORTH); + panel.add(seriesXYValueCorrelationPane, BorderLayout.CENTER); + return panel; + } else { + return seriesXYValueCorrelationPane; + } + + } + + @Override + protected String[] fieldLabels() { + return new String[0]; + } + + @Override + protected TinyFormulaPane[] formulaPanes() { + return new TinyFormulaPane[0]; + } + + @Override + public BubbleColumnFieldCollection updateBean() { + BubbleColumnFieldCollection collection = new BubbleColumnFieldCollection(); + seriesXYValueCorrelationPane.updateBean(collection); + return collection; + } + + @Override + public void populateBean(BubbleColumnFieldCollection ob) { + seriesXYValueCorrelationPane.populateBean(ob); + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/ScatterDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/ScatterDataSetFieldsPane.java new file mode 100644 index 0000000000..79765cccb3 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/ScatterDataSetFieldsPane.java @@ -0,0 +1,95 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.diff.BubbleColumnField; +import com.fr.chartx.data.field.diff.BubbleColumnFieldCollection; +import com.fr.design.chartx.component.AbstractSingleFilterPane; +import com.fr.design.chartx.fields.AbstractDataSetFieldsPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.i18n.Toolkit; +import com.fr.extended.chart.UIComboBoxWithNone; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.JSeparator; +import java.awt.BorderLayout; + +/** + * Created by Wim on 2019/10/29. + */ +public class ScatterDataSetFieldsPane extends AbstractDataSetFieldsPane { + + private UIComboBoxWithNone series; + private UIComboBox xField; + private UIComboBox yField; + private UIComboBoxWithNone value; + + //todo 数据筛选 + private AbstractSingleFilterPane filterPane; + + + @Override + protected void initComponents() { + + series = new UIComboBoxWithNone(); + xField = new UIComboBox(); + yField = new UIComboBox(); + value = new UIComboBoxWithNone(); + + filterPane = new AbstractSingleFilterPane() { + @Override + public String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Chart_Series"); + } + }; + + JPanel northPane = new JPanel(new BorderLayout(0, 6)); + northPane.add(new JSeparator(), BorderLayout.CENTER); + northPane.add(createCenterPane(), BorderLayout.SOUTH); + northPane.setBorder(BorderFactory.createEmptyBorder(4, 24, 0, 15)); + + this.setLayout(new BorderLayout(0, 6)); + this.add(northPane, BorderLayout.NORTH); + JPanel contentPane = new JPanel(new BorderLayout()); + contentPane.add(new JPanel(), BorderLayout.NORTH); + contentPane.add(filterPane, BorderLayout.CENTER); + this.add(TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), contentPane), BorderLayout.CENTER); + } + + @Override + protected UIComboBox[] filedComboBoxes() { + return new UIComboBox[]{ + series, xField, yField, value + }; + } + + @Override + protected String[] fieldLabels() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + "x", + "y", + Toolkit.i18nText("Fine-Design_Chart_Use_Value") + }; + } + + @Override + public BubbleColumnFieldCollection updateBean() { + BubbleColumnFieldCollection collection = new BubbleColumnFieldCollection(); + BubbleColumnField field = collection.getBubbleColumnField(0); + updateField(series, field.getSeriesName()); + updateField(xField, field.getXField()); + updateField(yField, field.getYField()); + updateField(value, field.getValueField()); + return collection; + } + + @Override + public void populateBean(BubbleColumnFieldCollection ob) { + BubbleColumnField field = ob.getBubbleColumnField(0); + populateField(series, field.getSeriesName()); + populateField(xField, field.getXField()); + populateField(yField, field.getYField()); + populateField(value, field.getValueField()); + } +} diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartDataPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartDataPane.java index 5aed1e47d6..4d961b3c30 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartDataPane.java @@ -10,6 +10,7 @@ import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.data.DataContentsPane; import com.fr.design.mainframe.chart.gui.data.NormalChartDataPane; +import com.fr.plugin.chart.vanchart.VanChart; import javax.swing.*; import java.awt.*; @@ -35,6 +36,10 @@ public class ChartDataPane extends AbstractChartAttrPane { return contentsPane; } + protected JPanel createContentPane(VanChart vanChart){ + return createContentPane(); + } + /** * 界面标题 */ 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 6041f7e6fa..1206d0fd3a 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 @@ -3,6 +3,12 @@ package com.fr.van.chart.bubble; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chartx.AbstractVanSingleDataPane; +import com.fr.design.chartx.fields.diff.ScatterCellDataFieldsPane; +import com.fr.design.chartx.fields.diff.ScatterDataSetFieldsPane; +import com.fr.design.chartx.fields.diff.SingleCategoryCellDataFieldsPane; +import com.fr.design.chartx.fields.diff.SingleCategoryDataSetFieldsPane; +import com.fr.design.chartx.single.SingleDataPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.i18n.Toolkit; @@ -14,6 +20,7 @@ import com.fr.design.mainframe.chart.gui.data.report.BubblePlotReportDataContent import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.plugin.chart.bubble.VanChartBubblePlot; +import com.fr.plugin.chart.vanchart.VanChart; import com.fr.van.chart.bubble.data.VanChartBubblePlotTableDataContentPane; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; import com.fr.van.chart.designer.other.VanChartOtherPane; @@ -115,4 +122,19 @@ public class BubbleIndependentVanChartInterface extends AbstractIndependentVanCh public ConditionAttributesPane getPlotConditionPane(Plot plot) { return new VanChartBubbleConditionPane(plot); } + + @Override + public ChartDataPane getChartDataPane(AttributeChangeListener listener) { + return new AbstractVanSingleDataPane(listener) { + @Override + protected SingleDataPane createSingleDataPane(VanChart vanChart) { + VanChartBubblePlot bubblePlot = vanChart.getPlot(); + if (bubblePlot.isForceBubble()) { + return new SingleDataPane(new SingleCategoryDataSetFieldsPane(), new SingleCategoryCellDataFieldsPane()); + } else { + return new SingleDataPane(new ScatterDataSetFieldsPane(), new ScatterCellDataFieldsPane()); + } + } + }; + } } 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 c45aa17c35..c9f3b977c2 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 @@ -17,6 +17,7 @@ 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.data.table.PiePlotTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.plugin.chart.vanchart.VanChart; import com.fr.van.chart.designer.data.OneDimensionalPlotReportDataContentPane; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; import com.fr.van.chart.designer.other.VanChartOtherPane; @@ -98,7 +99,7 @@ public class FunnelIndependentVanChartInterface extends AbstractIndependentVanCh public ChartDataPane getChartDataPane(AttributeChangeListener listener) { return new AbstractVanSingleDataPane(listener) { @Override - protected SingleDataPane createSingleDataPane() { + protected SingleDataPane createSingleDataPane(VanChart vanChart) { return new SingleDataPane(new FunnelDataSetFieldsPane(), new FunnelCellDataFieldsPane()); } }; 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 9b1aa395f5..36bc74ae6f 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 @@ -12,6 +12,7 @@ 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.type.AbstractChartTypePane; +import com.fr.plugin.chart.vanchart.VanChart; import com.fr.van.chart.multilayer.other.VanChartMultiPieConditionPane; import com.fr.van.chart.multilayer.style.VanChartMultiPieSeriesPane; import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; @@ -46,7 +47,7 @@ public class MultiPieIndependentVanChartInterface extends AbstractIndependentVan public ChartDataPane getChartDataPane(AttributeChangeListener listener) { return new AbstractVanSingleDataPane(listener) { @Override - protected SingleDataPane createSingleDataPane() { + protected SingleDataPane createSingleDataPane(VanChart vanChart) { return new SingleDataPane(new MultiPieDataSetFieldsPane(), new MultiPieCellDataFieldsPane()); } }; 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 ebd81f4f00..d8b7a875b8 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 @@ -4,6 +4,10 @@ package com.fr.van.chart.scatter; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chartx.AbstractVanSingleDataPane; +import com.fr.design.chartx.fields.diff.ScatterCellDataFieldsPane; +import com.fr.design.chartx.fields.diff.ScatterDataSetFieldsPane; +import com.fr.design.chartx.single.SingleDataPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.i18n.Toolkit; @@ -14,6 +18,7 @@ import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPa import com.fr.design.mainframe.chart.gui.data.report.BubblePlotReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.plugin.chart.vanchart.VanChart; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; import com.fr.van.chart.designer.other.VanChartOtherPane; import com.fr.van.chart.designer.other.zoom.ZoomPane; @@ -103,4 +108,14 @@ public class ScatterIndependentVanChartInterface extends AbstractIndependentVanC public ConditionAttributesPane getPlotConditionPane(Plot plot) { return new VanChartScatterConditionPane(plot); } + + @Override + public ChartDataPane getChartDataPane(AttributeChangeListener listener) { + return new AbstractVanSingleDataPane(listener) { + @Override + protected SingleDataPane createSingleDataPane(VanChart vanChart) { + return new SingleDataPane(new ScatterDataSetFieldsPane(), new ScatterCellDataFieldsPane()); + } + }; + } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/VanStructureChartTypeUI.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/VanStructureChartTypeUI.java index 19f5abd5a4..3238a51b57 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/VanStructureChartTypeUI.java +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/VanStructureChartTypeUI.java @@ -16,6 +16,7 @@ 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.vanchart.VanChart; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; import com.fr.van.chart.designer.other.VanChartOtherPane; import com.fr.van.chart.designer.other.zoom.ZoomPane; @@ -107,7 +108,7 @@ public class VanStructureChartTypeUI extends AbstractIndependentVanChartUI { public ChartDataPane getChartDataPane(AttributeChangeListener listener) { return new AbstractVanSingleDataPane(listener) { @Override - protected SingleDataPane createSingleDataPane() { + protected SingleDataPane createSingleDataPane(VanChart vanChart) { return new SingleDataPane(new StructureDataSetFieldsPane(), new StructureCellDataFieldsPane()); } }; diff --git a/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractIndependentVanChartUI.java b/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractIndependentVanChartUI.java index 39e22492f4..3e4d32503e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractIndependentVanChartUI.java +++ b/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractIndependentVanChartUI.java @@ -13,6 +13,7 @@ import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPa import com.fr.design.mainframe.chart.gui.data.report.CategoryPlotReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContentPane; +import com.fr.plugin.chart.vanchart.VanChart; import com.fr.van.chart.designer.other.VanChartOtherPane; import com.fr.van.chart.designer.style.VanChartStylePane; @@ -55,7 +56,7 @@ public abstract class AbstractIndependentVanChartUI extends AbstractIndependentC public ChartDataPane getChartDataPane(AttributeChangeListener listener) { return new AbstractVanSingleDataPane(listener) { @Override - protected SingleDataPane createSingleDataPane() { + protected SingleDataPane createSingleDataPane(VanChart vanChart) { return new SingleDataPane(new SingleCategoryDataSetFieldsPane(), new SingleCategoryCellDataFieldsPane()); } }; diff --git a/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java b/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java index 6cd2743fef..1505b09ca0 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java +++ b/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java @@ -15,6 +15,7 @@ import com.fr.design.mainframe.chart.gui.data.report.CategoryPlotReportDataConte import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContentPane; import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.vanchart.VanChart; import com.fr.van.chart.designer.data.VanChartMoreCateReportDataContentPane; import com.fr.van.chart.designer.data.VanChartMoreCateTableDataContentPane; import com.fr.van.chart.designer.other.VanChartInteractivePane; @@ -69,7 +70,7 @@ public abstract class AbstractMultiCategoryVanChartUI extends AbstractIndependen public ChartDataPane getChartDataPane(AttributeChangeListener listener) { return new AbstractVanSingleDataPane(listener) { @Override - protected SingleDataPane createSingleDataPane() { + protected SingleDataPane createSingleDataPane(VanChart vanChart) { return new SingleDataPane(new MultiCategoryDataSetFieldsPane(), new MultiCategoryCellDataFieldsPane()); } }; 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 b978d9355a..b40f5f76cc 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 @@ -15,6 +15,7 @@ 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.vanchart.VanChart; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; import com.fr.van.chart.designer.other.VanChartOtherPane; import com.fr.van.chart.designer.other.zoom.ZoomPane; @@ -102,7 +103,7 @@ public class WordCloudIndependentVanChartInterface extends AbstractIndependentVa public ChartDataPane getChartDataPane(AttributeChangeListener listener) { return new AbstractVanSingleDataPane(listener) { @Override - protected SingleDataPane createSingleDataPane() { + protected SingleDataPane createSingleDataPane(VanChart vanChart) { return new SingleDataPane(new WordCloudDataSetFieldsPane(), new WordCloudCellDataFieldsPane()); } }; From db5cd5b6e3069d904775f9e6d592e0064876bb42 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 4 Nov 2019 13:34:02 +0800 Subject: [PATCH 035/150] =?UTF-8?q?REPORT-22869=2019fdc=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E2=80=94=E2=80=94=E9=A2=84=E5=AE=9A=E4=B9=89=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=9B=B4=E5=A4=9A=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/style/StylePane.java | 33 +++++++++++++++++-- .../preference/PreferenceConfigProvider.java | 22 +++++++++++++ .../style/preference/PreferenceTabConfig.java | 32 ++++++++++++++++++ .../AbstractPreferenceConfigProvider.java | 29 ++++++++++++++++ .../impl/AbstractPreferenceTabConfig.java | 33 +++++++++++++++++++ 5 files changed, 146 insertions(+), 3 deletions(-) create mode 100644 designer-realize/src/main/java/com/fr/design/style/preference/PreferenceConfigProvider.java create mode 100644 designer-realize/src/main/java/com/fr/design/style/preference/PreferenceTabConfig.java create mode 100644 designer-realize/src/main/java/com/fr/design/style/preference/impl/AbstractPreferenceConfigProvider.java create mode 100644 designer-realize/src/main/java/com/fr/design/style/preference/impl/AbstractPreferenceTabConfig.java diff --git a/designer-realize/src/main/java/com/fr/design/style/StylePane.java b/designer-realize/src/main/java/com/fr/design/style/StylePane.java index 7fd8db07d4..a408450fbf 100644 --- a/designer-realize/src/main/java/com/fr/design/style/StylePane.java +++ b/designer-realize/src/main/java/com/fr/design/style/StylePane.java @@ -8,16 +8,20 @@ import com.fr.base.NameStyle; import com.fr.base.ScreenResolution; import com.fr.base.Style; import com.fr.base.core.StyleUtils; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.style.background.BackgroundPane; +import com.fr.design.style.preference.PreferenceConfigProvider; +import com.fr.design.style.preference.PreferenceTabConfig; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.Selection; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.solution.sandbox.collection.PluginSandboxCollections; import com.fr.report.cell.CellElement; import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.FloatElement; @@ -38,6 +42,8 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; +import java.util.List; +import java.util.Set; /** * Style Pane. @@ -48,6 +54,7 @@ public class StylePane extends BasicBeanPane