Browse Source
* commit 'c0982f2e68af183259ec370c513a2e440953f6e6': CHART-9141 删除图表设计器相关代码 CHART-9141 replace chart with chartProvider(eg:typePane) && 图表公式相关接口 && 删除图表内部对datamodel的cache(和engine确认过) CHART-9783 地图相关操作慢 REPORT-18570 fr连接bi 数据分析预览单元格没有过滤设置 限制文件大小 REPORT-19059 环境切换同名程序数据集还是使用上一个环境的sql 换个名字 REPORT-18855 加下单元测试 REPORT-19058 环境切换暂存文件为保存提示 REPORT-18855 & REPORT-18857 jpg图片持久化遗漏了一些场景 CHART-9576 远程设计 设计器中用实时的 内存配置推荐:设计器安装插件随lic显示状态不对 REPORT-18955 填报属性配置,提交条件的删除按钮没有灰色化 update KERNEL-582 国际化定制的地方会越来越多,想办法去掉这种if else写法 && REPORT-18522 将所有海外版设计器的信息回传功能阉割 将所有海外版设计器的信息回传功能阉割research/10.0
57 changed files with 1046 additions and 761 deletions
@ -0,0 +1,31 @@ |
|||||||
|
package com.fr.design.locale.impl; |
||||||
|
|
||||||
|
import com.fr.general.GeneralContext; |
||||||
|
import com.fr.general.locale.LocaleMark; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Locale; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Hades |
||||||
|
* @date 2019/6/24 |
||||||
|
*/ |
||||||
|
public class ProductImproveMark implements LocaleMark<Boolean> { |
||||||
|
|
||||||
|
private Map<Locale, Boolean> map = new HashMap<>(); |
||||||
|
|
||||||
|
public ProductImproveMark() { |
||||||
|
map.put(Locale.CHINA, true); |
||||||
|
map.put(Locale.TAIWAN, false); |
||||||
|
map.put(Locale.US, false); |
||||||
|
map.put(Locale.KOREA, false); |
||||||
|
map.put(Locale.JAPAN, false); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Boolean getValue() { |
||||||
|
Boolean result = map.get(GeneralContext.getLocale()); |
||||||
|
return result == null ? false : result; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,35 @@ |
|||||||
|
package com.fr.design.locale.impl; |
||||||
|
|
||||||
|
import com.fr.design.DesignerEnvManager; |
||||||
|
import com.fr.general.GeneralContext; |
||||||
|
import com.fr.general.locale.LocaleMark; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Locale; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Hades |
||||||
|
* @date 2019/6/24 |
||||||
|
*/ |
||||||
|
public class SplashMark implements LocaleMark<String> { |
||||||
|
|
||||||
|
private Map<Locale, String> map = new HashMap<Locale, String>(); |
||||||
|
private static final String SPLASH_PATH = "/com/fr/design/images/splash_10.gif"; |
||||||
|
private static final String SPLASH_EN_PATH = "/com/fr/design/images/splash_10_en.gif"; |
||||||
|
private static final String SPLASH_JP_PATH = "/com/fr/design/images/splash_10_jp.gif"; |
||||||
|
|
||||||
|
public SplashMark() { |
||||||
|
map.put(Locale.CHINA, SPLASH_PATH); |
||||||
|
map.put(Locale.KOREA, SPLASH_EN_PATH); |
||||||
|
map.put(Locale.JAPAN, SPLASH_JP_PATH); |
||||||
|
map.put(Locale.US, SPLASH_EN_PATH); |
||||||
|
map.put(Locale.TAIWAN, SPLASH_EN_PATH); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String getValue() { |
||||||
|
String result = map.get(DesignerEnvManager.getEnvManager().getLanguage()); |
||||||
|
return result == null ? SPLASH_EN_PATH : result; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,44 @@ |
|||||||
|
package com.fr.design.locale.impl; |
||||||
|
|
||||||
|
import com.fr.general.locale.SupportLocale; |
||||||
|
|
||||||
|
import java.util.HashSet; |
||||||
|
import java.util.Locale; |
||||||
|
import java.util.Set; |
||||||
|
|
||||||
|
/** |
||||||
|
* 某些国际化环境支持的操作 |
||||||
|
* 需要增加/删除支持的语言 统一在这里修改 无须改动业务代码 |
||||||
|
* 后续有新的不同语言下的差异操作 添加新的枚举 |
||||||
|
* @author Hades |
||||||
|
* @date 2019/6/24 |
||||||
|
*/ |
||||||
|
public enum SupportLocaleImpl implements SupportLocale { |
||||||
|
|
||||||
|
/** |
||||||
|
* 社区菜单支持的国际化环境 |
||||||
|
*/ |
||||||
|
COMMUNITY { |
||||||
|
@Override |
||||||
|
public Set<Locale> support() { |
||||||
|
Set<Locale> set = new HashSet<Locale>(); |
||||||
|
set.add(Locale.CHINA); |
||||||
|
set.add(Locale.TAIWAN); |
||||||
|
return set; |
||||||
|
} |
||||||
|
}, |
||||||
|
|
||||||
|
/** |
||||||
|
* Facebook支持的国际化环境 |
||||||
|
*/ |
||||||
|
FACEBOOK { |
||||||
|
@Override |
||||||
|
public Set<Locale> support() { |
||||||
|
Set<Locale> set = new HashSet<Locale>(); |
||||||
|
set.add(Locale.TAIWAN); |
||||||
|
return set; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
package com.fr.design.locale.impl; |
||||||
|
|
||||||
|
import com.fr.general.CloudCenter; |
||||||
|
import com.fr.general.GeneralContext; |
||||||
|
import com.fr.general.locale.LocaleMark; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Locale; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Hades |
||||||
|
* @date 2019/6/24 |
||||||
|
*/ |
||||||
|
public class UserInfoMark implements LocaleMark<String> { |
||||||
|
|
||||||
|
private Map<Locale, String> map = new HashMap<>(); |
||||||
|
private static final String CN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.cn"); |
||||||
|
private static final String EN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.en"); |
||||||
|
private static final String TW_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.tw"); |
||||||
|
private static final String JP_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.jp"); |
||||||
|
|
||||||
|
public UserInfoMark() { |
||||||
|
map.put(Locale.CHINA, CN_LOGIN_HTML); |
||||||
|
map.put(Locale.KOREA, EN_LOGIN_HTML); |
||||||
|
map.put(Locale.JAPAN, JP_LOGIN_HTML); |
||||||
|
map.put(Locale.US, EN_LOGIN_HTML); |
||||||
|
map.put(Locale.TAIWAN, TW_LOGIN_HTML); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String getValue() { |
||||||
|
String result = map.get(GeneralContext.getLocale()); |
||||||
|
return result == null ? EN_LOGIN_HTML : result; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,35 @@ |
|||||||
|
package com.fr.design.locale.impl; |
||||||
|
|
||||||
|
import com.fr.general.CloudCenter; |
||||||
|
import com.fr.general.GeneralContext; |
||||||
|
import com.fr.general.locale.LocaleMark; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Locale; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Hades |
||||||
|
* @date 2019/6/24 |
||||||
|
*/ |
||||||
|
public class VideoMark implements LocaleMark<String> { |
||||||
|
|
||||||
|
private Map<Locale, String> map = new HashMap<>(); |
||||||
|
private static final String VIDEO_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en"); |
||||||
|
private static final String VIDEO_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.video"); |
||||||
|
private static final String VIDEO_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.video.tw"); |
||||||
|
|
||||||
|
public VideoMark() { |
||||||
|
map.put(Locale.CHINA, VIDEO_CN); |
||||||
|
map.put(Locale.KOREA, VIDEO_EN); |
||||||
|
map.put(Locale.JAPAN, VIDEO_EN); |
||||||
|
map.put(Locale.US, VIDEO_EN); |
||||||
|
map.put(Locale.TAIWAN, VIDEO_TW); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String getValue() { |
||||||
|
String result = map.get(GeneralContext.getLocale()); |
||||||
|
return result == null ? VIDEO_EN : result; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,102 @@ |
|||||||
|
package com.fr.design.data; |
||||||
|
|
||||||
|
import com.fr.base.TableData; |
||||||
|
import com.fr.data.impl.storeproc.StoreProcedure; |
||||||
|
import com.fr.design.data.tabledata.wrapper.TableDataFactory; |
||||||
|
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; |
||||||
|
import com.fr.file.ProcedureConfig; |
||||||
|
import com.fr.file.TableDataConfig; |
||||||
|
import org.easymock.EasyMock; |
||||||
|
import org.junit.Assert; |
||||||
|
import org.junit.Test; |
||||||
|
import org.junit.runner.RunWith; |
||||||
|
import org.powermock.api.easymock.PowerMock; |
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest; |
||||||
|
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; |
||||||
|
import org.powermock.modules.junit4.PowerMockRunner; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class) |
||||||
|
@PrepareForTest({TableDataFactory.class, StoreProcedure.class, TableDataConfig.class, ProcedureConfig.class}) |
||||||
|
@SuppressStaticInitializationFor({"com.fr.design.data.tabledata.wrapper.TableDataFactory"}) |
||||||
|
public class DesignTableDataManagerTest { |
||||||
|
|
||||||
|
@Test |
||||||
|
public void testFireDataChange() { |
||||||
|
|
||||||
|
DesignTableDataManager.envChange(); |
||||||
|
|
||||||
|
|
||||||
|
PowerMock.mockStatic(TableDataConfig.class); |
||||||
|
|
||||||
|
TableDataConfig config = EasyMock.mock(TableDataConfig.class); |
||||||
|
TableDataConfig config2 = EasyMock.mock(TableDataConfig.class); |
||||||
|
|
||||||
|
TableData td1 = EasyMock.mock(TableData.class); |
||||||
|
TableData td2 = EasyMock.mock(TableData.class); |
||||||
|
TableData td3 = EasyMock.mock(TableData.class); |
||||||
|
TableData td4 = EasyMock.mock(TableData.class); |
||||||
|
EasyMock.expect(config.getTableData("firstData")).andReturn(td1).once(); |
||||||
|
EasyMock.expect(config.getTableData("secondData")).andReturn(td2).once(); |
||||||
|
EasyMock.expect(config2.getTableData("firstData")).andReturn(td3).once(); |
||||||
|
EasyMock.expect(config2.getTableData("secondData")).andReturn(td4).once(); |
||||||
|
|
||||||
|
EasyMock.expect(TableDataConfig.getInstance()).andReturn(config).once().andReturn(config2).once(); |
||||||
|
|
||||||
|
PowerMock.mockStatic(TableDataFactory.class); |
||||||
|
EasyMock.expect(TableDataFactory.getSortOfChineseNameOfServerData(config)) |
||||||
|
.andReturn(new String[]{"firstData", "secondData"}).once(); |
||||||
|
EasyMock.expect(TableDataFactory.getSortOfChineseNameOfServerData(config2)) |
||||||
|
.andReturn(new String[]{"firstData", "secondData"}).once(); |
||||||
|
|
||||||
|
|
||||||
|
ProcedureConfig proConfig = EasyMock.mock(ProcedureConfig.class); |
||||||
|
StoreProcedure pc1 = PowerMock.createMock(StoreProcedure.class); |
||||||
|
StoreProcedure pc2 = PowerMock.createMock(StoreProcedure.class); |
||||||
|
ProcedureConfig proConfig2 = EasyMock.mock(ProcedureConfig.class); |
||||||
|
StoreProcedure pc3 = PowerMock.createMock(StoreProcedure.class); |
||||||
|
StoreProcedure pc4 = PowerMock.createMock(StoreProcedure.class); |
||||||
|
|
||||||
|
Map<String, StoreProcedure> procedureMap = new HashMap<>(); |
||||||
|
procedureMap.put("firstPRO", pc1); |
||||||
|
procedureMap.put("secondPRO", pc2); |
||||||
|
EasyMock.expect(proConfig.getProcedure("firstPRO")).andReturn(pc1).once(); |
||||||
|
EasyMock.expect(proConfig.getProcedure("secondPRO")).andReturn(pc2).once(); |
||||||
|
|
||||||
|
Map<String, StoreProcedure> procedureMap2 = new HashMap<>(); |
||||||
|
procedureMap2.put("firstPRO", pc3); |
||||||
|
procedureMap2.put("secondPRO", pc4); |
||||||
|
EasyMock.expect(proConfig2.getProcedure("firstPRO")).andReturn(pc3).once(); |
||||||
|
EasyMock.expect(proConfig2.getProcedure("secondPRO")).andReturn(pc4).once(); |
||||||
|
|
||||||
|
EasyMock.expect(proConfig.getProcedures()).andReturn(procedureMap).once(); |
||||||
|
EasyMock.expect(proConfig2.getProcedures()).andReturn(procedureMap2).once(); |
||||||
|
|
||||||
|
PowerMock.mockStatic(ProcedureConfig.class); |
||||||
|
EasyMock.expect(ProcedureConfig.getInstance()).andReturn(proConfig).once().andReturn(proConfig2).once(); |
||||||
|
|
||||||
|
EasyMock.replay(proConfig, config, config2, proConfig2); |
||||||
|
PowerMock.replay(TableDataFactory.class, TableDataConfig.class, ProcedureConfig.class); |
||||||
|
|
||||||
|
|
||||||
|
Map<String, TableDataWrapper> map = DesignTableDataManager.getAllEditingDataSet(null); |
||||||
|
Assert.assertEquals(4, map.size()); |
||||||
|
Assert.assertSame(pc1, map.get("firstPRO").getTableData()); |
||||||
|
Assert.assertSame(pc2, map.get("secondPRO").getTableData()); |
||||||
|
Assert.assertSame(td1, map.get("firstData").getTableData()); |
||||||
|
Assert.assertSame(td2, map.get("secondData").getTableData()); |
||||||
|
|
||||||
|
DesignTableDataManager.fireDSChanged(new HashMap<String, String>()); |
||||||
|
|
||||||
|
Map<String, TableDataWrapper> map2 = DesignTableDataManager.getAllEditingDataSet(null); |
||||||
|
Assert.assertEquals(4, map2.size()); |
||||||
|
Assert.assertSame(pc3, map2.get("firstPRO").getTableData()); |
||||||
|
Assert.assertSame(pc4, map2.get("secondPRO").getTableData()); |
||||||
|
Assert.assertSame(td3, map2.get("firstData").getTableData()); |
||||||
|
Assert.assertSame(td4, map2.get("secondData").getTableData()); |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,23 @@ |
|||||||
|
package com.fr.file; |
||||||
|
|
||||||
|
import org.easymock.EasyMock; |
||||||
|
import org.junit.Assert; |
||||||
|
import org.junit.Test; |
||||||
|
|
||||||
|
public class StashedFILETest { |
||||||
|
|
||||||
|
/** |
||||||
|
* 用于测试暂存文件未保存时的提示 |
||||||
|
*/ |
||||||
|
@Test |
||||||
|
public void testToString() { |
||||||
|
FILE file = EasyMock.mock(FILE.class); |
||||||
|
String name = "getA.cpt"; |
||||||
|
EasyMock.expect(file.getName()).andReturn(name).once(); |
||||||
|
EasyMock.replay(file); |
||||||
|
FILE stashedFILE = new StashedFILE(file, new byte[0]); |
||||||
|
String expectString = FILEFactory.MEM_PREFIX + name; |
||||||
|
Assert.assertEquals(expectString, stashedFILE + ""); |
||||||
|
EasyMock.verify(file); |
||||||
|
} |
||||||
|
} |
@ -1,65 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. |
|
||||||
*/ |
|
||||||
|
|
||||||
package com.fr.design.mainframe.chart.gui; |
|
||||||
|
|
||||||
import com.fr.design.mainframe.chart.gui.other.ChartDesignerConditionAttrPane; |
|
||||||
import com.fr.design.mainframe.chart.gui.other.ChartDesignerInteractivePane; |
|
||||||
import com.fr.design.dialog.BasicPane; |
|
||||||
|
|
||||||
|
|
||||||
import javax.swing.*; |
|
||||||
import java.awt.*; |
|
||||||
import java.util.*; |
|
||||||
|
|
||||||
/** |
|
||||||
* 图表设计器的图标属性表高级tab |
|
||||||
* Created by IntelliJ IDEA. |
|
||||||
* Author : daisy |
|
||||||
* Version: 6.5.6 |
|
||||||
* Date: 14-10-16 |
|
||||||
* Time: 下午2:04 |
|
||||||
*/ |
|
||||||
public class ChartDesignerOtherPane extends ChartOtherPane { |
|
||||||
|
|
||||||
@Override |
|
||||||
protected JPanel createContentPane() { |
|
||||||
JPanel content = new JPanel(new BorderLayout()); |
|
||||||
otherPane = new ChartTabPane(); |
|
||||||
content.add(otherPane, BorderLayout.CENTER); |
|
||||||
return content; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 界面标题 |
|
||||||
* |
|
||||||
* @return 返回标题. |
|
||||||
*/ |
|
||||||
public String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Advanced"); |
|
||||||
} |
|
||||||
|
|
||||||
private boolean isHaveCondition() { |
|
||||||
return hasCondition; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private class ChartTabPane extends TabPane { |
|
||||||
|
|
||||||
@Override |
|
||||||
protected java.util.List<BasicPane> initPaneList() { |
|
||||||
java.util.List<BasicPane> paneList = new ArrayList<BasicPane>(); |
|
||||||
interactivePane = new ChartDesignerInteractivePane(ChartDesignerOtherPane.this); |
|
||||||
|
|
||||||
paneList.add(interactivePane); |
|
||||||
|
|
||||||
if (ChartDesignerOtherPane.this.isHaveCondition()) { |
|
||||||
conditionAttrPane = new ChartDesignerConditionAttrPane(); |
|
||||||
paneList.add(conditionAttrPane); |
|
||||||
} |
|
||||||
return paneList; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
} |
|
@ -1,33 +0,0 @@ |
|||||||
package com.fr.design.mainframe.chart.gui; |
|
||||||
|
|
||||||
import com.fr.chart.chartattr.ChartCollection; |
|
||||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
|
||||||
import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane; |
|
||||||
import com.fr.design.mainframe.chart.gui.style.series.SeriesPane4ChartDesigner; |
|
||||||
|
|
||||||
/** |
|
||||||
* 图表设计器的样式面板 |
|
||||||
* Created by IntelliJ IDEA. |
|
||||||
* Author : daisy |
|
||||||
* Version: 6.5.6 |
|
||||||
* Date: 14-10-25 |
|
||||||
* Time: 下午6:56 |
|
||||||
*/ |
|
||||||
public class StylePane4Chart extends ChartStylePane { |
|
||||||
|
|
||||||
public StylePane4Chart(AttributeChangeListener listener, boolean isNeedFormula) { |
|
||||||
super(listener, isNeedFormula); |
|
||||||
} |
|
||||||
|
|
||||||
public void update(ChartCollection collection) { |
|
||||||
int selectIndex = collection.getSelectedIndex(); |
|
||||||
super.update(collection); |
|
||||||
collection.getSelectedChart().setStyleGlobal(false); |
|
||||||
collection.setChartName(selectIndex, collection.getSelectedChart().getTitle().getTextObject().toString()); |
|
||||||
} |
|
||||||
|
|
||||||
protected ChartSeriesPane createChartSeriesPane(){ |
|
||||||
return new SeriesPane4ChartDesigner(StylePane4Chart.this); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -0,0 +1,409 @@ |
|||||||
|
package com.fr.design.mainframe.chart.gui.type; |
||||||
|
|
||||||
|
import com.fr.base.ChartColorMatching; |
||||||
|
import com.fr.base.ChartPreStyleConfig; |
||||||
|
import com.fr.base.background.ColorBackground; |
||||||
|
import com.fr.chart.base.AttrContents; |
||||||
|
import com.fr.chart.base.AttrFillStyle; |
||||||
|
import com.fr.chart.base.ChartConstants; |
||||||
|
import com.fr.chart.base.ChartUtils; |
||||||
|
import com.fr.chart.base.DataSeriesCondition; |
||||||
|
import com.fr.chart.base.TextAttr; |
||||||
|
import com.fr.chart.chartattr.Axis; |
||||||
|
import com.fr.chart.chartattr.CategoryPlot; |
||||||
|
import com.fr.chart.chartattr.Chart; |
||||||
|
import com.fr.chart.chartattr.Legend; |
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.chart.chartattr.Title; |
||||||
|
import com.fr.chart.chartglyph.ConditionAttr; |
||||||
|
import com.fr.general.ComparatorUtils; |
||||||
|
import com.fr.general.FRFont; |
||||||
|
import com.fr.js.NameJavaScriptGroup; |
||||||
|
import com.fr.log.FineLoggerFactory; |
||||||
|
import com.fr.stable.Constants; |
||||||
|
|
||||||
|
import java.awt.Color; |
||||||
|
import java.awt.Font; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by shine on 2019/7/1. |
||||||
|
*/ |
||||||
|
public abstract class AbstractDeprecatedChartTypePane extends AbstractChartTypePane<Chart> { |
||||||
|
|
||||||
|
protected void changePlotWithClone(Chart chart, Plot plot) { |
||||||
|
try { |
||||||
|
chart.switchPlot((Plot) plot.clone()); |
||||||
|
} catch (CloneNotSupportedException e) { |
||||||
|
FineLoggerFactory.getLogger().error("Error in change plot"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新界面属性 |
||||||
|
*/ |
||||||
|
public void populateBean(Chart chart) { |
||||||
|
for (ChartImagePane imagePane : typeDemo) { |
||||||
|
imagePane.isPressing = false; |
||||||
|
} |
||||||
|
for (ChartImagePane imagePane : styleList) { |
||||||
|
imagePane.isPressing = false; |
||||||
|
} |
||||||
|
|
||||||
|
if (styleList != null && !styleList.isEmpty()) { |
||||||
|
int plotStyle = chart.getPlot().getPlotStyle(); |
||||||
|
String styleName = chart.getPlot().getPlotFillStyle().getFillStyleName(); |
||||||
|
|
||||||
|
switch (plotStyle) { |
||||||
|
case ChartConstants.STYLE_SHADE: |
||||||
|
if (ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Retro"), styleName)) { |
||||||
|
styleList.get(STYLE_SHADE).isPressing = true; |
||||||
|
lastStyleIndex = STYLE_SHADE; |
||||||
|
} |
||||||
|
break; |
||||||
|
case ChartConstants.STYLE_TRANSPARENT: |
||||||
|
if (ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Fresh"), styleName)) { |
||||||
|
styleList.get(STYLE_TRANSPARENT).isPressing = true; |
||||||
|
lastStyleIndex = STYLE_TRANSPARENT; |
||||||
|
} |
||||||
|
break; |
||||||
|
case ChartConstants.STYLE_3D: |
||||||
|
if (ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Bright"), styleName)) { |
||||||
|
styleList.get(STYLE_PLANE3D).isPressing = true; |
||||||
|
lastStyleIndex = STYLE_PLANE3D; |
||||||
|
} |
||||||
|
break; |
||||||
|
case ChartConstants.STYLE_OUTER: |
||||||
|
if (ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Bright"), styleName)) { |
||||||
|
styleList.get(STYLE_HIGHLIGHT).isPressing = true; |
||||||
|
lastStyleIndex = STYLE_HIGHLIGHT; |
||||||
|
} |
||||||
|
break; |
||||||
|
default: |
||||||
|
lastStyleIndex = -1; |
||||||
|
break; |
||||||
|
} |
||||||
|
stylePane.setVisible(!(chart.getPlot().isSupport3D())); |
||||||
|
this.repaint(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void updateBean(Chart chart) { |
||||||
|
Plot oldPlot = chart.getPlot(); |
||||||
|
Plot newPlot = this.setSelectedClonedPlotWithCondition(oldPlot); |
||||||
|
checkTypeChange(oldPlot);//判断图表的类型是否发生变化
|
||||||
|
if (styleList != null && !styleList.isEmpty()) { |
||||||
|
if (styleList.get(STYLE_SHADE).isPressing && lastStyleIndex != STYLE_SHADE) { |
||||||
|
lastStyleIndex = STYLE_SHADE; |
||||||
|
chart.setPlot(newPlot); |
||||||
|
chart.getPlot().setPlotStyle(ChartConstants.STYLE_SHADE); |
||||||
|
resetChart(chart); |
||||||
|
createCondition4Shade(chart); |
||||||
|
setPlotFillStyle(chart); |
||||||
|
} else if (styleList.get(STYLE_TRANSPARENT).isPressing && lastStyleIndex != STYLE_TRANSPARENT) { |
||||||
|
lastStyleIndex = STYLE_TRANSPARENT; |
||||||
|
chart.setPlot(newPlot); |
||||||
|
chart.getPlot().setPlotStyle(ChartConstants.STYLE_TRANSPARENT); |
||||||
|
resetChart(chart); |
||||||
|
createCondition4Transparent(chart); |
||||||
|
setPlotFillStyle(chart); |
||||||
|
} else if (styleList.get(STYLE_PLANE3D).isPressing && lastStyleIndex != STYLE_PLANE3D) { |
||||||
|
lastStyleIndex = STYLE_PLANE3D; |
||||||
|
chart.setPlot(newPlot); |
||||||
|
chart.getPlot().setPlotStyle(ChartConstants.STYLE_3D); |
||||||
|
resetChart(chart); |
||||||
|
createCondition4Plane3D(chart); |
||||||
|
setPlotFillStyle(chart); |
||||||
|
} else if (styleList.get(STYLE_HIGHLIGHT).isPressing && lastStyleIndex != STYLE_HIGHLIGHT) { |
||||||
|
lastStyleIndex = STYLE_HIGHLIGHT; |
||||||
|
chart.setPlot(newPlot); |
||||||
|
chart.getPlot().setPlotStyle(ChartConstants.STYLE_OUTER); |
||||||
|
resetChart(chart); |
||||||
|
createCondition4HighLight(chart); |
||||||
|
setPlotFillStyle(chart); |
||||||
|
} else if (lastStyleIndex >= STYLE_SHADE && lastStyleIndex <= STYLE_HIGHLIGHT) { |
||||||
|
if (styleList.get(lastStyleIndex).isDoubleClicked || typeChanged) { |
||||||
|
chart.setPlot(newPlot); |
||||||
|
resetChart(chart); |
||||||
|
styleList.get(lastStyleIndex).isPressing = false; |
||||||
|
checkDemosBackground(); |
||||||
|
lastStyleIndex = -1; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
stylePane.setVisible(!(chart.getPlot().isSupport3D())); |
||||||
|
this.repaint(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private Plot setSelectedClonedPlotWithCondition(Plot oldPlot) { |
||||||
|
Plot newPlot = getSelectedClonedPlot(); |
||||||
|
if (oldPlot != null && ComparatorUtils.equals(newPlot.getClass(), oldPlot.getClass())) { |
||||||
|
if (oldPlot.getHotHyperLink() != null) { |
||||||
|
NameJavaScriptGroup hotHyper = oldPlot.getHotHyperLink(); |
||||||
|
try { |
||||||
|
newPlot.setHotHyperLink((NameJavaScriptGroup) hotHyper.clone()); |
||||||
|
} catch (CloneNotSupportedException e) { |
||||||
|
FineLoggerFactory.getLogger().error("Error in Hyperlink, Please Check it.", e); |
||||||
|
} |
||||||
|
} |
||||||
|
newPlot.setConditionCollection(oldPlot.getConditionCollection()); |
||||||
|
newPlot.setSeriesDragEnable(oldPlot.isSeriesDragEnable()); |
||||||
|
if (newPlot.isSupportZoomCategoryAxis() && newPlot.getxAxis() != null) { |
||||||
|
newPlot.getxAxis().setZoom(oldPlot.getxAxis().isZoom()); |
||||||
|
} |
||||||
|
if (newPlot.isSupportTooltipInInteractivePane()) { |
||||||
|
newPlot.setHotTooltipStyle(oldPlot.getHotTooltipStyle()); |
||||||
|
} |
||||||
|
|
||||||
|
if (newPlot.isSupportAutoRefresh()) { |
||||||
|
newPlot.setAutoRefreshPerSecond(oldPlot.getAutoRefreshPerSecond()); |
||||||
|
} |
||||||
|
|
||||||
|
if (newPlot.isSupportAxisTip()) { |
||||||
|
newPlot.setInteractiveAxisTooltip(oldPlot.isInteractiveAxisTooltip()); |
||||||
|
} |
||||||
|
} |
||||||
|
return newPlot; |
||||||
|
} |
||||||
|
|
||||||
|
//平面3D的默认属性设置
|
||||||
|
private void createCondition4Plane3D(Chart chart) { |
||||||
|
if (chart != null) { |
||||||
|
//标题
|
||||||
|
Title title = new Title(chart.getTitle().getTextObject()); |
||||||
|
chart.setTitle(title); |
||||||
|
title.setTitleVisible(true); |
||||||
|
TextAttr textAttr = title.getTextAttr(); |
||||||
|
if (textAttr == null) { |
||||||
|
textAttr = new TextAttr(); |
||||||
|
title.setTextAttr(textAttr); |
||||||
|
} |
||||||
|
title.setPosition(Constants.CENTER); |
||||||
|
textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 16f, new Color(51, 51, 51))); |
||||||
|
|
||||||
|
//图例
|
||||||
|
Legend legend = new Legend(); |
||||||
|
legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(128, 128, 128))); |
||||||
|
legend.setPosition(Constants.TOP); |
||||||
|
chart.getPlot().setLegend(legend); |
||||||
|
|
||||||
|
//分类轴,现在只有柱形图,条形图,面积图
|
||||||
|
if (chart.getPlot() instanceof CategoryPlot) { |
||||||
|
CategoryPlot plot = (CategoryPlot) chart.getPlot(); |
||||||
|
//分类轴设置
|
||||||
|
Axis cateAxis = plot.getxAxis(); |
||||||
|
cateAxis.setAxisStyle(Constants.LINE_THICK); |
||||||
|
cateAxis.setAxisColor(new Color(57, 57, 57)); |
||||||
|
cateAxis.setTickMarkType(Constants.TICK_MARK_NONE); |
||||||
|
cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); |
||||||
|
cateAxis.setShowAxisLabel(true); |
||||||
|
cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(57, 57, 57))); |
||||||
|
|
||||||
|
//值轴设置
|
||||||
|
Axis valueAxis = plot.getyAxis(); |
||||||
|
valueAxis.setAxisStyle(Constants.LINE_NONE); |
||||||
|
valueAxis.setTickMarkType(Constants.TICK_MARK_NONE); |
||||||
|
valueAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); |
||||||
|
valueAxis.setShowAxisLabel(false); |
||||||
|
|
||||||
|
//绘图区
|
||||||
|
plot.getyAxis().setMainGridStyle(Constants.LINE_THIN); |
||||||
|
plot.getyAxis().setMainGridColor(new Color(192, 192, 192)); |
||||||
|
chart.setBorderStyle(Constants.LINE_NONE); |
||||||
|
|
||||||
|
//数据标签
|
||||||
|
ConditionAttr attrList = plot.getConditionCollection().getDefaultAttr(); |
||||||
|
DataSeriesCondition attr = attrList.getExisted(AttrContents.class); |
||||||
|
if (attr != null) { |
||||||
|
attrList.remove(attr); |
||||||
|
} |
||||||
|
AttrContents attrContents = new AttrContents(); |
||||||
|
attrContents.setPosition(Constants.OUTSIDE); |
||||||
|
attrContents.setSeriesLabel(ChartConstants.VALUE_PARA); |
||||||
|
attrContents.setTextAttr(new TextAttr(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(51, 51, 51)))); |
||||||
|
attrList.addDataSeriesCondition(attrContents); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//透明风格的默认属性设置
|
||||||
|
private void createCondition4Transparent(Chart chart) { |
||||||
|
if (chart != null) { |
||||||
|
//标题
|
||||||
|
Title title = new Title(chart.getTitle().getTextObject()); |
||||||
|
chart.setTitle(title); |
||||||
|
title.setTitleVisible(true); |
||||||
|
TextAttr textAttr = title.getTextAttr(); |
||||||
|
if (textAttr == null) { |
||||||
|
textAttr = new TextAttr(); |
||||||
|
title.setTextAttr(textAttr); |
||||||
|
} |
||||||
|
title.setPosition(Constants.LEFT); |
||||||
|
textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.BOLD, 16f, new Color(192, 192, 192))); |
||||||
|
|
||||||
|
//图例
|
||||||
|
Legend legend = new Legend(); |
||||||
|
legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(138, 140, 139))); |
||||||
|
legend.setPosition(Constants.RIGHT_TOP); |
||||||
|
chart.getPlot().setLegend(legend); |
||||||
|
|
||||||
|
Plot plot = chart.getPlot(); |
||||||
|
//绘图区
|
||||||
|
chart.setBackground(ColorBackground.getInstance(new Color(51, 51, 51))); |
||||||
|
|
||||||
|
//分类轴,现在只有柱形图,条形图,面积图
|
||||||
|
if (plot instanceof CategoryPlot) { |
||||||
|
//边框
|
||||||
|
plot.setBorderStyle(Constants.LINE_THIN); |
||||||
|
plot.setBorderColor(new Color(65, 65, 65)); |
||||||
|
|
||||||
|
//分类轴设置
|
||||||
|
Axis cateAxis = plot.getxAxis(); |
||||||
|
cateAxis.setAxisStyle(Constants.LINE_THICK); |
||||||
|
cateAxis.setAxisColor(new Color(192, 192, 192)); |
||||||
|
cateAxis.setTickMarkType(Constants.TICK_MARK_NONE); |
||||||
|
cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); |
||||||
|
cateAxis.setShowAxisLabel(true); |
||||||
|
cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(150, 150, 150))); |
||||||
|
|
||||||
|
//值轴
|
||||||
|
Axis valueAxis = plot.getyAxis(); |
||||||
|
valueAxis.setShowAxisLabel(true); |
||||||
|
valueAxis.setAxisStyle(Constants.LINE_NONE); |
||||||
|
valueAxis.getTextAttr().setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 10f, new Color(150, 150, 150))); |
||||||
|
valueAxis.setMainGridStyle(Constants.LINE_THIN); |
||||||
|
valueAxis.setMainGridColor(new Color(63, 62, 62)); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//渐变的默认属性设置
|
||||||
|
private void createCondition4Shade(Chart chart) { |
||||||
|
if (chart != null) { |
||||||
|
//标题
|
||||||
|
Title title = new Title(chart.getTitle().getTextObject()); |
||||||
|
chart.setTitle(title); |
||||||
|
title.setTitleVisible(true); |
||||||
|
TextAttr textAttr = title.getTextAttr(); |
||||||
|
if (textAttr == null) { |
||||||
|
textAttr = new TextAttr(); |
||||||
|
title.setTextAttr(textAttr); |
||||||
|
} |
||||||
|
title.setPosition(Constants.CENTER); |
||||||
|
textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.BOLD, 16f, new Color(0, 51, 102))); |
||||||
|
|
||||||
|
//图例
|
||||||
|
Legend legend = new Legend(); |
||||||
|
legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(128, 128, 128))); |
||||||
|
legend.setPosition(Constants.BOTTOM); |
||||||
|
chart.getPlot().setLegend(legend); |
||||||
|
|
||||||
|
//分类轴,现在只有柱形图,条形图,面积图
|
||||||
|
if (chart.getPlot() instanceof CategoryPlot) { |
||||||
|
CategoryPlot plot = (CategoryPlot) chart.getPlot(); |
||||||
|
|
||||||
|
//分类轴设置
|
||||||
|
Axis cateAxis = plot.getxAxis(); |
||||||
|
cateAxis.setAxisStyle(Constants.LINE_THICK); |
||||||
|
cateAxis.setAxisColor(new Color(73, 100, 117)); |
||||||
|
cateAxis.setTickMarkType(Constants.TICK_MARK_NONE); |
||||||
|
cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); |
||||||
|
cateAxis.setShowAxisLabel(true); |
||||||
|
cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(128, 128, 128))); |
||||||
|
|
||||||
|
//值轴
|
||||||
|
Axis valueAxis = plot.getyAxis(); |
||||||
|
valueAxis.setShowAxisLabel(true); |
||||||
|
valueAxis.getTextAttr().setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 10f, new Color(128, 128, 128))); |
||||||
|
valueAxis.setAxisStyle(Constants.LINE_NONE); |
||||||
|
|
||||||
|
//绘图区
|
||||||
|
plot.getyAxis().setMainGridStyle(Constants.LINE_THIN); |
||||||
|
plot.getyAxis().setMainGridColor(new Color(192, 192, 192)); |
||||||
|
plot.setHorizontalIntervalBackgroundColor(new Color(243, 243, 243)); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//高光渐变的默认属性设置
|
||||||
|
private void createCondition4HighLight(Chart chart) { |
||||||
|
if (chart != null) { |
||||||
|
//标题
|
||||||
|
Title title = new Title(chart.getTitle().getTextObject()); |
||||||
|
chart.setTitle(title); |
||||||
|
title.setTitleVisible(true); |
||||||
|
TextAttr textAttr = title.getTextAttr(); |
||||||
|
if (textAttr == null) { |
||||||
|
textAttr = new TextAttr(); |
||||||
|
title.setTextAttr(textAttr); |
||||||
|
} |
||||||
|
title.setPosition(Constants.LEFT); |
||||||
|
textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.BOLD, 16f, new Color(51, 51, 51))); |
||||||
|
|
||||||
|
//图例
|
||||||
|
Legend legend = new Legend(); |
||||||
|
legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(138, 140, 139))); |
||||||
|
legend.setPosition(Constants.RIGHT_TOP); |
||||||
|
chart.getPlot().setLegend(legend); |
||||||
|
|
||||||
|
//分类轴,现在只有柱形图,条形图,面积图
|
||||||
|
if (chart.getPlot() instanceof CategoryPlot) { |
||||||
|
CategoryPlot plot = (CategoryPlot) chart.getPlot(); |
||||||
|
|
||||||
|
//分类轴设置
|
||||||
|
Axis cateAxis = plot.getxAxis(); |
||||||
|
cateAxis.setAxisStyle(Constants.LINE_THICK); |
||||||
|
cateAxis.setAxisColor(new Color(204, 220, 228)); |
||||||
|
cateAxis.setTickMarkType(Constants.TICK_MARK_INSIDE); |
||||||
|
cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); |
||||||
|
cateAxis.setShowAxisLabel(true); |
||||||
|
cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(138, 140, 139))); |
||||||
|
|
||||||
|
//值轴
|
||||||
|
Axis valueAxis = plot.getyAxis(); |
||||||
|
valueAxis.setAxisStyle(Constants.NONE); |
||||||
|
valueAxis.setAxisColor(null); |
||||||
|
valueAxis.setTickMarkType(Constants.TICK_MARK_INSIDE); |
||||||
|
valueAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); |
||||||
|
valueAxis.setShowAxisLabel(true); |
||||||
|
valueAxis.getTextAttr().setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 10f, new Color(138, 140, 139))); |
||||||
|
|
||||||
|
//绘图区
|
||||||
|
plot.setBorderStyle(Constants.LINE_THIN); |
||||||
|
plot.setBorderColor(new Color(204, 220, 228)); |
||||||
|
plot.setBackground(ColorBackground.getInstance(new Color(248, 247, 245))); |
||||||
|
plot.getyAxis().setMainGridStyle(Constants.LINE_THIN); |
||||||
|
plot.getyAxis().setMainGridColor(new Color(192, 192, 192)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void setPlotFillStyle(Chart chart) { |
||||||
|
ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance(); |
||||||
|
Plot plot = chart.getPlot(); |
||||||
|
Object preStyle = null; |
||||||
|
String name = ""; |
||||||
|
if (styleList.get(STYLE_SHADE).isPressing) { |
||||||
|
name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Retro"); |
||||||
|
preStyle = manager.getPreStyle(name); |
||||||
|
} else if (styleList.get(STYLE_TRANSPARENT).isPressing) { |
||||||
|
name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Fresh"); |
||||||
|
preStyle = manager.getPreStyle(name); |
||||||
|
} else if (styleList.get(STYLE_PLANE3D).isPressing) { |
||||||
|
name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Bright"); |
||||||
|
preStyle = manager.getPreStyle(name); |
||||||
|
} else if (styleList.get(STYLE_HIGHLIGHT).isPressing) { |
||||||
|
name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Bright"); |
||||||
|
preStyle = manager.getPreStyle(name); |
||||||
|
} |
||||||
|
if (preStyle == null) { |
||||||
|
plot.getPlotFillStyle().setColorStyle(ChartConstants.COLOR_DEFAULT); |
||||||
|
} else { |
||||||
|
AttrFillStyle fillStyle = ChartUtils.chartColorMatching2AttrFillStyle((ChartColorMatching) preStyle); |
||||||
|
fillStyle.setFillStyleName(name); |
||||||
|
plot.setPlotFillStyle(fillStyle); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,69 @@ |
|||||||
|
package com.fr.design.mainframe; |
||||||
|
|
||||||
|
import com.fr.config.dao.DaoContext; |
||||||
|
import com.fr.config.dao.impl.LocalClassHelperDao; |
||||||
|
import com.fr.config.dao.impl.LocalEntityDao; |
||||||
|
import com.fr.config.dao.impl.LocalXmlEntityDao; |
||||||
|
import com.fr.form.main.Form; |
||||||
|
import com.fr.form.ui.ElementCaseEditor; |
||||||
|
import com.fr.general.ImageWithSuffix; |
||||||
|
import com.fr.general.ModuleContext; |
||||||
|
import com.fr.main.impl.WorkBook; |
||||||
|
import com.fr.report.cell.DefaultTemplateCellElement; |
||||||
|
import com.fr.report.cell.TemplateCellElement; |
||||||
|
import com.fr.report.cell.cellattr.CellImage; |
||||||
|
import com.fr.report.restriction.CellCountRestriction; |
||||||
|
import com.fr.report.restriction.ReportRestrictionScene; |
||||||
|
import com.fr.report.worksheet.FormElementCase; |
||||||
|
import com.fr.report.worksheet.WorkSheet; |
||||||
|
import com.fr.restriction.Restrictions; |
||||||
|
import com.fr.stable.module.Module; |
||||||
|
import com.fr.start.Designer; |
||||||
|
import junit.framework.TestCase; |
||||||
|
import org.junit.Assert; |
||||||
|
|
||||||
|
import java.awt.image.BufferedImage; |
||||||
|
|
||||||
|
public class JFileTest extends TestCase { |
||||||
|
@Override |
||||||
|
protected void setUp() throws Exception { |
||||||
|
DaoContext.setEntityDao(new LocalEntityDao()); |
||||||
|
DaoContext.setClassHelperDao(new LocalClassHelperDao()); |
||||||
|
DaoContext.setXmlEntityDao(new LocalXmlEntityDao()); |
||||||
|
Restrictions.register(ReportRestrictionScene.CELL_COUNT, new CellCountRestriction()); |
||||||
|
ModuleContext.startModule(Module.PAGE_MODULE); |
||||||
|
ModuleContext.startModule(Module.VIEW_MODULE); |
||||||
|
Designer designer = new Designer(new String[0]); |
||||||
|
} |
||||||
|
|
||||||
|
public void testJWorkBookSetPicture() { |
||||||
|
WorkBook workBook = new WorkBook(); |
||||||
|
WorkSheet workSheet = new WorkSheet(); |
||||||
|
workBook.addReport("sheet1", workSheet); |
||||||
|
TemplateCellElement cellElement = new DefaultTemplateCellElement(); |
||||||
|
workSheet.addCellElement(cellElement); |
||||||
|
ImageWithSuffix imageWithSuffix = ImageWithSuffix.build(new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB), "jpg"); |
||||||
|
CellImage cellImage = new CellImage(); |
||||||
|
cellImage.setImage(imageWithSuffix); |
||||||
|
JWorkBook jWorkBook = new JWorkBook(workBook, "text"); |
||||||
|
jWorkBook.setPictureElem(cellElement, cellImage); |
||||||
|
Assert.assertEquals(imageWithSuffix, cellElement.getValue()); |
||||||
|
} |
||||||
|
|
||||||
|
public void testJFormSetPicture() { |
||||||
|
Form form = new Form(); |
||||||
|
ElementCaseEditor editor = new ElementCaseEditor(); |
||||||
|
FormElementCase elementCase = new FormElementCase(); |
||||||
|
TemplateCellElement cellElement = new DefaultTemplateCellElement(); |
||||||
|
elementCase.addCellElement(cellElement); |
||||||
|
editor.setElementCase(elementCase); |
||||||
|
form.getContainer().addWidget(editor); |
||||||
|
ImageWithSuffix imageWithSuffix = ImageWithSuffix.build(new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB), "jpg"); |
||||||
|
CellImage cellImage = new CellImage(); |
||||||
|
cellImage.setImage(imageWithSuffix); |
||||||
|
JForm jForm = new JForm(); |
||||||
|
jForm.setTarget(form); |
||||||
|
jForm.setPictureElem(cellElement, cellImage); |
||||||
|
Assert.assertEquals(imageWithSuffix, cellElement.getValue()); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue