Browse Source

Merging in latest from upstream (DESIGN/design:refs/heads/refactor/19.4.3)

* 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
Bjorn 6 years ago
parent
commit
9dce29f1f2
  1. 6
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 18
      designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java
  3. 15
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  4. 2
      designer-base/src/main/java/com/fr/design/extra/PluginUtils.java
  5. 31
      designer-base/src/main/java/com/fr/design/locale/impl/ProductImproveMark.java
  6. 35
      designer-base/src/main/java/com/fr/design/locale/impl/SplashMark.java
  7. 44
      designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java
  8. 36
      designer-base/src/main/java/com/fr/design/locale/impl/UserInfoMark.java
  9. 35
      designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java
  10. 3
      designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java
  11. 27
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  12. 7
      designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java
  13. 5
      designer-base/src/main/java/com/fr/file/StashedFILE.java
  14. 102
      designer-base/src/test/java/com/fr/design/data/DesignTableDataManagerTest.java
  15. 23
      designer-base/src/test/java/com/fr/file/StashedFILETest.java
  16. 16
      designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java
  17. 14
      designer-chart/src/main/java/com/fr/design/chart/ChartCommonWizardPane.java
  18. 86
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  19. 10
      designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java
  20. 5
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/ChartComponentAction.java
  21. 3
      designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java
  22. 43
      designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java
  23. 65
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartDesignerOtherPane.java
  24. 68
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  25. 69
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java
  26. 33
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/StylePane4Chart.java
  27. 6
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractBarPane.java
  28. 394
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java
  29. 409
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractDeprecatedChartTypePane.java
  30. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AreaPlotPane.java
  31. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/BubblePlotPane.java
  32. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/CustomPlotPane.java
  33. 8
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/DonutPlotPane.java
  34. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/FunnelPlotPane.java
  35. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GanttPlotPane.java
  36. 6
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GisMapPlotPane.java
  37. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/LinePlotPane.java
  38. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java
  39. 6
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MeterPlotPane.java
  40. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/PiePlotPane.java
  41. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RadarPlotPane.java
  42. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RangePlotPane.java
  43. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/StockPlotPane.java
  44. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/UserDefinedChartTypePane.java
  45. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/XYScatterPlotPane.java
  46. 7
      designer-chart/src/main/java/com/fr/extended/chart/ExtendedTypePane.java
  47. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java
  48. 6
      designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java
  49. 2
      designer-realize/src/main/java/com/fr/design/actions/insert/flot/ImageFloatAction.java
  50. 2
      designer-realize/src/main/java/com/fr/design/headerfooter/ImagePane.java
  51. 4
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  52. 7
      designer-realize/src/main/java/com/fr/design/webattr/ViewToolBarPane.java
  53. 1
      designer-realize/src/main/java/com/fr/grid/Grid.java
  54. 4
      designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java
  55. 22
      designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java
  56. 14
      designer-realize/src/main/java/com/fr/start/SplashContext.java
  57. 69
      designer-realize/src/test/java/com.fr/design/mainframe/JFileTest.java

6
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -14,6 +14,7 @@ import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.env.LocalDesignerWorkspaceInfo;
import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.locale.impl.ProductImproveMark;
import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.update.push.DesignerPushUpdateConfigManager;
import com.fr.design.style.color.ColorSelectConfigManager;
@ -23,6 +24,8 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogFormatter;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import com.fr.general.xml.GeneralXMLTools;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.CommonUtils;
@ -688,7 +691,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
* @return 是否加入产品改良
*/
public boolean isJoinProductImprove() {
return joinProductImprove;
LocaleMark<Boolean> localeMark = LocaleCenter.getMark(ProductImproveMark.class);
return localeMark.getValue() && this.joinProductImprove;
}
/**

18
designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java

@ -1,16 +1,16 @@
package com.fr.design.actions.community;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.locale.impl.VideoMark;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.util.Locale;
public class VideoAction extends UpdateAction
{
@ -27,14 +27,8 @@ public class VideoAction extends UpdateAction
@Override
public void actionPerformed(ActionEvent arg0)
{
String url;
if (GeneralContext.getLocale().equals(Locale.US)) {
url = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en");
} else {
url = CloudCenter.getInstance().acquireUrlByKind("bbs.video");
}
BrowseUtils.browser(url);
LocaleMark<String> localeMark = LocaleCenter.getMark(VideoMark.class);
BrowseUtils.browser(localeMark.getValue());
}
public static final MenuKeySet VIDEO = new MenuKeySet() {
@Override

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){

31
designer-base/src/main/java/com/fr/design/locale/impl/ProductImproveMark.java

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

35
designer-base/src/main/java/com/fr/design/locale/impl/SplashMark.java

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

44
designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java

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

36
designer-base/src/main/java/com/fr/design/locale/impl/UserInfoMark.java

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

35
designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java

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

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

27
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -58,6 +58,9 @@ import com.fr.design.remote.action.RemoteDesignAuthManagerAction;
import com.fr.design.utils.ThemeUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.locale.LocaleAction;
import com.fr.general.locale.LocaleCenter;
import com.fr.design.locale.impl.SupportLocaleImpl;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime;
@ -240,7 +243,7 @@ public abstract class ToolBarMenuDock {
public MenuDef[] menus(final ToolBarMenuDockPlus plus) {
//删除之前创建的插件菜单监听
clearPluginListeners();
java.util.List<MenuDef> menuList = new java.util.ArrayList<MenuDef>();
final java.util.List<MenuDef> menuList = new java.util.ArrayList<MenuDef>();
// 添加文件菜单
menuList.add(createFileMenuDef(plus));
@ -258,10 +261,13 @@ public abstract class ToolBarMenuDock {
// 添加帮助菜单
menuList.add(createHelpMenuDef());
if (GeneralContext.getLocale().equals(Locale.CHINA) || GeneralContext.getLocale().equals(Locale.TAIWAN)) {
// 添加社区菜单
addCommunityMenuDef(menuList);
}
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
addCommunityMenuDef(menuList);
}
}, SupportLocaleImpl.COMMUNITY);
// 添加全部UpdateAction到actionmanager中
addAllUpdateActionsToList(menuList);
@ -532,7 +538,7 @@ public abstract class ToolBarMenuDock {
* @return 社区菜单的子菜单
*/
public ShortCut[] createCommunityShortCuts() {
java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>();
final java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>();
shortCuts.add(new BBSAction());
shortCuts.add(new VideoAction());
shortCuts.add(new TutorialAction());
@ -543,9 +549,12 @@ public abstract class ToolBarMenuDock {
shortCuts.add(new CusDemandAction());
shortCuts.add(new CenterAction());
shortCuts.add(new SignAction());
if (Locale.TAIWAN.equals(GeneralContext.getLocale())) {
shortCuts.add(new FacebookFansAction());
}
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new FacebookFansAction());
}
}, SupportLocaleImpl.FACEBOOK);
return shortCuts.toArray(new ShortCut[shortCuts.size()]);
}

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

16
designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java

@ -2,7 +2,6 @@ package com.fr.design;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.base.ChartInternationalNameContentBean;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider;
@ -161,7 +160,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
ChartWidgetOption[] child = new ChartWidgetOption[typeName.length];
int index = 0;
for (ChartInternationalNameContentBean bean : typeName) {
String plotID = bean.getPlotID();
String plotID = bean.getChartID();
ChartProvider[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID);
if (ArrayUtils.isEmpty(rowChart) && !ChartTypeManager.innerChart(plotID)) {
continue;
@ -254,7 +253,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
*
* @param paneList pane容器
*/
public void addPlotTypePaneList(List<FurtherBasicBeanPane<? extends Chart>> paneList, Map<String, Map<String, FurtherBasicBeanPane<? extends Chart>>> allChartTypePane) {
public void addPlotTypePaneList(List<FurtherBasicBeanPane<? extends ChartProvider>> paneList, Map<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>> allChartTypePane) {
List<Integer> priorityList = getPriorityInOrder();
for (Integer aPriorityList : priorityList) {
@ -264,7 +263,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
}
public void addPlotTypePaneList(String priority, List<FurtherBasicBeanPane<? extends Chart>> paneList, Map<String, Map<String, FurtherBasicBeanPane<? extends Chart>>> allChartTypePane) {
public void addPlotTypePaneList(String priority, List<FurtherBasicBeanPane<? extends ChartProvider>> paneList, Map<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>> allChartTypePane) {
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority)) {
@ -283,7 +282,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
paneList.add(pane);
if (allChartTypePane.get(priority) == null) {
allChartTypePane.put(priority, new LinkedHashMap<String, FurtherBasicBeanPane<? extends Chart>>());
allChartTypePane.put(priority, new LinkedHashMap<String, FurtherBasicBeanPane<? extends ChartProvider>>());
}
allChartTypePane.get(priority).put(plotID, pane);
}
@ -450,9 +449,10 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
return true;
}
public boolean needChartChangePane(Chart chart) {
if (chart != null && chart.getPlot() != null) {
IndependentChartUIProvider provider = getChartTypeInterface(chart.getPlot().getPlotID());
public boolean needChartChangePane(ChartProvider chart) {
if (chart != null) {
String chartID = chart.getID();
IndependentChartUIProvider provider = getChartTypeInterface(chartID);
if (provider != null) {
return provider.needChartChangePane();
}

14
designer-chart/src/main/java/com/fr/design/chart/ChartCommonWizardPane.java

@ -1,7 +1,7 @@
package com.fr.design.chart;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chartx.attr.ChartProvider;
public abstract class ChartCommonWizardPane extends ChartWizardPane {
private static final long serialVersionUID = 2467967841657570498L;
@ -11,12 +11,12 @@ public abstract class ChartCommonWizardPane extends ChartWizardPane {
if (cc == null) {
return;
}
populate(cc.getSelectedChart());
populate(cc.getSelectedChartProvider());
}
public abstract void populate(Chart chart);
public abstract void update(Chart oldChart);
public abstract void populate(ChartProvider chart);
public abstract void update(ChartProvider oldChart);
}

86
designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java

@ -5,18 +5,13 @@ package com.fr.design.chart;
*/
import com.fr.chart.base.ChartInternationalNameContentBean;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.ChartIcon;
import com.fr.chart.chartattr.MapPlot;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.license.exception.RegistEditionException;
import com.fr.license.function.VT4FR;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory;
@ -24,7 +19,6 @@ import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.ListCellRenderer;
@ -37,22 +31,22 @@ public class ChartTypePane extends ChartCommonWizardPane {
private static final long serialVersionUID = -1175602484968520546L;
private ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstanceWithCheck().getAllChartBaseNames();
//todo@shinerefactor 这个页面所有强转Chart的地方都要处理一下
private Chart[][] charts4Icon = null;
private ChartProvider[][] charts4Icon = null;
{
charts4Icon = new Chart[this.typeName.length][];
charts4Icon = new ChartProvider[this.typeName.length][];
for (int i = 0; i < this.typeName.length; i++) {
ChartProvider[] rowCharts = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.typeName[i].getPlotID());
ChartProvider[] rowCharts = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.typeName[i].getChartID());
int rowChartsCount = rowCharts.length;
charts4Icon[i] = new Chart[rowChartsCount];
charts4Icon[i] = new ChartProvider[rowChartsCount];
for (int j = 0; j < rowChartsCount; j++) {
try {
charts4Icon[i][j] = (Chart) rowCharts[j].clone();
charts4Icon[i][j].setTitle(null);
if(charts4Icon[i][j].getPlot() != null){
charts4Icon[i][j].getPlot().setLegend(null);
}
charts4Icon[i][j] = (ChartProvider) rowCharts[j].clone();
//todo@shinerefactor 老图表也是提供一张图片 这边就不用setTitle(null) 然后实时去画
// charts4Icon[i][j].setTitle(null);
// if(charts4Icon[i][j].getPlot() != null){
// charts4Icon[i][j].getPlot().setLegend(null);
// }
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
@ -123,7 +117,7 @@ public class ChartTypePane extends ChartCommonWizardPane {
protected ListSelectionListener listSelectionListener = new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
int main_index = mainTypeList.getSelectedIndex();
Chart[] sub_charts = ChartTypePane.this.charts4Icon[main_index];
ChartProvider[] sub_charts = ChartTypePane.this.charts4Icon[main_index];
ChartTypePane.this.iconListModel.clear();
for (int i = 0; i < sub_charts.length; i++) {
ChartTypePane.this.iconListModel.addElement(new ChartIcon(sub_charts[i]));
@ -133,56 +127,14 @@ public class ChartTypePane extends ChartCommonWizardPane {
};
public String getChartName(ChartIcon chartIcon) {
Chart chart = (Chart)chartIcon.getChart();
return chart.getChartName();
ChartProvider chart = chartIcon.getChart();
return ChartTypeManager.getInstanceWithCheck().getChartName(chart.getID());
}
public void populate(Chart chart) {
if (chart == null) {
return;
}
Plot plot = chart.getPlot();
int mainIndex = 0;
int subIndex = 0;
for (int i = 0; i < typeName.length; i++) {
ChartProvider[] charts = ChartTypeManager.getInstanceWithCheck().getChartTypes(typeName[i].getPlotID());
for (int j = 0; j < charts.length; j++) {
if (((Chart) charts[j]).getPlot().match4GUI(plot)) {
mainIndex = i;
subIndex = j;
// 一旦匹配 立马中断
break;
}
}
}
mainTypeList.setSelectedIndex(mainIndex);
iconViewList.setSelectedIndex(subIndex);
}
public void update(Chart oldChart) {
String plotID = typeName[mainTypeList.getSelectedIndex()].getPlotID();
Chart chart = (Chart) ChartTypeManager.getInstanceWithCheck().getChartTypes(plotID)[iconViewList.getSelectedIndex()];
if(chart.getPlot() != null){
if(chart.getPlot() instanceof MapPlot && !supportMap()){
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Not_Supported"));
throw new RegistEditionException(VT4FR.ChartMap);
}
if (chart.getPlot() != null) {
try {
oldChart.changePlotInNewType((Plot) chart.getPlot().clone());
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
public void populate(ChartProvider chart) {
}
private boolean supportMap() {
return VT4FR.ChartMap.isSupport();
public void update(ChartProvider oldChart) {
}
public void update(ChartCollection cc) {
@ -190,12 +142,12 @@ public class ChartTypePane extends ChartCommonWizardPane {
return;
}
Chart chart4Update = cc.getSelectedChart();
ChartProvider chart4Update = cc.getSelectedChartProvider();
if (chart4Update == null) {
String plotID = typeName[mainTypeList.getSelectedIndex()].getPlotID();
Chart chart = (Chart) ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()];
String plotID = typeName[mainTypeList.getSelectedIndex()].getChartID();
ChartProvider chart = ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()];
try{
chart4Update = (Chart)chart.clone();
chart4Update = (ChartProvider) chart.clone();
cc.addChart(chart4Update);
}catch (CloneNotSupportedException ex){
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);

10
designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java

@ -1,7 +1,6 @@
package com.fr.design.chart.gui;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider;
import com.fr.base.chart.BaseChartGetter;
import com.fr.design.gui.core.WidgetOption;
import com.fr.form.ui.ChartEditor;
import com.fr.form.ui.Widget;
@ -38,14 +37,11 @@ public class ChartWidgetOption extends WidgetOption {
Class<? extends ChartEditor> clz = widgetClass();
try {
ChartEditor widget = clz.newInstance();
ChartProvider chart = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.chartID)[0];
widget.addChart((ChartProvider) chart.clone());
widget.setChartCollection(BaseChartGetter.createChartCollection(this.chartID));
return widget;
} catch (InstantiationException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (IllegalAccessException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}

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

@ -1,6 +1,5 @@
package com.fr.design.chart.gui.active.action;
import com.fr.chart.chartattr.Axis;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartglyph.AxisGlyph;
import com.fr.design.actions.UpdateAction;
@ -32,10 +31,6 @@ public abstract class ChartComponentAction extends UpdateAction {
return chartComponent.getChartCollection();
}
public Axis getActiveAxis() {
return chartComponent.getActiveAxis();
}
public AxisGlyph getActiveAxisGlyph() {
return chartComponent.getActiveAxisGlyph();
}

3
designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java

@ -1,6 +1,5 @@
package com.fr.design.chart.series.SeriesCondition.impl;
import com.fr.base.chart.BaseChartCollection;
import com.fr.chart.chartattr.Bar2DPlot;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
@ -92,7 +91,7 @@ public class ChartHyperPoplinkPane extends AbstractHyperLinkPane<ChartHyperPopli
this.itemNameTextField.setText(chartHyperlink.getItemName());
}
BaseChartCollection cc = chartHyperlink.getChartCollection();
ChartCollection cc = (ChartCollection) chartHyperlink.getChartCollection();
if (cc == null || cc.getChartCount() < 1) {
cc = createChartCollection();
chartHyperlink.setChartCollection(cc);

43
designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java

@ -1,8 +1,8 @@
package com.fr.design.mainframe.chart;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.data.DesignTableDataManager;
@ -20,6 +20,7 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.ChartTypePane;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.vanchart.VanChart;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
@ -109,12 +110,14 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
if (!ComparatorUtils.equals(collection, lastCollection)) {
//此处画图
Chart chart = collection.getSelectedChart();
chart.demoImgEvent(true);
VanChart vanChart = collection.getSelectedChart(VanChart.class);
if (vanChart != null) {
//此处画图
vanChart.demoImgEvent(true);
}
try {
lastCollection = (ChartCollection) collection.clone();
lastCollection = collection.clone();
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("error in clone ChartEditPane");
}
@ -131,7 +134,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
* 重新构造面板
* @param currentChart 图表
*/
public void reLayout(Chart currentChart){
public void reLayout(ChartProvider currentChart) {
if(currentChart != null){
int chartIndex = getSelectedChartIndex(currentChart);
this.removeAll();
@ -139,12 +142,8 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
paneList = new ArrayList<AbstractChartAttrPane>();
addTypePane();
boolean isDefault = true;
String plotID = "";
if(currentChart.getPlot() != null){
plotID = currentChart.getPlot().getPlotID();
isDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID);
}
String chartID = currentChart.getID();
boolean isDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(chartID);
if(isDefault){
paneList.add(dataPane4SupportCell);
@ -152,11 +151,11 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
paneList.add(otherPane);
this.isDefaultPane = true;
}else{
ChartDataPane chartDataPane = createChartDataPane(plotID);
ChartDataPane chartDataPane = createChartDataPane(chartID);
if (chartDataPane != null) {
paneList.add(chartDataPane);
}
AbstractChartAttrPane[] otherPaneList = ChartTypeInterfaceManager.getInstance().getAttrPaneArray(plotID, listener);
AbstractChartAttrPane[] otherPaneList = ChartTypeInterfaceManager.getInstance().getAttrPaneArray(chartID, listener);
for(int i = 0; i < otherPaneList.length; i++){
otherPaneList[i].addAttributeChangeListener(listener);
paneList.add(otherPaneList[i]);
@ -226,8 +225,8 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
return;
}
if(checkNeedsReLayout(collection.getSelectedChart())){
reLayout(collection.getSelectedChart());
if (checkNeedsReLayout(collection.getSelectedChartProvider())) {
reLayout(collection.getSelectedChartProvider());
}
this.collection = collection;
@ -253,7 +252,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
}
}
public int getSelectedChartIndex(Chart chart){
public int getSelectedChartIndex(ChartProvider chart) {
int index = 0;
if(typePane != null){
FurtherBasicBeanPane[] paneList = typePane.getPaneList();
@ -267,15 +266,13 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
}
//populate的时候看看要不要重构面板
private boolean checkNeedsReLayout(Chart chart){
private boolean checkNeedsReLayout(ChartProvider chart) {
if(chart != null){
int lastIndex = typePane.getSelectedIndex();
int currentIndex = getSelectedChartIndex(chart);
boolean currentPane = true;
if(chart.getPlot() != null){
String plotID = chart.getPlot().getPlotID();
currentPane = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID);
}
String chartID = chart.getID();
boolean currentPane = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(chartID);
return (currentPane != isDefaultPane) || (!currentPane && lastIndex != currentIndex);
}
return false;

65
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartDesignerOtherPane.java

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

68
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java

@ -19,6 +19,7 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
@ -42,6 +43,8 @@ import java.awt.event.MouseListener;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
/**
* 图表 类型 增删 控制按钮界面.
@ -56,6 +59,12 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
private static final int P_W = 300;
private static final int P_H = 400;
private static Set<Class<? extends ChartProvider>> supportChangeConfigChartClassSet = new HashSet<Class<? extends ChartProvider>>();
static {
registerSupportChangeConfigChartClass(VanChart.class);
}
private UIButton addButton;
private UIButton configButton;
private ArrayList<ChartChangeButton> indexList = new ArrayList<ChartChangeButton>();
@ -109,6 +118,10 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
// Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK);
}
public static void registerSupportChangeConfigChartClass(Class<? extends ChartProvider> cls) {
supportChangeConfigChartClassSet.add(cls);
}
private void initConfigCreator() {
configCreator = new UIMenuNameableCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Change_Config_Attributes"), new AttrChangeConfig(), ChangeConfigPane.class);
}
@ -135,7 +148,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
if (editingCollection != null) {
//点击添加按钮,则会触发切换状态
ChartProvider chart = editingCollection.getChangeStateNewChart();
ChartProvider chart = getChangeStateNewChart();
try {
ChartProvider newChart = (ChartProvider) chart.clone();
editingCollection.addNamedChart(name, newChart);
@ -150,12 +163,51 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
//获取图表收集器的状态
private void checkoutChange(){
editingCollection.calculateMultiChartMode();
calculateMultiChartMode();
if (parent != null){
parent.relayoutChartTypePane(editingCollection);
}
//检查是否可以配置切换
configButton.setEnabled(editingCollection.changeEnable());
configButton.setEnabled(changeEnable());
}
/**
* 获取切花状态下的图表
*
* @return
*/
public ChartProvider getChangeStateNewChart() {
ChartProvider chart = editingCollection.getSelectedChartProvider();
String priority = ChartTypeManager.VAN_CHART_PRIORITY;
//todo@shinerefactor
// chart.getPriority();
return ChartTypeManager.getInstanceWithCheck().getFirstChart(priority);
}
//图表收集器模式状态改变
private void calculateMultiChartMode() {
//设置切换功能是否可用
editingCollection.getChangeConfigAttr().setEnable(changeEnable());
//多图表切换模式
if (editingCollection.getChartCount() > 1) {
editingCollection.setState(SwitchState.CHANGE);
} else {
editingCollection.setState(SwitchState.DEFAULT);
}
}
/**
* 是否支持图表切换的配置
*
* @return
*/
private boolean changeEnable() {
return editingCollection.getChartCount() > 1
&& supportChange();
}
private boolean supportChange() {
return supportChangeConfigChartClassSet.contains(editingCollection.getSelectedChartProvider().getClass());
}
ActionListener configListener = new ActionListener() {
@ -310,11 +362,11 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
}
private void checkConfigButtonVisible() {
addButton.setVisible(ChartTypeManager.enabledChart(editingCollection.getSelectedChart().getPlot().getPlotID()));
addButton.setVisible(ChartTypeManager.enabledChart(editingCollection.getSelectedChartProvider().getID()));
//新建一个collection
if(editingCollection.getState() == SwitchState.DEFAULT && editingCollection.getSelectedChart() != null){
if (editingCollection.getState() == SwitchState.DEFAULT && editingCollection.getSelectedChartProvider() != null) {
//Chart 不支持图表切换
configButton.setVisible(editingCollection.getSelectedChart().supportChange());
configButton.setVisible(supportChange());
}
}
@ -440,7 +492,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
private void deleteAButton() {
//先重构属性,在重构面板,否则面板在重构过程中,会重新将属性中的切换图表加到indexList中,导致面板无法删除
//记录改变前的plotID
String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChart().getPlot().getPlotID();
String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChartProvider().getID();
if (editingCollection != null) {
int count = editingCollection.getChartCount();
for (int i = 0; i < count; i++) {
@ -520,7 +572,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
if (isEnabled()) {
noSelected();
//记录改变前的plotID
String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChart().getPlot().getPlotID();
String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChartProvider().getID();
changeCollectionSelected(getButtonName());
setSelectedWithFireListener(true);
fireSelectedChanged();

69
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java

@ -2,9 +2,9 @@ package com.fr.design.mainframe.chart.gui;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartattr.SwitchState;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.dialog.BasicScrollPane;
@ -98,14 +98,14 @@ public class ChartTypePane extends AbstractChartAttrPane{
public String title4PopupWindow() {
return PaneTitleConstants.CHART_TYPE_TITLE;
}
class ComboBoxPane extends UIComboBoxPane<Chart>{
private Map<String, Map<String, FurtherBasicBeanPane<? extends Chart>>> allChartTypePane;
class ComboBoxPane extends UIComboBoxPane<ChartProvider> {
private Map<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>> allChartTypePane;
@Override
protected List<FurtherBasicBeanPane<? extends Chart>> initPaneList() {
List<FurtherBasicBeanPane<? extends Chart>> paneList = new ArrayList<FurtherBasicBeanPane<? extends Chart>>();
allChartTypePane = new LinkedHashMap<String, Map<String, FurtherBasicBeanPane<? extends Chart>>>();
protected List<FurtherBasicBeanPane<? extends ChartProvider>> initPaneList() {
List<FurtherBasicBeanPane<? extends ChartProvider>> paneList = new ArrayList<FurtherBasicBeanPane<? extends ChartProvider>>();
allChartTypePane = new LinkedHashMap<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>>();
ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(paneList, allChartTypePane);
return paneList;
}
@ -121,13 +121,12 @@ public class ChartTypePane extends AbstractChartAttrPane{
* 如果是切换图表的不同图表之间切换则collection的选择下标会改变
* @param chart
*/
public void updateBean(Chart chart) {
public void updateBean(ChartProvider chart) {
Plot oldPlot = chart.getPlot();
String lastPlotID = oldPlot == null ? StringUtils.EMPTY : oldPlot.getPlotID();
String lastPlotID = chart.getID();
try{
Chart newDefaultChart = (Chart)((AbstractChartTypePane)getSelectedPane()).getDefaultChart().clone();
ChartProvider newDefaultChart = (ChartProvider) ((AbstractChartTypePane) getSelectedPane()).getDefaultChart().clone();
if (!ComparatorUtils.equals(chart.getClass(), newDefaultChart.getClass())) {
//vanChart 和 chart 之间切换
//不同chart之间切换
@ -142,20 +141,20 @@ public class ChartTypePane extends AbstractChartAttrPane{
//这一步会替换plot
((AbstractChartTypePane)getSelectedPane()).updateBean(chart);
Plot plot = chart.getPlot();
if(plot != null){
String plotID = plot.getPlotID();
String chartID = chart.getID();
//plot改变的话图表类型就算改变了
//chartID改变的话图表类型就算改变了
if (StringUtils.isNotEmpty(chartID)) {
chart.setWrapperName(ChartTypeManager.getInstanceWithCheck().getWrapperName(plotID));
chart.setChartImagePath(ChartTypeManager.getInstanceWithCheck().getChartImagePath(plotID));
if (chart instanceof Chart) {
//todo@shinerefactor: 这边看下是否可以删除
((Chart) chart).setWrapperName(ChartTypeManager.getInstanceWithCheck().getWrapperName(chartID));
((Chart) chart).setChartImagePath(ChartTypeManager.getInstanceWithCheck().getChartImagePath(chartID));
}
boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID);
boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(chartID);
if(editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))){
if (editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, chartID))) {
editPane.reLayout(chart);
}
}
@ -195,12 +194,12 @@ public class ChartTypePane extends AbstractChartAttrPane{
private void addOnePriorityCards(String priority, boolean ignore) {
Map<String, FurtherBasicBeanPane<? extends Chart>> map = allChartTypePane.get(priority);
Map<String, FurtherBasicBeanPane<? extends ChartProvider>> map = allChartTypePane.get(priority);
Iterator<Map.Entry<String, FurtherBasicBeanPane<? extends Chart>>> iterator = map.entrySet().iterator();
Iterator<Map.Entry<String, FurtherBasicBeanPane<? extends ChartProvider>>> iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, FurtherBasicBeanPane<? extends Chart>> entry = iterator.next();
Map.Entry<String, FurtherBasicBeanPane<? extends ChartProvider>> entry = iterator.next();
String plotID = entry.getKey();
if (ignore || ChartTypeManager.enabledChart(plotID)) {
cards.add(entry.getValue());
@ -217,9 +216,11 @@ public class ChartTypePane extends AbstractChartAttrPane{
//处理办法:这边除了重构 下拉项选项和cardNames 还需要把cards重构下(不需要init pane,只需要我需要的拿出来就好了)
private void relayout(ChartCollection collection){
//重构需要重构下拉框选项和cardNames
Chart chart = collection.getSelectedChart();
String priority = chart.getPriority();
String plotID = chart.getPlot().getPlotID();
ChartProvider chart = collection.getSelectedChartProvider();
String priority = ChartTypeManager.VAN_CHART_PRIORITY;
//TODO@shinerefactor
// chart.getPriority();
String plotID = chart.getID();
boolean enabledChart = ChartTypeManager.enabledChart(plotID);
String item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(priority, plotID);
@ -262,7 +263,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
}
@Override
public void populateBean(Chart ob) {
public void populateBean(ChartProvider ob) {
for (int i = 0; i < this.cards.size(); i++) {
FurtherBasicBeanPane pane = cards.get(i);
if (pane.accept(ob)) {
@ -279,12 +280,12 @@ public class ChartTypePane extends AbstractChartAttrPane{
}
@Override
public Chart updateBean() {
public ChartProvider updateBean() {
return getSelectedPane().updateBean();
}
@Override
public FurtherBasicBeanPane<? extends Chart> getSelectedPane(){
public FurtherBasicBeanPane<? extends ChartProvider> getSelectedPane() {
Object item = jcb.getSelectedItem();
for (int i = 0; i < cards.size(); i++){
if (ComparatorUtils.equals(item, cards.get(i).title4PopupWindow())){
@ -303,8 +304,8 @@ public class ChartTypePane extends AbstractChartAttrPane{
* @param collection
*/
public void reLayoutEditPane(String lastPlotID, ChartCollection collection){
Chart chart = collection.getSelectedChart();
String plotID = chart.getPlot().getPlotID();
ChartProvider chart = collection.getSelectedChartProvider();
String plotID = chart.getID();
boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID);
if (editPane != null && editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))){
editPane.reLayout(chart);
@ -322,7 +323,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
public void populate(ChartCollection collection) {
editingCollection = collection;
Chart chart = collection.getSelectedChart();
ChartProvider chart = collection.getSelectedChartProvider();
this.remove(leftContentPane);
initContentPane();
@ -340,7 +341,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
public void update(ChartCollection collection) {
editingCollection = collection;
buttonPane.update(collection);// 内部操作时 已经做过处理.
Chart chart = collection.getSelectedChart();
ChartProvider chart = collection.getSelectedChartProvider();
chartTypeComBox.updateBean(chart);
}

33
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/StylePane4Chart.java

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

6
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractBarPane.java

@ -9,9 +9,9 @@ import com.fr.chart.chartattr.Chart;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-25 下午04:55:05
*/
public abstract class AbstractBarPane extends AbstractChartTypePane {
protected static final int COLOMN_CHART = 0;
public abstract class AbstractBarPane extends AbstractDeprecatedChartTypePane {
protected static final int COLOMN_CHART = 0;
protected static final int STACK_COLOMN_CHART = 1;
protected static final int PERCENT_STACK_COLOMN_CHART = 2;
protected static final int THREE_D_COLOMN_CHART = 3;

394
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java

@ -1,21 +1,9 @@
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.chart.charttypes.BarIndependentChart;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.beans.FurtherBasicBeanPane;
@ -25,9 +13,6 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
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 javax.swing.JPanel;
@ -35,12 +20,11 @@ import javax.swing.JSeparator;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.util.ArrayList;
import java.util.List;
public abstract class AbstractChartTypePane extends FurtherBasicBeanPane<Chart>{
public abstract class AbstractChartTypePane<T extends ChartProvider> extends FurtherBasicBeanPane<T> {
private static final int ONE_LINE_NUM = 4;
@ -163,50 +147,6 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane<Chart>{
}
}
}
/**
* 更新界面属性
*/
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();
}
}
protected void checkDemosBackground() {
if(this.styleList != null && !styleList.isEmpty()){
@ -222,119 +162,10 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane<Chart>{
}
}
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);
}
}
/**
* 保存风格,对选中的风格做设置
*/
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;
}
/**
* 更新整个新的Chart类型
*/
public Chart updateBean() {
public T updateBean() {
return null;
}
@ -346,14 +177,6 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane<Chart>{
chart.setBackground(null);
}
protected void changePlotWithClone(Chart chart, Plot plot) {
try {
chart.switchPlot((Plot)plot.clone());
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error in change plot");
}
}
/**
* 重置
*/
@ -394,219 +217,6 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane<Chart>{
return false;
}
//高光渐变的默认属性设置
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));
}
}
}
//平面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));
}
}
}
protected boolean needsResetChart(Chart chart){
return chart != null
&&chart.getPlot() != null

409
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractDeprecatedChartTypePane.java

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

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AreaPlotPane.java

@ -17,7 +17,7 @@ import com.fr.locale.InterProviderFactory;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-25 下午06:57:36
*/
public class AreaPlotPane extends AbstractChartTypePane{
public class AreaPlotPane extends AbstractDeprecatedChartTypePane {
private static final int STACK_AREA_CHART = 0;
private static final int PERCENT_AREA_LINE_CHART = 1;

4
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/BubblePlotPane.java

@ -13,8 +13,8 @@ import com.fr.locale.InterProviderFactory;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-25 下午06:56:47
*/
public class BubblePlotPane extends AbstractChartTypePane {
private static final long serialVersionUID = -601566194238908115L;
public class BubblePlotPane extends AbstractDeprecatedChartTypePane {
private static final long serialVersionUID = -601566194238908115L;
private static final int BUBBLE_CHART = 0;

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/CustomPlotPane.java

@ -11,7 +11,7 @@ import com.fr.locale.InterProviderFactory;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-21 下午06:17:40
*/
public class CustomPlotPane extends AbstractChartTypePane {
public class CustomPlotPane extends AbstractDeprecatedChartTypePane {
@Override
protected String getPlotTypeID() {

8
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/DonutPlotPane.java

@ -22,10 +22,10 @@ import java.text.DecimalFormat;
* @author eason
*
*/
public class DonutPlotPane extends AbstractChartTypePane{
private static final long serialVersionUID = -7084314809934346710L;
private static final int DONUT_CHART = 0; //2d圆环图
private static final int THREE_D_DONUT_CHART = 1; //3D圆环图
public class DonutPlotPane extends AbstractDeprecatedChartTypePane {
private static final long serialVersionUID = -7084314809934346710L;
private static final int DONUT_CHART = 0; //2d圆环图
private static final int THREE_D_DONUT_CHART = 1; //3D圆环图
@Override
protected String[] getTypeIconPath() {

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/FunnelPlotPane.java

@ -18,7 +18,7 @@ import java.text.DecimalFormat;
* Time: 下午2:50
* To change this template use File | Settings | File Templates.
*/
public class FunnelPlotPane extends AbstractChartTypePane{
public class FunnelPlotPane extends AbstractDeprecatedChartTypePane {
private static final int FUNNEL_CHART = 0;

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GanttPlotPane.java

@ -11,7 +11,7 @@ import com.fr.locale.InterProviderFactory;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-26 上午10:38:18
*/
public class GanttPlotPane extends AbstractChartTypePane{
public class GanttPlotPane extends AbstractDeprecatedChartTypePane {
private static final long serialVersionUID = -601566194238908115L;
private static final int GANTT = 0;

6
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GisMapPlotPane.java

@ -19,10 +19,10 @@ import java.awt.BorderLayout;
import java.awt.Component;
public class GisMapPlotPane extends AbstractChartTypePane{
public class GisMapPlotPane extends AbstractDeprecatedChartTypePane {
private static final long serialVersionUID = 2595221900000305396L;
private static final int GISMAP = 0;
private UITextField keyInput;

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/LinePlotPane.java

@ -9,7 +9,7 @@ import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory;
public class LinePlotPane extends AbstractChartTypePane{
public class LinePlotPane extends AbstractDeprecatedChartTypePane {
private static final int LINE_CHART = 0;

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java

@ -16,7 +16,7 @@ import com.fr.log.FineLoggerFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
public class MapPlotPane extends AbstractChartTypePane {
public class MapPlotPane extends AbstractDeprecatedChartTypePane {
private boolean isSvgMap = true; // 默认是svg地图

6
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MeterPlotPane.java

@ -16,9 +16,9 @@ import com.fr.log.FineLoggerFactory;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-26 上午10:48:57
*/
public class MeterPlotPane extends AbstractChartTypePane {
private static final int METER = 0;
public class MeterPlotPane extends AbstractDeprecatedChartTypePane {
private static final int METER = 0;
private static final int BLUE_METER =1;
private static final int SIMPLE_METER = 2;

4
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/PiePlotPane.java

@ -21,8 +21,8 @@ import java.text.DecimalFormat;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-25 下午06:55:33
*/
public class PiePlotPane extends AbstractChartTypePane{
private static final long serialVersionUID = -601566194238908115L;
public class PiePlotPane extends AbstractDeprecatedChartTypePane {
private static final long serialVersionUID = -601566194238908115L;
private static final int PIE_CHART = 0;
private static final int THREE_D_PIE_CHART = 1;

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RadarPlotPane.java

@ -11,7 +11,7 @@ import com.fr.locale.InterProviderFactory;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-26 上午09:55:01
*/
public class RadarPlotPane extends AbstractChartTypePane{
public class RadarPlotPane extends AbstractDeprecatedChartTypePane {
private static final long serialVersionUID = -601566194238908115L;
private static final int RADAR = 0;

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RangePlotPane.java

@ -12,7 +12,7 @@ import com.fr.locale.InterProviderFactory;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-26 上午10:43:50
*/
public class RangePlotPane extends AbstractChartTypePane{
public class RangePlotPane extends AbstractDeprecatedChartTypePane {
private static final long serialVersionUID = -601566194238908115L;
private static final int RANGE = 0;

4
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/StockPlotPane.java

@ -11,8 +11,8 @@ import com.fr.locale.InterProviderFactory;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-26 上午10:52:36
*/
public class StockPlotPane extends AbstractChartTypePane {
public class StockPlotPane extends AbstractDeprecatedChartTypePane {
private static final int STOCK = 0;

4
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/UserDefinedChartTypePane.java

@ -1,12 +1,14 @@
package com.fr.design.mainframe.chart.gui.type;
import com.fr.chart.chartattr.Chart;
import com.fr.common.annotations.Compatible;
/**
* Created by mengao on 2017/8/30.
* 不能删掉这个类echarts插件中用到
*/
public abstract class UserDefinedChartTypePane extends AbstractChartTypePane {
@Compatible
public abstract class UserDefinedChartTypePane extends AbstractDeprecatedChartTypePane {
protected String[] getTypeLayoutPath() {
return new String[0];
}

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/XYScatterPlotPane.java

@ -14,7 +14,7 @@ import com.fr.stable.Constants;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-25 下午08:33:55
*/
public class XYScatterPlotPane extends AbstractChartTypePane{
public class XYScatterPlotPane extends AbstractDeprecatedChartTypePane {
private static final long serialVersionUID = -601566194238908115L;
private static final int XYSCATTER_CHART = 0;

7
designer-chart/src/main/java/com/fr/extended/chart/ExtendedTypePane.java

@ -1,6 +1,5 @@
package com.fr.extended.chart;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
@ -9,7 +8,7 @@ import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
/**
* Created by shine on 2018/3/5.
*/
public class ExtendedTypePane<T extends AbstractChart> extends AbstractChartTypePane {
public class ExtendedTypePane<T extends AbstractChart> extends AbstractChartTypePane<AbstractChart> {
@Override
protected String[] getTypeIconPath() {
@ -35,7 +34,7 @@ public class ExtendedTypePane<T extends AbstractChart> extends AbstractChartType
}
@Override
public void populateBean(Chart chart) {
public void populateBean(AbstractChart chart) {
if (getTypeIconPath().length > 0) {
for (ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
@ -47,7 +46,7 @@ public class ExtendedTypePane<T extends AbstractChart> extends AbstractChartType
}
@Override
public void updateBean(Chart chart) {
public void updateBean(AbstractChart chart) {
update((T) chart);
if (getTypeIconPath().length > 0) {

5
designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java

@ -12,9 +12,8 @@ import com.fr.design.gui.ilable.MultilineLabel;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.general.Background;
import com.fr.log.FineLoggerFactory;
import com.fr.js.NameJavaScriptGroup;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.base.VanChartZoom;
@ -25,7 +24,7 @@ import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
public abstract class AbstractVanChartTypePane extends AbstractChartTypePane{
public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Chart> {
private static final long serialVersionUID = 7743244512351499265L;
private UICheckBox largeModelCheckBox;

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

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

4
designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java

@ -64,9 +64,9 @@ public class PolyComponentsBar extends JToolBar {
);
this.add(serIcons[0]);
for (int i = 0; i < typeLen; i++) {
String chartID = typeName[i].getPlotID();
String chartID = typeName[i].getChartID();
String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(chartID);
BaseChartCollection chartCollection = BaseChartGetter.getStaticChartCollection(chartID);
BaseChartCollection chartCollection = BaseChartGetter.createChartCollection(chartID);
serIcons[i + 1] = new SerIcon(chartCollection, InterProviderFactory.getProvider().getLocText(typeName[i].getName()), iconPath);
this.add(serIcons[i + 1]);
}

22
designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java

@ -8,11 +8,14 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextarea.DescriptionTextArea;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.locale.impl.UserInfoMark;
import com.fr.design.mainframe.ActiveKeyGenerator;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import javax.swing.*;
import javax.swing.border.TitledBorder;
@ -31,11 +34,6 @@ public class CollectUserInformationDialog extends UIDialog {
private static final int ONLINE_VERIFY_TIMEOUT = 30 * 1000;
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");
private UITextField keyTextField;
private ActionListener actionListener = new ActionListener() {
@ -129,19 +127,9 @@ public class CollectUserInformationDialog extends UIDialog {
private void getKeyAction() {
Locale locale = GeneralContext.getLocale();
String url = EN_LOGIN_HTML;
if (ComparatorUtils.equals(locale, Locale.TAIWAN)) {
url = TW_LOGIN_HTML;
}
if (ComparatorUtils.equals(locale, Locale.CHINA)) {
url = CN_LOGIN_HTML;
}
if (ComparatorUtils.equals(locale, Locale.JAPAN)) {
url = JP_LOGIN_HTML;
}
LocaleMark<String> localeMark = LocaleCenter.getMark(UserInfoMark.class);
try {
Desktop.getDesktop().browse(new URI(url));
Desktop.getDesktop().browse(new URI(localeMark.getValue()));
} catch (Exception ignored) {
}

14
designer-realize/src/main/java/com/fr/start/SplashContext.java

@ -1,12 +1,14 @@
package com.fr.start;
import com.fr.design.DesignerEnvManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.locale.impl.SplashMark;
import com.fr.design.mainframe.bbs.BBSConstants;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.general.GeneralContext;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import com.fr.module.ModuleEvent;
import com.fr.stable.StringUtils;
@ -168,13 +170,7 @@ public class SplashContext {
}
private static String getSplashPath() {
Locale locale = DesignerEnvManager.getEnvManager().getLanguage();
if (Locale.US.equals(locale) || Locale.KOREA.equals(locale) || Locale.TAIWAN.equals(locale)) {
return "/com/fr/design/images/splash_10_en.gif";
} else if (Locale.JAPAN.equals(locale)) {
return "/com/fr/design/images/splash_10_jp.gif";
} else {
return "/com/fr/design/images/splash_10.gif";
}
LocaleMark<String> localeMark = LocaleCenter.getMark(SplashMark.class);
return localeMark.getValue();
}
}

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