Browse Source

Merge pull request #989 in DESIGN/design from release/10.0 to feature/10.0

* commit '0506d68d934830a0ef86663e0abc03825bb2c0b8':
  REPORT-19083 设计器内删除当前模板时,未自动退回到最后一张已打开的模板
  无JIRA任务 数据收集,为了规避获取username要在启动之后,写了个中转文件
  REPORT-18422 图片控件插件问题 设计器部分漏提交
  CHART-9783 地图相关操作慢
  REPORT-18570 fr连接bi 数据分析预览单元格没有过滤设置
  限制文件大小
  REPORT-19059 环境切换同名程序数据集还是使用上一个环境的sql
  换个名字
  REPORT-18855 加下单元测试
  REPORT-19058 环境切换暂存文件为保存提示
  REPORT-18855 & REPORT-18857 jpg图片持久化遗漏了一些场景
  CHART-9576 远程设计 设计器中用实时的
  内存配置推荐:设计器安装插件随lic显示状态不对
  REPORT-18955 填报属性配置,提交条件的删除按钮没有灰色化
research/10.0
neil 6 years ago
parent
commit
284ddbe8ac
  1. 15
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  2. 2
      designer-base/src/main/java/com/fr/design/extra/PluginUtils.java
  3. 2
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  4. 3
      designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java
  5. 7
      designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java
  6. 5
      designer-base/src/main/java/com/fr/file/StashedFILE.java
  7. 102
      designer-base/src/test/java/com/fr/design/data/DesignTableDataManagerTest.java
  8. 23
      designer-base/src/test/java/com/fr/file/StashedFILETest.java
  9. 6
      designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java
  10. 2
      designer-realize/src/main/java/com/fr/design/actions/insert/flot/ImageFloatAction.java
  11. 2
      designer-realize/src/main/java/com/fr/design/headerfooter/ImagePane.java
  12. 4
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  13. 26
      designer-realize/src/main/java/com/fr/design/report/SelectImagePane.java
  14. 7
      designer-realize/src/main/java/com/fr/design/webattr/ViewToolBarPane.java
  15. 1
      designer-realize/src/main/java/com/fr/grid/Grid.java
  16. 15
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java
  17. 69
      designer-realize/src/test/java/com.fr/design/mainframe/JFileTest.java

15
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -41,7 +41,7 @@ import javax.swing.event.ChangeListener;
import java.io.ByteArrayOutputStream;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
@ -123,6 +123,7 @@ public abstract class DesignTableDataManager {
* @param dsNameChangedMap 改变名字的数据集
*/
public static void fireDSChanged(Map<String, String> dsNameChangedMap) {
clearGlobalDs();
if (!dsNameChangedMap.isEmpty()) {
setDsNameChangedMap(dsNameChangedMap);
}
@ -334,15 +335,9 @@ public abstract class DesignTableDataManager {
private static void addStoreProcedureData(java.util.Map<String, TableDataWrapper> resMap) {
ProcedureConfig procedureConfig = ProcedureConfig.getInstance();
String[] namearray = new String[0];
@SuppressWarnings("unchecked")
java.util.Iterator<String> nameIt = procedureConfig.getProcedures().keySet().iterator();
while (nameIt.hasNext()) {
namearray = (String[]) ArrayUtils.add(namearray, nameIt.next());
}
Arrays.sort(namearray, Collator.getInstance(java.util.Locale.CHINA));
for (String name : namearray) {
List<String> names = new ArrayList<>(procedureConfig.getProcedures().keySet());
Collections.sort(names, Collator.getInstance(java.util.Locale.CHINA));
for (String name : names) {
StoreProcedure storeProcedure = procedureConfig.getProcedure(name);
if (globalDsCache.containsKey(name)) {
resMap.put(name, globalDsCache.get(name));

2
designer-base/src/main/java/com/fr/design/extra/PluginUtils.java

@ -233,6 +233,8 @@ public class PluginUtils {
jo.put("onTrial", pluginContext.isOnTrial());
jo.put("deadline", getDeadline(pluginContext));
jo.put("registerFailed", pluginContext.isRegisterFailed());
jo.put("selfState", pluginContext.getSelfState());
jo.put("switchedReason", pluginContext.getSwitchedReason());
ja.put(jo);
}
}catch (Exception e){

2
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

@ -263,9 +263,9 @@ public class HistoryTemplateListCache implements CallbackEvent {
JTemplate<?, ?> template = iterator.next();
String tPath = template.getPath();
if (isDir ? tPath.startsWith(path) : tPath.equals(path)) {
int size = getHistoryCount();
iterator.remove();
int index = iterator.nextIndex();
int size = getHistoryCount();
if (size == index + 1 && index > 0) {
//如果删除的是后一个Tab,则定位到前一个
MutilTempalteTabPane.getInstance().setSelectedIndex(index - 1);

3
designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java

@ -36,6 +36,7 @@ public class TemplateInfoCollector implements XMLReadable, XMLWriter {
private static final String XML_TEMPLATE_INFO_LIST = "TemplateInfoList";
private static final String XML_FILE_NAME = "tpl.info";
private static TemplateInfoCollector instance;
private static final int MAX_SIZE = 512 * 1024 * 1024;
private Map<String, TemplateInfo> templateInfoMap;
private DesignerOpenHistory designerOpenHistory;
@ -167,7 +168,7 @@ public class TemplateInfoCollector implements XMLReadable, XMLWriter {
}
private boolean shouldCollectInfo() {
return DesignerEnvManager.getEnvManager().isJoinProductImprove() && FRContext.isChineseEnv();
return FileUtils.sizeOf(getInfoFile()) <= MAX_SIZE && DesignerEnvManager.getEnvManager().isJoinProductImprove() && FRContext.isChineseEnv();
}
/**

7
designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java

@ -279,7 +279,12 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
addSubmitConditionButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final DSColumnLiteConditionPane conditionPane = new DSColumnLiteConditionPane();
final DSColumnLiteConditionPane conditionPane = new DSColumnLiteConditionPane() {
@Override
protected boolean isNeedDoWithCondition(Condition liteCondition) {
return liteCondition != null;
}
};
String[] columns = chooseTable.currentColumnNames();
if (columns != null && columns.length > 0) {
conditionPane.populateColumns(chooseTable.currentColumnNames());

5
designer-base/src/main/java/com/fr/file/StashedFILE.java

@ -71,4 +71,9 @@ public class StashedFILE extends AbstractFILE {
public boolean isEnvFile() {
return false;
}
@Override
public String toString() {
return FILEFactory.MEM_PREFIX + getName();
}
}

102
designer-base/src/test/java/com/fr/design/data/DesignTableDataManagerTest.java

@ -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());
}
}

23
designer-base/src/test/java/com/fr/file/StashedFILETest.java

@ -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);
}
}

6
designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java

@ -6,7 +6,6 @@ import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.map.designer.type.GEOJSONTreeHelper;
import com.fr.plugin.chart.map.server.ChartGEOJSONHelper;
import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper;
import com.fr.geojson.helper.GEOJSONHelper;
import com.fr.stable.StringUtils;
import javax.swing.JTree;
@ -98,7 +97,8 @@ public class MapDataTree extends JTree {
}
String dirPath = el.getUserObject().toString();
String url = CompatibleGEOJSONHelper.getJsonUrlByPathIncludeParam(dirPath);
if (GEOJSONHelper.getInstance().isValidDirPath(dirPath) && ComparatorUtils.equals(jsonUrl, url)){
//先equals再valid原因:valid 远程下实时去服务器看有没有json文件
if (ComparatorUtils.equals(jsonUrl, url) && GEOJSONTreeHelper.isValidDirPath(dirPath)) {
selectTreeNode(el, m_model);
return el;
}
@ -151,7 +151,7 @@ public class MapDataTree extends JTree {
DefaultMutableTreeNode el = els.nextElement();
String path = el.getUserObject().toString();
String fileName = ChartGEOJSONHelper.getPresentNameWithPath(path);
if (GEOJSONHelper.getInstance().isValidDirPath(path) && StringUtils.contains(fileName, text)) {
if (StringUtils.contains(fileName, text) && GEOJSONTreeHelper.isValidDirPath(path)) {
selectTreeNode(el, m_model);
return;
}

2
designer-realize/src/main/java/com/fr/design/actions/insert/flot/ImageFloatAction.java

@ -87,7 +87,7 @@ public class ImageFloatAction extends ElementCaseAction {
if (selectedFile != null && selectedFile.isFile()) {
CellImage cellImage = selectImagePane.update();
Image image = cellImage.getImage();
Image image = cellImage.getBufferImage();
JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
currentEditingTemplate.setPictureElem(floatElement, cellImage);

2
designer-realize/src/main/java/com/fr/design/headerfooter/ImagePane.java

@ -78,7 +78,7 @@ public class ImagePane extends BasicPane {
}
public Image update() {
return this.imagePreviewPane.getImage();
return this.imagePreviewPane.getImageWithSuffix();
}
/**

4
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -68,7 +68,6 @@ import com.fr.file.FILE;
import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils;
import com.fr.general.ImageWithSuffix;
import com.fr.general.ModuleContext;
import com.fr.grid.Grid;
import com.fr.grid.GridUtils;
@ -90,7 +89,6 @@ import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.poly.PolyWorkSheet;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ArrayUtils;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.module.Module;
@ -623,7 +621,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
if (workBook instanceof WorkBookAdapter) {
elem.setValue(new CellImagePainter(cellImage));
} else {
elem.setValue(ImageWithSuffix.build(cellImage.getImage(),cellImage.getSuffix()));
elem.setValue(cellImage.getImage());
}
}

26
designer-realize/src/main/java/com/fr/design/report/SelectImagePane.java

@ -1,21 +1,18 @@
package com.fr.design.report;
import com.fr.base.BaseUtils;
import com.fr.base.Style;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.ImgChooseWrapper;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.image.ImageFileChooser;
import com.fr.design.style.background.image.ImagePreviewPane;
import com.fr.design.utils.ImageUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ImageWithSuffix;
import com.fr.report.cell.Elem;
import com.fr.report.cell.cellattr.CellImage;
import com.fr.report.cell.painter.CellImagePainter;
import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
@ -27,7 +24,6 @@ import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.File;
/**
@ -44,8 +40,6 @@ public class SelectImagePane extends BasicPane {
private Style imageStyle = null;
private Image previewImage = null;
private File imageFile;
public SelectImagePane() {
@ -119,21 +113,8 @@ public class SelectImagePane extends BasicPane {
.showOpenDialog(SelectImagePane.this);
if (returnVal != JFileChooser.CANCEL_OPTION) {
File selectedFile = imageFileChooser.getSelectedFile();
if (selectedFile != null && selectedFile.isFile()) {
String filePath = selectedFile.getPath();
BufferedImage image = BaseUtils.readImage(filePath);
CoreGraphHelper.waitForImage(image);
imageFile = selectedFile;
setImageStyle();
previewPane.setImageWithSuffix(ImageWithSuffix.build(image, ImageUtils.getImageType(selectedFile)));
previewPane.setImageStyle(imageStyle);
previewImage = image;
} else {
previewPane.setImage(null);
}
previewPane.repaint();
imageFile = selectedFile;
ImgChooseWrapper.getInstance(previewPane, imageFileChooser, imageStyle, null).dealWithImageFile(returnVal);
}
}
};
@ -202,7 +183,6 @@ public class SelectImagePane extends BasicPane {
public void setImage(Image image) {
previewPane.setImage(image);
this.previewImage = image;
}
public CellImage update() {

7
designer-realize/src/main/java/com/fr/design/webattr/ViewToolBarPane.java

@ -52,9 +52,10 @@ public class ViewToolBarPane extends AbstractEditToolBarPane {
editToolBarButton.setEnabled(isUseToolBarCheckBox.isSelected());
}
});
sortCheckBox.setSelected(true);
conditonFilterBox.setSelected(true);
listFilterBox.setSelected(true);
// 切换BI工程目录 webView未设置 默认false
sortCheckBox.setSelected(false);
conditonFilterBox.setSelected(false);
listFilterBox.setSelected(false);
northPane.add(GUICoreUtils.createFlowPane(new Component[]{sortCheckBox, conditonFilterBox, listFilterBox}, FlowLayout.LEFT, 6));
northPane.add(GUICoreUtils.createFlowPane(new Component[] {isUseToolBarCheckBox, editToolBarButton}, FlowLayout.LEFT));
northPane.add(GUICoreUtils.createFlowPane(showListenersLabel, FlowLayout.LEFT));

1
designer-realize/src/main/java/com/fr/grid/Grid.java

@ -961,7 +961,6 @@ public class Grid extends BaseGridComponent {
if (!ComparatorUtils.equals_exactly(oldValue, newValue)) {
if (newValue instanceof CellImage) {
CellImage cellImage = (CellImage) newValue;
newValue = cellImage.getImage();
JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
currentEditingTemplate.setPictureElem(selectedFloatElement, cellImage);

15
designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

@ -3,8 +3,12 @@ package com.fr.start.module;
import com.fr.base.BaseFormula;
import com.fr.base.Formula;
import com.fr.base.MultiFieldParameter;
import com.fr.base.passport.FinePassportListenerAdapter;
import com.fr.base.passport.FinePassportManager;
import com.fr.base.process.ProcessOperator;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.NewFormAction;
import com.fr.design.actions.core.ActionFactory;
@ -120,6 +124,7 @@ public class DesignerActivator extends Activator {
loadLogAppender();
DesignerSocketIO.update();
UserInfoPane.getInstance().updateBBSUserInfo();
storePassport();
}
private void loadLogAppender() {
@ -340,6 +345,16 @@ public class DesignerActivator extends Activator {
StableFactory.registerMarkedObject(ElementCaseThumbnailProcessor.MARK_STRING, new ElementCaseThumbnail());
}
private static void storePassport() {
FinePassportManager.getInstance().storePassport(MarketConfig.getInstance().getBbsUsername(), DesignerEnvManager.getEnvManager().getActivationKey());
FinePassportManager.getInstance().addPassportListener(new FinePassportListenerAdapter() {
@Override
public void onLoginSuccess() {
FinePassportManager.getInstance().storePassport(MarketConfig.getInstance().getBbsUsername(), DesignerEnvManager.getEnvManager().getActivationKey());
}
});
}
@Override
public void stop() {
unloadLogAppender();

69
designer-realize/src/test/java/com.fr/design/mainframe/JFileTest.java

@ -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…
Cancel
Save