Browse Source

Pull request #2043: CHART-15034 && CHART-14688 && CHART-15019 bugfix

Merge in DESIGN/design from ~BJORN/design:release/10.0 to release/10.0

* commit 'a70193f6fa45c4afce86299ffeeacaeff24a5cf7':
  CHART-15034 && CHART-14688 && CHART-15019	bugfix
feature/big-screen
Bjorn 4 years ago
parent
commit
d6d00f2583
  1. 6
      designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java
  2. 8
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/ChartDataFilterPane.java
  3. 63
      designer-chart/src/main/java/com/fr/van/chart/range/component/LegendGradientBar.java
  4. 16
      designer-realize/src/main/java/com/fr/design/cell/editor/ChartCellEditor.java
  5. 17
      designer-realize/src/main/java/com/fr/design/cell/editor/ChartFloatEditor.java

6
designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java

@ -3,8 +3,8 @@ package com.fr.design.chart;
import com.fr.base.chart.BaseChartPainter; import com.fr.base.chart.BaseChartPainter;
import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.base.chart.result.WebChartIDInfo; import com.fr.base.chart.result.WebChartIDInfo;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.script.Calculator; import com.fr.script.Calculator;
@ -57,8 +57,8 @@ public class ChartIcon implements Icon, XMLable {
} }
private void initChartName() { private void initChartName() {
Chart chart = chartCollection.getSelectedChart(Chart.class); ChartProvider chart = chartCollection.getSelectedChartProvider(ChartProvider.class);
String[] subName = ChartTypeInterfaceManager.getInstance().getSubName(chart.getPlot().getPlotID()); String[] subName = ChartTypeInterfaceManager.getInstance().getSubName(chart.getID());
chartName = subName[0]; chartName = subName[0];
} }

8
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/ChartDataFilterPane.java

@ -7,9 +7,9 @@ import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartdata.TopDefinition; import com.fr.chart.chartdata.TopDefinition;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.i18n.Toolkit;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.style.AbstractChartTabPane; import com.fr.design.mainframe.chart.gui.style.AbstractChartTabPane;
@ -21,12 +21,12 @@ import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.util.ArrayList;
import java.util.List;
/** /**
* 图表数据 分类 系列 过滤界面. * 图表数据 分类 系列 过滤界面.
@ -37,7 +37,7 @@ import java.util.List;
public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> { public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
private static final long serialVersionUID = 3650522989381790194L; private static final long serialVersionUID = 3650522989381790194L;
private static final int PAN_WIDTH = 246; private static final int PAN_WIDTH = 246;
private static final int FIL_HEIGHT = 150; private static final int FIL_HEIGHT = 200;
private CategoryFilterPane categoryPane; private CategoryFilterPane categoryPane;
private SeriesFilterPane seriesPane; private SeriesFilterPane seriesPane;

63
designer-chart/src/main/java/com/fr/van/chart/range/component/LegendGradientBar.java

@ -7,7 +7,6 @@ import com.fr.design.event.UIObserverListener;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.style.background.gradient.SelectColorPointBtn; import com.fr.design.style.background.gradient.SelectColorPointBtn;
import com.fr.design.style.color.ColorCell; import com.fr.design.style.color.ColorCell;
import com.fr.design.style.color.ColorSelectConfigManager;
import com.fr.design.style.color.ColorSelectDetailPane; import com.fr.design.style.color.ColorSelectDetailPane;
import com.fr.design.style.color.ColorSelectDialog; import com.fr.design.style.color.ColorSelectDialog;
import com.fr.design.style.color.ColorSelectable; import com.fr.design.style.color.ColorSelectable;
@ -18,6 +17,9 @@ import com.fr.stable.AssistUtils;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.awt.Color; import java.awt.Color;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Dimension; import java.awt.Dimension;
@ -27,9 +29,6 @@ import java.awt.LinearGradientPaint;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class LegendGradientBar extends JComponent implements ColorSelectable, UIObserver { public class LegendGradientBar extends JComponent implements ColorSelectable, UIObserver {
@ -168,12 +167,14 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
SelectColorPointBtn pi = new SelectColorPointBtn(((startPos + endPos) / (pColors.length + 1)) * (i + 1), REC_HEIGHT, pColors[i]); SelectColorPointBtn pi = new SelectColorPointBtn(((startPos + endPos) / (pColors.length + 1)) * (i + 1), REC_HEIGHT, pColors[i]);
selectColorPointBtnList.add(pi); selectColorPointBtnList.add(pi);
} }
refreshColorsAndDist(selectColorPointBtnList);
this.repaint(); this.repaint();
} }
/** /**
* 添加事件 * 添加事件
*
* @param changeListener 事件 * @param changeListener 事件
*/ */
public void addChangeListener(ChangeListener changeListener) { public void addChangeListener(ChangeListener changeListener) {
@ -216,7 +217,7 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
//如果该位置已经有滑块占领,则做跨越偏移 //如果该位置已经有滑块占领,则做跨越偏移
selectColorPointBtnList.get(index).setX(LegendGradientBar.this.setOffset(e.getX(), index, OFFSETSTEP)); selectColorPointBtnList.get(index).setX(LegendGradientBar.this.setOffset(e.getX(), index, OFFSETSTEP));
} }
refreshColorsAndDist(selectColorPointBtnList);
LegendGradientBar.this.repaint(); LegendGradientBar.this.repaint();
} }
}); });
@ -229,8 +230,7 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
if (x >= (min + max) / 2) { if (x >= (min + max) / 2) {
x -= offset; x -= offset;
x = setOffset(x, index, offset + OFFSETSTEP); x = setOffset(x, index, offset + OFFSETSTEP);
} } else {
else{
x += offset; x += offset;
x = setOffset(x, index, offset + OFFSETSTEP); x = setOffset(x, index, offset + OFFSETSTEP);
} }
@ -240,8 +240,7 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
//边界情况 //边界情况
if (x <= min) { if (x <= min) {
x = min + (index + 1) * OFFSETSTEP; x = min + (index + 1) * OFFSETSTEP;
} } else if (x >= max) {
else if (x >= max){
x = max - (index + 1) * OFFSETSTEP; x = max - (index + 1) * OFFSETSTEP;
} }
return x; return x;
@ -259,48 +258,31 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
break; break;
} }
} }
if (select >= 0) { if (select >= 0) {
ColorSelectDetailPane pane = new ColorSelectDetailPane(Color.WHITE); dealClick(selectColorPointBtnList.get(select));
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, LegendGradientBar.this); } else if (selectColorSlotBtnStart.contains(e.getX(), e.getY())) {
Color color = LegendGradientBar.this.getColor(); dealClick(selectColorSlotBtnStart);
if (color != null) { } else if (selectColorSlotBtnEnd.contains(e.getX(), e.getY())) {
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color); dealClick(selectColorSlotBtnEnd);
selectColorPointBtnList.get(select).setColorInner(color);
LegendGradientBar.this.repaint();
} }
} }
}
});
//是否选中颜色编辑槽
else if (selectColorSlotBtnStart.contains(e.getX(), e.getY())) {
ColorSelectDetailPane pane = new ColorSelectDetailPane(Color.WHITE);
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, LegendGradientBar.this);
Color color = LegendGradientBar.this.getColor();
if (color != null) {
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color);
selectColorSlotBtnStart.setColorInner(color);
//stateChanged();
LegendGradientBar.this.repaint();
} }
} else if (selectColorSlotBtnEnd.contains(e.getX(), e.getY())) {
private void dealClick(SelectColorPointBtn selectColorPointBtn) {
ColorSelectDetailPane pane = new ColorSelectDetailPane(Color.WHITE); ColorSelectDetailPane pane = new ColorSelectDetailPane(Color.WHITE);
this.setColor(selectColorPointBtn.getColorInner());
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, LegendGradientBar.this); ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, LegendGradientBar.this);
Color color = LegendGradientBar.this.getColor(); Color color = this.getColor();
if (color != null) { if (color != null) {
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color); DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color);
selectColorSlotBtnEnd.setColorInner(color); selectColorPointBtn.setColorInner(color);
//stateChanged(); refreshColorsAndDist(selectColorPointBtnList);
LegendGradientBar.this.repaint();
}
}
LegendGradientBar.this.repaint(); LegendGradientBar.this.repaint();
} }
} }
});
}
private void addMouseReleasedListener() { private void addMouseReleasedListener() {
this.addMouseListener(new MouseAdapter() { this.addMouseListener(new MouseAdapter() {
@ -318,9 +300,6 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
Point2D start = new Point2D.Float(4, 0); Point2D start = new Point2D.Float(4, 0);
Point2D end = new Point2D.Float(max, 0); Point2D end = new Point2D.Float(max, 0);
//获取排序后的颜色数组和位置数组
refreshColorsAndDist(selectColorPointBtnList);
LinearGradientPaint paint = new LinearGradientPaint(start, end, dist, colors); LinearGradientPaint paint = new LinearGradientPaint(start, end, dist, colors);
g2.setPaint(paint); g2.setPaint(paint);

16
designer-realize/src/main/java/com/fr/design/cell/editor/ChartCellEditor.java

@ -10,7 +10,6 @@ import com.fr.grid.Grid;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import java.awt.Component; import java.awt.Component;
@ -52,20 +51,7 @@ public class ChartCellEditor extends AbstractCellEditor implements DialogActionL
public Component getCellEditorComponent(final Grid grid, TemplateCellElement cellElement, int resolution) { public Component getCellEditorComponent(final Grid grid, TemplateCellElement cellElement, int resolution) {
Object valueCell = cellElement.getValue(); Object valueCell = cellElement.getValue();
if (valueCell instanceof BaseChartCollection) { if (valueCell instanceof BaseChartCollection) {
if (glyphComponent == null) { return null;
glyphComponent = DesignModuleFactory.getChartComponent((BaseChartCollection)valueCell);
glyphComponent.addStopEditingListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
stopCellEditing();
grid.requestFocus();// kunsnat: 补充, 编辑图表reset之后, Grid也算停止编辑 重获焦点 bug20443SS
}
});
} else {
glyphComponent.populate((BaseChartCollection) valueCell);
}
this.chartCellEditorDialog = null;
return glyphComponent;
} }
this.chartCellEditorDialog = getMiddleChartDialog(SwingUtilities.getWindowAncestor(grid)); this.chartCellEditorDialog = getMiddleChartDialog(SwingUtilities.getWindowAncestor(grid));
this.chartCellEditorDialog.addDialogActionListener(this); this.chartCellEditorDialog.addDialogActionListener(this);

17
designer-realize/src/main/java/com/fr/design/cell/editor/ChartFloatEditor.java

@ -9,7 +9,6 @@ import com.fr.grid.Grid;
import com.fr.report.cell.FloatElement; import com.fr.report.cell.FloatElement;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import java.awt.Component; import java.awt.Component;
@ -49,21 +48,7 @@ public class ChartFloatEditor extends AbstractFloatEditor implements DialogActio
public Component getFloatEditorComponent(final Grid grid, FloatElement floatElement, int resolution) { public Component getFloatEditorComponent(final Grid grid, FloatElement floatElement, int resolution) {
Object valueCell = floatElement.getValue(); Object valueCell = floatElement.getValue();
if (valueCell instanceof BaseChartCollection) { if (valueCell instanceof BaseChartCollection) {
this.chartFloatEditorDialog = null; return null;
if (glyphComponent == null) {
glyphComponent = DesignModuleFactory.getChartComponent((BaseChartCollection)valueCell);
glyphComponent.addStopEditingListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
stopFloatEditing();
grid.requestFocus();// kunsnat: 补充, 编辑图表reset之后, Grid也算停止编辑 重获焦点 bug20443
}
});
} else {
glyphComponent.populate((BaseChartCollection) valueCell);
}
return glyphComponent;
} }
this.chartFloatEditorDialog = getMiddleChartDialog(SwingUtilities.getWindowAncestor(grid)); this.chartFloatEditorDialog = getMiddleChartDialog(SwingUtilities.getWindowAncestor(grid));
this.chartFloatEditorDialog.addDialogActionListener(this); this.chartFloatEditorDialog.addDialogActionListener(this);

Loading…
Cancel
Save