Browse Source

ChartComponent用ChartProvider.toIamge接口渲染图表 && CHART-9062 删除activeGlyph相关代码

research/11.0
zheng 5 years ago
parent
commit
6ac2d498d2
  1. 97
      designer-chart/src/main/java/com/fr/design/chart/gui/ActiveGlyphFactory.java
  2. 100
      designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java
  3. 161
      designer-chart/src/main/java/com/fr/design/chart/gui/active/ActiveGlyph.java
  4. 38
      designer-chart/src/main/java/com/fr/design/chart/gui/active/AlertValueActiveGlyph.java
  5. 43
      designer-chart/src/main/java/com/fr/design/chart/gui/active/AxisActiveGlyph.java
  6. 19
      designer-chart/src/main/java/com/fr/design/chart/gui/active/CategoryAxisActiveGlyph.java
  7. 39
      designer-chart/src/main/java/com/fr/design/chart/gui/active/ChartActiveGlyph.java
  8. 44
      designer-chart/src/main/java/com/fr/design/chart/gui/active/DataLabelActiveGlyph.java
  9. 53
      designer-chart/src/main/java/com/fr/design/chart/gui/active/DataSeriesActiveGlyph.java
  10. 30
      designer-chart/src/main/java/com/fr/design/chart/gui/active/DataSheetActiveGlyph.java
  11. 18
      designer-chart/src/main/java/com/fr/design/chart/gui/active/DateAxisActiveGlyph.java
  12. 30
      designer-chart/src/main/java/com/fr/design/chart/gui/active/LegendActiveGlyph.java
  13. 34
      designer-chart/src/main/java/com/fr/design/chart/gui/active/PlotActiveGlyph.java
  14. 18
      designer-chart/src/main/java/com/fr/design/chart/gui/active/RadarAxisActiveGlyph.java
  15. 18
      designer-chart/src/main/java/com/fr/design/chart/gui/active/RangeAxisActiveGlyph.java
  16. 35
      designer-chart/src/main/java/com/fr/design/chart/gui/active/TextActiveGlyph.java
  17. 43
      designer-chart/src/main/java/com/fr/design/chart/gui/active/TrendLineActiveGlyph.java
  18. 19
      designer-chart/src/main/java/com/fr/design/chart/gui/active/ValueAxisActiveGlyph.java
  19. 37
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/ChartComponentAction.java
  20. 27
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetAnalysisLineStyleAction.java
  21. 33
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetAxisStyleAction.java
  22. 31
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetChartStyleAciton.java
  23. 26
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetDataLabelStyleAction.java
  24. 33
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetDataSheetAction.java
  25. 32
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetLegendStyleAction.java
  26. 32
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetPlotStyleAction.java
  27. 32
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetTitleStyleAction.java

97
designer-chart/src/main/java/com/fr/design/chart/gui/ActiveGlyphFactory.java

@ -1,97 +0,0 @@
package com.fr.design.chart.gui;
import java.util.HashMap;
import java.util.Map;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.CategoryAxisGlyph;
import com.fr.chart.chartglyph.ChartAlertValueGlyph;
import com.fr.chart.chartglyph.ChartGlyph;
import com.fr.chart.chartglyph.DataSeries;
import com.fr.chart.chartglyph.DataSheetGlyph;
import com.fr.chart.chartglyph.DateAxisGlyph;
import com.fr.chart.chartglyph.LegendGlyph;
import com.fr.chart.chartglyph.PlotGlyph;
import com.fr.chart.chartglyph.RadarAxisGlyph;
import com.fr.chart.chartglyph.RangeAxisGlyph;
import com.fr.chart.chartglyph.TextGlyph;
import com.fr.chart.chartglyph.TitleGlyph;
import com.fr.chart.chartglyph.TrendLineGlyph;
import com.fr.chart.chartglyph.ValueAxisGlyph;
import com.fr.design.chart.gui.active.ActiveGlyph;
import com.fr.design.chart.gui.active.AlertValueActiveGlyph;
import com.fr.design.chart.gui.active.CategoryAxisActiveGlyph;
import com.fr.design.chart.gui.active.ChartActiveGlyph;
import com.fr.design.chart.gui.active.DataLabelActiveGlyph;
import com.fr.design.chart.gui.active.DataSeriesActiveGlyph;
import com.fr.design.chart.gui.active.DataSheetActiveGlyph;
import com.fr.design.chart.gui.active.DateAxisActiveGlyph;
import com.fr.design.chart.gui.active.LegendActiveGlyph;
import com.fr.design.chart.gui.active.PlotActiveGlyph;
import com.fr.design.chart.gui.active.RadarAxisActiveGlyph;
import com.fr.design.chart.gui.active.RangeAxisActiveGlyph;
import com.fr.design.chart.gui.active.TextActiveGlyph;
import com.fr.design.chart.gui.active.TrendLineActiveGlyph;
import com.fr.design.chart.gui.active.ValueAxisActiveGlyph;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-23
* Time : 上午9:08
*/
public class ActiveGlyphFactory {
private static Map<String, Class> glyphMap = new HashMap<String, Class>();
static {
glyphMap.put(DataSeries.class.getName(), DataSeriesActiveGlyph.class);
glyphMap.put(RadarAxisGlyph.class.getName(), RadarAxisActiveGlyph.class);
glyphMap.put(RangeAxisGlyph.class.getName(), RangeAxisActiveGlyph.class);
glyphMap.put(TitleGlyph.class.getName(), TextActiveGlyph.class);
glyphMap.put(DateAxisGlyph.class.getName(), DateAxisActiveGlyph.class);
glyphMap.put(ValueAxisGlyph.class.getName(), ValueAxisActiveGlyph.class);
glyphMap.put(CategoryAxisGlyph.class.getName(), CategoryAxisActiveGlyph.class);
glyphMap.put(ChartGlyph.class.getName(), ChartActiveGlyph.class);
glyphMap.put(DataSheetGlyph.class.getName(), DataSheetActiveGlyph.class);
glyphMap.put(LegendGlyph.class.getName(), LegendActiveGlyph.class);
glyphMap.put(TextGlyph.class.getName(), DataLabelActiveGlyph.class);
glyphMap.put(TrendLineGlyph.class.getName(), TrendLineActiveGlyph.class);
glyphMap.put(ChartAlertValueGlyph.class.getName(), AlertValueActiveGlyph.class);
}
private ActiveGlyphFactory() {
}
public static ActiveGlyph createActiveGlyph(ChartComponent chartComponent, Object glyph) {
return createActiveGlyph(chartComponent, glyph, null);
}
public static ActiveGlyph createActiveGlyph(ChartComponent chartComponent, Object glyph, Glyph parentGlyph) {
if (glyph == null) {
return null;
}
String clsName = glyph.getClass().getName();
Class cls = glyphMap.get(clsName);
Class parameterCls = glyph.getClass();
if (cls == null) {
if (clsName.endsWith("PlotGlyph")) {
cls = PlotActiveGlyph.class;
parameterCls = PlotGlyph.class;
} else if (clsName.endsWith("DataSeries4Area")) {
cls = DataSeriesActiveGlyph.class;
parameterCls = DataSeries.class;
} else {
cls = ChartActiveGlyph.class;
parameterCls = ChartGlyph.class;
}
}
try {
Class[] argsClass = new Class[]{ChartComponent.class, parameterCls, Glyph.class};
return (ActiveGlyph) cls.getConstructor(argsClass).newInstance(new Object[]{chartComponent, glyph, parentGlyph});
} catch (Exception e) {
return null;
}
}
}

100
designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java

@ -2,36 +2,26 @@ package com.fr.design.chart.gui;
import com.fr.base.ScreenResolution;
import com.fr.base.chart.BaseChartCollection;
import com.fr.base.chart.BaseChartGlyph;
import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.chart.ChartWebPara;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.Axis;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartglyph.AxisGlyph;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.chart.gui.active.ActiveGlyph;
import com.fr.design.chart.gui.active.ChartActiveGlyph;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.core.PropertyChangeListener;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Paint;
import java.awt.Point;
import java.awt.RenderingHints;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.geom.Rectangle2D;
import java.awt.geom.RoundRectangle2D;
import java.util.ArrayList;
import java.util.List;
@ -45,21 +35,11 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
private static final long serialVersionUID = 744164838619052097L;
private final List<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>();
private ChartCollection chartCollection4Design;
private Chart editingChart;
private BaseChartGlyph chartGlyph;
private ChartProvider editingChart;
private int chartWidth = -1;
private int chartHeight = -1;
private Point point;
private int resolution = ScreenResolution.getScreenResolution();
private ActiveGlyph activeGlyph;
private boolean supportEdit = true;
private final int[] resizeCursors = new int[]{
Cursor.NW_RESIZE_CURSOR, Cursor.N_RESIZE_CURSOR, Cursor.NE_RESIZE_CURSOR,
Cursor.E_RESIZE_CURSOR, Cursor.W_RESIZE_CURSOR,
Cursor.SE_RESIZE_CURSOR, Cursor.S_RESIZE_CURSOR, Cursor.SW_RESIZE_CURSOR
};
private boolean supportEdit = true;
public ChartComponent() {
super();
@ -112,15 +92,11 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
fireStopEditing();
this.editingChart = null;
this.chartGlyph = null;
this.activeGlyph = null;
this.point = null;
this.chartHeight = this.chartWidth = -1;
this.editingChart = this.chartCollection4Design.getSelectedChart();
this.editingChart = this.chartCollection4Design.getSelectedChartProvider();
refreshChartGlyph();
this.activeGlyph = ActiveGlyphFactory.createActiveGlyph(this, chartGlyph);
repaint();
}
@ -166,9 +142,6 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
return editingChart;
}
public BaseChartGlyph getChartGlyph() {
return chartGlyph;
}
public void paintComponent(Graphics g) { //
super.paintComponent(g);
@ -192,12 +165,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
//画图
drawChartGlyph(g2d);
ActiveGlyph ag = this.getActiveGlyph();
if (ag != null) {
ag.paint4ActiveGlyph(g2d, chartGlyph);
}
drawChart(g2d);
g2d.translate(-ChartConstants.PREGAP4BOUNDS/2, -ChartConstants.PREGAP4BOUNDS/2);
if (lastHint == null) {
@ -212,24 +180,11 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
*/
private void refreshChartGlyph() {
Dimension d = getBounds().getSize();
this.editingChart = this.chartCollection4Design.getSelectedChart();// kunsnat: 切换选中时 同步切换Plot
if (editingChart != null) {
this.chartGlyph = editingChart.createGlyph(editingChart.defaultChartData());
this.activeGlyph = ActiveGlyphFactory.createActiveGlyph(this, chartGlyph);
}
this.editingChart = this.chartCollection4Design.getSelectedChartProvider();// kunsnat: 切换选中时 同步切换Plot
this.chartWidth = d.width - ChartConstants.PREGAP4BOUNDS;
this.chartHeight = d.height - ChartConstants.PREGAP4BOUNDS;
}
private ActiveGlyph getActiveGlyph() {
if (point == null) {
this.activeGlyph = new ChartActiveGlyph(this, chartGlyph);
} else {
this.activeGlyph = new ChartActiveGlyph(this, chartGlyph).findActionGlyphFromChildren(point.x, point.y);
}
return this.activeGlyph;
}
/**
* 鼠标点击
* @param event 鼠标事件
@ -243,16 +198,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
* @param e 鼠标事件
*/
public void mousePressed(MouseEvent e) {
point = new Point(e.getX(),e.getY());
if (!ArrayUtils.contains(resizeCursors, this.getCursor().getType())) {
this.activeGlyph = new ChartActiveGlyph(this, chartGlyph).findActionGlyphFromChildren(point.x, point.y);
}
if (this.activeGlyph == null) {
return;
}
repaint();
}
@ -291,45 +237,21 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
* @param e 鼠标事件
*/
public void mouseMoved(MouseEvent e) {
ActiveGlyph ag = this.getActiveGlyph();
if (ag != null) {
ag.onMouseMove(e);
}
}
public AxisGlyph getActiveAxisGlyph() {
return (AxisGlyph) activeGlyph.getGlyph();
}
public Axis getActiveAxis() {
AxisGlyph axisGlyph = getActiveAxisGlyph();
if (editingChart.getPlot() != null) {
return editingChart.getPlot().getAxis(axisGlyph.getAxisType());
}
return null;
}
private boolean needRefreshChartGlyph() {
return chartGlyph == null || chartWidth != this.getBounds().width || chartHeight != this.getBounds().height;
return editingChart == null || chartWidth != this.getBounds().width || chartHeight != this.getBounds().height;
}
public void drawChartGlyph(Graphics2D g2d) {
if (chartGlyph != null) {
if (chartGlyph.isRoundBorder()) {
chartGlyph.setBounds(new RoundRectangle2D.Double(0, 0, chartWidth, chartHeight, 10, 10));
} else {
chartGlyph.setBounds(new Rectangle2D.Double(0, 0, chartWidth, chartHeight));
}
private void drawChart(Graphics2D g2d) {
if (editingChart != null) {
//不直接画chartGlyph而画image的原因是表单的柱形图会溢出表单
//其他图都ok,其实感觉应该是柱形图画的不对,应该也可以改那边
//处理画图事件
resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution();
int resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution();
if (resolution == 0){
resolution = ScreenResolution.getScreenResolution();
}
Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,resolution, this, null);
Image chartImage = editingChart.toImage(chartWidth, chartHeight, resolution, new ChartWebPara());
g2d.drawImage(chartImage, 0, 0, null);
}

161
designer-chart/src/main/java/com/fr/design/chart/gui/active/ActiveGlyph.java

@ -1,161 +0,0 @@
package com.fr.design.chart.gui.active;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Shape;
import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;
import com.fr.base.ScreenResolution;
import com.fr.base.chart.BaseChartGlyph;
import com.fr.base.chart.Glyph;
import com.fr.design.chart.gui.ActiveGlyphFactory;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午3:51
* 选中的Glyph
*/
public abstract class ActiveGlyph {
protected Glyph parentGlyph;
protected ChartComponent chartComponent;
public ActiveGlyph(ChartComponent chartComponent, Glyph parentGlyph) {
this.chartComponent = chartComponent;
this.parentGlyph = parentGlyph;
}
public abstract Glyph getGlyph();
public void drawAllGlyph(Graphics2D g2d, int resolution){
Point2D offset4Paint = offset4Paint();
g2d.translate(offset4Paint.getX(), offset4Paint.getY());
this.getGlyph().draw(g2d, resolution);
g2d.translate(-offset4Paint.getX(), -offset4Paint.getY());
};
/**
* 属性表中, 通过点击 展开到对应的界面.
*/
public abstract void goRightPane();
/**
* 画的偏移的
* @return 偏移的
*/
public Point2D offset4Paint() {
return new Point2D.Double(
this.parentGlyph.getShape().getBounds().getX(),
this.parentGlyph.getShape().getBounds().getY()
);
}
public void paint4ActiveGlyph(Graphics2D g2d, BaseChartGlyph chartGlyph) {
if(this.parentGlyph == null) {
return;
}
Paint oldPaint = g2d.getPaint();
Composite oldComposite = g2d.getComposite();
g2d.setPaint(Color.WHITE);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
g2d.fill(chartGlyph.getShape());
drawAllGlyph(g2d, ScreenResolution.getScreenResolution());
g2d.setPaint(oldPaint);
g2d.setComposite(oldComposite);
}
protected void drawSelectedBounds4Active(Graphics2D g2d) {
if (this.getGlyph() != null) {
Shape shape = this.getGlyph().getShape();
if (shape != null) {
g2d.draw(shape);
}
}
}
/**
*当前的ActiveGlyph是否包含坐标mouseX, mouseY
* @param mouseX 坐标X
* @param mouseY 坐标Y
* @return 包含则返回true
*/
public boolean contains(int mouseX, int mouseY) {
if (getGlyph() == null || getGlyph().getShape() == null){
return false;
}
Point2D offset = this.offset4Paint();
/*
* alex:因为Line2D.contains(x, y)必然返回false
* 所以用intersect一个区域,这个区域大小用4 * 4的,区域大一些,就灵敏一些
*/
return getGlyph().getShape().intersects(mouseX - offset.getX() - 2, mouseY - offset.getY() - 2, 4, 4);
}
/**
* 在当前选中的ActiveGlyph中,仅仅在其Children中找与mouseX, mouseY匹配的ActiveGlyph
* @param mouseX 坐标X
* @param mouseY 坐标Y
* @return 当前ativeGlyph
*/
public ActiveGlyph findActionGlyphFromChildren(int mouseX, int mouseY) {
Glyph currentGlyph = getGlyph();
// 报错应对.
if (currentGlyph == null) {
return null;
}
java.util.Iterator selectableChildren = currentGlyph.selectableChildren();
ActiveGlyph resAG = null;
while (selectableChildren.hasNext() && resAG == null) {
ActiveGlyph childActiveGlyph = ActiveGlyphFactory.createActiveGlyph(chartComponent, selectableChildren.next(), currentGlyph);
// 如果childActiveGlyph不为null,找一下其子辈有没有符合条件
if (childActiveGlyph != null) {
resAG = childActiveGlyph.findActionGlyphFromChildren(mouseX, mouseY);
}
// 如果childActiveGlyph的子辈没有符合条件的,就看一下这个childGlyph是否符合条件
if (resAG == null && childActiveGlyph != null && childActiveGlyph.contains(mouseX, mouseY)) {
resAG = childActiveGlyph;
}
}
// 如果当前ActiveGlyph的所有子辈都没有与mouseX, mouseY相匹配的,看一下它自己是否匹配
if (resAG == null) {
if (this.contains(mouseX, mouseY)) {
resAG = this;
}
}
return resAG;
}
/**
* 拖拽
* @param e 事件
*/
public void onMouseDragged(MouseEvent e) {
}
/**
* 移动事件
* @param e 事件
*/
public void onMouseMove(MouseEvent e) {
}
}

38
designer-chart/src/main/java/com/fr/design/chart/gui/active/AlertValueActiveGlyph.java

@ -1,38 +0,0 @@
package com.fr.design.chart.gui.active;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.ChartAlertValueGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetAnalysisLineStyleAction;
public class AlertValueActiveGlyph extends ActiveGlyph{
ChartAlertValueGlyph alertValueGlyph;
public AlertValueActiveGlyph(ChartComponent chartComponent,ChartAlertValueGlyph alertLine, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.alertValueGlyph = alertLine;
}
public Point2D offset4Paint() {
Rectangle2D valueAxisBoudns = this.alertValueGlyph.getValueAxisGlyph().getBounds();
return new Point2D.Double(
this.parentGlyph.getShape().getBounds().getX() + valueAxisBoudns.getX(),
this.parentGlyph.getShape().getBounds().getY() + valueAxisBoudns.getY()
);
}
@Override
public Glyph getGlyph() {
return this.alertValueGlyph;
}
@Override
public void goRightPane() {
new SetAnalysisLineStyleAction(chartComponent).showAnalysisLineStylePane();
}
}

43
designer-chart/src/main/java/com/fr/design/chart/gui/active/AxisActiveGlyph.java

@ -1,43 +0,0 @@
package com.fr.design.chart.gui.active;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.AxisGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetAxisStyleAction;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:00
*/
public abstract class AxisActiveGlyph extends ActiveGlyph {
protected AxisGlyph axis;
public AxisActiveGlyph(ChartComponent chartComponent, AxisGlyph axis, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.axis = axis;
}
public void drawAllGlyph(Graphics2D g2d, int resolution){
Point2D offset4Paint = offset4Paint();
g2d.translate(offset4Paint.getX(), offset4Paint.getY());
this.axis.drawWithOutAlert(g2d, resolution);
g2d.translate(-offset4Paint.getX(), -offset4Paint.getY());
};
public void goRightPane() {
new SetAxisStyleAction(chartComponent).showAxisStylePane();
}
/**
* 返回 对应的属性Axis
*/
public Glyph getGlyph() {
return this.axis;
}
}

19
designer-chart/src/main/java/com/fr/design/chart/gui/active/CategoryAxisActiveGlyph.java

@ -1,19 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.CategoryAxisGlyph;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:01
*/
public class CategoryAxisActiveGlyph extends AxisActiveGlyph {
public CategoryAxisActiveGlyph(ChartComponent chartComponent, CategoryAxisGlyph axis, Glyph parentGlyph) {
super(chartComponent, axis, parentGlyph);
}
}

39
designer-chart/src/main/java/com/fr/design/chart/gui/active/ChartActiveGlyph.java

@ -1,39 +0,0 @@
package com.fr.design.chart.gui.active;
import java.awt.geom.Point2D;
import com.fr.base.chart.BaseChartGlyph;
import com.fr.base.chart.Glyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetChartStyleAciton;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午3:54
*/
public class ChartActiveGlyph extends ActiveGlyph {
private BaseChartGlyph glyphChart;
public ChartActiveGlyph(ChartComponent chartComponent, BaseChartGlyph chart) {
this(chartComponent, chart, null);
}
public ChartActiveGlyph(ChartComponent chartComponent, BaseChartGlyph chart, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.glyphChart = chart;
}
public Glyph getGlyph() {
return this.glyphChart;
}
public Point2D offset4Paint() {
return new java.awt.Point(0, 0);
}
public void goRightPane() {
new SetChartStyleAciton(chartComponent).showChartStylePane();
}
}

44
designer-chart/src/main/java/com/fr/design/chart/gui/active/DataLabelActiveGlyph.java

@ -1,44 +0,0 @@
package com.fr.design.chart.gui.active;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.PlotGlyph;
import com.fr.chart.chartglyph.TextGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetDataLabelStyleAction;
public class DataLabelActiveGlyph extends ActiveGlyph{
private TextGlyph dataLabel;
public DataLabelActiveGlyph(ChartComponent chartComponent, TextGlyph dataLabel, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.dataLabel = dataLabel;
}
public void drawAllGlyph(Graphics2D g2d, int resolution){
Point2D offset4Paint = offset4Paint();
g2d.translate(offset4Paint.getX(), offset4Paint.getY());
ArrayList<TextGlyph> allDataPointLableGlyph = new ArrayList<TextGlyph>();
PlotGlyph plotGlyph = (PlotGlyph)(this.parentGlyph);
plotGlyph.getAllDataPointGlyph(allDataPointLableGlyph);
for(int index = 0; index < allDataPointLableGlyph.size(); index++){
allDataPointLableGlyph.get(index).draw(g2d, resolution);
}
g2d.translate(-offset4Paint.getX(), -offset4Paint.getY());
};
@Override
public Glyph getGlyph() {
return this.dataLabel;
}
@Override
public void goRightPane() {
new SetDataLabelStyleAction(chartComponent).showDataLabelStylePane();
}
}

53
designer-chart/src/main/java/com/fr/design/chart/gui/active/DataSeriesActiveGlyph.java

@ -1,53 +0,0 @@
package com.fr.design.chart.gui.active;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.DataSeries;
import com.fr.chart.chartglyph.PlotGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午3:59
*/
public class DataSeriesActiveGlyph extends ActiveGlyph {
private DataSeries series;
public DataSeriesActiveGlyph(ChartComponent chartComponent, DataSeries series, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.series = series;
}
public Glyph getGlyph() {
return this.series;
}
/**
* 界面条状
*/
public void goRightPane() {
if(chartComponent.getEditingChart() == null) {
return;
}
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_SERIES_TITLE);
}
@Override
public void drawAllGlyph(Graphics2D g2d, int resolution) {
Point2D offset4Paint = offset4Paint();
g2d.translate(offset4Paint.getX(), offset4Paint.getY());
if(this.parentGlyph != null && this.parentGlyph instanceof PlotGlyph){
PlotGlyph plotGlyph = (PlotGlyph)this.parentGlyph;
plotGlyph.drawShape4Series(g2d, resolution);
}
g2d.translate(-offset4Paint.getX(), -offset4Paint.getY());
}
}

30
designer-chart/src/main/java/com/fr/design/chart/gui/active/DataSheetActiveGlyph.java

@ -1,30 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.DataSheetGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetDataSheetAction;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午3:57
*/
public class DataSheetActiveGlyph extends ActiveGlyph {
private DataSheetGlyph dataSheetGlyph;
public DataSheetActiveGlyph(ChartComponent chartComponent, DataSheetGlyph dataSheetGlyph, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.dataSheetGlyph = dataSheetGlyph;
}
public Glyph getGlyph() {
return this.dataSheetGlyph;
}
public void goRightPane() {
new SetDataSheetAction(chartComponent).showDataSheetStylePane();
}
}

18
designer-chart/src/main/java/com/fr/design/chart/gui/active/DateAxisActiveGlyph.java

@ -1,18 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.DateAxisGlyph;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:03
*/
public class DateAxisActiveGlyph extends AxisActiveGlyph {
public DateAxisActiveGlyph(ChartComponent chartComponent, DateAxisGlyph axis, Glyph parentGlyph) {
super(chartComponent, axis, parentGlyph);
}
}

30
designer-chart/src/main/java/com/fr/design/chart/gui/active/LegendActiveGlyph.java

@ -1,30 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.LegendGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetLegendStyleAction;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午3:58
*/
public class LegendActiveGlyph extends ActiveGlyph {
private LegendGlyph legendGlyph;
public LegendActiveGlyph(ChartComponent chartComponent, LegendGlyph legendGlyph, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.legendGlyph = legendGlyph;
}
public Glyph getGlyph() {
return this.legendGlyph;
}
public void goRightPane() {
new SetLegendStyleAction(chartComponent).showLegendStylePane();
}
}

34
designer-chart/src/main/java/com/fr/design/chart/gui/active/PlotActiveGlyph.java

@ -1,34 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.PlotGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetPlotStyleAction;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午3:55
*/
public class PlotActiveGlyph extends ActiveGlyph {
private PlotGlyph plotGlyph;
public PlotActiveGlyph(ChartComponent chartComponent, PlotGlyph plotGlyph, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.plotGlyph = plotGlyph;
}
public Glyph getGlyph() {
return this.plotGlyph;
}
public void goRightPane() {
new SetPlotStyleAction(chartComponent).showPlotPane();
}
public java.awt.Point offset4Paint() {
return new java.awt.Point(0, 0);
}
}

18
designer-chart/src/main/java/com/fr/design/chart/gui/active/RadarAxisActiveGlyph.java

@ -1,18 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.RadarAxisGlyph;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:03
*/
public class RadarAxisActiveGlyph extends AxisActiveGlyph {
public RadarAxisActiveGlyph(ChartComponent chartComponent, RadarAxisGlyph axis, Glyph parentGlyph) {
super(chartComponent, axis, parentGlyph);
}
}

18
designer-chart/src/main/java/com/fr/design/chart/gui/active/RangeAxisActiveGlyph.java

@ -1,18 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.ValueAxisGlyph;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:02
*/
public class RangeAxisActiveGlyph extends AxisActiveGlyph {
public RangeAxisActiveGlyph(ChartComponent chartComponent, ValueAxisGlyph axis, Glyph parentGlyph) {
super(chartComponent, axis, parentGlyph);
}
}

35
designer-chart/src/main/java/com/fr/design/chart/gui/active/TextActiveGlyph.java

@ -1,35 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.TitleGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetTitleStyleAction;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午3:57
*/
public class TextActiveGlyph extends ActiveGlyph {
private TitleGlyph titleGlyph;
public TextActiveGlyph(ChartComponent chartComponent, TitleGlyph titleGlyph, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.titleGlyph = titleGlyph;
}
public Glyph getGlyph() {
return this.titleGlyph;
}
public java.awt.Point offset4Paint() {
return new java.awt.Point(0, 0);
}
public void goRightPane() {
new SetTitleStyleAction(chartComponent).showTitlePane();
}
}

43
designer-chart/src/main/java/com/fr/design/chart/gui/active/TrendLineActiveGlyph.java

@ -1,43 +0,0 @@
package com.fr.design.chart.gui.active;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.List;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.PlotGlyph;
import com.fr.chart.chartglyph.TrendLineGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetAnalysisLineStyleAction;
public class TrendLineActiveGlyph extends ActiveGlyph{
private TrendLineGlyph trendLine;
public TrendLineActiveGlyph(ChartComponent chartComponent,TrendLineGlyph trendLine, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.trendLine = trendLine;
}
@Override
public Glyph getGlyph() {
return this.trendLine;
}
public void drawAllGlyph(Graphics2D g2d, int resolution){
Point2D offset4Paint = offset4Paint();
g2d.translate(offset4Paint.getX(), offset4Paint.getY());
PlotGlyph plotGlyph = (PlotGlyph)this.parentGlyph;
List<TrendLineGlyph> list = new ArrayList<TrendLineGlyph>();
plotGlyph.getAllTrendLineGlyph(list);
for(int index = 0; index < list.size(); index++){
list.get(index).draw(g2d, resolution);
}
g2d.translate(-offset4Paint.getX(), -offset4Paint.getY());
};
@Override
public void goRightPane() {
new SetAnalysisLineStyleAction(chartComponent).showAnalysisLineStylePane();
}
}

19
designer-chart/src/main/java/com/fr/design/chart/gui/active/ValueAxisActiveGlyph.java

@ -1,19 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.ValueAxisGlyph;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:02
*/
public class ValueAxisActiveGlyph extends AxisActiveGlyph {
public ValueAxisActiveGlyph(ChartComponent chartComponent, ValueAxisGlyph axis, Glyph parentGlyph) {
super(chartComponent, axis, parentGlyph);
}
}

37
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/ChartComponentAction.java

@ -1,37 +0,0 @@
package com.fr.design.chart.gui.active.action;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartglyph.AxisGlyph;
import com.fr.design.actions.UpdateAction;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午5:05
*/
public abstract class ChartComponentAction extends UpdateAction {
protected ChartComponent chartComponent;
public ChartComponentAction(ChartComponent chartComponent) {
this.chartComponent = chartComponent;
}
public void reset() {
chartComponent.reset();
}
public void repaint() {
chartComponent.repaint();
}
public ChartCollection getChartCollection() {
return chartComponent.getChartCollection();
}
public AxisGlyph getActiveAxisGlyph() {
return chartComponent.getActiveAxisGlyph();
}
}

27
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetAnalysisLineStyleAction.java

@ -1,27 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
public class SetAnalysisLineStyleAction extends ChartComponentAction{
public SetAnalysisLineStyleAction(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Set_Analysis_Line"));
}
@Override
public void actionPerformed(ActionEvent e) {
showAnalysisLineStylePane();
}
public void showAnalysisLineStylePane(){
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_LINE_TITLE);
}
}

33
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetAxisStyleAction.java

@ -1,33 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
import com.fr.stable.StringUtils;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午5:10
*/
public class SetAxisStyleAction extends ChartComponentAction {
public SetAxisStyleAction(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Set_Axis_Format"));
}
public void actionPerformed(ActionEvent e) {
showAxisStylePane();
}
public void showAxisStylePane() {
String axisType = getActiveAxisGlyph() == null ? StringUtils.EMPTY : getActiveAxisGlyph().getAxisType();
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_AXIS_TITLE, axisType);
}
}

31
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetChartStyleAciton.java

@ -1,31 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午5:00
*/
public class SetChartStyleAciton extends ChartComponentAction {
public SetChartStyleAciton(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Pattern"));
}
public void actionPerformed(ActionEvent e) {
showChartStylePane();
}
public void showChartStylePane() {
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_AREA_TITLE, PaneTitleConstants.CHART_STYLE_AREA_AREA_TITLE);
}
}

26
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetDataLabelStyleAction.java

@ -1,26 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
public class SetDataLabelStyleAction extends ChartComponentAction{
public SetDataLabelStyleAction(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Set_Data_Label"));
}
@Override
public void actionPerformed(ActionEvent e) {
showDataLabelStylePane();
}
public void showDataLabelStylePane() {
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_LABEL_TITLE);
}
}

33
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetDataSheetAction.java

@ -1,33 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:49
*/
public class SetDataSheetAction extends ChartComponentAction {
private static final long serialVersionUID = -4763886493273213850L;
public SetDataSheetAction(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Set_Data_Sheet"));
}
public void actionPerformed(ActionEvent e) {
showDataSheetStylePane();
}
public void showDataSheetStylePane() {
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_DATA_TITLE);
}
}

32
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetLegendStyleAction.java

@ -1,32 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:56
*/
public class SetLegendStyleAction extends ChartComponentAction {
private static final long serialVersionUID = 3253190503195130478L;
public SetLegendStyleAction(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Set_Legend_Sytle"));
}
public void actionPerformed(ActionEvent e) {
showLegendStylePane();
}
public void showLegendStylePane() {
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_LEGNED_TITLE);
}
}

32
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetPlotStyleAction.java

@ -1,32 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:58
*/
public class SetPlotStyleAction extends ChartComponentAction {
private static final long serialVersionUID = 2894127568015714372L;
public SetPlotStyleAction(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Set_Plot"));
}
public void actionPerformed(ActionEvent e) {
showPlotPane();
}
public void showPlotPane() {
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_AREA_TITLE, PaneTitleConstants.CHART_STYLE_AREA_PLOT_TITLE);
}
}

32
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetTitleStyleAction.java

@ -1,32 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:52
*/
public class SetTitleStyleAction extends ChartComponentAction {
private static final long serialVersionUID = -4763886493273213850L;
public SetTitleStyleAction(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Set_Title_Style"));
}
public void actionPerformed(ActionEvent e) {
showTitlePane();
}
public void showTitlePane() {
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_TITLE_TITLE);
}
}
Loading…
Cancel
Save