From ccef564ff4126a0f7ba89d75ca73c1f6fcfa05f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Sat, 9 May 2020 09:51:14 +0800 Subject: [PATCH] =?UTF-8?q?CHART-13814=20=E6=A0=87=E8=AE=B0=E7=82=B9?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=9D=A2=E6=9D=BF=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../marker/VanChartCommonMarkerPane.java | 50 +++++++++++++------ 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartCommonMarkerPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartCommonMarkerPane.java index f62604501..d4f7834a2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartCommonMarkerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartCommonMarkerPane.java @@ -1,12 +1,14 @@ package com.fr.van.chart.designer.component.marker; import com.fr.chart.chartglyph.Marker; -import com.fr.design.i18n.Toolkit; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.xcombox.MarkerComboBox; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; import com.fr.plugin.chart.base.VanChartAttrMarker; import com.fr.plugin.chart.marker.type.MarkerType; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -42,11 +44,12 @@ public class VanChartCommonMarkerPane extends BasicBeanPane MarkerType.MARKER_TRIANGLE_HOLLOW }; private static Marker[] normalMarkers = null; + protected static Marker[] getNormalMarkers() { - if(normalMarkers == null){ + if (normalMarkers == null) { normalMarkers = new Marker[NORMAL_TYPES.length]; int i = 0; - for(MarkerType markerType : NORMAL_TYPES){ + for (MarkerType markerType : NORMAL_TYPES) { normalMarkers[i++] = Marker.createMarker(markerType); } } @@ -79,11 +82,12 @@ public class VanChartCommonMarkerPane extends BasicBeanPane MarkerType.MARKER_TRIANGLE_HOLLOW }; private static Marker[] mapMarkers = null; + protected static Marker[] getMapScatterMarkers() { - if(mapMarkers == null){ + if (mapMarkers == null) { mapMarkers = new Marker[MAP_TYPES.length]; int i = 0; - for(MarkerType markerType : MAP_TYPES){ + for (MarkerType markerType : MAP_TYPES) { mapMarkers[i++] = Marker.createMarker(markerType); } } @@ -98,11 +102,12 @@ public class VanChartCommonMarkerPane extends BasicBeanPane MarkerType.MARKER_STAR }; private static Marker[] ganttMarkers = null; + protected static Marker[] getGanttMarkers() { - if(ganttMarkers == null){ + if (ganttMarkers == null) { ganttMarkers = new Marker[GANTT_TYPES.length]; int i = 0; - for(MarkerType markerType : GANTT_TYPES){ + for (MarkerType markerType : GANTT_TYPES) { ganttMarkers[i++] = Marker.createMarker(markerType); } } @@ -119,11 +124,23 @@ public class VanChartCommonMarkerPane extends BasicBeanPane public VanChartCommonMarkerPane() { markerTypeComboBox = new MarkerComboBox(getMarkers()); - markerFillColor = new VanChartMarkerBackgroundPane(){ + markerFillColor = new VanChartMarkerBackgroundPane() { + protected JPanel initContentPanel() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double[] columnSize = {f, e}; + double[] rowSize = {p, p, p}; + + return TableLayoutHelper.createGapTableLayoutPane(getPaneComponents(), rowSize, columnSize, 0, LayoutConstants.VGAP_MEDIUM); + } + protected Component[][] getPaneComponents() { - return new Component[][]{ - new Component[]{typeComboBox, null}, - new Component[]{centerPane, null}, + return new Component[][]{ + new Component[]{null, null}, + new Component[]{null, typeComboBox}, + new Component[]{null, centerPane}, }; } }; @@ -173,7 +190,7 @@ public class VanChartCommonMarkerPane extends BasicBeanPane protected double[] getColumnSize() { double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; - return new double[] {d, e}; + return new double[]{d, e}; } protected Marker[] getMarkers() { @@ -195,7 +212,7 @@ public class VanChartCommonMarkerPane extends BasicBeanPane @Override public void populateBean(VanChartAttrMarker marker) { - if(marker == null){ + if (marker == null) { marker = new VanChartAttrMarker(); marker.setCommon(true); } @@ -210,9 +227,10 @@ public class VanChartCommonMarkerPane extends BasicBeanPane markerFillColor.populate(marker.getColorBackground()); } - protected MarkerType populateMarkType(VanChartAttrMarker marker){ + protected MarkerType populateMarkType(VanChartAttrMarker marker) { return marker.getMarkerType(); } + /** * Update. */ @@ -223,14 +241,14 @@ public class VanChartCommonMarkerPane extends BasicBeanPane return marker; } - public void updateBean(VanChartAttrMarker marker){ + public void updateBean(VanChartAttrMarker marker) { marker.setCommon(true); updateColor(marker); marker.setRadius(radius.getValue()); marker.setMarkerType(MarkerType.parse(markerTypeComboBox.getSelectedMarkder().getMarkerType())); } - protected void updateColor(VanChartAttrMarker marker){ + protected void updateColor(VanChartAttrMarker marker) { marker.setColorBackground(markerFillColor.update()); } }