From 9fd31ccc8c78b4f5a68caf2e50c9ea31bb0a7da4 Mon Sep 17 00:00:00 2001 From: zheng Date: Tue, 10 Apr 2018 09:05:05 +0800 Subject: [PATCH] CHART-2100 bug --- .../fr/van/chart/designer/TableLayout4VanChartHelper.java | 4 ++-- .../chart/range/component/GradualIntervalConfigPane.java | 6 +++++- .../fr/van/chart/range/component/LegendGradientBar.java | 8 +++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/designer_chart/src/com/fr/van/chart/designer/TableLayout4VanChartHelper.java b/designer_chart/src/com/fr/van/chart/designer/TableLayout4VanChartHelper.java index d4854b7c07..ed94fd15c9 100644 --- a/designer_chart/src/com/fr/van/chart/designer/TableLayout4VanChartHelper.java +++ b/designer_chart/src/com/fr/van/chart/designer/TableLayout4VanChartHelper.java @@ -21,9 +21,9 @@ public class TableLayout4VanChartHelper { private static final int SMALL_GAP = 20; public static final int EXPANDABLE_PANE_WIDTH =290; public static final int EXPANDABLE_PANE_HIGHT =24; - public static final double DESCRIPTION_AREA_WIDTH =60; + public static final int DESCRIPTION_AREA_WIDTH = 60; public static final int EDIT_AREA_WIDTH =155; - public static final double SECOND_EDIT_AREA_WIDTH =143; + public static final int SECOND_EDIT_AREA_WIDTH = 143; public static final int COMPONENT_INTERVAL =12; public static final Border SECOND_EDIT_AREA_BORDER = BorderFactory.createEmptyBorder(0,12,0,0); diff --git a/designer_chart/src/com/fr/van/chart/range/component/GradualIntervalConfigPane.java b/designer_chart/src/com/fr/van/chart/range/component/GradualIntervalConfigPane.java index 60304afa28..3ce50d693c 100644 --- a/designer_chart/src/com/fr/van/chart/range/component/GradualIntervalConfigPane.java +++ b/designer_chart/src/com/fr/van/chart/range/component/GradualIntervalConfigPane.java @@ -50,7 +50,7 @@ public class GradualIntervalConfigPane extends JPanel{ } }; - legendGradientBar = new LegendGradientBar(); + legendGradientBar = createLegendGradientBar(); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -66,6 +66,10 @@ public class GradualIntervalConfigPane extends JPanel{ this.add(contentPane,BorderLayout.CENTER); } + protected LegendGradientBar createLegendGradientBar() { + return new LegendGradientBar(); + } + protected Component[][] getPaneComponents(){ return new Component[][]{ new Component[]{minMaxValuePane, null}, diff --git a/designer_chart/src/com/fr/van/chart/range/component/LegendGradientBar.java b/designer_chart/src/com/fr/van/chart/range/component/LegendGradientBar.java index 8a2a9c0f3d..8b8c07aa52 100644 --- a/designer_chart/src/com/fr/van/chart/range/component/LegendGradientBar.java +++ b/designer_chart/src/com/fr/van/chart/range/component/LegendGradientBar.java @@ -126,10 +126,16 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI addMouseEnteredListener(); addMouseClickListener(); addMouseReleasedListener(); - addMouseDragListener(); + if (supportDrag()) { + addMouseDragListener(); + } addMouseExitedListener(); } + protected boolean supportDrag() { + return true; + } + private Color[] initColors(Color subColor, int colorSelectionBtnNum) { Color[] converseColors = getColorArray(subColor, colorSelectionBtnNum); Color[] colors = new Color[colorSelectionBtnNum];