forked from fanruan/design
Browse Source
* commit '863fce65ac5a2275f9a1154ea74372ad53352ec5': CHART-15968 解决标签界面属性保存错误 CHART-15566 预定义边界界面图表预览 REPORT-40969 数据集-数据库数据集-重命名有问题 REPORT-38514 标签控件的属性界面-字体大小显示异常 【问题原因】标签属性界面,跟字体有关的一块由FRFontPane控制,这个界面表示字体大小的fontSizeComboBox会将接收到的值转化为浮点数而不是整数,变成浮点数之后会出现显示不全的情况 【改动思路】17年Momeak的一个改动(无JIRA任务)将字体大小从整数修改为浮点数,考虑到这一点,不采取改回整数的修改方案,而是将fontSizeComboBox与前一个组件之间的间隙减小,TableLayout下fontSizeComboBox就会被自动拉长,拉长后能够完整显示字体大小,改动效果已经通过产品确认 Revert "无JIRA任务 修复feature" 无JIRA任务 修复featureresearch/10.0
superman
4 years ago
13 changed files with 276 additions and 31 deletions
@ -0,0 +1,100 @@ |
|||||||
|
package com.fr.design.mainframe.predefined.ui.preview; |
||||||
|
|
||||||
|
import com.fr.base.chart.BaseChartCollection; |
||||||
|
import com.fr.base.chart.BaseChartPainter; |
||||||
|
import com.fr.base.chart.chartdata.CallbackEvent; |
||||||
|
import com.fr.base.chart.result.WebChartIDInfo; |
||||||
|
import com.fr.chart.base.ChartConstants; |
||||||
|
import com.fr.chart.base.ChartPreStyleProvider; |
||||||
|
import com.fr.chart.chartattr.ChartCollection; |
||||||
|
import com.fr.config.predefined.PredefinedStyle; |
||||||
|
import com.fr.design.gui.chart.MiddleChartComponent; |
||||||
|
import com.fr.plugin.chart.vanchart.VanChart; |
||||||
|
import com.fr.script.Calculator; |
||||||
|
import com.fr.stable.core.PropertyChangeListener; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.awt.Dimension; |
||||||
|
import java.awt.Graphics; |
||||||
|
import java.awt.Graphics2D; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Bjorn |
||||||
|
* @version 10.0 |
||||||
|
* Created by Bjorn on 2020-09-28 |
||||||
|
*/ |
||||||
|
public class ChartPreStylePreView extends MiddleChartComponent { |
||||||
|
|
||||||
|
private ChartCollection chartCollection; |
||||||
|
|
||||||
|
private double scaleX = 1.0; |
||||||
|
private double scaleY = 1.0; |
||||||
|
|
||||||
|
private CallbackEvent callbackEvent; |
||||||
|
|
||||||
|
public ChartPreStylePreView() { |
||||||
|
} |
||||||
|
|
||||||
|
public ChartPreStylePreView(ChartCollection cc) { |
||||||
|
this(cc, 1.0, 1.0); |
||||||
|
} |
||||||
|
|
||||||
|
public ChartPreStylePreView(ChartCollection cc, double scaleX, double scaleY) { |
||||||
|
this.scaleX = scaleX; |
||||||
|
this.scaleY = scaleY; |
||||||
|
populate(cc); |
||||||
|
} |
||||||
|
|
||||||
|
public void setCallbackEvent(CallbackEvent callbackEvent) { |
||||||
|
this.callbackEvent = callbackEvent; |
||||||
|
} |
||||||
|
|
||||||
|
public void paintComponent(Graphics g) { |
||||||
|
Graphics2D g2d = (Graphics2D) g; |
||||||
|
g2d.translate(ChartConstants.PREGAP4BOUNDS / 2, ChartConstants.PREGAP4BOUNDS / 2); |
||||||
|
g2d.scale(scaleX, scaleY); |
||||||
|
super.paintComponent(g); |
||||||
|
drawChart(g2d); |
||||||
|
g2d.scale(1 / scaleX, 1 / scaleY); |
||||||
|
g2d.translate(-ChartConstants.PREGAP4BOUNDS / 2, -ChartConstants.PREGAP4BOUNDS / 2); |
||||||
|
} |
||||||
|
|
||||||
|
private void drawChart(Graphics2D g2d) { |
||||||
|
Dimension d = getBounds().getSize(); |
||||||
|
int chartWidth = (int) (d.width / scaleX) - ChartConstants.PREGAP4BOUNDS; |
||||||
|
int chartHeight = (int) (d.height / scaleX) - ChartConstants.PREGAP4BOUNDS; |
||||||
|
BaseChartPainter painter = chartCollection.createResultChartPainterWithOutDealFormula(Calculator.createCalculator(), |
||||||
|
WebChartIDInfo.createEmptyDesignerInfo(), chartWidth, chartHeight); |
||||||
|
painter.paint(g2d, chartWidth, chartHeight, 0, null, callbackEvent); |
||||||
|
} |
||||||
|
|
||||||
|
public void refresh(PredefinedStyle style) { |
||||||
|
VanChart vanChart = chartCollection.getSelectedChartProvider(VanChart.class); |
||||||
|
List<ChartPreStyleProvider> chartPreStyleProviders = vanChart.getChartPreStyleProvider(); |
||||||
|
for (ChartPreStyleProvider chartPreStyleProvider : chartPreStyleProviders) { |
||||||
|
chartPreStyleProvider.updatePreDefinedStyle(style); |
||||||
|
} |
||||||
|
vanChart.attrChange(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populate(BaseChartCollection cc) { |
||||||
|
this.chartCollection = (ChartCollection) cc; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public BaseChartCollection update() { |
||||||
|
return this.chartCollection; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void addStopEditingListener(PropertyChangeListener l) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public void reset() { |
||||||
|
|
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue