Browse Source

Merge pull request #807 in DESIGN/design from ~JEO/report-design:final/10.0 to final/10.0

* commit '4fddd7ddba90c857f3bdf451fc72f82d22f276f4': (24 commits)
  REPORT-15703 【10.0冒烟】设计器删除模板后,上方路径显示问题
  KERNEL-445 防止没有添加jXBrowser的用户启动失败
  update
  KERNEL-445 refactor: 使用FineUI实现报表参数配置和模板Web属性面板
  KERNEL-445 调试窗口独立出来+增加重载资源文件的按钮
  update
  CHART-3647 更换url
  REPORT-15409 数据源连接接口BUG
  REPORT-15207 远程设计另存到本地
  换用ScheduledExecutorService schedule来延时发送
  REPORT-15332 有一个国际化调用比较早,需要在这边就设置好locale,由于后台GeneralContext默认是China
  http://www.finedevelop.com:2016/browse/REPORT-15128 lastTime刷新后,会导致功能点上传不上去
  REPORT-14787 远程设计另存过程中频繁进行RPC请求
  无JIRA任务 提供内置示例
  无JIRA任务 设计器可以使用基于Atom组件做界面开发+示例demo
  REPORT-15185 设计器打开启动画面修改 添加英文版
  误提交了测试代码
  无JIRA任务 完善提供的web容器API,简化加载jar包中html/js/css的方式
  完善一个示例代码
  无JIRA任务 添加一个通用的web组件,其他地方暂时用不到
  ...
final/10.0
Kara 6 years ago
parent
commit
153a80892d
  1. 36
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 12
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  3. 67
      designer-base/src/main/java/com/fr/design/actions/help/FineUIAction.java
  4. 3
      designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java
  5. 11
      designer-base/src/main/java/com/fr/design/mainframe/DesignAuthorityEventType.java
  6. 2
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  7. 1
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  8. 6
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  9. 9
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  10. 28
      designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java
  11. 53
      designer-base/src/main/java/com/fr/design/ui/Assistant.java
  12. 83
      designer-base/src/main/java/com/fr/design/ui/EmbProtocolHandler.java
  13. 22
      designer-base/src/main/java/com/fr/design/ui/ModernRequestClient.java
  14. 15
      designer-base/src/main/java/com/fr/design/ui/ModernUIConstants.java
  15. 212
      designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java
  16. 26
      designer-base/src/main/java/com/fr/file/FileNodeFILE.java
  17. 12
      designer-base/src/main/resources/com/fr/design/ui/InitNameSpace.js
  18. 8
      designer-base/src/main/resources/com/fr/design/ui/InsertScript.js
  19. 9
      designer-base/src/main/resources/com/fr/design/ui/InsertStyle.js
  20. 220
      designer-base/src/main/resources/com/fr/design/ui/help/demo.js
  21. 12
      designer-base/src/main/resources/com/fr/design/ui/tpl.html
  22. 28
      designer-base/src/test/java/com/fr/design/ui/FineUIDemo.java
  23. 75
      designer-base/src/test/java/com/fr/design/ui/ModernUIPaneTest.java
  24. 32
      designer-base/src/test/java/com/fr/design/ui/StartComponent.java
  25. 40
      designer-base/src/test/java/com/fr/design/ui/report/ReportServerParamComponent.java
  26. 29
      designer-base/src/test/java/com/fr/design/ui/report/ReportServerParamDemo.java
  27. 40
      designer-base/src/test/java/com/fr/design/ui/report/TemplateWebSettingComponent.java
  28. 28
      designer-base/src/test/java/com/fr/design/ui/report/TemplateWebSettingDemo.java
  29. 20
      designer-base/src/test/resources/com/fr/design/ui/demo.html
  30. 11
      designer-base/src/test/resources/com/fr/design/ui/fineui.html
  31. 12
      designer-base/src/test/resources/com/fr/design/ui/script/css/js/common/settingtab/settingtab.css
  32. 0
      designer-base/src/test/resources/com/fr/design/ui/script/css/js/index.css
  33. 41
      designer-base/src/test/resources/com/fr/design/ui/script/js/common/bar.container.js
  34. 89
      designer-base/src/test/resources/com/fr/design/ui/script/js/common/edit.list.js
  35. 33
      designer-base/src/test/resources/com/fr/design/ui/script/js/common/form.rowbackground.setting.js
  36. 54
      designer-base/src/test/resources/com/fr/design/ui/script/js/common/globalsingle.combo.js
  37. 53
      designer-base/src/test/resources/com/fr/design/ui/script/js/common/leavesetting.js
  38. 53
      designer-base/src/test/resources/com/fr/design/ui/script/js/common/reportshow.location.js
  39. 59
      designer-base/src/test/resources/com/fr/design/ui/script/js/common/settingtab/settingtab.js
  40. 17
      designer-base/src/test/resources/com/fr/design/ui/script/js/common/settingtab/settingtab.less
  41. 53
      designer-base/src/test/resources/com/fr/design/ui/script/js/common/sheetlabel.position.js
  42. 126
      designer-base/src/test/resources/com/fr/design/ui/script/js/common/toobar/toobar.js
  43. 42
      designer-base/src/test/resources/com/fr/design/ui/script/js/common/toobar/toolbar.region.js
  44. 67
      designer-base/src/test/resources/com/fr/design/ui/script/js/common/toolbarHeight.select.js
  45. 47
      designer-base/src/test/resources/com/fr/design/ui/script/js/common/usetoolbar.js
  46. 30
      designer-base/src/test/resources/com/fr/design/ui/script/js/enum.js
  47. 53
      designer-base/src/test/resources/com/fr/design/ui/script/js/i18n.js
  48. 1
      designer-base/src/test/resources/com/fr/design/ui/script/js/index.less
  49. 59
      designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/card/data.analysis.js
  50. 69
      designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/card/form.page.js
  51. 66
      designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/card/page.preview.js
  52. 33
      designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/reportserver.constants.js
  53. 50
      designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/reportserver.js
  54. 64
      designer-base/src/test/resources/com/fr/design/ui/script/js/templatewebproperties/card/form.page.js
  55. 73
      designer-base/src/test/resources/com/fr/design/ui/script/js/templatewebproperties/card/page.preview.js
  56. 69
      designer-base/src/test/resources/com/fr/design/ui/script/js/templatewebproperties/templateweb.constants.js
  57. 48
      designer-base/src/test/resources/com/fr/design/ui/script/js/templatewebproperties/templateweb.js
  58. 12
      designer-base/src/test/resources/com/fr/design/ui/script/report.css
  59. 1328
      designer-base/src/test/resources/com/fr/design/ui/script/report.js
  60. 57
      designer-base/src/test/resources/com/fr/design/ui/script/start.js
  61. 12
      designer-base/src/test/resources/com/fr/design/ui/script/template.css
  62. 1328
      designer-base/src/test/resources/com/fr/design/ui/script/template.js
  63. 2
      designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java
  64. 38
      designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java
  65. 15
      designer-realize/src/main/java/com/fr/start/SplashContext.java
  66. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash_10_en.gif
  67. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash_10_jp.gif

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

@ -164,6 +164,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private static List<SwingWorker> mapWorkerList = new ArrayList<SwingWorker>(); private static List<SwingWorker> mapWorkerList = new ArrayList<SwingWorker>();
private boolean imageCompress = false;//图片压缩 private boolean imageCompress = false;//图片压缩
// 开启内嵌web页面的调试窗口
private boolean openDebug = false;
/** /**
* DesignerEnvManager. * DesignerEnvManager.
@ -175,6 +177,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
public static DesignerEnvManager getEnvManager(boolean needCheckEnv) { public static DesignerEnvManager getEnvManager(boolean needCheckEnv) {
if (designerEnvManager == null) { if (designerEnvManager == null) {
designerEnvManager = new DesignerEnvManager(); designerEnvManager = new DesignerEnvManager();
//REPORT-15332有一个国际化调用比较早,需要在这边就设置好locale,由于后台GeneralContext默认是China
GeneralContext.setLocale(designerEnvManager.getLanguage());
try { try {
XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile()); XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile());
} catch (Exception e) { } catch (Exception e) {
@ -1383,6 +1387,13 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
reader.readXMLObject(this.configManager); reader.readXMLObject(this.configManager);
} }
private void readOpenDebug(XMLableReader reader) {
String tmpVal;
if (StringUtils.isNotBlank(tmpVal = reader.getElementValue())) {
this.openDebug = Boolean.parseBoolean(tmpVal);
}
}
public String getUUID() { public String getUUID() {
return StringUtils.isEmpty(uuid) ? UUID.randomUUID().toString() : uuid; return StringUtils.isEmpty(uuid) ? UUID.randomUUID().toString() : uuid;
} }
@ -1411,6 +1422,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.imageCompress = imageCompress; this.imageCompress = imageCompress;
} }
public boolean isOpenDebug() {
return openDebug;
}
public void setOpenDebug(boolean openDebug) {
this.openDebug = openDebug;
}
/** /**
* Read XML.<br> * Read XML.<br>
* The method will be invoked when read data from XML file.<br> * The method will be invoked when read data from XML file.<br>
@ -1458,12 +1477,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
readUUID(reader); readUUID(reader);
} else if ("status".equals(name)) { } else if ("status".equals(name)) {
readActiveStatus(reader); readActiveStatus(reader);
} else if (ComparatorUtils.equals(CAS_PARAS, name)) { } else if (CAS_PARAS.equals(name)) {
readHttpsParas(reader); readHttpsParas(reader);
} else if (name.equals("AlphaFineConfigManager")) { } else if ("AlphaFineConfigManager".equals(name)) {
readAlphaFineAttr(reader); readAlphaFineAttr(reader);
} else if (name.equals("RecentColors")) { } else if ("RecentColors".equals(name)) {
readRecentColor(reader); readRecentColor(reader);
} else if ("OpenDebug".equals(name)) {
readOpenDebug(reader);
} else { } else {
readLayout(reader, name); readLayout(reader, name);
} }
@ -1668,6 +1689,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
writeHttpsParas(writer); writeHttpsParas(writer);
writeAlphaFineAttr(writer); writeAlphaFineAttr(writer);
writeRecentColor(writer); writeRecentColor(writer);
writeOpenDebug(writer);
writer.end(); writer.end();
} }
@ -1683,6 +1705,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
} }
} }
private void writeOpenDebug(XMLPrintWriter writer) {
if (this.openDebug) {
writer.startTAG("OpenDebug");
writer.textNode(String.valueOf(openDebug));
writer.end();
}
}
//写入uuid //写入uuid
private void writeUUID(XMLPrintWriter writer) { private void writeUUID(XMLPrintWriter writer) {

12
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -18,6 +18,7 @@ import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
@ -131,6 +132,7 @@ public class PreferencePane extends BasicPane {
private UITextField jdkHomeTextField; private UITextField jdkHomeTextField;
private UICheckBox oracleSpace; private UICheckBox oracleSpace;
private UISpinner cachingTemplateSpinner; private UISpinner cachingTemplateSpinner;
private UICheckBox openDebugComboBox;
private UICheckBox joinProductImprove; private UICheckBox joinProductImprove;
public PreferencePane() { public PreferencePane() {
@ -171,6 +173,12 @@ public class PreferencePane extends BasicPane {
oracleSpace = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_All_Oracle_Tables")); oracleSpace = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_All_Oracle_Tables"));
oraclePane.add(oracleSpace); oraclePane.add(oracleSpace);
JPanel debuggerPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Basic_Develop_Tools"));
openDebugComboBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Open_Debug_Window"));
debuggerPane.add(openDebugComboBox, BorderLayout.CENTER);
advancePane.add(debuggerPane);
JPanel improvePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Product_Improve")); JPanel improvePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Product_Improve"));
joinProductImprove = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Join_Product_Improve")); joinProductImprove = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Join_Product_Improve"));
improvePane.add(joinProductImprove); improvePane.add(joinProductImprove);
@ -550,6 +558,8 @@ public class PreferencePane extends BasicPane {
this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort())); this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort()));
openDebugComboBox.setSelected(designerEnvManager.isOpenDebug());
this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace()); this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace());
this.cachingTemplateSpinner.setValue(designerEnvManager.getCachingTemplateLimit()); this.cachingTemplateSpinner.setValue(designerEnvManager.getCachingTemplateLimit());
this.joinProductImprove.setSelected(designerEnvManager.isJoinProductImprove()); this.joinProductImprove.setSelected(designerEnvManager.isJoinProductImprove());
@ -609,6 +619,8 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setJettyServerPort(portEditor.getValue().intValue()); designerEnvManager.setJettyServerPort(portEditor.getValue().intValue());
designerEnvManager.setOpenDebug(openDebugComboBox.isSelected());
designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected()); designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected());
designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue()); designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue());
designerEnvManager.setJoinProductImprove(this.joinProductImprove.isSelected()); designerEnvManager.setJoinProductImprove(this.joinProductImprove.isSelected());

67
designer-base/src/main/java/com/fr/design/actions/help/FineUIAction.java

@ -0,0 +1,67 @@
package com.fr.design.actions.help;
import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.ui.ModernUIPane;
import com.fr.locale.InterProviderFactory;
import com.fr.web.struct.AssembleComponent;
import com.fr.web.struct.Atom;
import com.fr.web.struct.browser.RequestClient;
import com.fr.web.struct.category.ScriptPath;
import com.fr.web.struct.impl.FineUI;
import java.awt.event.ActionEvent;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-03-08
*/
public class FineUIAction extends UpdateAction {
public FineUIAction() {
setName("FineUI");
}
@Override
public void actionPerformed(final ActionEvent e) {
ModernUIPane<?> pane = new ModernUIPane.Builder<>()
// .prepare(new ScriptContextAdapter() {
// @Override
// public void onScriptContextCreated(ScriptContextEvent event) {
// JSValue pool = event.getBrowser().executeJavaScriptAndReturnValue("window.Pool");
// pool.asObject().setProperty("i18n", new I18n());
// }
// })
.withComponent(new AssembleComponent() {
@Override
public ScriptPath script(RequestClient req) {
return ScriptPath.build("/com/fr/design/ui/help/demo.js");
}
@Override
public Atom[] refer() {
return new Atom[] {FineUI.KEY};
}
})
.build();
BasicDialog dialog = pane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
}
});
dialog.setVisible(true);
}
public static class I18n {
public String i18nText(String key) {
return InterProviderFactory.getProvider().getLocText(key);
}
}
}

3
designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java

@ -60,7 +60,8 @@ class JControlUpdatePane extends JPanel {
elEditing = el; elEditing = el;
NameableCreator[] creators = listControlPane.creators(); NameableCreator[] creators = listControlPane.creators();
for (int i = 0, len = updatePanes.length; i < len; i++) { //倒序的原因是为了让一些继承内置连接类的插件实现能够生效REPORT-15409
for (int i = updatePanes.length - 1; i > -1; i--) {
Object ob2Populate = creators[i].acceptObject2Populate(el.wrapper); Object ob2Populate = creators[i].acceptObject2Populate(el.wrapper);
if (ob2Populate != null) { if (ob2Populate != null) {
if (updatePanes[i] == null) { if (updatePanes[i] == null) {

11
designer-base/src/main/java/com/fr/design/mainframe/DesignAuthorityEventType.java

@ -0,0 +1,11 @@
package com.fr.design.mainframe;
import com.fr.event.Event;
public enum DesignAuthorityEventType implements Event<DesignerFrame> {
// 退出权限编辑
StartEdit,
// 进入权限编辑
StopEdit;
}

2
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -39,6 +39,7 @@ import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.MenuManager; import com.fr.design.menu.MenuManager;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.EventDispatcher;
import com.fr.exception.DecryptTemplateException; import com.fr.exception.DecryptTemplateException;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FILEFactory; import com.fr.file.FILEFactory;
@ -333,6 +334,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
needToAddAuhtorityPaint(); needToAddAuhtorityPaint();
refreshDottedLine(); refreshDottedLine();
fireAuthorityStateToNomal(); fireAuthorityStateToNomal();
EventDispatcher.fire(DesignAuthorityEventType.StopEdit, DesignerFrame.this);
} }
/** /**

1
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -370,6 +370,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
} }
selectedOperation.deleteFile(); selectedOperation.deleteFile();
stateChange(); stateChange();
DesignerContext.getDesignerFrame().setTitle();
} }
} }

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

@ -599,7 +599,11 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
editingFILE = fileChooser.getSelectedFILE(); editingFILE = fileChooser.getSelectedFILE();
} }
boolean lockedTarget = WorkContext.getCurrent().get(TplOperator.class).saveAs(editingFILE.getPath()); boolean lockedTarget =
// 目标本地文件
!editingFILE.isEnvFile() ||
// 目标远程文件
WorkContext.getCurrent().get(TplOperator.class).saveAs(editingFILE.getPath());
if (lockedTarget) { if (lockedTarget) {
boolean saved = saveNewFile(editingFILE, oldName); boolean saved = saveNewFile(editingFILE, oldName);
// 目标文件保存成功并且源文件不一致的情况下,把源文件锁释放掉 // 目标文件保存成功并且源文件不一致的情况下,把源文件锁释放掉

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

@ -6,6 +6,7 @@ package com.fr.design.mainframe.toolbar;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.community.BBSAction; import com.fr.design.actions.community.BBSAction;
@ -24,6 +25,7 @@ import com.fr.design.actions.file.OpenTemplateAction;
import com.fr.design.actions.file.PreferenceAction; import com.fr.design.actions.file.PreferenceAction;
import com.fr.design.actions.file.SwitchExistEnv; import com.fr.design.actions.file.SwitchExistEnv;
import com.fr.design.actions.help.AboutAction; import com.fr.design.actions.help.AboutAction;
import com.fr.design.actions.help.FineUIAction;
import com.fr.design.actions.help.TutorialAction; import com.fr.design.actions.help.TutorialAction;
import com.fr.design.actions.help.WebDemoAction; import com.fr.design.actions.help.WebDemoAction;
import com.fr.design.actions.help.alphafine.AlphaFineAction; import com.fr.design.actions.help.alphafine.AlphaFineAction;
@ -499,9 +501,14 @@ public abstract class ToolBarMenuDock {
if (AlphaFineConfigManager.isALPHALicAvailable()) { if (AlphaFineConfigManager.isALPHALicAvailable()) {
shortCuts.add(new AlphaFineAction()); shortCuts.add(new AlphaFineAction());
} }
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
if (DesignerEnvManager.getEnvManager().isOpenDebug()) {
shortCuts.add(new FineUIAction());
}
shortCuts.add(new AboutAction()); shortCuts.add(new AboutAction());
return shortCuts.toArray(new ShortCut[shortCuts.size()]);
return shortCuts.toArray(new ShortCut[0]);
} }
/** /**

28
designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java

@ -11,18 +11,29 @@ import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignAuthorityEventType;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.DockingView; import com.fr.design.mainframe.DockingView;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import javax.swing.*; import com.fr.event.Listener;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.ScrollPaneConstants;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionEvent;
import javax.swing.tree.DefaultTreeSelectionModel;
import javax.swing.tree.TreeNode; import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
@ -40,6 +51,15 @@ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSo
private static ReportAndFSManagePane singleton = new ReportAndFSManagePane(); private static ReportAndFSManagePane singleton = new ReportAndFSManagePane();
private static RoleTree roleTree; private static RoleTree roleTree;
static {
EventDispatcher.listen(DesignAuthorityEventType.StopEdit, new Listener<DesignerFrame>() {
public void on(Event event, DesignerFrame param) {
DefaultTreeSelectionModel model = roleTree.getCheckBoxTreeSelectionModel();
model.removeSelectionPaths(model.getSelectionPaths());
}
});
}
private RefreshAction refreshAction = new RefreshAction(); private RefreshAction refreshAction = new RefreshAction();
private UIHeadGroup buttonGroup; private UIHeadGroup buttonGroup;
private RoleSourceOP op; private RoleSourceOP op;

53
designer-base/src/main/java/com/fr/design/ui/Assistant.java

@ -0,0 +1,53 @@
package com.fr.design.ui;
import com.fr.stable.StringUtils;
import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.BrowserContext;
import com.teamdev.jxbrowser.chromium.ProtocolService;
import com.teamdev.jxbrowser.chromium.URLResponse;
import java.io.DataInputStream;
import java.io.InputStream;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-03-07
*/
public class Assistant {
public static URLResponse inputStream2Response(InputStream inputStream, String filePath) throws Exception {
URLResponse response = new URLResponse();
DataInputStream stream = new DataInputStream(inputStream);
byte[] data = new byte[stream.available()];
stream.readFully(data);
response.setData(data);
String mimeType = getMimeType(filePath);
response.getHeaders().setHeader("Content-Type", mimeType);
return response;
}
private static String getMimeType(String path) {
if (StringUtils.isBlank(path)) {
return "text/html";
}
if (path.endsWith(".html")) {
return "text/html";
}
if (path.endsWith(".css")) {
return "text/css";
}
if (path.endsWith(".js")) {
return "text/javascript";
}
return "text/html";
}
public static void setEmbProtocolHandler(Browser browser, EmbProtocolHandler handler) {
BrowserContext browserContext = browser.getContext();
ProtocolService protocolService = browserContext.getProtocolService();
// 支持读取jar包中文件的自定义协议————emb:/com/fr/design/images/bbs.png
protocolService.setProtocolHandler("emb", handler);
}
}

83
designer-base/src/main/java/com/fr/design/ui/EmbProtocolHandler.java

@ -0,0 +1,83 @@
package com.fr.design.ui;
import com.fr.general.IOUtils;
import com.fr.stable.StringUtils;
import com.fr.web.struct.AssembleComponent;
import com.fr.web.struct.AtomBuilder;
import com.fr.web.struct.PathGroup;
import com.fr.web.struct.category.ScriptPath;
import com.fr.web.struct.category.StylePath;
import com.teamdev.jxbrowser.chromium.ProtocolHandler;
import com.teamdev.jxbrowser.chromium.URLRequest;
import com.teamdev.jxbrowser.chromium.URLResponse;
import java.io.InputStream;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-03-07
*/
public class EmbProtocolHandler implements ProtocolHandler {
private AssembleComponent component;
public EmbProtocolHandler() {
}
public EmbProtocolHandler(AssembleComponent component) {
this.component = component;
}
@Override
public URLResponse onRequest(URLRequest req) {
try {
String path = req.getURL();
if (path.startsWith("emb:dynamic")) {
URLResponse response = new URLResponse();
response.setData(htmlText().getBytes());
response.getHeaders().setHeader("Content-Type", "text/html");
return response;
} else {
int index = path.indexOf("=");
if (index > 0) {
path = path.substring(index + 1);
} else {
path = path.substring(4);
}
InputStream inputStream = IOUtils.readResource(path);
return Assistant.inputStream2Response(inputStream, path);
}
} catch (Exception ignore) {
}
return null;
}
private String htmlText() {
PathGroup pathGroup = AtomBuilder.create().buildAssembleFilePath(ModernRequestClient.KEY, component);
StylePath[] stylePaths = pathGroup.toStylePathGroup();
StringBuilder styleText = new StringBuilder();
for (StylePath path : stylePaths) {
if (StringUtils.isNotBlank(path.toFilePath())) {
styleText.append("<link rel=\"stylesheet\" href=\"emb:");
styleText.append(path.toFilePath());
styleText.append("\"/>");
}
}
String result = ModernUIConstants.HTML_TPL.replaceAll("##style##", styleText.toString());
ScriptPath[] scriptPaths = pathGroup.toScriptPathGroup();
StringBuilder scriptText = new StringBuilder();
for (ScriptPath path : scriptPaths) {
if (StringUtils.isNotBlank(path.toFilePath())) {
scriptText.append("<script src=\"emb:");
scriptText.append(path.toFilePath());
scriptText.append("\"></script>");
}
}
result = result.replaceAll("##script##", scriptText.toString());
return result;
}
}

22
designer-base/src/main/java/com/fr/design/ui/ModernRequestClient.java

@ -0,0 +1,22 @@
package com.fr.design.ui;
import com.fr.web.struct.browser.RequestClient;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-03-07
*/
public enum ModernRequestClient implements RequestClient {
KEY;
@Override
public boolean isIE() {
return false;
}
@Override
public boolean isLowIEVersion() {
return false;
}}

15
designer-base/src/main/java/com/fr/design/ui/ModernUIConstants.java

@ -0,0 +1,15 @@
package com.fr.design.ui;
import com.fr.general.IOUtils;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-03-05
*/
class ModernUIConstants {
static final String SCRIPT_INIT_NAME_SPACE = IOUtils.readResourceAsString("/com/fr/design/ui/InitNameSpace.js");
static final String HTML_TPL = IOUtils.readResourceAsString("/com/fr/design/ui/tpl.html");
}

212
designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java

@ -0,0 +1,212 @@
package com.fr.design.ui;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.web.struct.AssembleComponent;
import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.BrowserPreferences;
import com.teamdev.jxbrowser.chromium.JSValue;
import com.teamdev.jxbrowser.chromium.events.FinishLoadingEvent;
import com.teamdev.jxbrowser.chromium.events.LoadAdapter;
import com.teamdev.jxbrowser.chromium.events.LoadListener;
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
import com.teamdev.jxbrowser.chromium.events.ScriptContextListener;
import com.teamdev.jxbrowser.chromium.swing.BrowserView;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-03-04
* 用于加载html5的Swing容器可以在设计选项设置中打开调试窗口示例可查看com.fr.design.ui.ModernUIPaneTest
*/
public class ModernUIPane<T> extends BasicPane {
private Browser browser;
private String namespace = "Pool";
private String variable = "data";
private String expression = "update()";
private ModernUIPane() {
initialize();
}
private void initialize() {
if (browser == null) {
setLayout(new BorderLayout());
BrowserPreferences.setChromiumSwitches("--disable-google-traffic");
if (DesignerEnvManager.getEnvManager().isOpenDebug()) {
UIToolbar toolbar = new UIToolbar();
add(toolbar, BorderLayout.NORTH);
UIButton openDebugButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Open_Debug_Window"));
toolbar.add(openDebugButton);
UIButton reloadButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Reload"));
toolbar.add(reloadButton);
openDebugButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
showDebuggerDialog();
}
});
reloadButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
browser.reloadIgnoringCache();
}
});
BrowserPreferences.setChromiumSwitches("--remote-debugging-port=9222");
initializeBrowser();
add(new BrowserView(browser), BorderLayout.CENTER);
} else {
initializeBrowser();
add(new BrowserView(browser), BorderLayout.CENTER);
}
}
}
private void showDebuggerDialog() {
JDialog dialog = new JDialog(SwingUtilities.getWindowAncestor(this));
Browser debugger = new Browser();
BrowserView debuggerView = new BrowserView(debugger);
dialog.add(debuggerView, BorderLayout.CENTER);
dialog.setSize(new Dimension(800, 400));
GUICoreUtils.centerWindow(dialog);
dialog.setVisible(true);
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
debugger.loadURL(browser.getRemoteDebuggingURL());
}
private void initializeBrowser() {
browser = new Browser();
// 初始化的时候,就把命名空间对象初始化好,确保window.a.b.c("a.b.c"为命名空间)对象都是初始化过的
browser.addScriptContextListener(new ScriptContextAdapter() {
@Override
public void onScriptContextCreated(ScriptContextEvent event) {
event.getBrowser().executeJavaScript(String.format(ModernUIConstants.SCRIPT_INIT_NAME_SPACE, namespace));
}
});
}
@Override
protected String title4PopupWindow() {
return "Modern";
}
public void populate(final T t) {
browser.addLoadListener(new LoadAdapter() {
@Override
public void onFinishLoadingFrame(FinishLoadingEvent event) {
if (event.isMainFrame()) {
JSValue ns = event.getBrowser().executeJavaScriptAndReturnValue("window." + namespace);
ns.asObject().setProperty(variable, t);
}
}
});
}
public T update() {
JSValue jsValue = browser.executeJavaScriptAndReturnValue("window." + namespace + "." + expression);
if (jsValue.isObject()) {
return (T)jsValue.asJavaObject();
}
return null;
}
public static class Builder<T> {
private ModernUIPane<T> pane = new ModernUIPane<>();
public Builder<T> prepare(ScriptContextListener contextListener) {
pane.browser.addScriptContextListener(contextListener);
return this;
}
public Builder<T> prepare(LoadListener loadListener) {
pane.browser.addLoadListener(loadListener);
return this;
}
/**
* 加载jar包中的资源
* @param path 资源路径
*/
public Builder<T> withEMB(final String path) {
Assistant.setEmbProtocolHandler(pane.browser, new EmbProtocolHandler());
pane.browser.loadURL("emb:" + path);
return this;
}
/**
* 加载url指向的资源
* @param url 文件的地址
*/
public Builder<T> withURL(final String url) {
Assistant.setEmbProtocolHandler(pane.browser, new EmbProtocolHandler());
pane.browser.loadURL(url);
return this;
}
/**
* 加载Atom组件
* @param component Atom组件
*/
public Builder<T> withComponent(AssembleComponent component) {
Assistant.setEmbProtocolHandler(pane.browser, new EmbProtocolHandler(component));
pane.browser.loadURL("emb:dynamic");
return this;
}
/**
* 加载html文本内容
* @param html 要加载html文本内容
*/
public Builder<T> withHTML(String html) {
Assistant.setEmbProtocolHandler(pane.browser, new EmbProtocolHandler());
pane.browser.loadHTML(html);
return this;
}
/**
* 设置该前端页面做数据交换所使用的对象
* @param namespace 对象名
*/
public Builder<T> namespace(String namespace) {
pane.namespace = namespace;
return this;
}
/**
* java端往js端传数据时使用的变量名字
* @param name 变量的名字
*/
public Builder<T> variable(String name) {
pane.variable = name;
return this;
}
/**
* js端往java端传数据时执行的函数表达式
* @param expression 函数表达式
*/
public Builder<T> expression(String expression) {
pane.expression = expression;
return this;
}
public ModernUIPane<T> build() {
return pane;
}
}
}

26
designer-base/src/main/java/com/fr/file/FileNodeFILE.java

@ -7,6 +7,9 @@ import com.fr.design.file.NodeAuthProcessor;
import com.fr.design.gui.itree.filetree.FileNodeComparator; import com.fr.design.gui.itree.filetree.FileNodeComparator;
import com.fr.design.gui.itree.filetree.FileTreeIcon; import com.fr.design.gui.itree.filetree.FileTreeIcon;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.io.EncryptUtils; import com.fr.io.EncryptUtils;
@ -15,6 +18,8 @@ import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent;
import com.fr.workspace.resource.WorkResourceTempRenameStream; import com.fr.workspace.resource.WorkResourceTempRenameStream;
import com.fr.workspace.server.lock.TplOperator; import com.fr.workspace.server.lock.TplOperator;
@ -26,6 +31,21 @@ import java.util.Arrays;
public class FileNodeFILE implements FILE { public class FileNodeFILE implements FILE {
private static String webRootPath = FRContext.getCommonOperator().getWebRootPath();
private static String[] supportTypes = FRContext.getFileNodes().getSupportedTypes();
static {
EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener<Workspace>() {
@Override
public void on(Event event, Workspace workspace) {
webRootPath = FRContext.getCommonOperator().getWebRootPath();
supportTypes = FRContext.getFileNodes().getSupportedTypes();
}
});
}
private FileNode node; private FileNode node;
//记录下FILE对应的运行环境,每次创建都设置下当前的运行环境 //记录下FILE对应的运行环境,每次创建都设置下当前的运行环境
@ -95,7 +115,7 @@ public class FileNodeFILE implements FILE {
@Override @Override
public String prefix() { public String prefix() {
if (ComparatorUtils.equals(getEnvPath(), FRContext.getCommonOperator().getWebRootPath())) { if (ComparatorUtils.equals(getEnvPath(), webRootPath)) {
return FILEFactory.WEBREPORT_PREFIX; return FILEFactory.WEBREPORT_PREFIX;
} }
return FILEFactory.ENV_PREFIX; return FILEFactory.ENV_PREFIX;
@ -212,7 +232,7 @@ public class FileNodeFILE implements FILE {
try { try {
FileNode[] nodeArray; FileNode[] nodeArray;
nodeArray = listFile(node.getEnvPath()); nodeArray = listFile(node.getEnvPath());
Arrays.sort(nodeArray, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes())); Arrays.sort(nodeArray, new FileNodeComparator(supportTypes));
return fileNodeArray2FILEArray(nodeArray, envPath); return fileNodeArray2FILEArray(nodeArray, envPath);
} catch (Exception e) { } catch (Exception e) {
@ -235,7 +255,7 @@ public class FileNodeFILE implements FILE {
private FileNode[] listFile(String rootFilePath) { private FileNode[] listFile(String rootFilePath) {
try { try {
if (ComparatorUtils.equals(envPath, FRContext.getCommonOperator().getWebRootPath())) { if (ComparatorUtils.equals(envPath, webRootPath)) {
return FRContext.getFileNodes().listWebRootFile(rootFilePath); return FRContext.getFileNodes().listWebRootFile(rootFilePath);
} else { } else {
return FRContext.getFileNodes().list(rootFilePath); return FRContext.getFileNodes().list(rootFilePath);

12
designer-base/src/main/resources/com/fr/design/ui/InitNameSpace.js

@ -0,0 +1,12 @@
var arr ="%s".split(".").reverse();
var create = function (obj, names) {
var name = names.pop();
if (!name) {
return;
}
if (!obj[name]) {
obj[name] = {};
}
create(obj[name], names);
};
create(window, arr);

8
designer-base/src/main/resources/com/fr/design/ui/InsertScript.js

@ -0,0 +1,8 @@
var arr = "%s".split(",");
var header = document.getElementsByTagName("head")[0];
arr.forEach(function(el) {
var script = document.createElement("script")
script.type = "text/javascript";
script.src = "emb:" + el;
header.appendChild(script);
});

9
designer-base/src/main/resources/com/fr/design/ui/InsertStyle.js

@ -0,0 +1,9 @@
var arr = "%s".split(",");
var header = document.getElementsByTagName("head")[0];
arr.forEach(function(el) {
var css = document.createElement("link");
css.type = "text/css";
css.rel = "stylesheet";
css.href = "emb:" + el;
header.appendChild(css);
});

220
designer-base/src/main/resources/com/fr/design/ui/help/demo.js

@ -0,0 +1,220 @@
window.addEventListener("load", function (ev) {
window.BI.i18nText = function(key) {return window.Pool.i18n.i18nText(key);}
var combo1 = BI.createWidget({
type: "bi.vertical",
items: [
{
type: "bi.text_value_combo",
text: "选项1",
width: 300,
items: [
{
el: {
type: "bi.single_select_radio_item",
width: 290,
text: "选项1",
value: 1
},
text: "选项1",
value: 1,
lgap: 10
},
{
el: {
type: "bi.single_select_radio_item",
width: 290,
text: "选项2",
value: 2
},
lgap: 10,
text: "选项2",
value: 2
},
{
el: {
type: "bi.single_select_radio_item",
width: 290,
text: "选项3",
value: 3
},
lgap: 10,
text: "选项3",
value: 3
}
]
}
]
});
var date = BI.createWidget({
type: "bi.left",
items: [{
el: {
type: "bi.date_time_combo",
value: {
year: 2018,
month: 9,
day: 28,
hour: 13,
minute: 31,
second: 1
}
}
}]
});
var comboTree = BI.createWidget({
type: "bi.vertical",
items: [
{
type: "bi.tree_value_chooser_combo",
width: 300,
itemsCreator: function(op, callback) {
callback([
{
id: 1,
text: "第1项",
value: "1"
},
{
id: 2,
text: "第2项",
value: "2"
},
{
id: 3,
text: "第3项",
value: "3",
open: true
},
{
id: 11,
pId: 1,
text: "子项1",
value: "11"
},
{
id: 12,
pId: 1,
text: "子项2",
value: "12"
},
{
id: 13,
pId: 1,
text: "子项3",
value: "13"
},
{
id: 31,
pId: 3,
text: "子项1",
value: "31"
},
{
id: 32,
pId: 3,
text: "子项2",
value: "32"
},
{
id: 33,
pId: 3,
text: "子项3",
value: "33"
}
]);
}
}
]
});
var color = BI.createWidget({
type: "bi.left",
items: [{
type: "bi.simple_color_chooser",
width: 24,
height: 24
}, {
el: {
type: "bi.color_chooser",
width: 230,
height: 24
},
lgap: 10
}]
});
var Slider = BI.inherit(BI.Widget, {
props: {
width: 300,
height: 50,
min: 0,
max: 100
},
mounted: function() {
var o = this.options;
this.singleSliderInterval.setMinAndMax({
min: o.min,
max: o.max
});
this.singleSliderInterval.setValue({
min: 10,
max: 80
});
this.singleSliderInterval.populate();
},
render: function() {
var self = this,
o = this.options;
return {
type: "bi.vertical",
element: this,
items: [
{
type: "bi.interval_slider",
digit: 0,
width: o.width,
height: o.height,
ref: function(_ref) {
self.singleSliderInterval = _ref;
}
}
]
};
}
});
BI.shortcut("demo.slider_interval", Slider);
var slider = BI.createWidget({
type: "demo.slider_interval"
});
BI.createWidget({
type:"bi.absolute",
element: "body",
items: [{
el: combo1,
left: 100,
top: 100
}, {
el : date,
left: 100,
top : 150
}, {
el : comboTree,
left : 100,
top : 200
}, {
el : color,
left : 100,
top : 250
}, {
el : slider,
left : 400,
top : 100
}]
});
});

12
designer-base/src/main/resources/com/fr/design/ui/tpl.html

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
##style##
##script##
</head>
<body>
</body>
</html>

28
designer-base/src/test/java/com/fr/design/ui/FineUIDemo.java

@ -0,0 +1,28 @@
package com.fr.design.ui;
import com.fr.design.DesignerEnvManager;
import javax.swing.*;
import java.awt.*;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-03-07
*/
public class FineUIDemo {
public static void main(String... args) {
final JFrame frame = new JFrame();
frame.setSize(1200, 800);
JPanel contentPane = (JPanel) frame.getContentPane();
// 是否需要开启调试窗口
DesignerEnvManager.getEnvManager().setOpenDebug(true);
final ModernUIPane<ModernUIPaneTest.Model> pane = new ModernUIPane.Builder<ModernUIPaneTest.Model>()
.withComponent(StartComponent.KEY).build();
contentPane.add(pane, BorderLayout.CENTER);
frame.setVisible(true);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
}

75
designer-base/src/test/java/com/fr/design/ui/ModernUIPaneTest.java

@ -0,0 +1,75 @@
package com.fr.design.ui;
import com.fr.design.DesignerEnvManager;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-03-05
*/
public class ModernUIPaneTest {
public static void main(String... args) {
final JFrame frame = new JFrame();
frame.setSize(1200, 800);
JPanel contentPane = (JPanel) frame.getContentPane();
// 是否需要开启调试窗口
DesignerEnvManager.getEnvManager().setOpenDebug(true);
final ModernUIPane<Model> pane = new ModernUIPane.Builder<Model>()
.withEMB("/com/fr/design/ui/demo.html").namespace("Pool").build();
contentPane.add(pane, BorderLayout.CENTER);
Model model = new Model();
model.setAge(20);
model.setName("Pick");
pane.populate(model);
JPanel panel = new JPanel(new FlowLayout());
contentPane.add(panel, BorderLayout.SOUTH);
JButton button = new JButton("点击我可以看到Swing的弹框,输出填写的信息");
panel.add(button);
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Model returnValue = pane.update();
if (returnValue != null) {
JOptionPane.showMessageDialog(frame, String.format("姓名为:%s,年龄为:%d", returnValue.getName(), returnValue.getAge()));
}
}
});
frame.setVisible(true);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
public static class Model {
private String name;
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public void print(String message) {
System.out.println(message);
}
}
}

32
designer-base/src/test/java/com/fr/design/ui/StartComponent.java

@ -0,0 +1,32 @@
package com.fr.design.ui;
import com.fr.web.struct.AssembleComponent;
import com.fr.web.struct.Atom;
import com.fr.web.struct.browser.RequestClient;
import com.fr.web.struct.category.ScriptPath;
import com.fr.web.struct.impl.FineUI;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-03-08
*/
public class StartComponent extends AssembleComponent {
public static final StartComponent KEY = new StartComponent();
private StartComponent() {
}
@Override
public ScriptPath script(RequestClient req) {
return ScriptPath.build("/com/fr/design/ui/script/start.js");
}
@Override
public Atom[] refer() {
return new Atom[] {FineUI.KEY};
}
}

40
designer-base/src/test/java/com/fr/design/ui/report/ReportServerParamComponent.java

@ -0,0 +1,40 @@
package com.fr.design.ui.report;
import com.fr.web.struct.AssembleComponent;
import com.fr.web.struct.Atom;
import com.fr.web.struct.browser.RequestClient;
import com.fr.web.struct.category.ParserType;
import com.fr.web.struct.category.ScriptPath;
import com.fr.web.struct.category.StylePath;
import com.fr.web.struct.impl.FineUI;
/**
* Created by windy on 2019/3/25.
* 报表服务器参数demo使用
*/
public class ReportServerParamComponent extends AssembleComponent {
public static final ReportServerParamComponent KEY = new ReportServerParamComponent();
private ReportServerParamComponent() {
}
@Override
public Atom[] refer() {
return new Atom[] {
FineUI.KEY
};
}
@Override
public ScriptPath script(RequestClient req) {
return ScriptPath.build("/com/fr/design/ui/script/report.js");
}
@Override
public StylePath style() {
return StylePath.build("/com/fr/design/ui/script/report.css", ParserType.DYNAMIC);
}
}

29
designer-base/src/test/java/com/fr/design/ui/report/ReportServerParamDemo.java

@ -0,0 +1,29 @@
package com.fr.design.ui.report;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ui.ModernUIPane;
import com.fr.design.ui.ModernUIPaneTest;
import javax.swing.*;
import java.awt.*;
/**
* Created by windy on 2019/3/25.
* 报表服务器参数demo
*/
public class ReportServerParamDemo {
public static void main(String... args) {
final JFrame frame = new JFrame();
frame.setSize(660, 600);
JPanel contentPane = (JPanel) frame.getContentPane();
// 是否需要开启调试窗口
DesignerEnvManager.getEnvManager().setOpenDebug(true);
final ModernUIPane<ModernUIPaneTest.Model> pane = new ModernUIPane.Builder<ModernUIPaneTest.Model>()
.withComponent(ReportServerParamComponent.KEY).build();
contentPane.add(pane, BorderLayout.CENTER);
frame.setVisible(true);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
}

40
designer-base/src/test/java/com/fr/design/ui/report/TemplateWebSettingComponent.java

@ -0,0 +1,40 @@
package com.fr.design.ui.report;
import com.fr.web.struct.AssembleComponent;
import com.fr.web.struct.Atom;
import com.fr.web.struct.browser.RequestClient;
import com.fr.web.struct.category.ParserType;
import com.fr.web.struct.category.ScriptPath;
import com.fr.web.struct.category.StylePath;
import com.fr.web.struct.impl.FineUI;
/**
* Created by windy on 2019/3/26.
* 模板Web属性demo使用
*/
public class TemplateWebSettingComponent extends AssembleComponent {
public static final TemplateWebSettingComponent KEY = new TemplateWebSettingComponent();
private TemplateWebSettingComponent() {
}
@Override
public Atom[] refer() {
return new Atom[] {
FineUI.KEY
};
}
@Override
public ScriptPath script(RequestClient req) {
return ScriptPath.build("/com/fr/design/ui/script/template.js");
}
@Override
public StylePath style() {
return StylePath.build("/com/fr/design/ui/script/template.css", ParserType.DYNAMIC);
}
}

28
designer-base/src/test/java/com/fr/design/ui/report/TemplateWebSettingDemo.java

@ -0,0 +1,28 @@
package com.fr.design.ui.report;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ui.ModernUIPane;
import com.fr.design.ui.ModernUIPaneTest;
import javax.swing.*;
import java.awt.*;
/**
* Created by windy on 2019/3/26.
* 模板Web属性demo
*/
public class TemplateWebSettingDemo {
public static void main(String... args) {
final JFrame frame = new JFrame();
frame.setSize(660, 600);
JPanel contentPane = (JPanel) frame.getContentPane();
// 是否需要开启调试窗口
DesignerEnvManager.getEnvManager().setOpenDebug(true);
final ModernUIPane<ModernUIPaneTest.Model> pane = new ModernUIPane.Builder<ModernUIPaneTest.Model>()
.withComponent(TemplateWebSettingComponent.KEY).build();
contentPane.add(pane, BorderLayout.CENTER);
frame.setVisible(true);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
}

20
designer-base/src/test/resources/com/fr/design/ui/demo.html

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script type="text/javascript">
Pool.update = function () {
Pool.data.setAge(parseInt(document.getElementById("age").value));
Pool.data.setName(document.getElementById("name").value);
return Pool.data;
};
</script>
</head>
<body>
<div>测试页面,请点击最下面的按钮</div>
<input id="name" type="text" placeholder="请输入名字"/>
<input id="age" type="number" placeholder="请输入年龄"/>
<img src="emb:/com/fr/design/images/splash_10.gif">
</body>
</html>

11
designer-base/src/test/resources/com/fr/design/ui/fineui.html

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="emb:/com/fr/web/ui/fineui.min.css"/>
<script src="emb:/com/fr/web/ui/fineui.min.js"/>
</head>
<body>
</body>
</html>

12
designer-base/src/test/resources/com/fr/design/ui/script/css/js/common/settingtab/settingtab.css

@ -0,0 +1,12 @@
.bi-setting-tab .tab-group {
background-color: #F2F4F7;
font-size: 12px;
}
.bi-setting-tab .tab-group .tab-item:hover {
color: #3685f2;
}
.bi-setting-tab .tab-group .tab-item.active {
background-color: #ffffff;
color: #3685f2;
border-top: 3px solid #3685f2;
}

0
designer-base/src/test/resources/com/fr/design/ui/script/css/js/index.css

41
designer-base/src/test/resources/com/fr/design/ui/script/js/common/bar.container.js

@ -0,0 +1,41 @@
!(function(){
/**
* 带确定取消的通用控件
*/
var Bar = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-settings-bar-container",
el: {
}
},
render: function() {
return {
type: "bi.vtape",
items: [this.options.el, {
type: "bi.right_vertical_adapt",
height: 24,
rgap: 10,
vgap: 10,
items: [{
type: "bi.button",
level: "ignore",
text: BI.i18nText("Fine-Design_Report_OK"),
handler: function() {
}
}, {
type: "bi.button",
level: "ignore",
text: BI.i18nText("Fine-Design_Basic_Engine_Cancel"),
handler: function() {
}
}]
}]
}
}
})
BI.shortcut("bi.settings.bar_container", Bar)
})();

89
designer-base/src/test/resources/com/fr/design/ui/script/js/common/edit.list.js

@ -0,0 +1,89 @@
!(function () {
/**
* 事件设置
*/
var List = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-report-server-param-setting-edit-list"
},
render: function () {
var self = this;
return {
type: "bi.vtape",
vgap: 5,
items: [{
type: "bi.vertical_adapt",
height: 24,
items: [{
type: "bi.icon_button",
cls: "text-add-tip-font",
width: 24,
height: 24,
handler: function() {
self.group.addItems([self._createItem()])
}
}, {
type: "bi.icon_button",
cls: "close-font",
width: 24,
height: 24,
handler: function() {
self.group.removeItemAt();
}
}, {
type: "bi.icon_button",
cls: "close-font",
width: 24,
height: 24,
handler: function() {
self.removeItemAt(self._getIndexOfItemValue(self.group.getValue()))
}
}]
}, {
type: "bi.button_group",
cls: "bi-border bi-card",
ref: function(_ref) {
self.group = _ref;
},
items: []
}]
};
},
_getIndexOfItemValue: function(values) {
values = BI.isArray(values) ? values : [values];
var indexes = [];
BI.each(this.group.getAllButtons(), function(idx, button){
if(BI.contains(values, button.getValue())) {
indexes.push(idx);
}
});
return indexes;
},
_createItem: function() {
return {
type: "bi.text_button",
textAlign: "left",
hgap: 10,
text: "选项" + this.group.getAllButtons().length,
cls: "bi-list-item-select",
value: BI.UUID()
};
},
populate: function(items) {
this.group.populate(items);
},
addItems: function(items) {
},
removeItemAt: function(indexes) {
this.group.removeItemAt(indexes);
}
});
BI.shortcut("bi.report.server.param_setting.edit_list", List);
})();

33
designer-base/src/test/resources/com/fr/design/ui/script/js/common/form.rowbackground.setting.js

@ -0,0 +1,33 @@
!(function () {
/**
* 填报当前编辑行背景设置相关
*/
var Analysis = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-report-form-background-setting"
},
render: function () {
var self = this, o = this.options;
return {
type: "bi.vertical_adapt",
items: [{
type: "bi.multi_select_item",
logic: {
dynamic: true
},
iconWrapperWidth: 16,
text: BI.i18nText("Fine-Design_Report_Set_Face_Write_Current_Edit_Row_Background")
}, {
el: {
type: "bi.color_chooser",
width: 24,
height: 24
},
lgap: 10
}]
};
}
});
BI.shortcut("bi.report.form_background_setting", Analysis);
})();

54
designer-base/src/test/resources/com/fr/design/ui/script/js/common/globalsingle.combo.js

@ -0,0 +1,54 @@
!(function () {
/**
*
* 为模板单独设置的相关项
*/
var Analysis = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-report-global-or-single-combo",
value: 1
},
render: function () {
var self = this, o = this.options;
return {
type: "bi.vertical_adapt",
rgap: 10,
height: 24,
items: [{
type: "bi.label",
text: BI.i18nText("Fine-Design_Report_Blow_Set")
}, {
type: "bi.text_value_combo",
width: 200,
ref: function(_ref) {
self.combo = _ref;
},
value: o.value,
items: [{
text: BI.i18nText("Fine-Design_Report_I_Want_To_Set_Single"),
value: 1
}, {
text: BI.i18nText("Fine-Design_Form_Using_Server_Report_View_Settings"),
value: 2
}],
listerners: [{
eventName: "EVENT_CHANGE",
action: function() {
}
}]
}]
};
},
getValue: function() {
return self.combo.getValue();
},
setValue: function(v) {
this.combo.setValue(v);
}
});
BI.shortcut("bi.report.global_or_single_combo", Analysis);
})();

53
designer-base/src/test/resources/com/fr/design/ui/script/js/common/leavesetting.js

@ -0,0 +1,53 @@
!(function () {
/**
* 离开提示/直接显示控件/自动暂存相关
*/
var Analysis = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-report-leave-setting",
value: [1]
},
render: function () {
var self = this, o = this.options;
return {
type: "bi.button_group",
value: o.value,
items: BI.createItems([{
text: BI.i18nText("Fine-Design_Report_Unload_Check"),
value: 1
}, {
text: BI.i18nText("Fine-Design_Basic_Engine_Event_Show_Widgets"),
value: 2
}, {
text: BI.i18nText("Fine-Design_Report_Write_Auto_Stash"),
value: 3
}], {
type: "bi.multi_select_item",
hgap: 5,
logic: {
dynamic: true
},
iconWrapperWidth: 16
}),
chooseType: BI.Selection.Multi,
layouts: [{
type: "bi.vertical_adapt",
rgap: 5
}],
ref: function(_ref) {
self.group = _ref;
}
};
},
getValue: function() {
return self.group.getValue();
},
setValue: function(v) {
this.group.setValue(v);
}
});
BI.shortcut("bi.report.leave_setting", Analysis);
})();

53
designer-base/src/test/resources/com/fr/design/ui/script/js/common/reportshow.location.js

@ -0,0 +1,53 @@
!(function () {
/**
* 报表显示位置相关
*/
var Analysis = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-report-server-param-setting-report-show-location"
},
render: function () {
var self = this, o = this.options;
return {
type: "bi.vertical_adapt",
height: 24,
items: [{
type: "bi.label",
text: BI.i18nText("Fine-Design_Report_Show_Location")
}, {
type: "bi.button_group",
ref: function(_ref) {
self.group = _ref;
},
value: 2,
items: BI.createItems([{
text: BI.i18nText("Fine-Design_Report_Center_Display"),
value: 1
}, {
text: BI.i18nText("Fine-Design_Report_Left_Display"),
value: 2
}], {
type: "bi.single_select_radio_item",
logic: {
dynamic: true
}
}),
layouts: [{
type: "bi.left",
lgap: 10
}]
}]
};
},
getValue: function() {
return self.group.getValue();
},
setValue: function(v) {
this.group.setValue(v);
}
});
BI.shortcut("bi.report.server.param_setting.report_show_location", Analysis);
})();

59
designer-base/src/test/resources/com/fr/design/ui/script/js/common/settingtab/settingtab.js

@ -0,0 +1,59 @@
!(function () {
var Tab = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-setting-tab",
value: "",
tabItems: [],
cardCreator: BI.emptyFn
},
render: function () {
var self = this, o = this.options;
return {
type: "bi.vtape",
items: [{
type: "bi.vertical_adapt",
cls: "tab-group",
items: [{
type: "bi.button_group",
layouts: [{
type: "bi.left"
}],
value: o.value,
items: BI.map(o.tabItems, function(idx, item){
return {
el: BI.extend({
type: "bi.text_button",
hgap: 10,
height: 24
}, item)
};
}),
listeners: [{
eventName: BI.ButtonGroup.EVENT_CHANGE,
action: function (v) {
self.tableTab.setSelect(v);
}
}],
ref: function (_ref) {
// self.buttons = _ref;
}
}],
height: 24
}, {
type: "bi.tab",
cls: "bi-card",
showIndex: o.value,
cardCreator: this.options.cardCreator,
ref: function (ref) {
self.tableTab = ref;
}
}]
};
}
});
BI.shortcut("bi.setting.tab", Tab);
})();

17
designer-base/src/test/resources/com/fr/design/ui/script/js/common/settingtab/settingtab.less

@ -0,0 +1,17 @@
@import "../../index.less";
.bi-setting-tab {
& .tab-group {
background-color: @color-bi-background-light-gray;
font-size: @font-size-12;
& .tab-item {
&:hover {
color: @color-bi-text-highlight;
}
&.active {
background-color: @color-bi-background-default;
color: @color-bi-text-highlight;
border-top: 3px solid @color-bi-text-highlight;
}
}
}
}

53
designer-base/src/test/resources/com/fr/design/ui/script/js/common/sheetlabel.position.js

@ -0,0 +1,53 @@
!(function () {
/**
* sheet标签页显示位置
*/
var Analysis = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-report-server-param-setting-report-show-location"
},
render: function () {
var self = this, o = this.options;
return {
type: "bi.vertical_adapt",
height: 24,
items: [{
type: "bi.label",
text: BI.i18nText("Fine-Design_Report_Sheet_Label_Page_Display_Position")
}, {
type: "bi.button_group",
ref: function(_ref) {
self.group = _ref;
},
value: 2,
items: BI.createItems([{
text: BI.i18nText("Fine-Design_Form_Base_Top"),
value: 1
}, {
text: BI.i18nText("Fine-Design_Report_Bottom"),
value: 2
}], {
type: "bi.single_select_radio_item",
logic: {
dynamic: true
}
}),
layouts: [{
type: "bi.left",
lgap: 10
}]
}]
};
},
getValue: function() {
return self.group.getValue();
},
setValue: function(v) {
this.group.setValue(v);
}
});
BI.shortcut("bi.report.sheet_label_location", Analysis);
})();

126
designer-base/src/test/resources/com/fr/design/ui/script/js/common/toobar/toobar.js

@ -0,0 +1,126 @@
!(function(){
var ToolBar = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-settings-tool-bar",
value: [1]
},
render: function() {
var self = this, o = this.options;
return {
type: "bi.vertical",
items: [{
type: "bi.left_right_vertical_adapt",
height: 24,
bgap: 15,
rhgap: 10,
items: {
left: [{
type: "bi.label",
text: BI.i18nText("Fine-Design_Report_Mobile_ToolBar"),
width: 70,
textAlign: "left"
}, {
type: "bi.button_group",
value: o.value,
chooseType: BI.Selection.Multi,
items: BI.createItems([{
text: BI.i18nText("Fine-Design_Report_ToolBar_Top"),
value: 1,
listeners: [{
eventName: "EVENT_CHANGE",
action: function() {
if(this.isSelected()) {
self._populateDefault();
} else {
self.topRegion.populate();
}
}
}]
}, {
text: BI.i18nText("Fine-Design_Report_ToolBar_Bottom"),
value: 2
}], {
type: "bi.multi_select_item",
hgap: 5,
logic: {
dynamic: true
},
iconWrapperWidth: 16
}),
ref: function(_ref) {
self.group = _ref;
},
layouts: [{
type: "bi.left"
}],
listeners: [{
eventName: "EVENT_CHANGE",
action: function() {
}
}]
}],
right: [{
el: {
type: "bi.text_button",
cls: "bi-border",
text: BI.i18nText("Fine-Design_Basic_Scale_Custom_Button"),
handler: function() {
},
hgap: 5
}
}, {
el: {
type: "bi.text_button",
cls: "bi-border",
text: BI.i18nText("Fine-Design_Report_Restore_Default"),
handler: function() {
},
hgap: 5
}
}]
}
}, {
el: {
type: "bi.settings.tool_bar.region",
height: 56,
title: BI.i18nText("Fine-Design_Report_ToolBar_Top"),
ref: function(_ref) {
self.topRegion = _ref;
},
items: BI.contains(o.value, 1) ? this._createDefaultItems() : []
},
bgap: 20
}, {
type: "bi.settings.tool_bar.region",
height: 56,
title: BI.i18nText("Fine-Design_Report_ToolBar_Bottom"),
ref: function(_ref) {
self.bottomRegion = _ref;
}
}]
}
},
_createDefaultItems: function() {
return BI.createItems(BI.Constants.getConstant("bi.constant.report.template.web_setting.tools"), {
type: "bi.icon_text_item",
height: 24,
extraCls: "bi-background bi-list-item-select bi-border-radius",
logic: {
dynamic: true
},
textHgap: 10,
value: BI.UUID()
})
},
_populateDefault: function() {
this.topRegion.populate(this._createDefaultItems());
}
})
BI.shortcut("bi.settings.tool_bar", ToolBar)
})();

42
designer-base/src/test/resources/com/fr/design/ui/script/js/common/toobar/toolbar.region.js

@ -0,0 +1,42 @@
!(function(){
var Region = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-settings-tool-bar-region",
title: ""
},
render: function() {
var self = this, o = this.options;
return [{
type: "bi.button_group",
cls: "bi-border",
items: o.items,
chooseType: BI.Selection.Multi,
layouts: [{
type: "bi.vertical_adapt",
hgap: 10
}],
ref: function(_ref) {
self.group = _ref;
}
}, {
type: "bi.absolute",
items: [{
el: {
type: "bi.label",
cls: "bi-background",
text: o.title
},
top: -10,
left: 10
}]
}]
},
populate: function(items) {
this.group.populate(items);
}
})
BI.shortcut("bi.settings.tool_bar.region", Region);
})();

67
designer-base/src/test/resources/com/fr/design/ui/script/js/common/toolbarHeight.select.js

@ -0,0 +1,67 @@
!(function () {
/**
* 工具栏高度相关
*/
var Analysis = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-report-server-param-setting-tool-bar-height-select",
height: 24,
value: 2
},
render: function () {
var self = this, o = this.options;
return {
type: "bi.vertical_adapt",
height: 24,
items: [{
el: {
type: "bi.label",
text: BI.i18nText("Fine-Design_Report_Mobile_ToolBar_Height")
},
rgap: 10
}, {
type: "bi.button_group",
value: o.value,
ref: function(_ref) {
self.group = _ref;
},
items: BI.createItems([{
text: BI.i18nText("Fine-Design_Report_Tool_Bar_High"),
value: 1
}, {
text: BI.i18nText("Fine-Design_Report_Tool_Bar_Middle"),
value: 2
}, {
text: BI.i18nText("Fine-Design_Report_Tool_Bar_Low"),
value: 3
}], {
type: "bi.single_select_radio_item",
logic: {
dynamic: true
}
}),
layouts: [{
type: "bi.vertical_adapt"
}],
listeners: [{
eventName: "EVENT_CHANGE",
action: function() {
}
}]
}]
};
},
getValue: function() {
return self.group.getValue();
},
setValue: function(v) {
this.group.setValue(v);
}
});
BI.shortcut("bi.report.server.param_setting.tool_bar_height_select", Analysis);
})();

47
designer-base/src/test/resources/com/fr/design/ui/script/js/common/usetoolbar.js

@ -0,0 +1,47 @@
!(function () {
/**
* 使用工具栏相关
*/
var Analysis = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-report-server-param-setting-use-tool-bar"
},
render: function () {
var self = this;
return {
type: "bi.vertical_adapt",
height: 24,
items: [{
el: {
type: "bi.multi_select_item",
ref: function(_ref) {
self.multiSelect = _ref;
},
hgap: 5,
selected: true,
text: BI.i18nText("Fine-Design_Report_Use_ToolBar"),
logic: {
dynamic: true
},
iconWrapperWidth: 16
}
}, {
type: "bi.text_button",
cls: "bi-card bi-border",
text: BI.i18nText("Fine-Design_Report_Edit"),
hgap: 10
}]
};
},
getValue: function() {
return self.multiSelect.getSelected();
},
setValue: function(v) {
this.multiSelect.setSelected(v);
}
});
BI.shortcut("bi.report.server.param_setting.use_tool_bar", Analysis);
})();

30
designer-base/src/test/resources/com/fr/design/ui/script/js/enum.js

@ -0,0 +1,30 @@
window.BICst = window.BICst || {};
BICst.REPORT_SERVER_PARAM = {
SPLIT_PAGE_PREVIEW_SETTING: 1,
FORM_PAGE_SETTING: 2,
DATA_ANALYSIS_SETTING: 3,
IMPORT_CSS: 4,
IMPORT_JS: 5,
ERROR_TEMPLATE_DEFINE: 6,
PRINT_SETTING: 7
};
BICst.REPORT_TEMPLATE_WEB_SETTING = {
BASE: 1,
PRINT: 2,
SPLIT_PAGE_PREVIEW_SETTING: 3,
FORM_PAGE_SETTING: 4,
DATA_ANALYSIS_SETTING: 5,
BROWSER: 6,
IMPORT_CSS: 7,
IMPORT_JS: 8
};
BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS = {
FIRST_PAGE: 1,
PRE_PAGE: 2,
NEXT_PAGE: 3,
LAST_PAGE: 4,
PRINT: 5,
EXPORT: 6,
EMAIL: 7
};

53
designer-base/src/test/resources/com/fr/design/ui/script/js/i18n.js

@ -0,0 +1,53 @@
BI.addI18n({
"Fine-Design_Report_WEB_Pagination_Setting": "分页预览设置",
"Fine-Design_Report_WEB_Write_Setting": "填报页面设置",
"Fine-Design_Report_Data_Analysis_Settings": "数据分析设置",
"Fine-Design_Report_ReportServerP_Import_Css": "引用Css",
"Fine-Design_Report_ReportServerP_Import_JavaScript": "引用JavaScript",
"Fine-Design_Report_Error_Handler_Template": "出错模板定义",
"Fine-Design_Report_Print_Setting": "打印设置",
"Fine-Design_Report_Mobile_ToolBar": "工具栏",
"Fine-Design_Report_Tool_Bar_High": "高",
"Fine-Design_Report_Tool_Bar_Middle": "中",
"Fine-Design_Report_Tool_Bar_Low": "低",
"Fine-Design_Report_Mobile_ToolBar_Height": "工具栏高度",
"Fine-Design_Report_Is_Paint_Page": "以图片方式显示",
"Fine-Design_Report_IS_Auto_Scale": "iframe嵌入时自动缩放",
"Fine-Design_Report_IS_TD_HEAVY_EXPORT": "重方式输出格子",
"Fine-Design_Report_Use_ToolBar": "使用工具栏",
"Fine-Design_Report_Show_Location": "报表显示位置",
"Fine-Design_Report_Center_Display": "居中展示",
"Fine-Design_Report_Left_Display": "左展示",
"Fine-Design_Report_Editing_Listeners": "事件编辑",
"Fine-Design_Report_Edit": "编辑",
"Fine-Design_Report_Sheet_Label_Page_Display_Position": "sheet标签页显示位置:",
"Fine-Design_Form_Base_Top": "上",
"Fine-Design_Report_Bottom": "下",
"Fine-Design_Report_Set_Face_Write_Current_Edit_Row_Background": "当前编辑行背景设置",
"Fine-Design_Report_Unload_Check": "未提交离开提示",
"Fine-Design_Basic_Engine_Event_Show_Widgets": "直接显示控件",
"Fine-Design_Report_Write_Auto_Stash": "自动暂存",
"Fine-Design_Report_Engine_Sort_Sort": "排序",
"Fine-Design_Report_Engine_Selection_Filter": "条件筛选",
"Fine-Design_Report_Engine_List_Filter": "列表筛选",
"Fine-Design_Basic_Engine_Cancel": "取消",
"Fine-Design_Report_OK": "确定",
"Fine-Design_Report_Basic": "基本",
"Fine-Design_Report_Printer(Server)": "打印机(服务器)",
"Fine-Design_Report_Browser_Background": "浏览器背景",
"Fine-Design_Report_I_Want_To_Set_Single": "为该模板单独设置",
"Fine-Design_Form_Using_Server_Report_View_Settings": "采用服务器设置",
"Fine-Design_Report_Blow_Set": "以下设置:",
"Fine-Design_Report_PageSetup_Page": "页面",
"Fine-Design_Report_ToolBar_Top": "顶部工具栏",
"Fine-Design_Report_ToolBar_Bottom": "底部工具栏",
"Fine-Design_Basic_Scale_Custom_Button": "自定义",
"Fine-Design_Report_Restore_Default": "恢复默认",
"Fine-Design_Report_Engine_ReportServerP_First": "首页",
"Fine-Design_Report_Engine_ReportServerP_Previous": "上一页",
"Fine-Design_Report_Engine_ReportServerP_Next": "下一页",
"Fine-Design_Report_Engine_ReportServerP_Last": "末页",
"Fine-Design_Report_Engine_Print": "打印",
"Fine-Design_Report_Engine_Export": "导出",
"Fine-Design_Report_Engine_Email": "邮件"
});

1
designer-base/src/test/resources/com/fr/design/ui/script/js/index.less

@ -0,0 +1 @@
@import "../../fineui/src/less/index.less";

59
designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/card/data.analysis.js

@ -0,0 +1,59 @@
!(function () {
/**
* 服务器 数据分析设置
*/
var Analysis = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-report-server-param-setting-data-analysis"
},
render: function () {
return {
type: "bi.vtape",
vgap: 10,
hgap: 10,
items: [{
type: "bi.button_group",
height: 24,
value: [1,2,3],
items: BI.createItems([{
text: BI.i18nText("Fine-Design_Report_Engine_Sort_Sort"),
value: 1
}, {
text: BI.i18nText("Fine-Design_Report_Engine_Selection_Filter"),
value: 2
}, {
text: BI.i18nText("Fine-Design_Report_Engine_List_Filter"),
value: 2
}], {
type: "bi.multi_select_item",
logic: {
dynamic: true
},
iconWrapperWidth: 16,
hgap: 5
}),
chooseType: BI.Selection.Multi,
layouts: [{
type: "bi.vertical_adapt"
}]
}, {
type: "bi.report.server.param_setting.use_tool_bar",
height: 24,
value: true
}, {
type: "bi.report.server.param_setting.tool_bar_height_select",
height: 24
}, {
type: "bi.label",
height: 24,
textAlign: "left",
text: BI.i18nText("Fine-Design_Report_Editing_Listeners") + ":",
}, {
type: "bi.report.server.param_setting.edit_list"
}]
};
}
});
BI.shortcut("bi.report.server.param_setting.data_analysis", Analysis);
})();

69
designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/card/form.page.js

@ -0,0 +1,69 @@
!(function () {
/**
* 服务器 填报预览设置
*/
var Analysis = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-report-server-param-setting-form-page"
},
render: function () {
return {
type: "bi.vtape",
vgap: 10,
hgap: 10,
items: [{
type: "bi.grid",
height: 78,
columns: 2,
rows: 2,
items: [{
column: 0,
row: 0,
el: {
type: "bi.report.sheet_label_location",
height: 24
}
}, {
column: 1,
row: 0,
el: {
type: "bi.report.server.param_setting.report_show_location",
height: 24
}
}, {
column: 0,
row: 1,
el: {
type: "bi.report.form_background_setting",
height: 24
}
}, {
column: 1,
row: 1,
el: {
type: "bi.report.leave_setting",
height: 24
}
}]
}, {
type: "bi.report.server.param_setting.use_tool_bar",
height: 24,
value: true
}, {
type: "bi.report.server.param_setting.tool_bar_height_select",
height: 24
}, {
type: "bi.label",
height: 24,
textAlign: "left",
text: BI.i18nText("Fine-Design_Report_Editing_Listeners") + ":",
}, {
type: "bi.report.server.param_setting.edit_list"
}]
};
}
});
BI.shortcut("bi.report.server.param_setting.form_page", Analysis);
})();

66
designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/card/page.preview.js

@ -0,0 +1,66 @@
!(function () {
/**
* 服务器 分页预览设置
*/
var Analysis = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-report-server-param-setting-page-preview"
},
render: function () {
return {
type: "bi.vtape",
vgap: 10,
hgap: 10,
items: [{
type: "bi.report.server.param_setting.report_show_location",
height: 24
}, {
type: "bi.button_group",
height: 92,
chooseType: BI.Selection.Multi,
items: BI.createItems([{
el: {
text: BI.i18nText("Fine-Design_Report_Is_Paint_Page"),
value: 1
},
bgap: 10
}, {
el: {
text: BI.i18nText("Fine-Design_Report_IS_Auto_Scale"),
value: 2
},
bgap: 10
}, {
text: BI.i18nText("Fine-Design_Report_IS_TD_HEAVY_EXPORT"),
value: 3
}], {
type: "bi.multi_select_item",
hgap: 5,
logic: {
dynamic: true
},
iconWrapperWidth: 16
}),
layouts: [{
type: "bi.vertical"
}]
}, {
type: "bi.report.server.param_setting.use_tool_bar",
height: 24
}, {
type: "bi.report.server.param_setting.tool_bar_height_select",
height: 24
}, {
type: "bi.label",
height: 24,
textAlign: "left",
text: BI.i18nText("Fine-Design_Report_Editing_Listeners") + ":",
}, {
type: "bi.report.server.param_setting.edit_list"
}]
};
}
});
BI.shortcut("bi.report.server.param_setting.page_preview", Analysis);
})();

33
designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/reportserver.constants.js

@ -0,0 +1,33 @@
!(function () {
BI.constant("bi.constant.report.server.param_setting", [
{
text: BI.i18nText("Fine-Design_Report_WEB_Pagination_Setting"),
cls: "tab-item",
value: BICst.REPORT_SERVER_PARAM.SPLIT_PAGE_PREVIEW_SETTING
}, {
text: BI.i18nText("Fine-Design_Report_WEB_Write_Setting"),
cls: "tab-item",
value: BICst.REPORT_SERVER_PARAM.FORM_PAGE_SETTING
}, {
text: BI.i18nText("Fine-Design_Report_Data_Analysis_Settings"),
cls: "tab-item",
value: BICst.REPORT_SERVER_PARAM.DATA_ANALYSIS_SETTING
}, {
text: BI.i18nText("Fine-Design_Report_ReportServerP_Import_Css"),
cls: "tab-item",
value: BICst.REPORT_SERVER_PARAM.IMPORT_CSS
}, {
text: BI.i18nText("Fine-Design_Report_ReportServerP_Import_JavaScript"),
cls: "tab-item",
value: BICst.REPORT_SERVER_PARAM.IMPORT_JS
}, {
text: BI.i18nText("Fine-Design_Report_Error_Handler_Template"),
cls: "tab-item",
value: BICst.REPORT_SERVER_PARAM.ERROR_TEMPLATE_DEFINE
}, {
text: BI.i18nText("Fine-Design_Report_Print_Setting"),
cls: "tab-item",
value: BICst.REPORT_SERVER_PARAM.PRINT_SETTING
}]
);
})();

50
designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/reportserver.js

@ -0,0 +1,50 @@
!(function () {
/**
* 报表服务器参数面板
*/
var Tab = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-report-server-param-setting"
},
render: function () {
return {
type: "bi.setting.tab",
value: BICst.REPORT_SERVER_PARAM.SPLIT_PAGE_PREVIEW_SETTING,
tabItems: BI.Constants.getConstant("bi.constant.report.server.param_setting"),
cardCreator: BI.bind(this._createCard, this)
};
},
_createCard: function (v) {
switch (v) {
case BICst.REPORT_SERVER_PARAM.SPLIT_PAGE_PREVIEW_SETTING:
return {
type: "bi.report.server.param_setting.page_preview"
};
case BICst.REPORT_SERVER_PARAM.FORM_PAGE_SETTING:
return {
type: "bi.report.server.param_setting.form_page"
};
case BICst.REPORT_SERVER_PARAM.DATA_ANALYSIS_SETTING:
return {
type: "bi.report.server.param_setting.data_analysis"
}
case BICst.REPORT_SERVER_PARAM.IMPORT_CSS:
case BICst.REPORT_SERVER_PARAM.IMPORT_JS:
case BICst.REPORT_SERVER_PARAM.ERROR_TEMPLATE_DEFINE:
case BICst.REPORT_SERVER_PARAM.PRINT_SETTING:
default:
return {
type: "bi.label",
text: "1"
};
}
}
});
BI.shortcut("bi.report.server.param_setting", Tab);
})();

64
designer-base/src/test/resources/com/fr/design/ui/script/js/templatewebproperties/card/form.page.js

@ -0,0 +1,64 @@
!(function () {
/**
* 填报页面设置
*/
var Analysis = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-report-server-param-setting-form-page"
},
render: function () {
return {
type: "bi.vtape",
vgap: 10,
hgap: 10,
items: [{
type: "bi.report.global_or_single_combo",
height: 24
}, {
type: "bi.grid",
height: 78,
columns: 2,
rows: 2,
items: [{
column: 0,
row: 0,
el: {
type: "bi.report.sheet_label_location"
}
}, {
column: 1,
row: 0,
el: {
type: "bi.report.server.param_setting.report_show_location",
height: 24
}
}, {
column: 0,
row: 1,
el: {
type: "bi.report.form_background_setting"
}
}, {
column: 1,
row: 1,
el: {
type: "bi.report.leave_setting"
}
}]
}, {
type: "bi.settings.tool_bar",
height: 180
}, {
type: "bi.label",
height: 24,
textAlign: "left",
text: BI.i18nText("Fine-Design_Report_Editing_Listeners") + ":",
}, {
type: "bi.report.server.param_setting.edit_list"
}]
};
}
});
BI.shortcut("bi.report.template.web_setting.form_page", Analysis);
})();

73
designer-base/src/test/resources/com/fr/design/ui/script/js/templatewebproperties/card/page.preview.js

@ -0,0 +1,73 @@
!(function () {
/**
* 分页预览设置
*/
var Analysis = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-report-server-param-setting-page-preview"
},
render: function () {
return {
type: "bi.vtape",
vgap: 10,
hgap: 10,
items: [{
type: "bi.report.global_or_single_combo",
height: 24
}, {
type: "bi.report.server.param_setting.report_show_location",
height: 24
}, {
type: "bi.vertical_adapt",
height: 24,
items: [{
type: "bi.label",
text: BI.i18nText("Fine-Design_Report_PageSetup_Page"),
textAlign: "right",
width: 70
}, {
el: {
type: "bi.button_group",
height: 24,
chooseType: BI.Selection.Multi,
items: BI.createItems([{
text: BI.i18nText("Fine-Design_Report_Is_Paint_Page"),
value: 1
}, {
text: BI.i18nText("Fine-Design_Report_IS_Auto_Scale"),
value: 2
}, {
text: BI.i18nText("Fine-Design_Report_IS_TD_HEAVY_EXPORT"),
value: 3
}], {
type: "bi.multi_select_item",
hgap: 5,
logic: {
dynamic: true
},
iconWrapperWidth: 16
}),
layouts: [{
type: "bi.left",
lgap: 5
}]
},
lgap: 10
}]
}, {
type: "bi.settings.tool_bar",
height: 180
}, {
type: "bi.label",
height: 24,
textAlign: "left",
text: BI.i18nText("Fine-Design_Report_Editing_Listeners") + ":",
}, {
type: "bi.report.server.param_setting.edit_list"
}]
};
}
});
BI.shortcut("bi.report.template.web_setting.page_preview", Analysis);
})();

69
designer-base/src/test/resources/com/fr/design/ui/script/js/templatewebproperties/templateweb.constants.js

@ -0,0 +1,69 @@
!(function () {
BI.constant("bi.constant.report.template.web_setting", [
{
text: BI.i18nText("Fine-Design_Report_Basic"),
cls: "tab-item",
value: BICst.REPORT_TEMPLATE_WEB_SETTING.BASE
}, {
text: BI.i18nText("Fine-Design_Report_Printer(Server)"),
cls: "tab-item",
value: BICst.REPORT_TEMPLATE_WEB_SETTING.PRINT
}, {
text: BI.i18nText("Fine-Design_Report_WEB_Pagination_Setting"),
cls: "tab-item",
value: BICst.REPORT_TEMPLATE_WEB_SETTING.SPLIT_PAGE_PREVIEW_SETTING
}, {
text: BI.i18nText("Fine-Design_Report_WEB_Write_Setting"),
cls: "tab-item",
value: BICst.REPORT_TEMPLATE_WEB_SETTING.FORM_PAGE_SETTING
}, {
text: BI.i18nText("Fine-Design_Report_Data_Analysis_Settings"),
cls: "tab-item",
value: BICst.REPORT_TEMPLATE_WEB_SETTING.DATA_ANALYSIS_SETTING
}, {
text: BI.i18nText("Fine-Design_Report_Browser_Background"),
cls: "tab-item",
value: BICst.REPORT_TEMPLATE_WEB_SETTING.BROWSER
}, {
text: BI.i18nText("Fine-Design_Report_ReportServerP_Import_Css"),
cls: "tab-item",
value: BICst.REPORT_TEMPLATE_WEB_SETTING.IMPORT_CSS
}, {
text: BI.i18nText("Fine-Design_Report_ReportServerP_Import_JavaScript"),
cls: "tab-item",
value: BICst.REPORT_TEMPLATE_WEB_SETTING.IMPORT_JS
}]
);
BI.constant("bi.constant.report.template.web_setting.tools", [
{
text: BI.i18nText("Fine-Design_Report_Engine_ReportServerP_First"),
cls: "close-font",
value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.FIRST_PAGE
}, {
text: BI.i18nText("Fine-Design_Report_Engine_ReportServerP_Previous"),
cls: "close-font",
value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.PRE_PAGE
}, {
text: BI.i18nText("Fine-Design_Report_Engine_ReportServerP_Next"),
cls: "close-font",
value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.NEXT_PAGE
}, {
text: BI.i18nText("Fine-Design_Report_Engine_ReportServerP_Last"),
cls: "close-font",
value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.LAST_PAGE
}, {
text: BI.i18nText("Fine-Design_Report_Engine_Print"),
cls: "close-font",
value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.PRINT
}, {
text: BI.i18nText("Fine-Design_Report_Engine_Export"),
cls: "close-font",
value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.EXPORT
}, {
text: BI.i18nText("Fine-Design_Report_Engine_Email"),
cls: "close-font",
value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.EMAIL
}]
);
})();

48
designer-base/src/test/resources/com/fr/design/ui/script/js/templatewebproperties/templateweb.js

@ -0,0 +1,48 @@
!(function () {
/**
* 模板Web属性面板
*/
var Tab = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-report-template-web-setting"
},
render: function () {
return {
type: "bi.setting.tab",
value: BICst.REPORT_TEMPLATE_WEB_SETTING.SPLIT_PAGE_PREVIEW_SETTING,
tabItems: BI.Constants.getConstant("bi.constant.report.template.web_setting"),
cardCreator: BI.bind(this._createCard, this)
};
},
_createCard: function (v) {
switch (v) {
case BICst.REPORT_TEMPLATE_WEB_SETTING.SPLIT_PAGE_PREVIEW_SETTING:
return {
type: "bi.report.template.web_setting.page_preview"
}
case BICst.REPORT_TEMPLATE_WEB_SETTING.FORM_PAGE_SETTING:
return {
type: "bi.report.template.web_setting.form_page"
}
case BICst.REPORT_TEMPLATE_WEB_SETTING.DATA_ANALYSIS_SETTING:
case BICst.REPORT_TEMPLATE_WEB_SETTING.BASE:
case BICst.REPORT_TEMPLATE_WEB_SETTING.PRINT:
case BICst.REPORT_TEMPLATE_WEB_SETTING.BROWSER:
case BICst.REPORT_TEMPLATE_WEB_SETTING.IMPORT_CSS:
case BICst.REPORT_TEMPLATE_WEB_SETTING.IMPORT_JS:
default:
return {
type: "bi.label",
text: "1"
};
}
}
});
BI.shortcut("bi.report.template.web_setting", Tab);
})();

12
designer-base/src/test/resources/com/fr/design/ui/script/report.css

@ -0,0 +1,12 @@
.bi-setting-tab .tab-group {
background-color: #F2F4F7;
font-size: 12px;
}
.bi-setting-tab .tab-group .tab-item:hover {
color: #3685f2;
}
.bi-setting-tab .tab-group .tab-item.active {
background-color: #ffffff;
color: #3685f2;
border-top: 3px solid #3685f2;
}

1328
designer-base/src/test/resources/com/fr/design/ui/script/report.js

File diff suppressed because it is too large Load Diff

57
designer-base/src/test/resources/com/fr/design/ui/script/start.js

@ -0,0 +1,57 @@
window.addEventListener("load", function (ev) {
var combo1 = BI.createWidget({
type: "bi.vertical",
items: [
{
type: "bi.text_value_combo",
text: "选项1",
width: 300,
items: [
{
el: {
type: "bi.single_select_radio_item",
width: 290,
text: "选项1",
value: 1
},
text: "选项1",
value: 1,
lgap: 10
},
{
el: {
type: "bi.single_select_radio_item",
width: 290,
text: "选项2",
value: 2
},
lgap: 10,
text: "选项2",
value: 2
},
{
el: {
type: "bi.single_select_radio_item",
width: 290,
text: "选项3",
value: 3
},
lgap: 10,
text: "选项3",
value: 3
}
]
}
]
});
BI.createWidget({
type:"bi.absolute",
element: "body",
items: [{
el: combo1,
left: 100,
top: 100
}]
});
});

12
designer-base/src/test/resources/com/fr/design/ui/script/template.css

@ -0,0 +1,12 @@
.bi-setting-tab .tab-group {
background-color: #F2F4F7;
font-size: 12px;
}
.bi-setting-tab .tab-group .tab-item:hover {
color: #3685f2;
}
.bi-setting-tab .tab-group .tab-item.active {
background-color: #ffffff;
color: #3685f2;
border-top: 3px solid #3685f2;
}

1328
designer-base/src/test/resources/com/fr/design/ui/script/template.js

File diff suppressed because it is too large Load Diff

2
designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java

@ -25,7 +25,7 @@ public class ChartMapEditorAction extends UpdateAction {
int port = DesignerEnvManager.getEnvManager().getEmbedServerPort(); int port = DesignerEnvManager.getEnvManager().getEmbedServerPort();
String web = GeneralContext.getCurrentAppNameOfEnv(); String web = GeneralContext.getCurrentAppNameOfEnv();
String serverlet = ServerConfig.getInstance().getServletName(); String serverlet = ServerConfig.getInstance().getServletName();
ServerStarter.browserURLWithLocalEnv(WorkContext.getCurrent().isLocal() ? String.format("http://localhost:%d/%s/%s/view/report?op=map", port, web, serverlet) : WorkContext.getCurrent().getPath() + "/view/report?op=map"); ServerStarter.browserURLWithLocalEnv(WorkContext.getCurrent().isLocal() ? String.format("http://localhost:%d/%s/%s/map/edit", port, web, serverlet) : WorkContext.getCurrent().getPath() + "/map/edit");
} }
} }

38
designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java

@ -54,6 +54,9 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/** /**
* @author neil * @author neil
@ -181,12 +184,6 @@ public class InformationCollector implements XMLReadable, XMLWriter {
} }
private void sendUserInfo(){ private void sendUserInfo(){
long currentTime = new Date().getTime();
long lastTime = getLastTimeMillis();
if (currentTime - lastTime <= DELTA) {
return;
}
JSONObject content = getJSONContentAsByte(); JSONObject content = getJSONContentAsByte();
String url = CloudCenter.getInstance().acquireUrlByKind("user.info.v10"); String url = CloudCenter.getInstance().acquireUrlByKind("user.info.v10");
boolean success = false; boolean success = false;
@ -204,13 +201,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
} }
} }
private void sendFunctionsInfo(){ private void sendFunctionsInfo(long currentTime, long lastTime){
Date current = new Date();
long lastTime = getLastTimeMillis();
long currentTime = current.getTime();
if (currentTime - lastTime <= DELTA) {
return;
}
FineLoggerFactory.getLogger().info("Start sent function records to the cloud center..."); FineLoggerFactory.getLogger().info("Start sent function records to the cloud center...");
queryAndSendOnePageFunctionContent(currentTime, lastTime, 0); queryAndSendOnePageFunctionContent(currentTime, lastTime, 0);
long page = (totalCount/PAGE_SIZE) + 1; long page = (totalCount/PAGE_SIZE) + 1;
@ -350,23 +341,22 @@ public class InformationCollector implements XMLReadable, XMLWriter {
return; return;
} }
Thread sendThread = new Thread(new Runnable() { ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
service.schedule(new Runnable() {
@Override @Override
public void run() { public void run() {
try { long currentTime = new Date().getTime();
//读取XML的5分钟后开始发请求连接服务器. long lastTime = getLastTimeMillis();
Thread.sleep(SEND_DELAY); if (currentTime - lastTime > DELTA) {
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
sendUserInfo(); sendUserInfo();
sendFunctionsInfo(); sendFunctionsInfo(currentTime, lastTime);
}
TemplateInfoCollector.getInstance().sendTemplateInfo(); TemplateInfoCollector.getInstance().sendTemplateInfo();
ErrorInfoUploader.getInstance().sendErrorInfo(); ErrorInfoUploader.getInstance().sendErrorInfo();
} }
}); }, SEND_DELAY, TimeUnit.SECONDS);
sendThread.start();
} }
/** /**

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

@ -24,7 +24,7 @@ import java.util.concurrent.TimeUnit;
public class SplashContext { public class SplashContext {
public static final String SPLASH_PATH = getSplashPath(); public static final String SPLASH_PATH = getSplashPath();
public static final String SPLASH_CACHE_NAME = getSplashCacheName(); public static final String SPLASH_CACHE_NAME = SPLASH_PATH.substring(SPLASH_PATH.lastIndexOf("/") + 1);
private static final int FETCH_ONLINE_MAX_TIMES = 50; private static final int FETCH_ONLINE_MAX_TIMES = 50;
private static final SplashContext SPLASH_CONTEXT = new SplashContext(); private static final SplashContext SPLASH_CONTEXT = new SplashContext();
@ -166,18 +166,13 @@ public class SplashContext {
} }
private static String getSplashPath() { private static String getSplashPath() {
if (DesignerEnvManager.getEnvManager().getLanguage().equals(Locale.JAPAN)) { Locale locale = DesignerEnvManager.getEnvManager().getLanguage();
if (Locale.US.equals(locale) || Locale.KOREA.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"; return "/com/fr/design/images/splash_10_jp.gif";
} else { } else {
return "/com/fr/design/images/splash_10.gif"; return "/com/fr/design/images/splash_10.gif";
} }
} }
private static String getSplashCacheName() {
if (DesignerEnvManager.getEnvManager().getLanguage().equals(Locale.JAPAN)) {
return "splash_10_jp.gif";
} else {
return "splash_10.gif";
}
}
} }

BIN
designer-realize/src/main/resources/com/fr/design/images/splash_10_en.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 MiB

BIN
designer-realize/src/main/resources/com/fr/design/images/splash_10_jp.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 MiB

After

Width:  |  Height:  |  Size: 16 MiB

Loading…
Cancel
Save