Browse Source

Merge pull request #395 in BA/design from ~XIAOHU/design:master to master

* commit 'a128fcfb1c836bf22f0cf7c7aea44021c5c488d8':
  update
  update
  update
  updaet
  updaet
  updaet
  update
  悬浮元素回调事件
master
superman 8 years ago
parent
commit
e24175ad38
  1. 16
      designer_chart/src/com/fr/design/chart/gui/ChartComponent.java

16
designer_chart/src/com/fr/design/chart/gui/ChartComponent.java

@ -5,6 +5,7 @@ import com.fr.base.ScreenResolution;
import com.fr.base.chart.BaseChart;
import com.fr.base.chart.BaseChartCollection;
import com.fr.base.chart.BaseChartGlyph;
import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.Axis;
import com.fr.chart.chartattr.Chart;
@ -31,7 +32,7 @@ import java.util.List;
* 类说明: 事件说明: 工具栏编辑--> 是刷新ChartComponent 然后响应整个设计块的改变事件
右键编辑 ---> 刷新ChartCompment 刷新对应的工具栏(加入事件) 然后响应整个设计块的改变事件
*/
public class ChartComponent extends MiddleChartComponent implements MouseListener, MouseMotionListener {
public class ChartComponent extends MiddleChartComponent implements MouseListener, MouseMotionListener, CallbackEvent{
private static final long serialVersionUID = 744164838619052097L;
private final List<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>();
private ChartCollection chartCollection4Design;
@ -181,8 +182,9 @@ 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);
@ -302,7 +304,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
return chartGlyph == null || chartWidth != this.getBounds().width || chartHeight != this.getBounds().height;
}
private void drawChartGlyph(Graphics2D g2d) {
public void drawChartGlyph(Graphics2D g2d) {
if (chartGlyph != null) {
if (chartGlyph.isRoundBorder()) {
chartGlyph.setBounds(new RoundRectangle2D.Double(0, 0, chartWidth, chartHeight, 10, 10));
@ -312,10 +314,14 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
// chartGlyph.draw(g2d, ScreenResolution.getScreenResolution());
//不直接画chartGlyph而画image的原因是表单的柱形图会溢出表单
//其他图都ok,其实感觉应该是柱形图画的不对,应该也可以改那边
Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,ScreenResolution.getScreenResolution());
//处理画图事件
Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,ScreenResolution.getScreenResolution(), this);
g2d.drawImage(chartImage, 0, 0, null);
}
}
@Override
public void callback() {
this.repaint();
}
}
Loading…
Cancel
Save