Browse Source

Merge branch 'feature/10.0' of http://cloud.finedevelop.com:2015/scm/~kerry/design_10.0 into feature/10.0

master
kerry 7 years ago
parent
commit
0d61980263
  1. 193
      designer-base/src/com/fr/design/DesignerEnvManager.java
  2. 26
      designer-base/src/com/fr/design/actions/file/LocalePane.java
  3. 40
      designer-base/src/com/fr/design/actions/file/SwitchExistEnv.java
  4. 53
      designer-base/src/com/fr/design/actions/help/AboutPane.java
  5. 22
      designer-base/src/com/fr/design/env/EnvGenerator.java
  6. 134
      designer-base/src/com/fr/design/env/RemoteEnvConfig.java
  7. 9
      designer-base/src/com/fr/design/file/HistoryTemplateListPane.java
  8. 37
      designer-base/src/com/fr/design/file/TemplateTreePane.java
  9. 16
      designer-base/src/com/fr/design/formula/JavaEditorPane.java
  10. 203
      designer-base/src/com/fr/design/gui/icombobox/FRTreeComboBox.java
  11. 53
      designer-base/src/com/fr/design/gui/imenu/UIBasicMenuItemUI.java
  12. 20
      designer-base/src/com/fr/design/gui/ispinner/UISpinner.java
  13. 25
      designer-base/src/com/fr/design/gui/itree/filetree/EnvFileTree.java
  14. 8
      designer-base/src/com/fr/design/gui/itree/filetree/TemplateFileTree.java
  15. 46
      designer-base/src/com/fr/design/mainframe/DesignerFrame.java
  16. 62
      designer-base/src/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  17. 21
      designer-base/src/com/fr/design/mainframe/JTemplate.java
  18. 59
      designer-base/src/com/fr/design/mainframe/TemplatePane.java
  19. 15
      designer-base/src/com/fr/design/mainframe/form/FormECDesignerProvider.java
  20. 14
      designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java
  21. 2
      designer-base/src/com/fr/design/roleAuthority/RoleDataWrapper.java
  22. 12
      designer-base/src/com/fr/design/style/color/ColorSelectConfigManager.java
  23. 33
      designer-base/src/com/fr/design/utils/DesignUtils.java
  24. 12
      designer-base/src/com/fr/design/widget/EventCreator.java
  25. 4
      designer-base/src/com/fr/env/EnvListPane.java
  26. 2
      designer-base/src/com/fr/env/LocalEnvPane.java
  27. 288
      designer-base/src/com/fr/env/RemoteEnv.java
  28. 8
      designer-base/src/com/fr/env/RemoteEnvPane.java
  29. 88
      designer-base/src/com/fr/env/RemoteEnvPane2.java
  30. 11
      designer-base/src/com/fr/env/SignIn.java
  31. 50
      designer-base/src/com/fr/file/FILEChooserPane.java
  32. 37
      designer-base/src/com/fr/file/FileNodeFILE.java
  33. 52
      designer-base/src/com/fr/start/BaseDesigner.java
  34. 6
      designer-base/src/com/fr/start/ServerStarter.java
  35. 16
      designer-base/src/com/fr/start/server/FineEmbedServerActivator.java
  36. 16
      designer-chart/src/com/fr/design/chart/series/PlotSeries/MapGroupExtensionPane.java
  37. 13
      designer-form/src/com/fr/design/designer/beans/models/SelectionModel.java
  38. 52
      designer-form/src/com/fr/design/designer/creator/XMultiFileUploader.java
  39. 15
      designer-form/src/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java
  40. 33
      designer-form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  41. 5
      designer-form/src/com/fr/design/designer/properties/mobile/BodyMobilePropertyUI.java
  42. 36
      designer-form/src/com/fr/design/designer/properties/mobile/MultiFileUploaderPropertyUI.java
  43. 24
      designer-form/src/com/fr/design/form/mobile/FormMobileAttrPane.java
  44. 65
      designer-form/src/com/fr/design/form/mobile/FormMobileOthersPane.java
  45. 75
      designer-form/src/com/fr/design/mainframe/ElementCaseHelpDialog.java
  46. 1
      designer-form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java
  47. BIN
      designer-realize/src/com/fr/design/images/splash_10.gif
  48. 8
      designer-realize/src/com/fr/design/mainframe/HyperlinkGroupPaneActionImpl.java
  49. 10
      designer-realize/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java
  50. 8
      designer-realize/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java
  51. 4
      designer-realize/src/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java
  52. 8
      designer-realize/src/com/fr/design/mainframe/form/FormElementCaseDesigner.java
  53. 78
      designer-realize/src/com/fr/design/present/ConditionAttributesGroupPane.java
  54. 62
      designer-realize/src/com/fr/design/report/UnitFieldPane.java
  55. 60
      designer-realize/src/com/fr/design/report/mobile/MobileOthersPane.java
  56. 5
      designer-realize/src/com/fr/design/report/mobile/ReportMobileAttrPane.java
  57. 8
      designer-realize/src/com/fr/design/webattr/EventPane.java
  58. 2
      designer-realize/src/com/fr/design/webattr/WriteWebSettingPane.java
  59. 47
      designer-realize/src/com/fr/start/Designer.java
  60. 12
      designer-realize/src/com/fr/start/EnvSwitcher.java
  61. 3
      designer-realize/src/com/fr/start/SplashContext.java
  62. 6
      designer-realize/src/com/fr/start/fx/SplashFxWindow.java
  63. 12
      designer-realize/src/com/fr/start/jni/SplashMac.java
  64. 18
      designer-realize/src/com/fr/start/module/DesignerEnvProvider.java
  65. 406
      designer-realize/src/com/fr/start/preload/ImagePreLoader.java

193
designer-base/src/com/fr/design/DesignerEnvManager.java

@ -6,19 +6,19 @@ package com.fr.design;
import com.fr.base.BaseXMLUtils;
import com.fr.base.FRContext;
import com.fr.base.Utils;
import com.fr.base.env.EnvUpdater;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.resource.EnvConfigUtils;
import com.fr.core.env.resource.LocalEnvConfig;
import com.fr.core.env.resource.RemoteEnvConfig;
import com.fr.core.env.impl.LocalEnvConfig;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.constants.UIConstants;
import com.fr.env.SignIn;
import com.fr.design.env.EnvGenerator;
import com.fr.file.FILEFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogFormatter;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.general.xml.GeneralXMLTools;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants;
import com.fr.stable.EnvChangedListener;
@ -73,7 +73,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private boolean showPaintToolBar = true;
private int maxNumberOrPreviewRow = 200;
// name和Env的键值对
private Map<String, EnvConfig> nameEnvMap = new ListMap();
private Map<String, EnvConfig> nameEnvMap = new ListMap<>();
// marks: 当前报表服务器名字
private String curEnvName = null;
private boolean showProjectPane = true;
@ -526,11 +526,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (isCurrentEnvDefault()) {
return;
}
try {
SignIn.signIn(getDefaultEnv());
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage());
}
EnvUpdater.updateEnv(EnvGenerator.generate(getDefaultEnv()));
}
/**
@ -1311,8 +1307,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.readReportPaneAttributions(reader);
} else if ("RecentOpenedFilePathList".equals(name) || "ResentOpenedFilePathList".equals(name)) {
this.readRecentOpenFileList(reader);
} else if ("Envs".equals(name) || name.equals("ReportServerMap")) {
this.readCurEnv(reader);
} else if ("EnvConfigMap".equals(name)) {
this.readEnvConfigMap(reader);
} else if (name.equals("ActivationKey")) {
readActiveKey(reader);
} else if ("LogLocation".equals(name)) {
@ -1457,32 +1453,30 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
}
private void readCurEnv(XMLableReader reader) {
String tmpVal;
// marks:设置默认的webInf名字
if ((tmpVal = reader.getAttrAsString("currentEnv", null)) != null) {
this.setCurEnvName(tmpVal);
}
private void readEnvConfigMap(XMLableReader reader) {
String currentEnv = reader.getAttrAsString("currentEnv", StringUtils.EMPTY);
this.setCurEnvName(currentEnv);
reader.readXMLObject(new XMLReadable() {
@Override
public void readXML(XMLableReader reader) {
if (reader.isAttr()) {
DesignerEnvManager.this.clearAllEnv();
}
if (reader.isChildNode()) {
if (reader.getTagName().contains("Env")) { // description.
// marks:获取名字
String reportServerName = reader.getAttrAsString("name", null);
EnvConfig env = readEnv(reader);
if (env == null) {
return;
}
DesignerEnvManager.this.putEnv(reportServerName, env);
clearAllEnv();
} else if (reader.isChildNode()) {
String tagName = reader.getTagName();
if ("EnvConfigElement".equals(tagName)) {
final String name = reader.getAttrAsString("name", StringUtils.EMPTY);
reader.readXMLObject(new XMLReadable() {
@Override
public void readXML(XMLableReader reader) {
if (reader.isChildNode()) {
String tagName = reader.getTagName();
if (EnvConfig.XML_TAG.equals(tagName)) {
EnvConfig envConfig = (EnvConfig) GeneralXMLTools.readXMLable(reader);
putEnv(name, envConfig);
}
}
}
});
}
}
}
@ -1524,7 +1518,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
public void writeXML(XMLPrintWriter writer) {
writer.startTAG("Designer");
writeAttrues(writer);
writeAttributes(writer);
writeReportPaneAttributions(writer);
writeRecentOpenFileAndEnvList(writer);
writeSomeAttr(writer);
@ -1596,22 +1590,20 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
writer.end();
writer.startTAG("Envs");
writer.startTAG("EnvConfigMap");
if (this.curEnvName != null) {
writer.attr("currentEnv", this.curEnvName);
}
Iterator<String> nameIt = this.getEnvNameIterator();
while (nameIt.hasNext()) {
String envName = nameIt.next();
EnvConfig env = this.getEnv(envName);
writeEnv(writer, envName, env);
for (Entry<String, EnvConfig> entry : nameEnvMap.entrySet()) {
writer.startTAG("EnvConfigElement").attr("name", entry.getKey());
EnvConfig envConfig = entry.getValue();
GeneralXMLTools.writeXMLable(writer, envConfig, EnvConfig.XML_TAG);
writer.end();
}
writer.end();
}
private void writeAttrues(XMLPrintWriter writer) {
private void writeAttributes(XMLPrintWriter writer) {
writer.startTAG("Attributes");
if (this.getWindowBounds() != null) {
writer.attr("windowBounds", BaseXMLUtils.getRectangleText(this.getWindowBounds()));
@ -1767,46 +1759,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
.end();
}
/*
* 写Env为xml
*/
private static void writeEnv(XMLPrintWriter writer, String name, EnvConfig env) {
if (env == null) {
return;
}
writer.startTAG("EnvConfig");
writer.classAttr(env.getClass());
writer.attr("name", name);
EnvConfigXMLAdapter xmlAdapter = env instanceof RemoteEnvConfig
? new RemoteEnvConfigXMLAdapter()
: new LocalEnvConfigXMLAdapter();
xmlAdapter.fromEnvConfig(env).writeXML(writer);
writer.end();
}
/*
* 从xml读Env
*/
private static EnvConfig readEnv(XMLableReader reader) {
EnvConfigXMLAdapter xmlAdapter = null;
String tmpVal; //temp value
if ((tmpVal = reader.getAttrAsString("class", null)) != null) {
if (tmpVal.contains(".LocalEnv")) {
xmlAdapter = new LocalEnvConfigXMLAdapter();
} else if (tmpVal.contains(".RemoteEnv")) {
xmlAdapter = new RemoteEnvConfigXMLAdapter();
}
}
if (xmlAdapter == null) {
return null;
}
reader.readXMLObject(xmlAdapter);
return xmlAdapter.toEnvConfig();
}
public AlphaFineConfigManager getAlphaFineConfigManager() {
return alphaFineConfigManager;
@ -1816,79 +1768,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.alphaFineConfigManager = alphaFineConfigManager;
}
private interface EnvConfigXMLAdapter extends XMLReadable, XMLWriter {
EnvConfig toEnvConfig();
EnvConfigXMLAdapter fromEnvConfig(EnvConfig envConfig);
}
private static class LocalEnvConfigXMLAdapter implements EnvConfigXMLAdapter {
private String path;
public void readXML(XMLableReader reader) {
if (reader.isChildNode()) {
if ("DIR".equals(reader.getTagName())) {
this.path = reader.getElementValue();
}
}
}
public void writeXML(XMLPrintWriter writer) {
writer.startTAG("DIR").textNode(this.path).end();
}
public EnvConfig toEnvConfig() {
return new LocalEnvConfig(path);
}
public EnvConfigXMLAdapter fromEnvConfig(EnvConfig envConfig) {
this.path = envConfig.getPath();
return this;
}
}
private static class RemoteEnvConfigXMLAdapter implements EnvConfigXMLAdapter {
private String path;
private String username;
private String password;
public void readXML(XMLableReader reader) {
if (reader.isChildNode()) {
String tmpVal;
if ("DIR".equals(reader.getTagName())) {
if ((tmpVal = reader.getAttrAsString("path", null)) != null) {
this.path = tmpVal;
}
if ((tmpVal = reader.getAttrAsString("user", null)) != null) {
this.username = tmpVal;
}
if ((tmpVal = reader.getAttrAsString("password", null)) != null) {
this.password = tmpVal;
}
}
}
}
public void writeXML(XMLPrintWriter writer) {
writer.startTAG("DIR")
.attr("path", this.path)
.attr("user", this.username)
.attr("password", this.password)
.end();
}
public EnvConfig toEnvConfig() {
return new RemoteEnvConfig(path, username, password);
}
public EnvConfigXMLAdapter fromEnvConfig(EnvConfig envConfig) {
this.path = envConfig.getPath();
this.username = EnvConfigUtils.getUsername(envConfig);
this.password = EnvConfigUtils.getPassword(envConfig);
return this;
}
}
public boolean isImageCompress() {
return imageCompress;
}

26
designer-base/src/com/fr/design/actions/file/LocalePane.java

@ -15,6 +15,7 @@ import com.fr.general.GeneralUtils;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.project.ProjectConstants;
@ -24,6 +25,7 @@ import javax.swing.event.DocumentListener;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableRowSorter;
import java.awt.*;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
@ -183,7 +185,7 @@ public class LocalePane extends BasicPane {
if (env == null) {
return;
}
FileNode[] fileNodes = env.listFile(ProjectConstants.LOCALE_NAME);
FileNode[] fileNodes = env.getFileOperator().list(ProjectConstants.LOCALE_NAME);
if (ArrayUtils.getLength(fileNodes) == 0) {
return;
}
@ -194,7 +196,7 @@ public class LocalePane extends BasicPane {
for (FileNode fileNode : fileNodes) {
String fileName = fileNode.getName();
if (fileName.endsWith(".properties")) {
InputStream in = env.readBean(fileName, ProjectConstants.LOCALE_NAME);
InputStream in = new ByteArrayInputStream(env.getFileOperator().read(StableUtils.pathJoin(ProjectConstants.LOCALE_NAME, fileName)));
Properties properties = new Properties();
properties.load(in);
keys.addAll(properties.stringPropertyNames());
@ -234,16 +236,16 @@ public class LocalePane extends BasicPane {
properties.setProperty(GeneralUtils.objectToString(customTableModel.getValueAt(j, 0)), GeneralUtils.objectToString(customTableModel.getValueAt(j, i)));
}
OutputStream out = null;
try {
out = env.writeBean(PREFIX + fileName + ".properties", ProjectConstants.LOCALE_NAME);
properties.store(out, null);
out.flush();
out.close();
} catch (Exception e) {
FineLoggerFactory.getLogger().info(e.getMessage());
}
// OutputStream out = null;
// try {
// out = env.writeBean(PREFIX + fileName + ".properties", ProjectConstants.LOCALE_NAME);
// properties.store(out, null);
//
// out.flush();
// out.close();
// } catch (Exception e) {
// FineLoggerFactory.getLogger().info(e.getMessage());
// }
}
}

40
designer-base/src/com/fr/design/actions/file/SwitchExistEnv.java

@ -1,13 +1,16 @@
package com.fr.design.actions.file;
import com.fr.base.BaseUtils;
import com.fr.base.env.Callback;
import com.fr.base.env.EnvUpdater;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.resource.LocalEnvConfig;
import com.fr.core.env.resource.RemoteEnvConfig;
import com.fr.core.env.impl.LocalEnvConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.tabledata.ResponseDataSourceChange;
import com.fr.design.env.EnvGenerator;
import com.fr.design.env.RemoteEnvConfig;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
@ -15,14 +18,14 @@ import com.fr.design.mainframe.TemplatePane;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef;
import com.fr.design.utils.DesignUtils;
import com.fr.env.RemoteEnv;
import com.fr.env.SignIn;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.EnvChangedListener;
import javax.swing.JOptionPane;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.util.HashMap;
import java.util.Iterator;
@ -97,24 +100,25 @@ public class SwitchExistEnv extends MenuDef {
*/
public void actionPerformed(ActionEvent e) {
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
EnvConfig selectedEnv = envManager.getEnv(this.getName());
try {
if (selectedEnv instanceof RemoteEnv && !((RemoteEnv) selectedEnv).testServerConnection()) {
final String envName = getName();
EnvConfig selectedEnv = envManager.getEnv(envName);
EnvUpdater.updateEnv(EnvGenerator.generate(selectedEnv), new Callback() {
@Override
public void success() {
DesignerEnvManager.getEnvManager().setCurEnvName(envName);
DesignUtils.refreshDesignerFrame();
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea();
fireDSChanged();
}
@Override
public void fail() {
TemplatePane.getInstance().editItems();
JOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}));
return;
}
SignIn.signIn(selectedEnv);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea();
fireDSChanged();
} catch (Exception em) {
FineLoggerFactory.getLogger().error(em.getMessage(), em);
JOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}));
TemplatePane.getInstance().editItems();
}
});
}
}
}

53
designer-base/src/com/fr/design/actions/help/AboutPane.java

@ -68,28 +68,36 @@ public class AboutPane extends JPanel {
Inter.getLocText("FR-Designer-Basic_Activation_Key_Copy_OK")
}));
if (shouldShowPhoneAndQQ()) {
if (ComparatorUtils.equals(ProductConstants.APP_NAME, FINEREPORT)) {
boxCenterAlignmentPane = new BoxCenterAligmentPane(Inter.getLocText("FR-Designer_Service_Phone") + ProductConstants.COMPARE_TELEPHONE);
contentPane.add(boxCenterAlignmentPane);
}
boxCenterAlignmentPane = new BoxCenterAligmentPane("QQ:" + SiteCenter.getInstance().acquireUrlByKind("help.qq"));
contentPane.add(boxCenterAlignmentPane);
}
addPhoneAndQQPane(contentPane);
// 官网
JPanel urlActionPane = getURLActionPane(Inter.getLocText("FR-Designer_Official_Website"), SiteCenter.getInstance().acquireUrlByKind("website." + FRContext.getLocale(), ProductConstants.WEBSITE_URL));
BoxCenterAligmentPane actionLabel = getURLActionLabel(SiteCenter.getInstance().acquireUrlByKind("website." + FRContext.getLocale(), ProductConstants.WEBSITE_URL));
BoxCenterAligmentPane emailLabel = getEmailActionLabel(SiteCenter.getInstance().acquireUrlByKind("support.email", ProductConstants.SUPPORT_EMAIL));
// 支持邮箱
String defaultEmail = SiteCenter.getInstance().acquireUrlByKind("support.email", ProductConstants.SUPPORT_EMAIL);
JPanel emailPane = getEmailActionPane(Inter.getLocText("FR-Designer_Support_Email"),SiteCenter.getInstance().acquireUrlByKind("support.email." + FRContext.getLocale(), defaultEmail));
contentPane.add(actionLabel);
contentPane.add(emailLabel);
contentPane.add(urlActionPane);
contentPane.add(emailPane);
if (shouldShowThanks()) {
addThankPane(contentPane);
}
}
// 是否显示服务电话和 qq
private boolean shouldShowPhoneAndQQ() {
return !FRContext.getLocale().equals(Locale.US);
private void addPhoneAndQQPane(JPanel contentPane) {
BoxCenterAligmentPane boxCenterAlignmentPane;
// 英文版不显示服务电话和QQ
if (FRContext.getLocale().equals(Locale.US)) {
return;
}
boxCenterAlignmentPane = new BoxCenterAligmentPane(Inter.getLocText("FR-Designer_Service_Phone") + SiteCenter.getInstance().acquireUrlByKind("service.phone." + FRContext.getLocale(), ProductConstants.COMPARE_TELEPHONE));
contentPane.add(boxCenterAlignmentPane);
// 繁体版不显示QQ
if (FRContext.getLocale().equals(Locale.TAIWAN)) {
return;
}
boxCenterAlignmentPane = new BoxCenterAligmentPane("QQ: " + SiteCenter.getInstance().acquireUrlByKind("help.qq"));
contentPane.add(boxCenterAlignmentPane);
}
// 是否显示鸣谢面板
@ -133,7 +141,7 @@ public class AboutPane extends JPanel {
StringUtils.BLANK, ProductConstants.RELEASE_VERSION, BUILD_PREFIX);
}
private BoxCenterAligmentPane getEmailActionLabel(final String mailTo) {
private JPanel getEmailActionPane(final String desc, final String mailTo){
ActionLabel emailLabel = new ActionLabel(mailTo);
emailLabel.addActionListener(new ActionListener() {
@ -147,10 +155,13 @@ public class AboutPane extends JPanel {
}
});
return new BoxCenterAligmentPane(emailLabel);
JPanel panel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
panel.add(new UILabel(desc));
panel.add(emailLabel);
return panel;
}
private BoxCenterAligmentPane getURLActionLabel(final String url) {
private JPanel getURLActionPane(final String desc, final String url){
ActionLabel actionLabel = new ActionLabel(url);
actionLabel.addActionListener(new ActionListener() {
@Override
@ -163,7 +174,11 @@ public class AboutPane extends JPanel {
}
});
return new BoxCenterAligmentPane(actionLabel);
JPanel panel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
panel.add(new UILabel(desc));
panel.add(actionLabel);
return panel;
}
class UserLabel extends BoldFontTextLabel {

22
designer-base/src/com/fr/design/env/EnvGenerator.java vendored

@ -0,0 +1,22 @@
package com.fr.design.env;
import com.fr.base.Env;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.impl.LocalEnvConfig;
import com.fr.dav.LocalEnv;
import com.fr.env.RemoteEnv;
/**
* 根据配置生成运行环境
*/
public class EnvGenerator {
public static Env generate(EnvConfig config) {
Env env = null;
if (config instanceof LocalEnvConfig) {
env = new LocalEnv((LocalEnvConfig)config);
} else if (config instanceof RemoteEnvConfig) {
env = new RemoteEnv((RemoteEnvConfig) config);
}
return env;
}
}

134
designer-base/src/com/fr/design/env/RemoteEnvConfig.java vendored

@ -0,0 +1,134 @@
package com.fr.design.env;
import com.fr.core.env.impl.AbstractEnvConfig;
import com.fr.general.Inter;
import com.fr.security.SecurityToolbox;
import com.fr.stable.AssistUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
public class RemoteEnvConfig extends AbstractEnvConfig {
public static final int DEFAULT_RPC_PORT = 39999;
private String host;
private int port;
private String username;
private String password;
public RemoteEnvConfig() {
}
public RemoteEnvConfig(String host, int port, String username, String password) {
this.host = host;
this.port = port;
this.username = username;
this.password = password;
}
@Override
public String getPath() {
return StableUtils.join(new Object[]{host, port}, ":");
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String getDescription(String name) {
return username + "@" + name + "[" + Inter.getLocText("Fine-Designer_Basic_Remote_Env") + "]";
}
@Override
public void readXML(XMLableReader reader) {
super.readXML(reader);
if (reader.isChildNode()) {
String tagName = reader.getTagName();
if ("Attr".equals(tagName)) {
this.host = reader.getAttrAsString("host", StringUtils.EMPTY);
this.port = reader.getAttrAsInt("port", DEFAULT_RPC_PORT);
this.username = reader.getAttrAsString("username", StringUtils.EMPTY);
String password = reader.getAttrAsString("password", StringUtils.EMPTY);
if (StringUtils.isNotEmpty(password)) {
this.password = SecurityToolbox.decrypt(password);
}
} else if ("Username".equals(tagName)) {
this.username = reader.getElementValue();
} else if ("Password".equals(tagName)) {
String txt = reader.getElementValue();
this.password = SecurityToolbox.decrypt(txt);
}
}
}
@Override
public void writeXML(XMLPrintWriter writer) {
super.writeXML(writer);
writer.startTAG("Attr")
.attr("host", host)
.attr("port", port);
writer.end();
writer.startTAG("Username").textNode(username).end();
if (StringUtils.isNotEmpty(password)) {
writer.startTAG("Password").textNode(SecurityToolbox.encrypt(password)).end();
}
}
@Override
public boolean equals(Object o) {
return o instanceof RemoteEnvConfig
&& AssistUtils.equals(((RemoteEnvConfig) o).host, host)
&& AssistUtils.equals(((RemoteEnvConfig) o).port, port)
&& AssistUtils.equals(((RemoteEnvConfig) o).username, username)
&& AssistUtils.equals(((RemoteEnvConfig) o).password, password);
}
@Override
public int hashCode() {
return AssistUtils.hashCode(host, port, username, password);
}
@Override
public Object clone() throws CloneNotSupportedException {
RemoteEnvConfig cloned = (RemoteEnvConfig) super.clone();
cloned.host = host;
cloned.port = port;
cloned.username = username;
cloned.password = password;
return cloned;
}
}

9
designer-base/src/com/fr/design/file/HistoryTemplateListPane.java

@ -1,5 +1,6 @@
package com.fr.design.file;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.dav.LocalEnv;
@ -18,9 +19,11 @@ import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants;
import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
@ -363,8 +366,10 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C
*/
public void openContainerFolder() {
FileNode fileNode = new FileNode(((JTemplate<?, ?>) list.getSelectedValue()).getEditingFILE().getPath(), false);
LocalEnv localEnv = (LocalEnv) FRContext.getCurrentEnv();
localEnv.openContainerFolder(fileNode);
Env env = FRContext.getCurrentEnv();
if (env.isLocalEnv()) {
IOUtils.openWindowsFolder(StableUtils.pathJoin(env.getEnvConfig().getPath(), fileNode.getEnvPath()));
}
}
/**

37
designer-base/src/com/fr/design/file/TemplateTreePane.java

@ -3,25 +3,26 @@
*/
package com.fr.design.file;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.base.io.FileAssistUtils;
import com.fr.dav.LocalEnv;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itree.filetree.TemplateFileTree;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.env.RemoteEnv;
import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode;
import com.fr.file.filetree.IOFileNodeFilter;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.CoreConstants;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants;
import com.sun.jna.platform.FileUtils;
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
@ -32,7 +33,6 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
public class TemplateTreePane extends JPanel implements FileOperations {
@ -141,13 +141,13 @@ public class TemplateTreePane extends JPanel implements FileOperations {
*/
public void openContainerFolder() {
FileNode fn = TemplateTreePane.this.reportletsTree.getSelectedFileNode();
LocalEnv localEnv = (LocalEnv) FRContext.getCurrentEnv();
Env localEnv = FRContext.getCurrentEnv();
String filePath = StableUtils.pathJoin(localEnv.getPath(), fn.getEnvPath());
filePath = filePath.substring(0, filePath.lastIndexOf(CoreConstants.SEPARATOR));
try {
Desktop.getDesktop().open(new File(filePath));
} catch (Exception e) {
localEnv.openContainerFolder(fn);
IOUtils.openWindowsFolder(StableUtils.pathJoin(localEnv.getEnvConfig().getPath(), fn.getEnvPath()));
}
}
@ -181,8 +181,8 @@ public class TemplateTreePane extends JPanel implements FileOperations {
break;
}
if (nodeFile.exists()) {
String path = StableUtils.pathJoin(new String[]{nodeFile.getEnvPath(), nodeFile.getPath()});
moveToTrash(nodeFile);
String path = StableUtils.pathJoin(nodeFile.getEnvPath(), nodeFile.getPath());
FileAssistUtils.moveToTrash(path);
deleteHistory(path.replaceAll("/", "\\\\"));
} else {
JOptionPane.showMessageDialog(this, Inter.getLocText("Warning-Template_Do_Not_Exsit"), ProductConstants.PRODUCT_NAME,
@ -282,27 +282,4 @@ public class TemplateTreePane extends JPanel implements FileOperations {
}
}
}
/**
* 文件回收
*
* @param nodeFile 节点文件
*/
private void moveToTrash(FileNodeFILE nodeFile) {
FileUtils fileUtils = FileUtils.getInstance();
if (fileUtils.hasTrash()) {
try {
fileUtils.moveToTrash(new File[]{new File(StableUtils.pathJoin(nodeFile.getEnvPath(), nodeFile.getPath()))});
//todo 走下这个流程,否则集群下其它节点无法同步删除
FRContext.getCurrentEnv().deleteFile(nodeFile.getPath());
} catch (IOException e) {
FineLoggerFactory.getLogger().info(e.getMessage());
FRContext.getCurrentEnv().deleteFile(nodeFile.getPath());
}
} else {
FineLoggerFactory.getLogger().info("No Trash Available");
FRContext.getCurrentEnv().deleteFile(nodeFile.getPath());
}
}
}

16
designer-base/src/com/fr/design/formula/JavaEditorPane.java

@ -9,8 +9,8 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants;
import com.fr.stable.JavaCompileInfo;
import com.fr.stable.StableUtils;
@ -21,7 +21,9 @@ import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.concurrent.ExecutionException;
@ -111,7 +113,7 @@ public class JavaEditorPane extends BasicPane {
private InputStream getJavaSourceInputStream() {
String javaPath = getJavaPath();
try {
return FRContext.getCurrentEnv().readBean(javaPath, ProjectConstants.CLASSES_NAME);
return new ByteArrayInputStream(FRContext.getCurrentEnv().getFileOperator().read(StableUtils.pathJoin(ProjectConstants.CLASSES_NAME, javaPath)));
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
@ -154,11 +156,7 @@ public class JavaEditorPane extends BasicPane {
return;
}
try {
OutputStream out = FRContext.getCurrentEnv().writeBean(getJavaPath(), ProjectConstants.CLASSES_NAME);
Writer writer = new BufferedWriter(new OutputStreamWriter(out, EncodeConstants.ENCODING_UTF_8));
writer.write(text);
writer.flush();
writer.close();
FRContext.getCurrentEnv().getFileOperator().write(text.getBytes(EncodeConstants.ENCODING_UTF_8), StableUtils.pathJoin(ProjectConstants.CLASSES_NAME, getJavaPath()));
JOptionPane.showMessageDialog(null, Inter.getLocText(new String[]{"Save", "Successfully"}) + "!");
fireSaveActionListener();
} catch (Exception e) {
@ -178,7 +176,7 @@ public class JavaEditorPane extends BasicPane {
@Override
protected JavaCompileInfo doInBackground() throws Exception {
Env env = FRContext.getCurrentEnv();
return env.compilerSourceCode(javaText.getText());
return env.getCommonOperator().compile(javaText.getText());
}
public void done() {

203
designer-base/src/com/fr/design/gui/icombobox/FRTreeComboBox.java

@ -50,13 +50,14 @@ import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
public class FRTreeComboBox extends UIComboBox {
private static final int PAGE_DIFF = 5;
private static final int DEFAULT_HEIGHT = 120;
private static final int PAGE_DIFF = 5;
private static final int DEFAULT_HEIGHT = 120;
// richer:下拉展示用的tree
protected JTree tree;
private boolean onlyLeafSelectable = true;
private Object selectedObject = null;
public FRTreeComboBox() {
this(new JTree());
@ -148,7 +149,7 @@ public class FRTreeComboBox extends UIComboBox {
for (Enumeration e2 = pathnode.children(); e2.hasMoreElements(); ) {
TreeNode n2 = (TreeNode) e2.nextElement();
TreePath path2 = path.pathByAddingChild(n2);
if (pathToString(path2).toUpperCase().startsWith(textField.getText().toUpperCase())) {
if (pathToString(path2).toUpperCase().contains(textField.getText().toUpperCase())) {
tree.scrollPathToVisible(path2);
tree.setSelectionPath(path2);
isBreak = true;
@ -162,6 +163,7 @@ public class FRTreeComboBox extends UIComboBox {
}
public void setSelectedItem(Object o) {
selectedObject = o;
if (o instanceof String) {
this.setSelectedItemString((String) o);
return;
@ -173,9 +175,13 @@ public class FRTreeComboBox extends UIComboBox {
this.getModel().setSelectedItem(o);
}
}
public Object getSelectedItemObject() {
return selectedObject;
}
private boolean validTreePath(String treePath){
return StringUtils.isNotEmpty(treePath) && treePath.charAt(0) == '[' && treePath.endsWith("]");
return StringUtils.isNotEmpty(treePath) && treePath.charAt(0) == '[' && treePath.endsWith("]");
}
protected String pathToString(TreePath path) {
@ -183,12 +189,7 @@ public class FRTreeComboBox extends UIComboBox {
if (validTreePath(temp)) {
temp = temp.substring(2, temp.length() - 1);
String[] selectedtable = temp.split(",");
String table = selectedtable[selectedtable.length - 1].trim();
if (table.contains(".")) {
String[] temp2 = table.split("\\.");
table = temp2[temp2.length - 1].trim();
}
return table;
return selectedtable[selectedtable.length - 1].trim();
}
return "";
}
@ -198,7 +199,7 @@ public class FRTreeComboBox extends UIComboBox {
*/
public void setSelectedItemString(String _name) {
if (StringUtils.isBlank(_name)) {
this.setSelectedIndex(-1);
this.setSelectedIndex(-1);
return;
}
DefaultTreeModel model = (DefaultTreeModel) this.tree.getModel();
@ -237,26 +238,26 @@ public class FRTreeComboBox extends UIComboBox {
}
}
public void setPopSize(int width, int height) {
treePopup.setPopSize(width, height);
}
public void setPopSize(int width, int height) {
treePopup.setPopSize(width, height);
}
private static TreePopup treePopup;
private static class FRTreeComboBoxUI extends BasicComboBoxUI implements MouseListener{
private boolean isRollover = false;
private boolean isRollover = false;
public FRTreeComboBoxUI() {
super();
}
public FRTreeComboBoxUI() {
super();
}
protected ComboPopup createPopup() {
treePopup = new TreePopup(comboBox);
return treePopup;
}
@Override
protected UIButton createArrowButton() {
arrowButton = new UIButton(UIConstants.ARROW_DOWN_ICON){
protected UIButton createArrowButton() {
arrowButton = new UIButton(UIConstants.ARROW_DOWN_ICON){
/**
* 组件是否需要响应添加的观察者事件
*
@ -267,77 +268,77 @@ public class FRTreeComboBox extends UIComboBox {
return false;
}
};
((UIButton) arrowButton).setRoundBorder(true, Constants.LEFT);
arrowButton.addMouseListener(this);
comboBox.addMouseListener(this);
return (UIButton) arrowButton;
}
public void paint(Graphics g, JComponent c) {
super.paint(g, c);
Graphics2D g2d = (Graphics2D)g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Color linecolor = null;
if (comboBox.isPopupVisible()) {
linecolor = UIConstants.LINE_COLOR;
arrowButton.setSelected(true);
} else if (isRollover) {
linecolor = UIConstants.LIGHT_BLUE;
} else {
linecolor = UIConstants.LINE_COLOR;
arrowButton.setSelected(false);
}
g2d.setColor(linecolor);
if (!comboBox.isPopupVisible()) {
g2d.drawRoundRect(0, 0, c.getWidth() - arrowButton.getWidth() + 3, c.getHeight() - 1, UIConstants.LARGEARC, UIConstants.LARGEARC);
} else {
g2d.drawRoundRect(0, 0, c.getWidth() , c.getHeight() + 3, UIConstants.LARGEARC, UIConstants.LARGEARC );
g2d.drawLine(0, c.getHeight()-1, c.getWidth(), c.getHeight()-1);
}
}
private void setRollover(boolean isRollover) {
if (this.isRollover != isRollover) {
this.isRollover = isRollover;
comboBox.repaint();
}
}
@Override
public void mouseEntered(MouseEvent e) {
setRollover(true);
}
@Override
public void mouseExited(MouseEvent e) {
setRollover(false);
}
@Override
public void mouseClicked(MouseEvent e) {
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
}
((UIButton) arrowButton).setRoundBorder(true, Constants.LEFT);
arrowButton.addMouseListener(this);
comboBox.addMouseListener(this);
return (UIButton) arrowButton;
}
public void paint(Graphics g, JComponent c) {
super.paint(g, c);
Graphics2D g2d = (Graphics2D)g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Color linecolor = null;
if (comboBox.isPopupVisible()) {
linecolor = UIConstants.LINE_COLOR;
arrowButton.setSelected(true);
} else if (isRollover) {
linecolor = UIConstants.LIGHT_BLUE;
} else {
linecolor = UIConstants.LINE_COLOR;
arrowButton.setSelected(false);
}
g2d.setColor(linecolor);
if (!comboBox.isPopupVisible()) {
g2d.drawRoundRect(0, 0, c.getWidth() - arrowButton.getWidth() + 3, c.getHeight() - 1, UIConstants.LARGEARC, UIConstants.LARGEARC);
} else {
g2d.drawRoundRect(0, 0, c.getWidth() , c.getHeight() + 3, UIConstants.LARGEARC, UIConstants.LARGEARC );
g2d.drawLine(0, c.getHeight()-1, c.getWidth(), c.getHeight()-1);
}
}
private void setRollover(boolean isRollover) {
if (this.isRollover != isRollover) {
this.isRollover = isRollover;
comboBox.repaint();
}
}
@Override
public void mouseEntered(MouseEvent e) {
setRollover(true);
}
@Override
public void mouseExited(MouseEvent e) {
setRollover(false);
}
@Override
public void mouseClicked(MouseEvent e) {
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
}
}
/**
* 添加弹出菜单监听
*
* @param l 监听事件
*
* @date 2015-1-22-下午5:04:00
*
*/
* 添加弹出菜单监听
*
* @param l 监听事件
*
* @date 2015-1-22-下午5:04:00
*
*/
public void addPopupMenuListener(PopupMenuListener l) {
treePopup.addPopupMenuListener(l);
}
@ -367,8 +368,8 @@ public class FRTreeComboBox extends UIComboBox {
*
*/
private static final long serialVersionUID = 1L;
private int defaultWidth = 0;
private int defaultHeight = 0;
private int defaultWidth = 0;
private int defaultHeight = 0;
protected FRTreeComboBox comboBox;
protected JScrollPane scrollPane;
protected JTree tree;
@ -492,8 +493,8 @@ public class FRTreeComboBox extends UIComboBox {
}
protected void updatePopup() {
int width = defaultWidth == 0 ? this.comboBox.getSize().width : defaultWidth;
int height = defaultHeight == 0 ? DEFAULT_HEIGHT : defaultHeight;
int width = defaultWidth == 0 ? this.comboBox.getSize().width : defaultWidth;
int height = defaultHeight == 0 ? DEFAULT_HEIGHT : defaultHeight;
this.setPreferredSize(new Dimension(width, height));
Object selectedObj = this.comboBox.getSelectedItem();
if (selectedObj instanceof TreePath) {
@ -502,10 +503,10 @@ public class FRTreeComboBox extends UIComboBox {
}
}
public void setPopSize(int width, int height) {
this.defaultWidth = width;
this.defaultHeight = height;
}
public void setPopSize(int width, int height) {
this.defaultWidth = width;
this.defaultHeight = height;
}
protected class InvocationMouseHandler extends MouseAdapter {
public void mousePressed(MouseEvent e) {
@ -533,7 +534,7 @@ public class FRTreeComboBox extends UIComboBox {
private Object item;
public FrTreeSearchComboBoxEditor(FRTreeComboBox comboBox) {
super();
super();
this.comboBox = comboBox;
textField.getDocument().addDocumentListener(this);
textField.addKeyListener(this.treeKeyListener);
@ -582,7 +583,7 @@ public class FRTreeComboBox extends UIComboBox {
public void setItem(Object item) {
this.item = item;
this.item = item;
this.setting = true;
textField.setText((item == null) ? "" : item.toString());
this.setting = false;

53
designer-base/src/com/fr/design/gui/imenu/UIBasicMenuItemUI.java

@ -4,20 +4,49 @@
package com.fr.design.gui.imenu;
import com.fr.general.ComparatorUtils;
import com.fr.design.utils.ColorRoutines;
import com.fr.design.utils.ThemeUtils;
import com.fr.general.ComparatorUtils;
import javax.swing.*;
import javax.swing.AbstractAction;
import javax.swing.ActionMap;
import javax.swing.ButtonModel;
import javax.swing.Icon;
import javax.swing.InputMap;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.KeyStroke;
import javax.swing.LookAndFeel;
import javax.swing.MenuElement;
import javax.swing.MenuSelectionManager;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.event.MenuDragMouseEvent;
import javax.swing.event.MenuDragMouseListener;
import javax.swing.event.MenuKeyListener;
import javax.swing.event.MouseInputListener;
import javax.swing.plaf.*;
import javax.swing.plaf.ActionMapUIResource;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.ComponentInputMapUIResource;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.MenuItemUI;
import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicGraphicsUtils;
import javax.swing.plaf.basic.BasicHTML;
import javax.swing.text.View;
import java.awt.*;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
@ -588,7 +617,7 @@ public class UIBasicMenuItemUI extends MenuItemUI {
}
protected void installDefaults() {
String prefix = getPropertyPrefix();
final String prefix = getPropertyPrefix();
acceleratorFont = UIManager.getFont("MenuItem.acceleratorFont");
@ -600,7 +629,7 @@ public class UIBasicMenuItemUI extends MenuItemUI {
LookAndFeel.installBorder(menuItem, prefix + ".border");
oldBorderPainted = menuItem.isBorderPainted();
menuItem.setBorderPainted(((Boolean) (UIManager.get(prefix + ".borderPainted"))).booleanValue());
LookAndFeel.installColorsAndFont(menuItem, prefix + ".background", prefix + ".foreground", prefix + ".font");
installFont(prefix);
// MenuItem specific defaults
if (selectionBackground == null || selectionBackground instanceof UIResource) {
@ -637,6 +666,18 @@ public class UIBasicMenuItemUI extends MenuItemUI {
defaultIconGap = DEFAULT_ICON_GAP; // Should be from table
}
private void installFont(final String prefix) {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
LookAndFeel.installColorsAndFont(menuItem, prefix + ".background", prefix + ".foreground", prefix + ".font");
}
});
thread.setName("UIBasicMenuItemUI");
thread.setDaemon(true);
thread.start();
}
protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon,
Icon arrowIcon, int defaultTextIconGap) {
JMenuItem b = (JMenuItem) c;

20
designer-base/src/com/fr/design/gui/ispinner/UISpinner.java

@ -12,28 +12,14 @@ import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import javax.swing.ButtonModel;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.plaf.ButtonUI;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.awt.*;
import java.awt.event.*;
public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver {

25
designer-base/src/com/fr/design/gui/itree/filetree/EnvFileTree.java

@ -1,19 +1,9 @@
package com.fr.design.gui.itree.filetree;
import java.awt.*;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.gui.itree.refreshabletree.RefreshableJTree;
import com.fr.file.filetree.FileNode;
@ -23,6 +13,15 @@ import com.fr.general.Inter;
import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils;
import javax.swing.*;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
/*
* 文件结构树.
*/
@ -192,7 +191,7 @@ public class EnvFileTree extends RefreshableJTree {
FileNode[] res_fns = null;
try {
res_fns = env == null ? new FileNode[0] : env.listFile(filePath);
res_fns = env == null ? new FileNode[0] : env.getFileOperator().list(filePath);
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}

8
designer-base/src/com/fr/design/gui/itree/filetree/TemplateFileTree.java

@ -1,10 +1,13 @@
package com.fr.design.gui.itree.filetree;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.base.extension.FileExtension;
import com.fr.base.operator.file.FileOperator;
import com.fr.core.env.proxy.EnvProxy;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.file.filetree.FileNode;
import com.fr.general.web.ParameterConstants;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StableUtils;
@ -102,8 +105,9 @@ public class TemplateFileTree extends EnvFileTree {
}
public FileNode[] listFile(String path) throws Exception {
String extra = EnvProxy.get(FileOperator.class).readExtraResourcePath(path);
return EnvProxy.get(FileOperator.class).list(extra, path);
return FRContext.getCurrentEnv().getFileOperator().list(
path,
new FileExtension[]{FileExtension.CPT, FileExtension.FRM, FileExtension.CPTX, FileExtension.FRMX});
}
/*

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

@ -4,11 +4,9 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.base.env.EnvUpdater;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.EnvContext;
import com.fr.core.env.resource.EnvConfigUtils;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager;
@ -37,15 +35,14 @@ import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.MenuManager;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.EventDispatcher;
import com.fr.file.FILE;
import com.fr.file.FILEFactory;
import com.fr.file.FileFILE;
import com.fr.file.FileNodeFILE;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
@ -58,9 +55,23 @@ import com.fr.stable.StableUtils;
import com.fr.stable.image4j.codec.ico.ICODecoder;
import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLayeredPane;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
import javax.swing.border.MatteBorder;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.DnDConstants;
@ -84,9 +95,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import static com.fr.core.env.EnvEvent.AFTER_SIGN_OUT;
import static com.fr.core.env.EnvEvent.BEFORE_SIGN_OUT;
public class DesignerFrame extends JFrame implements JTemplateActionListener, TargetModifiedListener {
public static final String DESIGNER_FRAME_NAME = "designer_frame";
public static final Dimension MIN_SIZE = new Dimension(100, 100);
@ -130,9 +138,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private WindowAdapter windowAdapter = new WindowAdapter() {
public void windowOpened(WindowEvent e) {
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setComposite();
reCalculateFrameSize();
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().doResize();
}
@ -265,6 +270,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
}
});
this.addDesignerOpenedListener(new DesignerOpenedListener() {
@Override
public void designerOpened() {
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setComposite();
reCalculateFrameSize();
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().doResize();
}
});
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
this.setVisible(false);
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
@ -648,13 +661,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
defaultTitleSB.append(ProductConstants.PRODUCT_NAME);
defaultTitleSB.append(" ");
defaultTitleSB.append(ProductConstants.BRANCH);
defaultTitleSB.append(" ");
// james:标识登录的用户和登录的ENV
String envName = DesignerEnvManager.getEnvManager().getCurEnvName();
EnvConfig env = DesignerEnvManager.getEnvManager().getEnv(envName);
if (env != null) {
defaultTitleSB.append(EnvConfigUtils.getUsername(env)).append('@').append(envName).append('[');
defaultTitleSB.append(Inter.getLocText("Env-Remote_Server"));
defaultTitleSB.append(']');
defaultTitleSB.append(env.getDescription(envName));
if (editingTemplate != null) {
String path = editingTemplate.getEditingFILE().getPath();
if (!editingTemplate.getEditingFILE().exists()) {
@ -981,7 +993,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
DesignerEnvManager.getEnvManager().saveXMLFile();
EnvContext.signOut();
EnvUpdater.disconnect();
this.setVisible(false);
this.dispose();

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

@ -10,7 +10,11 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.data.tabledata.ResponseDataSourceChange;
import com.fr.design.file.*;
import com.fr.design.file.FileOperations;
import com.fr.design.file.FileToolbarStateChangeListener;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenuHighLight;
@ -33,15 +37,23 @@ import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@ -129,9 +141,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public void refreshDockingView() {
ToolBarDef toolbarDef = new ToolBarDef();
toolbarDef.addShortCut(openReportAction, refreshTreeAction);
if (FRContext.getCurrentEnv().isSupportLocalFileOperate()) {
toolbarDef.addShortCut(openFolderAction, renameAction);
}
toolbarDef.addShortCut(openFolderAction, renameAction);
toolbarDef.addShortCut(delFileAction);
Set<ShortCut> extraShortCuts = ExtraDesignClassManager.getInstance().getExtraShortCuts();
for (ShortCut shortCut : extraShortCuts){
@ -256,37 +266,19 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public void stateChange() {
//当前环境为远程环境时
if (FRContext.getCurrentEnv() != null) {
if (!FRContext.getCurrentEnv().isSupportLocalFileOperate()) {
if (selectedOperation.getSelectedTemplatePath() != null) {
openReportAction.setEnabled(true);
} else {
openReportAction.setEnabled(false);
}
FileNode node = TemplateTreePane.getInstance().getTemplateFileTree().getSelectedFileNode();
if (selectedOperation.getSelectedTemplatePath() != null){
if (node.getLock() != null && !ComparatorUtils.equals(node.getUserID(),node.getLock())){
delFileAction.setEnabled(false);
} else {
delFileAction.setEnabled(true);
}
} else {
delFileAction.setEnabled(false);
}
//当前环境为本地环境时
if (selectedOperation.getSelectedTemplatePath() != null) {
openReportAction.setEnabled(true);
renameAction.setEnabled(true);
delFileAction.setEnabled(true);
} else {
//当前环境为本地环境时
if (selectedOperation.getSelectedTemplatePath() != null) {
openReportAction.setEnabled(true);
renameAction.setEnabled(true);
delFileAction.setEnabled(true);
} else {
openReportAction.setEnabled(false);
renameAction.setEnabled(false);
delFileAction.setEnabled(false);
}
openFolderAction.setEnabled(containsFolderNums() + seletedTemplateNums() != 0);
openReportAction.setEnabled(false);
renameAction.setEnabled(false);
delFileAction.setEnabled(false);
}
refreshTreeAction.setEnabled(true);
openFolderAction.setEnabled(containsFolderNums() + seletedTemplateNums() != 0);
}
refreshTreeAction.setEnabled(true);
if (containsFolderNums() > 0 && (containsFolderNums() + seletedTemplateNums() > 1)) {
refreshActions();
} else if (containsFolderNums() == 0 && seletedTemplateNums() > 1) {

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

@ -45,8 +45,8 @@ import com.fr.file.MemFILE;
import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.report.cell.Elem;
import com.fr.report.cell.cellattr.CellImage;
import com.fr.stable.ArrayUtils;
@ -539,7 +539,14 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
if (!editingFILE.exists()) {
return saveAsTemplate(isShowLoc);
}
if (!FRContext.getCurrentEnv().hasFileFolderAllow(this.getEditingFILE().getPath())) {
boolean access = false;
try {
access = FRContext.getCurrentEnv().getOrganizationOperator().canAccess(this.getEditingFILE().getPath());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (!access) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_No-Privilege") + "!", Inter.getLocText("FR-Designer_Message"), JOptionPane.WARNING_MESSAGE);
return false;
}
@ -579,18 +586,22 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
int chooseResult = fileChooser.showSaveDialog(DesignerContext.getDesignerFrame(), this.suffix());
if (isCancelOperation(chooseResult)) {
fileChooser = null;
return false;
}
if (isOkOperation(chooseResult)) {
if (!FRContext.getCurrentEnv().hasFileFolderAllow(fileChooser.getSelectedFILE().getPath()) ) {
boolean access = false;
try {
access = FRContext.getCurrentEnv().getOrganizationOperator().canAccess(fileChooser.getSelectedFILE().getPath());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (!access) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_No-Privilege") + "!", Inter.getLocText("FR-Designer_Message"), JOptionPane.WARNING_MESSAGE);
return false;
}
editingFILE = fileChooser.getSelectedFILE();
mkNewFile(editingFILE);
fileChooser = null;
}
return saveNewFile(editingFILE, oldName);

59
designer-base/src/com/fr/design/mainframe/TemplatePane.java

@ -1,40 +1,34 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.env.Callback;
import com.fr.base.env.EnvUpdater;
import com.fr.core.env.EnvConfig;
import com.fr.dav.LocalEnv;
import com.fr.core.env.impl.LocalEnvConfig;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.InformationWarnPane;
import com.fr.design.env.EnvGenerator;
import com.fr.design.env.RemoteEnvConfig;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.DesignUtils;
import com.fr.env.EnvListPane;
import com.fr.env.RemoteEnv;
import com.fr.env.SignIn;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.stable.EnvChangedListener;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
@ -121,27 +115,23 @@ public class TemplatePane extends JPanel implements MouseListener {
}
private boolean envListOkAction(EnvListPane envListPane) {
String selectedName = envListPane.updateEnvManager();
final String selectedName = envListPane.updateEnvManager();
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
EnvConfig selectedEnv = envManager.getEnv(selectedName);
GeneralContext.fireEnvWillChangeListener();
try {
//如果是远程的还要先测试下,如果失败就不切换
if (selectedEnv instanceof RemoteEnv) {
if (!((RemoteEnv) selectedEnv).testServerConnection()) {
EnvUpdater.updateEnv(EnvGenerator.generate(selectedEnv), new Callback() {
@Override
public void fail() {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}));
return false;
} else {
String remoteVersion = getDesignerVersion(selectedEnv);
if (StringUtils.isBlank(remoteVersion) || ComparatorUtils.compare(remoteVersion, ProductConstants.DESIGNER_VERSION) < 0) {
String infor = Inter.getLocText("Server-version-tip");
String moreInfo = Inter.getLocText("Server-version-tip-moreInfo");
new InformationWarnPane(infor, moreInfo, Inter.getLocText("Tooltips")).show();
return false;
}
}
}
SignIn.signIn(selectedEnv);
@Override
public void success() {
DesignerEnvManager.getEnvManager().setCurEnvName(selectedName);
DesignUtils.refreshDesignerFrame();
}
});
JTemplate template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (template != null) {
template.refreshToolArea();
@ -185,11 +175,12 @@ public class TemplatePane extends JPanel implements MouseListener {
}
private void setJLabel(String name) {
if (DesignerEnvManager.getEnvManager().getEnv(name) instanceof LocalEnv) {
envLabel.setIcon(BaseUtils.readIcon("com/fr/design/images/data/bind/localconnect.png"));
EnvConfig config = DesignerEnvManager.getEnvManager().getEnv(name);
if (config instanceof LocalEnvConfig) {
envLabel.setIcon(IOUtils.readIcon("com/fr/design/images/data/bind/localconnect.png"));
} else if (DesignerEnvManager.getEnvManager().getEnv(name) instanceof RemoteEnv) {
envLabel.setIcon(BaseUtils.readIcon("com/fr/design/images/data/bind/distanceconnect.png"));
} else if (config instanceof RemoteEnvConfig) {
envLabel.setIcon(IOUtils.readIcon("com/fr/design/images/data/bind/distanceconnect.png"));
}
envLabel.setText(name);
envLabel.repaint();

15
designer-base/src/com/fr/design/mainframe/form/FormECDesignerProvider.java

@ -20,7 +20,7 @@ public interface FormECDesignerProvider {
* 选中目标的 对应Menu
* @return 返回MenuDef数组.
*/
MenuDef[] menus4Target();
MenuDef[] menus4Target();
/**
* 获取焦点
@ -31,7 +31,7 @@ public interface FormECDesignerProvider {
* 工具栏菜单字体字号等
* @return 工具栏菜单数组
*/
ToolBarDef[] toolbars4Target();
ToolBarDef[] toolbars4Target();
/**
* 表单的报表块的工具按钮复制剪切那行
@ -43,25 +43,25 @@ public interface FormECDesignerProvider {
* 模板菜单
* @return 返回菜单
*/
ShortCut[] shortcut4TemplateMenu();
ShortCut[] shortcut4TemplateMenu();
/**
*当前正在编辑的elementcase
* @return 当前正在编辑的elementcase
*/
FormElementCaseProvider getEditingElementCase();
FormElementCaseProvider getEditingElementCase();
/**
* 右上角属性表
* @return 属性面板
*/
JComponent getEastDownPane();
JComponent getEastDownPane();
/**
* 右下角控件树或者扩展属性
* @return 属性面板
*/
JComponent getEastUpPane();
JComponent getEastUpPane();
/**
* 条件属性面板
@ -87,6 +87,7 @@ public interface FormECDesignerProvider {
* @param elementCaseContainerSize 缩略图的大小
* @return
*/
BufferedImage getElementCaseImage(Dimension elementCaseContainerSize);
BufferedImage getElementCaseImage(Dimension elementCaseContainerSize);
void refreshPropertyPane();
}

14
designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java

@ -1,14 +1,18 @@
package com.fr.design.mainframe.loghandler.socketio;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.config.ConfigEvent;
import com.fr.config.Configuration;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.EnvConstants;
import com.fr.core.env.EnvContext;
import com.fr.core.env.EnvEvent;
import com.fr.core.env.resource.LocalEnvConfig;
import com.fr.core.env.impl.LocalEnvConfig;
import com.fr.decision.webservice.utils.DecisionServiceConstants;
import com.fr.design.env.RemoteEnvConfig;
import com.fr.design.mainframe.loghandler.DesignerLogHandler;
import com.fr.env.RemoteEnv;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
@ -66,14 +70,14 @@ public class DesignerSocketIO {
}
private static void updateSocket() {
EnvConfig env = EnvContext.currentEnv();
if (env instanceof LocalEnvConfig) {
Env env = FRContext.getCurrentEnv();
if (env.isLocalEnv()) {
return;
}
try {
RemoteEnvConfig config = ((RemoteEnv)env).getEnvConfig();
String uri = String.format("http://%s:%s%s?%s=%s",
new URL(env.getPath()).getHost(),
config.getHost(),
WebSocketConfig.getInstance().getPort(),
EnvConstants.WS_NAMESPACE,
DecisionServiceConstants.WEB_SOCKET_TOKEN_NAME,

2
designer-base/src/com/fr/design/roleAuthority/RoleDataWrapper.java

@ -1 +1 @@
package com.fr.design.roleAuthority; import com.fr.base.FRContext; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.loader.ChildrenNodesLoader; import com.fr.general.Inter; import java.util.ArrayList; import java.util.List; /** * 将权限细粒度的角色数据包装一下,区分报表平台管理角色和数据决策系统角色 * <p/> * Author : daisy * Date: 13-8-30 import java.util.ArrayList; import java.util.List; private String roleTypename = null; /** roleTypename = roleName; * <p/> * Author : daisy * Date: 13-8-30 import java.util.ArrayList; import java.util.ArrayList; import java.util.ArrayList; import java.util.ArrayList; import java.util.ArrayList; import java.util.List; } //加载所有的角色列表 public ExpandMutableTreeNode[] load() { calculateRoleList(); return this.load(this.rolelist); } //从workbook中读取的角色列表 public ExpandMutableTreeNode[] load(List<String> rolelist) { this.rolelist = rolelist; ExpandMutableTreeNode[] res = new ExpandMutableTreeNode[rolelist.size()]; for (int i = 0; i < res.length; i++) { res[i] = new ExpandMutableTreeNode(rolelist.get(i)); } return res; } public String getRoleTypename(){ return roleTypename; } }
package com.fr.design.roleAuthority; import com.fr.base.FRContext; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.loader.ChildrenNodesLoader; import com.fr.general.Inter; import java.util.ArrayList; import java.util.ArrayList; /** import java.util.ArrayList; * 将权限细粒度的角色数据包装一下,区分报表平台管理角色和数据决策系统角色 import java.util.ArrayList; * <p/> import java.util.ArrayList; * Author : daisy import java.util.ArrayList; * Date: 13-8-30 import java.util.List; import java.util.List; import java.util.List; import java.util.ArrayList; import java.util.List; import java.util.List; import java.util.List; */ public class RoleDataWrapper implements ChildrenNodesLoader { import java.util.ArrayList; /** import java.util.List; * <p/> import java.util.List; * Author : daisy import java.util.List; * Date: 13-8-30 import java.util.ArrayList; /** import java.util.ArrayList; /** import java.util.ArrayList; import java.util.List; */ private void calculateRoleList() { try { Collections.addAll(rolelist, FRContext.getCurrentEnv().getOrganizationOperator().getRoleGroup()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } //加载所有的角色列表 public ExpandMutableTreeNode[] load() { calculateRoleList(); return this.load(this.rolelist); } //从workbook中读取的角色列表 public ExpandMutableTreeNode[] load(List<String> rolelist) { this.rolelist = rolelist; ExpandMutableTreeNode[] res = new ExpandMutableTreeNode[rolelist.size()]; for (int i = 0; i < res.length; i++) { res[i] = new ExpandMutableTreeNode(rolelist.get(i)); } return res; } public String getRoleTypename(){ return roleTypename; } }

12
designer-base/src/com/fr/design/style/color/ColorSelectConfigManager.java

@ -3,7 +3,6 @@ package com.fr.design.style.color;
import com.fr.base.FRContext;
import com.fr.file.XMLFileManager;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.general.GeneralContext;
import com.fr.stable.EnvChangedListener;
import com.fr.stable.xml.XMLPrintWriter;
@ -96,11 +95,6 @@ public class ColorSelectConfigManager extends XMLFileManager implements ColorSel
if (colors != null && !colors.isEmpty()) {
manager.setColorsToFile(colors);
}
try {
FRContext.getCurrentEnv().writeResource(manager);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
}
@ -115,7 +109,6 @@ public class ColorSelectConfigManager extends XMLFileManager implements ColorSel
ColorSelectConfigManager manager = new ColorSelectConfigManager();
XMLTools.readInputStreamXML(manager, input);
configManager = manager;
FRContext.getCurrentEnv().writeResource(configManager);
}
@ -131,11 +124,6 @@ public class ColorSelectConfigManager extends XMLFileManager implements ColorSel
}
return configManager;
}
public boolean writeResource() throws Exception {
return FRContext.getCurrentEnv().writeResource(ColorSelectConfigManager.getProviderInstance());
}
public String fileName() {
return "recentcolors.xml";

33
designer-base/src/com/fr/design/utils/DesignUtils.java

@ -7,8 +7,6 @@ import com.fr.base.FeedBackInfo;
import com.fr.base.ServerConfig;
import com.fr.base.Utils;
import com.fr.base.remote.RemoteDeziConstants;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.EnvContext;
import com.fr.dav.DavXMLUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
@ -31,11 +29,8 @@ import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.start.ServerStarter;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.Desktop;
import java.awt.Font;
import javax.swing.*;
import java.awt.*;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
@ -187,30 +182,6 @@ public class DesignUtils {
});
}
/**
* 当前的报表运行环境切换到env
*
* @param env 需要切换去的环境
*/
public static void switchToEnv(EnvConfig env) {
if (env == null) {
return;
}
// 看一下这个env在DesignerEnvManager里面有没有对应的,有的话就setCurrentEnvName
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
java.util.Iterator<String> nameIt = envManager.getEnvNameIterator();
while (nameIt.hasNext()) {
String name = nameIt.next();
if (ComparatorUtils.equals(envManager.getEnv(name), env)) {
envManager.setCurEnvName(name);
break;
}
}
EnvContext.signIn(env);
refreshDesignerFrame();
}
public static void refreshDesignerFrame() {
// 刷新DesignerFrame里面的面板

12
designer-base/src/com/fr/design/widget/EventCreator.java

@ -26,21 +26,21 @@ public class EventCreator extends NameableSelfCreator {
}
public static EventCreator[] createEventCreator(String[] supportedEvents, Class<? extends BasicBeanPane> updatePane) {
EventCreator[] creators = new EventCreator[supportedEvents.length];
for (int i = 0; i < supportedEvents.length; i++) {
creators[i] = new EventCreator(supportedEvents[i], updatePane);
EventCreator[] creators = new EventCreator[supportedEvents.length];
for (int i = 0; i < supportedEvents.length; i++) {
creators[i] = new EventCreator(supportedEvents[i], updatePane);
}
return creators;
}
/*
* richer:国际化事件名称所有需要国际化的事件都应按格式Event-eventName来进行国际化
* richer:国际化事件名称所有需要国际化的事件都应按格式FR-Engine_Event_eventName来进行国际化
*/
public static final String switchLang(String eventName) {
try {
return Inter.getLocText("Event-" + eventName);
return Inter.getLocText("FR-Engine_Event_" + eventName);
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
return eventName;

4
designer-base/src/com/fr/env/EnvListPane.java vendored

@ -1,8 +1,8 @@
package com.fr.env;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.resource.LocalEnvConfig;
import com.fr.core.env.resource.RemoteEnvConfig;
import com.fr.core.env.impl.LocalEnvConfig;
import com.fr.design.env.RemoteEnvConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;

2
designer-base/src/com/fr/env/LocalEnvPane.java vendored

@ -1,6 +1,6 @@
package com.fr.env;
import com.fr.core.env.resource.LocalEnvConfig;
import com.fr.core.env.impl.LocalEnvConfig;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextarea.UITextArea;

288
designer-base/src/com/fr/env/RemoteEnv.java vendored

@ -2,31 +2,30 @@ package com.fr.env;
import com.fr.base.EnvException;
import com.fr.base.TableData;
import com.fr.base.operator.common.CommonOperator;
import com.fr.base.operator.connect.ConnectOperator;
import com.fr.base.operator.file.FileOperator;
import com.fr.base.operator.file.SimpleFileOperator;
import com.fr.base.operator.org.OrganizationOperator;
import com.fr.base.remote.RemoteDeziConstants;
import com.fr.common.rpc.RemoteCallServerConfig;
import com.fr.common.rpc.netty.MessageSendExecutor;
import com.fr.common.rpc.netty.RemoteCallClient;
import com.fr.core.env.EnvConstants;
import com.fr.core.env.EnvContext;
import com.fr.core.env.resource.RemoteEnvConfig;
import com.fr.data.TableDataSource;
import com.fr.data.impl.EmbeddedTableData;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.dav.AbstractEnv;
import com.fr.dav.DavXMLUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.env.RemoteEnvConfig;
import com.fr.design.mainframe.DesignerContext;
import com.fr.file.CacheManager;
import com.fr.file.ConnectionConfig;
import com.fr.file.TableDataConfig;
import com.fr.general.CommonIOUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.general.LogRecordTime;
import com.fr.general.LogUtils;
import com.fr.general.http.HttpToolbox;
import com.fr.io.utils.ResourceIOUtils;
import com.fr.json.JSONArray;
@ -38,14 +37,11 @@ import com.fr.share.ShareConstants;
import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants;
import com.fr.stable.Filter;
import com.fr.stable.JavaCompileInfo;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.SvgProvider;
import com.fr.stable.file.XMLFileManagerProvider;
import com.fr.stable.project.ProjectConstants;
import com.fr.stable.xml.XMLTools;
import com.fr.third.guava.base.Strings;
import com.fr.third.guava.collect.ImmutableMap;
import com.fr.web.ResourceConstants;
@ -59,20 +55,17 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.awt.*;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import static com.fr.third.guava.base.Preconditions.checkArgument;
@ -93,13 +86,9 @@ public class RemoteEnv extends AbstractEnv<RemoteEnvConfig> implements DesignAut
this.config = config;
}
public RemoteEnv(String path, String userName, String password) {
config = new RemoteEnvConfig(path, userName, password);
}
@Override
public void connect() throws Exception {
RemoteCallClient.getInstance().load(config.getHost(), config.getPort(), RemoteCallServerConfig.getInstance().getSerializeProtocol());
}
@Override
@ -128,6 +117,26 @@ public class RemoteEnv extends AbstractEnv<RemoteEnvConfig> implements DesignAut
return MessageSendExecutor.getInstance().execute(FileOperator.class);
}
@Override
public CommonOperator getCommonOperator() throws Exception {
return MessageSendExecutor.getInstance().execute(CommonOperator.class);
}
@Override
public OrganizationOperator getOrganizationOperator() throws Exception {
return MessageSendExecutor.getInstance().execute(OrganizationOperator.class);
}
@Override
public SimpleFileOperator getSimpleFileOperator() throws Exception {
return MessageSendExecutor.getInstance().execute(SimpleFileOperator.class);
}
@Override
public RemoteEnvConfig getEnvConfig() {
return config;
}
@Override
public String getPath() {
return config.getPath();
@ -147,6 +156,11 @@ public class RemoteEnv extends AbstractEnv<RemoteEnvConfig> implements DesignAut
return EnvContext.currentToken();
}
@Override
public boolean isLocalEnv() {
return false;
}
/**
* execute method之后,取返回的 InputStream
*/
@ -303,16 +317,6 @@ public class RemoteEnv extends AbstractEnv<RemoteEnvConfig> implements DesignAut
* @throws Exception e
*/
/**
* 返回描述该运行环境的名字
*
* @return 描述环境名字的字符串
*/
@Override
public String getEnvDescription() {
return Inter.getLocText("Env-Remote_Server");
}
public class Bytes2ServerOutputStream extends OutputStream {
private ByteArrayOutputStream out = new ByteArrayOutputStream();
private HashMap<String, String> nameValuePairs;
@ -429,45 +433,6 @@ public class RemoteEnv extends AbstractEnv<RemoteEnvConfig> implements DesignAut
return Boolean.valueOf(IOUtils.inputStream2String(input, EncodeConstants.ENCODING_UTF_8));
}
/**
* DataSource中去除当前角色没有权限访问的数据源
*/
@Override
public void removeNoPrivilegeConnection() {
refreshHttpSProperty();
TableDataConfig dm = TableDataConfig.getInstance();
try {
HashMap<String, String> para = new HashMap<>();
para.put("op", "fs_remote_design");
para.put("cmd", "env_get_role");
para.put("currentUsername", this.getUser());
para.put("currentPwd", this.getPassword());
InputStream input = filterInputStream(
RemoteEnvUtils.simulateRPCByHttpGet(para, false, this)
);
JSONArray ja = new JSONArray(stream2String(input));
ArrayList<String> toBeRemoveTDName = new ArrayList<>();
for (int i = 0; i < ja.length(); i++) {
String toBeRemoveConnName = (String) ((JSONObject) ja.get(i)).get("name");
ConnectionConfig.getInstance().removeConnection(toBeRemoveConnName);
Iterator it = dm.getTableDatas().keySet().iterator();
while (it.hasNext()) {
String tdName = (String) it.next();
TableData td = dm.getTableData(tdName);
td.registerNoPrivilege(toBeRemoveTDName, toBeRemoveConnName, tdName);
}
}
for (int i = 0; i < toBeRemoveTDName.size(); i++) {
dm.removeTableData(toBeRemoveTDName.get(i));
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
}
@Override
public EmbeddedTableData previewTableData(Object tableData, Map parameterMap, int rowCount) throws Exception {
return previewTableData(null, tableData, parameterMap, rowCount);
@ -637,67 +602,6 @@ public class RemoteEnv extends AbstractEnv<RemoteEnvConfig> implements DesignAut
return true;
}
/**
* 写报表运行环境所需的配置文件
*
* @param mgr 管理各个资源文件的管理器
* @return 写入xml成功返回true
* @throws Exception 写入xml错误则抛出此异常
*/
@Override
public boolean writeResource(XMLFileManagerProvider mgr) throws Exception {
testServerConnection();
HashMap<String, String> para = new HashMap<>();
para.put("op", "fr_remote_design");
para.put("cmd", "design_save_resource");
para.put("resource", mgr.fileName());
para.put("class_name", mgr.getClass().getName());
para.put("current_uid", this.getUserID());
para.put("currentUsername", this.getUser());
// alex:通过ByteArrayOutputStream将mgr写成字节流
Bytes2ServerOutputStream out = new Bytes2ServerOutputStream(para);
XMLTools.writeOutputStreamXML(mgr, out);
try {
String res = stream2String(
filterInputStream(
RemoteEnvUtils.simulateRPCByHttpPost(out.getOut().toByteArray(), out.nameValuePairs, false, this)
)
);
if (StringUtils.isNotEmpty(res)) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Already_exist") + res);
return false;
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
return false;
}
return true;
}
/**
* 读取文件
*
* @param beanPath 文件名
* @param prefix 当前Env下得工程分类如reportletslib等
* @return InputStream 输入流
*/
@Override
public InputStream readBean(String beanPath, String prefix)
throws Exception {
refreshHttpSProperty();
HashMap<String, String> para = new HashMap<>();
para.put("op", "fs_remote_design");
para.put("cmd", "design_open");
para.put(RemoteDeziConstants.PREFXI, prefix);
para.put("resource", beanPath);
return filterInputStream(RemoteEnvUtils.simulateRPCByHttpGet(para, false, this));
}
/**
* 写文件
*
@ -771,93 +675,11 @@ public class RemoteEnv extends AbstractEnv<RemoteEnvConfig> implements DesignAut
}
/**
* 输出日志信息
*
* @throws Exception e
*/
@Override
public void printLogMessage() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
HashMap<String, String> para = new HashMap<>();
para.put("op", "fr_remote_design");
para.put("cmd", "get_log_message");
InputStream input = postBytes2ServerB(out.toByteArray(), para);
if (input == null) {
return;
}
LogRecordTime[] records = LogUtils.readXMLLogRecords(input);
}
@Override
public String[] getSupportedTypes() {
return FILE_TYPE;
}
/**
* 判断是否有文件夹权限
*
* @param path 路径
* @return 有权限则返回true
*/
@Override
public boolean hasFileFolderAllow(String path) {
refreshHttpSProperty();
try {
HashMap<String, String> para = new HashMap<>();
para.put("op", "fs_remote_design");
para.put("cmd", "design_filefolder_allow");
para.put("current_uid", this.getUserID());
para.put(RemoteDeziConstants.TEMPLATE_PATH, path);
InputStream input = filterInputStream(
RemoteEnvUtils.simulateRPCByHttpGet(para, false, this)
);
if (input == null) {
return false;
}
return Boolean.valueOf(IOUtils.inputStream2String(input, EncodeConstants.ENCODING_UTF_8));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
return false;
}
}
@Override
public InputStream getDataSourceInputStream(String filePath) throws Exception {
return readBean(filePath, "datasource");
}
@Override
public ArrayList getAllRole4Privilege(boolean isFS) {
refreshHttpSProperty();
ArrayList<String> allRoleList = new ArrayList<>();
try {
HashMap<String, String> para = new HashMap<>();
para.put("op", "fr_remote_design");
para.put("cmd", "get_all_role");
para.put("isFS", String.valueOf(isFS));
InputStream input = filterInputStream(
RemoteEnvUtils.simulateRPCByHttpGet(para, false, this)
);
JSONArray ja = new JSONArray(stream2String(input));
for (int i = 0; i < ja.length(); i++) {
String roleName = (String) ((JSONObject) ja.get(i)).get("name");
allRoleList.add(roleName);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
return allRoleList;
}
/**
* 获取当前env的build文件路径
*/
@ -874,56 +696,6 @@ public class RemoteEnv extends AbstractEnv<RemoteEnvConfig> implements DesignAut
this.buildFilePath = buildFilePath;
}
/**
* 编译Java源代码方便二次开发的进行
*
* @param sourceText 源代码
* @return 编译信息有可能是成功信息也有可能是出错或者警告信息
*/
@Override
public JavaCompileInfo compilerSourceCode(String sourceText) throws Exception {
HashMap<String, String> para = new HashMap<>();
para.put("op", "fr_remote_design");
para.put("cmd", "design_compile_source_code");
InputStream in = postBytes2ServerB(sourceText.getBytes(EncodeConstants.ENCODING_UTF_8), para);
BufferedReader br = new BufferedReader(new InputStreamReader(in, EncodeConstants.ENCODING_UTF_8));
StringBuilder sb = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
sb.append(line);
}
JSONObject jo = new JSONObject(sb.toString());
JavaCompileInfo info = new JavaCompileInfo();
info.parseJSON(jo);
return info;
}
@Override
public String pluginServiceAction(String serviceID, String req) throws Exception {
refreshHttpSProperty();
HashMap<String, String> para = new HashMap<>();
para.put("op", "fr_remote_design");
para.put("cmd", "design_get_plugin_service_data");
para.put("serviceID", serviceID);
para.put("req", req);
//jim :加上user,远程设计点击预览时传递用户角色信息
InputStream inputStream = filterInputStream(
RemoteEnvUtils.simulateRPCByHttpPost(para, false, this)
);
return IOUtils.inputStream2String(inputStream);
}
/**
* 远程不启动使用虚拟服务
* <p>
*
* @param serviceID serviceID
*/
@Override
public void pluginServiceStart(String serviceID) {
}
@Override
public String[] loadREUFile() {
refreshHttpSProperty();

8
designer-base/src/com/fr/env/RemoteEnvPane.java vendored

@ -2,7 +2,7 @@ package com.fr.env;
import com.fr.base.FRContext;
import com.fr.core.env.resource.EnvConfigUtils;
import com.fr.core.env.resource.RemoteEnvConfig;
import com.fr.design.env.RemoteEnvConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.UITitledBorder;
@ -280,8 +280,9 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteEnvConfig> {
String path = remoteEnvURL.getURL();
String user = this.usernameInput.getText();
String password = new String(this.passwordInput.getPassword());
return null;
return new RemoteEnvConfig(path, user, password);
//return new RemoteEnvConfig(path, user, password);
}
@Override
@ -471,7 +472,8 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteEnvConfig> {
private boolean testConnection() {
String url = remoteEnvURL.getURL();
RemoteEnv env = new RemoteEnv(url, usernameInput.getText(), new String(passwordInput.getPassword()));
//RemoteEnv env = new RemoteEnv(url, usernameInput.getText(), new String(passwordInput.getPassword()));
RemoteEnv env = null;
boolean connect = false;
try {
if (StringUtils.isNotEmpty(url)) {

88
designer-base/src/com/fr/env/RemoteEnvPane2.java vendored

@ -1,6 +1,6 @@
package com.fr.env;
import com.fr.core.env.resource.RemoteEnvConfig;
import com.fr.design.env.RemoteEnvConfig;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.UITitledBorder;
import com.fr.design.gui.ibutton.UIButton;
@ -12,14 +12,14 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.concurrent.ExecutionException;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
/**
* 远程环境设置界面暂时命名为2待做完功能直接替代掉老的RemoteEnvPane
@ -30,6 +30,10 @@ public class RemoteEnvPane2 extends BasicBeanPane<RemoteEnvConfig> {
private UIIntNumberField portTextField;
private UITextField usernameTextField;
private UIPassWordField passwordTextField;
private JDialog dialog;
private UILabel message;
private UIButton okButton;
private UIButton cancelButton;
public RemoteEnvPane2() {
initComponents();
@ -73,46 +77,82 @@ public class RemoteEnvPane2 extends BasicBeanPane<RemoteEnvConfig> {
}
});
contentPanel.add(valuePane, BorderLayout.CENTER);
message = new UILabel();
okButton = new UIButton(Inter.getLocText("OK"));
cancelButton = new UIButton(Inter.getLocText("Cancel"));
}
private void tryConnectRemoteEnv() {
final RemoteEnv remoteEnv = new RemoteEnv(this.updateBean());
new SwingWorker<Void, Void>() {
final SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
final RemoteEnv remoteEnv = new RemoteEnv(updateBean());
remoteEnv.connectOnce();
return null;
}
@Override
protected void done() {
okButton.setEnabled(true);
try {
get();
showConnectMessage();
message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Successful"));
} catch (Exception e) {
showCannotConnectMessage();
message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Failed"));
}
}
}.execute();
}
};
worker.execute();
initMessageDialog();
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dialog.dispose();
}
});
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dialog.dispose();
worker.cancel(true);
}
});
private void showCannotConnectMessage() {
JOptionPane.showMessageDialog(
this,
Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Failed"),
UIManager.getString("OptionPane.messageDialogTitle", this.getLocale()),
JOptionPane.ERROR_MESSAGE
);
dialog.addWindowListener(new WindowAdapter() {
public void windowClosed(WindowEvent e) {
worker.cancel(true);
}
});
dialog.setVisible(true);
dialog.dispose();
}
private void showConnectMessage() {
JOptionPane.showMessageDialog(
this,
Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Successful"),
UIManager.getString("OptionPane.messageDialogTitle", this.getLocale()),
JOptionPane.INFORMATION_MESSAGE
);
private void initMessageDialog() {
message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Env_Try") + "...");
message.setBorder(BorderFactory.createEmptyBorder(8, 5, 0, 0));
okButton.setEnabled(false);
dialog = new JDialog((Dialog) SwingUtilities.getWindowAncestor(RemoteEnvPane2.this), Inter.getLocText("Datasource-Test_Connection"), true);
dialog.setSize(new Dimension(268, 118));
okButton.setEnabled(false);
JPanel jp = new JPanel();
JPanel upPane = new JPanel();
JPanel downPane = new JPanel();
UILabel uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon"));
upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
upPane.add(uiLabel);
upPane.add(message);
downPane.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 0));
downPane.add(okButton);
downPane.add(cancelButton);
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
jp.add(upPane);
jp.add(downPane);
dialog.add(jp);
dialog.setResizable(false);
dialog.setLocationRelativeTo(SwingUtilities.getWindowAncestor(RemoteEnvPane2.this));
}
@Override
@ -125,7 +165,7 @@ public class RemoteEnvPane2 extends BasicBeanPane<RemoteEnvConfig> {
if (config == null) {
return;
}
hostTextField.setText(config.getPath());
hostTextField.setText(config.getHost());
if (config.getPort() != 0) {
portTextField.setValue(config.getPort());
}

11
designer-base/src/com/fr/env/SignIn.java vendored

@ -1,6 +1,8 @@
package com.fr.env;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.EnvContext;
import com.fr.core.env.EnvEvent;
@ -12,6 +14,7 @@ import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.stable.AssistUtils;
import javax.swing.*;
@ -34,10 +37,10 @@ public class SignIn {
* @throws Exception 异常
*/
public static void signIn(EnvConfig selectedEnv) throws Exception {
if (EnvContext.currentEnv() != null && !ComparatorUtils.equals(EnvContext.currentEnv(), selectedEnv)) {
EnvContext.signOut();
Env env = FRContext.getCurrentEnv();
if (env != null && AssistUtils.equals(env.getEnvConfig(), selectedEnv)) {
env.disconnect();
}
DesignUtils.switchToEnv(selectedEnv);
//DesignUtils.switchToEnv(selectedEnv);
}
}

50
designer-base/src/com/fr/file/FILEChooserPane.java

@ -1,8 +1,8 @@
package com.fr.file;
import com.fr.base.BaseUtils;
import com.fr.base.extension.FileExtension;
import com.fr.base.FRContext;
import com.fr.base.extension.FileExtension;
import com.fr.dav.LocalEnv;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction;
@ -26,6 +26,7 @@ import com.fr.file.filter.FILEFilter;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.CoreConstants;
import com.fr.stable.OperatingSystem;
import com.fr.stable.ProductConstants;
@ -33,38 +34,13 @@ import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import javax.swing.AbstractAction;
import javax.swing.AbstractListModel;
import javax.swing.ActionMap;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.Icon;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JFileChooser;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.KeyStroke;
import javax.swing.ListCellRenderer;
import javax.swing.ListModel;
import javax.swing.ListSelectionModel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.filechooser.FileSystemView;
import javax.swing.plaf.basic.BasicArrowButton;
import javax.swing.plaf.basic.BasicButtonUI;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.Window;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
@ -707,7 +683,14 @@ public class FILEChooserPane extends BasicPane {
}
returnValue = OK_OPTION;
FILE selectedFile = this.getSelectedFILE();
if (!FRContext.getCurrentEnv().hasFileFolderAllow(selectedFile.getPath())) {
boolean access = false;
try {
access = FRContext.getCurrentEnv().getOrganizationOperator().canAccess(selectedFile.getPath());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (!access) {
JOptionPane.showMessageDialog(FILEChooserPane.this, Inter.getLocText("FR-App-Privilege_No") + "!", Inter.getLocText("FR-App-File_Message"), JOptionPane.WARNING_MESSAGE);
return;
}
@ -1418,7 +1401,14 @@ public class FILEChooserPane extends BasicPane {
if (currentDirectory == null) {
return;
}
if (!FRContext.getCurrentEnv().hasFileFolderAllow(currentDirectory.getPath() + "/")) {
boolean access = false;
try {
access = FRContext.getCurrentEnv().getOrganizationOperator().canAccess(currentDirectory.getPath());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (!access) {
JOptionPane.showMessageDialog(FILEChooserPane.this, Inter.getLocText("FR-App-Privilege_No") + "!", Inter.getLocText("FR-App-File_Message"), JOptionPane.WARNING_MESSAGE);
return;
}

37
designer-base/src/com/fr/file/FileNodeFILE.java

@ -8,12 +8,14 @@ import com.fr.design.gui.itree.filetree.FileTreeIcon;
import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.OutputStream;
@ -166,7 +168,7 @@ public class FileNodeFILE implements FILE {
return res_array;
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return new FILE[0];
}
}
@ -178,18 +180,10 @@ public class FileNodeFILE implements FILE {
* @return 返回文件节点
*/
private FileNode[] listFile(String rootFilePath) {
if (ComparatorUtils.equals(envPath, FRContext.getCurrentEnv().getWebReportPath())) {
try {
return FRContext.getCurrentEnv().listReportPathFile(rootFilePath);
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
} else {
try {
return FRContext.getCurrentEnv().listFile(rootFilePath);
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
try {
return FRContext.getCurrentEnv().getFileOperator().list(rootFilePath);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return new FileNode[0];
}
@ -206,11 +200,9 @@ public class FileNodeFILE implements FILE {
}
try {
return FRContext.getCurrentEnv().createFolder(StableUtils.pathJoin(new String[]{
node.getEnvPath(), name
}));
return FRContext.getCurrentEnv().getFileOperator().createFolder(StableUtils.pathJoin(node.getEnvPath(), name));
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false;
}
}
@ -248,7 +240,7 @@ public class FileNodeFILE implements FILE {
}
try {
return FRContext.getCurrentEnv().fileExists(node.getEnvPath());
return FRContext.getCurrentEnv().getFileOperator().isExists(node.getEnvPath());
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
return false;
@ -275,9 +267,9 @@ public class FileNodeFILE implements FILE {
}
try {
return FRContext.getCurrentEnv().createFile(node.getEnvPath());
return FRContext.getCurrentEnv().getFileOperator().createFile(node.getEnvPath());
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false;
}
}
@ -299,10 +291,7 @@ public class FileNodeFILE implements FILE {
return null;
}
InputStream in = FRContext.getCurrentEnv().readBean(
envPath.substring(ProjectConstants.REPORTLETS_NAME.length() + 1),
ProjectConstants.REPORTLETS_NAME
);
InputStream in = new ByteArrayInputStream(FRContext.getCurrentEnv().getFileOperator().read(StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, envPath.substring(ProjectConstants.REPORTLETS_NAME.length() + 1))));
return envPath.endsWith(".cpt") || envPath.endsWith(".frm")
? XMLEncryptUtils.decodeInputStream(in) : in;

52
designer-base/src/com/fr/start/BaseDesigner.java

@ -11,6 +11,7 @@ import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerStartOpenFileProcessor;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.loghandler.LogMessageBar;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
import com.fr.design.utils.DesignUtils;
import com.fr.event.EventDispatcher;
@ -23,11 +24,13 @@ import com.fr.log.FineLoggerFactory;
import com.fr.module.ModuleEvent;
import com.fr.stable.OperatingSystem;
import java.awt.*;
import java.awt.Window;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.lang.reflect.Method;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* The main class of Report Designer.
@ -46,19 +49,47 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
EventDispatcher.fire(ModuleEvent.MajorModuleStarting, InterProviderFactory.getProvider().getLocText("FR-Designer_Initializing"));
// 初始化look and feel.这个在预加载之前执行是因为lookAndFeel里的东西,预加载时也要用到
DesignUtils.initLookAndFeel();
// 预加载一些耗时的单例面板
preLoadPane();
// 初始化Log Handler
DesignerEnvManager.loadLogSetting();
createDesignerFrame();
}
public void show(String[] args) {
collectUserInformation();
showDesignerFrame(args, DesignerContext.getDesignerFrame(), false);
for (int i = 0; !TemplateTreePane.getInstance().getTemplateFileTree().isTemplateShowing() && i < LOAD_TREE_MAXNUM; i++) {
TemplateTreePane.getInstance().getTemplateFileTree().refresh();
}
private void preLoadPane() {
ExecutorService service = Executors.newCachedThreadPool();
service.submit(new Runnable() {
@Override
public void run() {
LogMessageBar.getInstance();
}
});
service.submit(new Runnable() {
@Override
public void run() {
HistoryTemplateListPane.getInstance();
}
});
service.shutdown();
}
public void show(final String[] args) {
ExecutorService executorService = Executors.newSingleThreadExecutor();
executorService.submit(new Runnable() {
@Override
public void run() {
collectUserInformation();
showDesignerFrame(args, DesignerContext.getDesignerFrame(), false);
DesignerContext.getDesignerFrame().refreshEnv();
for (int i = 0; !TemplateTreePane.getInstance().getTemplateFileTree().isTemplateShowing() && i < LOAD_TREE_MAXNUM; i++) {
TemplateTreePane.getInstance().getTemplateFileTree().refresh();
}
}
});
executorService.shutdown();
DesignerContext.getDesignerFrame().setVisible(true);
}
@ -134,7 +165,6 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
df.getSelectedJTemplate().requestGridFocus();
}
});
df.setVisible(true);
return isException;
}

6
designer-base/src/com/fr/start/ServerStarter.java

@ -2,16 +2,17 @@ package com.fr.start;
import com.fr.base.FRContext;
import com.fr.base.ServerConfig;
import com.fr.base.env.EnvUpdater;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.env.EnvGenerator;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.mainframe.DesignerContext;
import com.fr.env.RemoteEnv;
import com.fr.env.SignIn;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
@ -52,9 +53,8 @@ public class ServerStarter {
@Override
public void doOk() {
try {
SignIn.signIn(DesignerEnvManager.getEnvManager().getDefaultEnv());
EnvUpdater.updateEnv(EnvGenerator.generate(DesignerEnvManager.getEnvManager().getDefaultEnv()));
TemplateTreePane.getInstance().refreshDockingView();
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
} catch (Exception e) {

16
designer-base/src/com/fr/start/server/FineEmbedServerActivator.java

@ -11,6 +11,7 @@ import com.fr.third.springframework.web.SpringServletContainerInitializer;
import com.fr.third.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.apache.catalina.Context;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.Wrapper;
import org.apache.catalina.loader.VirtualWebappLoader;
import org.apache.catalina.startup.Tomcat;
@ -57,7 +58,7 @@ public class FineEmbedServerActivator extends Activator {
String docBase = new File(FRContext.getCurrentEnv().getPath()).getParent();
String appName = "/" + FRContext.getCurrentEnv().getAppName();
Context context = tomcat.addContext(appName, docBase);
tomcat.addServlet(appName, "default", "org.apache.catalina.servlets.DefaultServlet");
addDefaultServlet(context);
//覆盖tomcat的WebAppClassLoader
context.setLoader(new FRTomcatLoader());
@ -68,6 +69,19 @@ public class FineEmbedServerActivator extends Activator {
context.addServletContainerInitializer(initializer, classes);
}
private void addDefaultServlet(Context context) {
Wrapper defaultServlet = context.createWrapper();
defaultServlet.setName("default");
defaultServlet.setServletClass("org.apache.catalina.servlets.DefaultServlet");
defaultServlet.addInitParameter("debug", "0");
defaultServlet.addInitParameter("listings", "false");
defaultServlet.setLoadOnStartup(1);
defaultServlet.setOverridable(true);
context.addChild(defaultServlet);
context.addServletMapping("/","default");
}
private void stopServerActivator() {

16
designer-chart/src/com/fr/design/chart/series/PlotSeries/MapGroupExtensionPane.java

@ -340,13 +340,13 @@ public class MapGroupExtensionPane extends BasicPane implements UIObserver {
return;
}
try{//提醒名字已存在
if(FRContext.getCurrentEnv().fileExists(StableUtils.pathJoin(
new String[]{MapSvgXMLHelper.relativeDefaultMapPath(),newName+SvgProvider.EXTENSION}))){
if(FRContext.getCurrentEnv().getFileOperator().isExists(StableUtils.pathJoin(
MapSvgXMLHelper.relativeDefaultMapPath(),newName+SvgProvider.EXTENSION))){
showRenameWaring(newName);
return;
}
if(FRContext.getCurrentEnv().fileExists(StableUtils.pathJoin(
new String[]{MapSvgXMLHelper.relativeCustomMapPath(), newName + SvgProvider.EXTENSION}))){
if(FRContext.getCurrentEnv().getFileOperator().isExists(StableUtils.pathJoin(
MapSvgXMLHelper.relativeCustomMapPath(), newName + SvgProvider.EXTENSION))){
showRenameWaring(newName);
return;
}
@ -361,10 +361,10 @@ public class MapGroupExtensionPane extends BasicPane implements UIObserver {
groupExtensionPane.setValueAtCurrentSelectIndex(newName);
fireStateChange();
saveMapInfo(newName);
FRContext.getCurrentEnv().deleteFile(
StableUtils.pathJoin(new String[]{MapSvgXMLHelper.relativeDefaultMapPath(),oldName+SvgProvider.EXTENSION}));
FRContext.getCurrentEnv().deleteFile(
StableUtils.pathJoin(new String[]{MapSvgXMLHelper.relativeCustomMapPath(),oldName+SvgProvider.EXTENSION}));
FRContext.getCurrentEnv().getFileOperator().delete(
StableUtils.pathJoin(MapSvgXMLHelper.relativeDefaultMapPath(),oldName+SvgProvider.EXTENSION));
FRContext.getCurrentEnv().getFileOperator().delete(
StableUtils.pathJoin(MapSvgXMLHelper.relativeCustomMapPath(),oldName+SvgProvider.EXTENSION));
refresh();
}catch (Exception exp){
FineLoggerFactory.getLogger().error(exp.getMessage());

13
designer-form/src/com/fr/design/designer/beans/models/SelectionModel.java

@ -65,6 +65,19 @@ public class SelectionModel {
if (e.getButton() == MouseEvent.BUTTON3 || (!InputEventBaseOnOS.isControlDown(e) && !e.isShiftDown())) {
// 如果Ctrl或者Shift键盘没有按下,则清除已经选择的组件
selection.reset();
} else {
//按下Ctrl或者shift键时鼠标可以进行多选,两次点击同一控件就取消选中
XCreator comp = designer.getComponentAt(e);
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer(comp).getTopLayout();
if (topLayout != null && !topLayout.isEditable()) {
comp = topLayout;
}
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(comp);
for (XCreator selected : selection.getSelectedCreators()) {
if (selected == comp || XCreatorUtils.getParentXLayoutContainer(selected) != container) {
selection.removeCreator(selected);
}
}
}
// 获取e所在的组件
XCreator comp = designer.getComponentAt(e);

52
designer-form/src/com/fr/design/designer/creator/XMultiFileUploader.java

@ -3,23 +3,24 @@
*/
package com.fr.design.designer.creator;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.beans.IntrospectionException;
import javax.swing.JComponent;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import com.fr.base.BaseUtils;
import com.fr.design.designer.properties.mobile.MultiFileUploaderPropertyUI;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.MultiFileEditor;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import javax.swing.JComponent;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.beans.IntrospectionException;
/**
* @author richer
* @since 6.5.3
@ -29,22 +30,22 @@ public class XMultiFileUploader extends XFieldEditor {
public XMultiFileUploader(MultiFileEditor widget, Dimension initSize) {
super(widget, initSize);
}
@Override
@Override
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return (CRPropertyDescriptor[]) ArrayUtils.addAll(
super.supportedDescriptor(),
new CRPropertyDescriptor[]{
new CRPropertyDescriptor("singleFile", this.data.getClass())
.setI18NName(Inter.getLocText("SINGLE_FILE_UPLOAD"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("accept", this.data.getClass())
.setI18NName(Inter.getLocText("File-Allow_Upload_Files"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("maxSize", this.data.getClass())
.setI18NName(Inter.getLocText("File-File_Size_Limit"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
});
super.supportedDescriptor(),
new CRPropertyDescriptor[]{
new CRPropertyDescriptor("singleFile", this.data.getClass())
.setI18NName(Inter.getLocText("SINGLE_FILE_UPLOAD"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("accept", this.data.getClass())
.setI18NName(Inter.getLocText("File-Allow_Upload_Files"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("maxSize", this.data.getClass())
.setI18NName(Inter.getLocText("File-File_Size_Limit"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
});
}
@Override
@ -93,4 +94,9 @@ public class XMultiFileUploader extends XFieldEditor {
protected String getIconName() {
return "files_up.png";
}
@Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
return new WidgetPropertyUIProvider[]{ new MultiFileUploaderPropertyUI(this)};
}
}

15
designer-form/src/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java

@ -5,17 +5,13 @@ import com.fr.design.designer.beans.adapters.layout.FRAbsoluteBodyLayoutAdapter;
import com.fr.design.designer.properties.mobile.BodyMobilePropertyUI;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.mainframe.widget.editors.PaddingMarginEditor;
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor;
import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer;
import com.fr.design.mainframe.widget.renderer.PaddingMarginCellRenderer;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WAbsoluteBodyLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.stable.core.PropertyChangeAdapter;
import java.awt.*;
import java.awt.Component;
import java.awt.Dimension;
import java.beans.IntrospectionException;
/**
@ -127,4 +123,11 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout {
return false;
}
/**
* 是否支持共享-body不支持共享
* @return
*/
public boolean isSupportShared() {
return false;
}
}

33
designer-form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java

@ -4,6 +4,8 @@
package com.fr.design.designer.creator.cardlayout;
import com.fr.base.GraphHelper;
import com.fr.base.iofileattr.SharableAttrMark;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.LayoutAdapter;
@ -16,8 +18,10 @@ import com.fr.design.designer.creator.XWBorderLayout;
import com.fr.design.designer.creator.XWidgetCreator;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.icon.IconPathConstants;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetHelpDialog;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.form.event.Listener;
import com.fr.form.ui.LayoutBorderStyle;
@ -33,8 +37,10 @@ import com.fr.form.ui.container.cardlayout.WCardTitleLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.share.ShareConstants;
import com.fr.stable.Constants;
import javax.swing.Icon;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Component;
@ -44,6 +50,7 @@ import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
@ -58,6 +65,7 @@ import java.util.List;
*/
public class XWCardMainBorderLayout extends XWBorderLayout {
private Icon controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH);
private static final int CENTER = 1;
private static final int NORTH = 0;
private static final int TITLE_STYLE = 2;
@ -358,9 +366,21 @@ public class XWCardMainBorderLayout extends XWBorderLayout {
);
g2d.setColor(Color.WHITE);
//画编辑文字
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.drawString(Inter.getLocText("FR-Designer_Edit"), x + w / 2 - 2, y + h / 2 + 5);
g.setColor(XCreatorConstants.FORM_BORDER_COLOR);
GraphHelper.draw(g, new Rectangle(BORDER_WIDTH, BORDER_WIDTH, getWidth() - BORDER_WIDTH * 2, getHeight() - BORDER_WIDTH * 2), Constants.LINE_MEDIUM);
paintExtro(g);
}
}
public void paintExtro(Graphics g) {
if (this.toData().getWidgetAttrMark(SharableAttrMark.XML_TAG) != null) {
int width = getWidth() - ShareConstants.SHARE_EL_CONTROL_BUTTON_HW;
g.setColor(UIConstants.NORMAL_BACKGROUND);
g.fillArc(width, 0, ShareConstants.SHARE_EL_CONTROL_BUTTON_HW, ShareConstants.SHARE_EL_CONTROL_BUTTON_HW,
0, 360);
controlMode.paintIcon(this, g, width, 0);
}
}
@ -379,6 +399,11 @@ public class XWCardMainBorderLayout extends XWBorderLayout {
*/
@Override
public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e){
//帮助弹窗
if (this.isHelpBtnOnFocus()) {
new WidgetHelpDialog(DesignerContext.getDesignerFrame(), this.toData().getDescription()).showWindow(e);
return;
}
FormDesigner designer = editingMouseListener.getDesigner();
SelectionModel selectionModel = editingMouseListener.getSelectionModel();
boolean isEditing = e.getButton() == MouseEvent.BUTTON1 &&
@ -455,4 +480,12 @@ public class XWCardMainBorderLayout extends XWBorderLayout {
return new FRCardMainBorderLayoutAdapter(this);
}
/**
* 是否支持共享-现只支持报表块图表tab块绝对布局
* @return
*/
public boolean isSupportShared() {
return true;
}
}

5
designer-form/src/com/fr/design/designer/properties/mobile/BodyMobilePropertyUI.java

@ -6,6 +6,7 @@ import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.dialog.BasicPane;
import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider;
import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.design.widget.ui.designer.mobile.BodyMobileDefinePane;
import com.fr.general.Inter;
/**
@ -25,12 +26,12 @@ public class BodyMobilePropertyUI extends AbstractWidgetPropertyUIProvider {
@Override
public AbstractPropertyTable createWidgetAttrTable() {
return new BodyAppRelayoutTable(xCreator);
return null;
}
@Override
public BasicPane createWidgetAttrPane() {
return null;
return new BodyMobileDefinePane(xCreator);
}
@Override

36
designer-form/src/com/fr/design/designer/properties/mobile/MultiFileUploaderPropertyUI.java

@ -0,0 +1,36 @@
package com.fr.design.designer.properties.mobile;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XMultiFileUploader;
import com.fr.design.dialog.BasicPane;
import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider;
import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.design.widget.ui.designer.mobile.MultiFileUploaderDefinePane;
import com.fr.general.Inter;
/**
* Created by plough on 2018/4/19.
*/
public class MultiFileUploaderPropertyUI extends AbstractWidgetPropertyUIProvider {
private XCreator xCreator;
public MultiFileUploaderPropertyUI(XMultiFileUploader xMultiFileUploader) {
this.xCreator = xMultiFileUploader;
}
@Override
public AbstractPropertyTable createWidgetAttrTable() {
return null;
}
@Override
public BasicPane createWidgetAttrPane() {
return new MultiFileUploaderDefinePane(xCreator);
}
@Override
public String tableTitle() {
return Inter.getLocText("FR-Designer_Mobile-Attr");
}
}

24
designer-form/src/com/fr/design/form/mobile/FormMobileAttrPane.java

@ -17,6 +17,8 @@ public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
private MobileToolBarPane mobileToolBarPane;
// 模版设置面板
private FormMobileTemplateSettingsPane formMobileTemplateSettingsPane;
// 其他
private FormMobileOthersPane formMobileOthersPane;
private static final int PADDING = 10;
@ -26,18 +28,18 @@ public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel mobileToolBarPaneWrapper = new JPanel(new BorderLayout());
mobileToolBarPaneWrapper.setBorder(BorderFactory.createEmptyBorder(PADDING, PADDING, 0, PADDING));
this.mobileToolBarPane = new MobileToolBarPane();
mobileToolBarPaneWrapper.add(this.mobileToolBarPane, BorderLayout.NORTH);
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.setBorder(BorderFactory.createEmptyBorder(PADDING, PADDING, PADDING, PADDING));
JPanel formMobileTemplateSettingsPaneWrapper = new JPanel(new BorderLayout());
formMobileTemplateSettingsPaneWrapper.setBorder(BorderFactory.createEmptyBorder(PADDING, PADDING, PADDING, PADDING));
this.formMobileTemplateSettingsPane = new FormMobileTemplateSettingsPane();
formMobileTemplateSettingsPaneWrapper.add(this.formMobileTemplateSettingsPane, BorderLayout.NORTH);
panel.add(formMobileTemplateSettingsPane = new FormMobileTemplateSettingsPane());
panel.add(mobileToolBarPane = new MobileToolBarPane());
panel.add(formMobileOthersPane = new FormMobileOthersPane());
this.add(formMobileTemplateSettingsPaneWrapper, BorderLayout.NORTH);
this.add(mobileToolBarPaneWrapper, BorderLayout.CENTER);
JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane();
panelWrapper.add(panel, BorderLayout.NORTH);
UIScrollPane scrollPane = new UIScrollPane(panelWrapper);
this.add(scrollPane);
}
@Override
@ -47,6 +49,7 @@ public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
}
this.mobileToolBarPane.populateBean(ob);
this.formMobileTemplateSettingsPane.populateBean(ob);
this.formMobileOthersPane.populateBean(ob);
}
@Override
@ -54,6 +57,7 @@ public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
FormMobileAttr formMobileAttr = new FormMobileAttr();
this.mobileToolBarPane.updateBean(formMobileAttr);
this.formMobileTemplateSettingsPane.updateBean(formMobileAttr);
this.formMobileOthersPane.updateBean(formMobileAttr);
return formMobileAttr;
}

65
designer-form/src/com/fr/design/form/mobile/FormMobileOthersPane.java

@ -0,0 +1,65 @@
package com.fr.design.form.mobile;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.mobile.MobileRadioCheckPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.main.mobile.FormMobileAttr;
import com.fr.general.Inter;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
/**
* Created by plough on 2018/5/31.
*/
public class FormMobileOthersPane extends BasicBeanPane<FormMobileAttr> {
private MobileRadioCheckPane appearRefreshCheckPane; // 页面再现时刷新
private MobileRadioCheckPane promptWhenLeaveWithoutSubmitCheckPane; // 数据未提交离开提示
public FormMobileOthersPane() {
this.initComponents();
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow());
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
contentPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L1, 0, 0));
appearRefreshCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Appear_Refresh"));
contentPane.add(appearRefreshCheckPane, BorderLayout.WEST);
promptWhenLeaveWithoutSubmitCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Prompt_When_Leave_Without_Submit"));
contentPane.add(promptWhenLeaveWithoutSubmitCheckPane, BorderLayout.CENTER);
borderPane.add(contentPane);
this.add(borderPane);
}
@Override
public void populateBean(FormMobileAttr ob) {
if (ob == null) {
ob = new FormMobileAttr();
}
this.appearRefreshCheckPane.populateBean(ob.isAppearRefresh());
this.promptWhenLeaveWithoutSubmitCheckPane.populateBean(ob.isPromptWhenLeaveWithoutSubmit());
}
@Override
public FormMobileAttr updateBean() {
return null;
}
@Override
public void updateBean(FormMobileAttr mobileAttr) {
if(mobileAttr != null) {
mobileAttr.setAppearRefresh(this.appearRefreshCheckPane.updateBean());
mobileAttr.setPromptWhenLeaveWithoutSubmit(this.promptWhenLeaveWithoutSubmitCheckPane.updateBean());
}
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Other");
}
}

75
designer-form/src/com/fr/design/mainframe/ElementCaseHelpDialog.java

@ -1,75 +0,0 @@
package com.fr.design.mainframe;
import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* @author zack
* @date 2016-10-14
* @since 8.0
*/
public class ElementCaseHelpDialog extends UIDialog {
private static final int OUTER_WIDTH = 190;
private static final int OUTER_HEIGHT = 280;
private String helpMsg;
private UIScrollPane helpArea;
public ElementCaseHelpDialog(Frame parent, String helpMsg) {
super(parent);
this.helpMsg = helpMsg;
initHelpArea();
JPanel panel = (JPanel) getContentPane();
initComponents(panel);
setSize(new Dimension(OUTER_WIDTH, OUTER_HEIGHT));
}
private void initHelpArea() {
UITextArea textArea = new UITextArea(helpMsg);
textArea.setEditable(false);
textArea.setBorder(null);
helpArea = new UIScrollPane(textArea);
helpArea.setBounds(0, 0, OUTER_WIDTH, OUTER_HEIGHT);
helpArea.setBorder(null);
}
private void initComponents(JPanel contentPane) {
contentPane.setLayout(new BorderLayout());
add(helpArea, BorderLayout.CENTER);
this.applyClosingAction();
this.setTitle(Inter.getLocText("FR-Designer_Help"));
}
/**
* 打开帮助框
*/
public void showWindow() {
this.setResizable(false);
setVisible(true);
}
/**
*
*/
@Override
public void checkValid() throws Exception {
}
public void setLocationRelativeTo(JFrame c, int x, int y) {
int dx = 0, dy = 0;
Point compLocation = c.getLocationOnScreen();//获取设计器Jframe坐标作为相对位置原点
setLocation(dx + x, dy + y);
dx = compLocation.x;
dy = compLocation.y + c.getRootPane().getY();//加上底层容器的y坐标(其实就是设计器最上方图标栏的高度)
setLocation(dx + x, dy + y);
}
}

1
designer-form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java

@ -76,6 +76,7 @@ public class FormMobileAttrAction extends JTemplateAction<JForm> {
formTpl.setFormMobileAttr(formMobileAttr); // 会调整 body 的自适应布局,放到最后
((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified();
WidgetPropertyPane.getInstance().refreshDockingView();
jf.fireTargetModified();
}
});
dialog.setVisible(true);

BIN
designer-realize/src/com/fr/design/images/splash_10.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 MiB

After

Width:  |  Height:  |  Size: 21 MiB

8
designer-realize/src/com/fr/design/mainframe/HyperlinkGroupPaneActionImpl.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe;
import com.fr.base.FRContext;
import com.fr.base.Style;
import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.designer.TargetComponent;
@ -84,7 +85,12 @@ public class HyperlinkGroupPaneActionImpl implements HyperlinkGroupPaneActionPro
frFont = frFont.applyUnderline(Constants.LINE_NONE);
}
editCellElement.setStyle(elementStyle.deriveFRFont(frFont));
editCellElement.setNameHyperlinkGroup(updateNameHyperlinks);
try {
editCellElement.setNameHyperlinkGroup((NameJavaScriptGroup) updateNameHyperlinks.clone());
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since NameJavaScriptGroup are FCloneable
FRContext.getLogger().error("InternalError: " + e.getMessage());
}
}
});
}

10
designer-realize/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java

@ -1,16 +1,18 @@
package com.fr.design.mainframe.alphafine.component;
import com.bulenkov.iconloader.IconLoader;
import com.fr.design.actions.help.alphafine.AlphaFineContext;
import com.fr.design.actions.help.alphafine.AlphaFineListener;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.utils.ThemeUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import java.awt.*;
import java.awt.AWTEvent;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -28,7 +30,7 @@ public class AlphaFinePane extends BasicPane {
setPreferredSize(new Dimension(24, 24));
setLayout(new BorderLayout());
UIButton refreshButton = new UIButton();
refreshButton.setIcon(IconLoader.getIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png"));
refreshButton.setIcon(IOUtils.readIcon(("/com/fr/design/mainframe/alphafine/images/smallsearch.png")));
refreshButton.setToolTipText(Inter.getLocText("FR-Designer_AlphaFine"));
refreshButton.set4ToolbarButton();
refreshButton.setRolloverEnabled(false);

8
designer-realize/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java

@ -12,13 +12,15 @@ import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
@ -149,7 +151,7 @@ public class FileSearchManager implements AlphaFineSearchProvider {
*/
private void searchFileContent(Env env, String searchText, FileNode node, boolean isAlreadyContain, boolean needMore) {
try {
InputStream inputStream = env.readBean(node.getEnvPath().substring(ProjectConstants.REPORTLETS_NAME.length() + 1), ProjectConstants.REPORTLETS_NAME);
InputStream inputStream = new ByteArrayInputStream(env.getFileOperator().read(StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, node.getEnvPath().substring(ProjectConstants.REPORTLETS_NAME.length() + 1))));
InputStreamReader isr = new InputStreamReader(inputStream, "UTF-8");
BufferedReader reader = new BufferedReader(isr);
String line;
@ -232,7 +234,7 @@ public class FileSearchManager implements AlphaFineSearchProvider {
* @throws Exception
*/
private void listAll(Env env, String rootFilePath, List<FileNode> nodeList, boolean recurse) throws Exception {
FileNode[] fns = env.listFile(rootFilePath);
FileNode[] fns = env.getFileOperator().list(rootFilePath);
for (int i = 0; i < fns.length; i++) {
FileNode fileNode = fns[i];
if (fileNode.isDirectory()) {

4
designer-realize/src/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java

@ -8,6 +8,7 @@ import com.fr.design.DesignerEnvManager;
import com.fr.general.FRLogManager;
import com.fr.general.Inter;
import com.fr.general.LogDuration;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.stable.xml.XMLPrintWriter;
@ -18,6 +19,7 @@ import com.fr.third.apache.log4j.spi.LoggingEvent;
import com.fr.web.core.SessionDealWith;
import com.fr.web.core.SessionIDInfor;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
/**
@ -132,7 +134,7 @@ public class ErrorInfoLogAppender extends AppenderSkeleton {
}
};
try {
file.readStream(FRContext.getCurrentEnv().readBean(bookPath, ProjectConstants.REPORTLETS_NAME));
file.readStream(new ByteArrayInputStream(FRContext.getCurrentEnv().getFileOperator().read(StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, bookPath))));
return file.getTemplateID();
} catch (Exception ignore) {
}

8
designer-realize/src/com/fr/design/mainframe/form/FormElementCaseDesigner.java

@ -138,6 +138,14 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
return image;
}
/**
* 刷新右侧属性面板
*/
@Override
public void refreshPropertyPane() {
this.elementCasePane.fireSelectionChangeListener();
}
/**
* 创建正在编辑的状态.
*

78
designer-realize/src/com/fr/design/present/ConditionAttributesGroupPane.java

@ -16,6 +16,7 @@ import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.general.Inter;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement;
@ -27,20 +28,21 @@ import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.Nameable;
public class ConditionAttributesGroupPane extends UIListControlPane {
private static ConditionAttributesGroupPane singleton;
private TemplateCellElement editCellElement; // 当前单元格对象
private static ConditionAttributesGroupPane singleton;
private TemplateCellElement editCellElement; // 当前单元格对象
private Selection editSelection; // 当前编辑对象
private ElementCasePane ePane;
private ConditionAttributesGroupPane() {
super();
}
super();
}
public static ConditionAttributesGroupPane getInstance() {
if (singleton == null) {
singleton = new ConditionAttributesGroupPane();
}
return singleton;
}
public static ConditionAttributesGroupPane getInstance() {
if (singleton == null) {
singleton = new ConditionAttributesGroupPane();
}
return singleton;
}
@Override
public NameableCreator[] createNameableCreators() {
@ -49,18 +51,21 @@ public class ConditionAttributesGroupPane extends UIListControlPane {
@Override
public void saveSettings() {
if (isPopulating) {
return;
}
final CellSelection finalCS = (CellSelection) ePane.getSelection();
if (isPopulating) {
return;
}
final TemplateElementCase tplEC = ePane.getEditingElementCase();
ReportActionUtils.actionIterateWithCellSelection(finalCS, tplEC, new ReportActionUtils.IterAction() {
public void dealWith(CellElement editCellElement) {
((TemplateCellElement)editCellElement).setHighlightGroup(updateHighlightGroup());
}
});
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
final HighlightGroup highlightGroup = updateHighlightGroup();
ReportActionUtils.actionIterateWithCellSelection((CellSelection) editSelection, tplEC, new ReportActionUtils.IterAction() {
public void dealWith(CellElement editCellElement) {
try {
((TemplateCellElement)editCellElement).setHighlightGroup((HighlightGroup) highlightGroup.clone());
} catch (CloneNotSupportedException e) {
FRContext.getLogger().error("InternalError: " + e.getMessage());
}
}
});
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
}
@Override
@ -68,24 +73,25 @@ public class ConditionAttributesGroupPane extends UIListControlPane {
return Inter.getLocText("Condition_Attributes");
}
@Override
public String getAddItemText() {
return Inter.getLocText("FR-Designer_Add_Condition");
}
@Override
public String getAddItemText() {
return Inter.getLocText("FR-Designer_Add_Condition");
}
public void populate(ElementCasePane ePane) {
public void populate(ElementCasePane ePane) {
this.ePane = ePane;
CellSelection cs = (CellSelection) ePane.getSelection();
final TemplateElementCase tplEC = ePane.getEditingElementCase();
editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow());
if (editCellElement == null) {
editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow());
}
this.editSelection = ePane.getSelection();
CellSelection cs = (CellSelection) ePane.getSelection();
final TemplateElementCase tplEC = ePane.getEditingElementCase();
editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow());
if (editCellElement == null) {
editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow());
}
SheetUtils.calculateDefaultParent(tplEC); // 不知道这行代码的作用,怕去掉之后会出问题,先放在这里
SheetUtils.calculateDefaultParent(tplEC); // 不知道这行代码的作用,怕去掉之后会出问题,先放在这里
populate(editCellElement.getHighlightGroup());
}
populate(editCellElement.getHighlightGroup());
}
/**
* Populate
@ -93,7 +99,7 @@ public class ConditionAttributesGroupPane extends UIListControlPane {
public void populate(HighlightGroup highlightGroup) {
// marks这个必须放在前面,不论是否有高亮分组都可以操作
if (highlightGroup == null || highlightGroup.size() <= 0) {
this.populate(new NameObject[0]);
this.populate(new NameObject[0]);
return;
}
List<NameObject> nameObjectList = new ArrayList<NameObject>();

62
designer-realize/src/com/fr/design/report/UnitFieldPane.java

@ -17,6 +17,7 @@ import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter;
import com.fr.stable.Constants;
import com.fr.stable.OperatingSystem;
import com.fr.stable.unit.CM;
import com.fr.stable.unit.INCH;
import com.fr.stable.unit.MM;
@ -26,23 +27,26 @@ import com.fr.stable.unit.UNIT;
* UnitFieldPane
*/
public class UnitFieldPane extends JPanel {
private static final int TEXT_FIELD_COLUMNS = 4;
private static final int TEXT_FIELD_COLUMNS_WINDOWS = 6;
private UIBasicSpinner valueSpinner;
private JFormattedTextField textField;
private UnitLabel unitLable;
private int unitType = Constants.UNIT_MM;
public static class UnitLabel extends UILabel {
private int preferredHeight;
public UnitLabel(int unitType, int preferredHeight) {
super();
this.preferredHeight = preferredHeight;
setUnitType(unitType);
}
public void setUnitType(int unitType) {
private int preferredHeight;
public UnitLabel(int unitType, int preferredHeight) {
super();
this.preferredHeight = preferredHeight;
setUnitType(unitType);
}
public void setUnitType(int unitType) {
if (unitType == Constants.UNIT_CM) {
this.setText(Inter.getLocText("FR-Designer_Unit_CM"));
} else if (unitType == Constants.UNIT_INCH) {
@ -53,41 +57,41 @@ public class UnitFieldPane extends JPanel {
//ajust the heigt of unitLabel.
Dimension unitDimension = new Dimension(this.getPreferredSize().width,
preferredHeight);
preferredHeight);
this.setMinimumSize(unitDimension);
this.setMinimumSize(unitDimension);
this.setSize(unitDimension);
this.setPreferredSize(unitDimension);
}
}
}
public UnitFieldPane(int unitType) {
this.setLayout(FRGUIPaneFactory.createBoxFlowLayout());
this.unitType = unitType;
valueSpinner = new UIBasicSpinner(new SpinnerNumberModel(0.0, 0.0, Double.MAX_VALUE, 1.0));
textField = ((JSpinner.DefaultEditor) valueSpinner.getEditor()).getTextField();
textField.setColumns(4);
textField.setColumns(OperatingSystem.isWindows() ? TEXT_FIELD_COLUMNS_WINDOWS : TEXT_FIELD_COLUMNS);
InputEventBaseOnOS.addBasicEditInputMap(textField);
this.add(valueSpinner);
unitLable = new UnitLabel(unitType, valueSpinner.getPreferredSize().height);
this.add(unitLable);
}
public JFormattedTextField getTextField() {
return textField;
}
return textField;
}
public void setUnitType(int unitType) {
unitLable.setUnitType(unitType);
this.unitType = unitType;
public void setUnitType(int unitType) {
unitLable.setUnitType(unitType);
this.unitType = unitType;
}
public UNIT getUnitValue() {
if (unitType == Constants.UNIT_CM) {
return new CM(((Number) valueSpinner.getValue()).floatValue());
} else if (unitType == Constants.UNIT_INCH) {
return new CM(((Number) valueSpinner.getValue()).floatValue());
} else if (unitType == Constants.UNIT_INCH) {
return new INCH(((Number) valueSpinner.getValue()).floatValue());
} else {
return new MM(((Number) valueSpinner.getValue()).floatValue());
@ -95,12 +99,12 @@ public class UnitFieldPane extends JPanel {
}
public void setUnitValue(UNIT value) {
if (unitType == Constants.UNIT_CM) {
valueSpinner.setValue(new Float(value.toCMValue4Scale2()));
} else if (unitType == Constants.UNIT_INCH) {
valueSpinner.setValue(new Float(value.toINCHValue4Scale3()));
if (unitType == Constants.UNIT_CM) {
valueSpinner.setValue(new Float(value.toCMValue4Scale2()));
} else if (unitType == Constants.UNIT_INCH) {
valueSpinner.setValue(new Float(value.toINCHValue4Scale3()));
} else {
valueSpinner.setValue(new Float(value.toMMValue4Scale2()));
valueSpinner.setValue(new Float(value.toMMValue4Scale2()));
}
}
}

60
designer-realize/src/com/fr/design/report/mobile/MobileOthersPane.java

@ -0,0 +1,60 @@
package com.fr.design.report.mobile;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.mobile.MobileRadioCheckPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter;
import com.fr.report.mobile.ElementCaseMobileAttr;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
/**
* Created by plough on 2018/5/31.
*/
public class MobileOthersPane extends BasicBeanPane<ElementCaseMobileAttr> {
private MobileRadioCheckPane appearRefreshCheckPane; // 页面再现时刷新
public MobileOthersPane() {
this.initComponents();
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow());
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
contentPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L1, 0, 0));
appearRefreshCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Appear_Refresh"));
contentPane.add(appearRefreshCheckPane, BorderLayout.WEST);
borderPane.add(contentPane);
this.add(borderPane);
}
@Override
public void populateBean(ElementCaseMobileAttr ob) {
if (ob == null) {
ob = new ElementCaseMobileAttr();
}
this.appearRefreshCheckPane.populateBean(ob.isAppearRefresh());
}
@Override
public ElementCaseMobileAttr updateBean() {
return null;
}
@Override
public void updateBean(ElementCaseMobileAttr mobileAttr) {
if(mobileAttr != null) {
mobileAttr.setAppearRefresh(this.appearRefreshCheckPane.updateBean());
}
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Other");
}
}

5
designer-realize/src/com/fr/design/report/mobile/ReportMobileAttrPane.java

@ -17,6 +17,8 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
private AppFitBrowserPane appFitBrowserPane;
//工具栏容器
private MobileToolBarPane mobileToolBarPane;
// 其他
private MobileOthersPane mobileOthersPane;
public ReportMobileAttrPane() {
initComponents();
@ -37,6 +39,7 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
jPanel.add(appFitBrowserPane);
jPanel.add(mobileToolBarPane = new MobileToolBarPane());
jPanel.add(mobileOthersPane = new MobileOthersPane());
jPanel.add(appFitPreviewPane);
UIScrollPane scrollPane = new UIScrollPane(jPanel);
@ -50,6 +53,7 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
}
appFitBrowserPane.populateBean(ob);
mobileToolBarPane.populateBean(ob);
mobileOthersPane.populateBean(ob);
reportMobileTemplateSettingsPane.populateBean(ob);
}
@ -57,6 +61,7 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
public ElementCaseMobileAttr updateBean() {
ElementCaseMobileAttr caseMobileAttr = appFitBrowserPane.updateBean();
mobileToolBarPane.updateBean(caseMobileAttr);
mobileOthersPane.updateBean(caseMobileAttr);
reportMobileTemplateSettingsPane.updateBean(caseMobileAttr);
return caseMobileAttr;

8
designer-realize/src/com/fr/design/webattr/EventPane.java

@ -29,7 +29,7 @@ import java.util.Arrays;
import java.util.List;
/**
* richer:调用该类并且对事件名字国际化时需要严格按照"Event-事件名"来进行命名
* richer:调用该类并且对事件名字国际化时需要严格按照"FR-Engine_Event_事件名"来进行命名
*/
public class EventPane extends BasicPane {
private DefaultListModel listModel;
@ -74,7 +74,7 @@ public class EventPane extends BasicPane {
super.setEnabled(enabled);
this.eventList.setEnabled(enabled);
this.addAction.setEnabled(enabled); // TODO ALEX_SEP
// 似乎UpdateAction.enable属性还是有用的...
// 似乎UpdateAction.enable属性还是有用的...
this.editAction.setEnabled(enabled);
this.removeAction.setEnabled(enabled);
@ -83,9 +83,9 @@ public class EventPane extends BasicPane {
private void checkEnableState() {
if (this.listModel.size() == 0 || eventList.getSelectedIndex() < 0) {
setEditEnabled(false);
setEditEnabled(false);
} else {
setEditEnabled(true);
setEditEnabled(true);
}
}

2
designer-realize/src/com/fr/design/webattr/WriteWebSettingPane.java

@ -76,7 +76,7 @@ public class WriteWebSettingPane extends WebSettingPane<WebWrite> {
unloadCheck = new UICheckBox(Inter.getLocText("FR-Designer_Unload_Check"));
unloadCheck.setSelected(true);
showWidgets = new UICheckBox(Inter.getLocText(new String[]{"Event-showWidgets"}));
showWidgets = new UICheckBox(Inter.getLocText(new String[]{"FR-Engine_Event_showWidgets"}));
showWidgets.setSelected(false);
isAutoStash = new UICheckBox(Inter.getLocText("FR-Designer-Write_Auto_Stash"));
isAutoStash.setSelected(false);

47
designer-realize/src/com/fr/start/Designer.java

@ -30,6 +30,7 @@ import com.fr.design.mainframe.JWorkBook;
import com.fr.design.mainframe.alphafine.component.AlphaFinePane;
import com.fr.design.mainframe.bbs.UserInfoLabel;
import com.fr.design.mainframe.bbs.UserInfoPane;
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef;
@ -41,6 +42,7 @@ import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.module.Module;
import com.fr.module.ModuleContext;
import com.fr.stable.BuildContext;
@ -52,16 +54,23 @@ import com.fr.stable.xml.XMLTools;
import com.fr.start.fx.SplashFx;
import com.fr.start.jni.SplashMac;
import com.fr.start.module.StartupArgs;
import com.fr.start.server.FineEmbedServer;
import com.fr.start.preload.ImagePreLoader;
import com.fr.start.server.ServerTray;
import javax.swing.*;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.border.MatteBorder;
import java.awt.*;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.util.ArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
@ -87,7 +96,7 @@ public class Designer extends BaseDesigner {
* @param args 参数
*/
public static void main(String[] args) {
preloadResource();
BuildContext.setBuildFilePath("/com/fr/stable/build.properties");
SplashContext.getInstance().registerSplash(createSplash());
SplashContext.getInstance().show();
@ -102,6 +111,33 @@ public class Designer extends BaseDesigner {
}
private static void preloadResource() {
ExecutorService service = Executors.newCachedThreadPool();
service.submit(new Runnable() {
@Override
public void run() {
SiteCenter.getInstance();
Cursor cursor = UIConstants.CELL_DEFAULT_CURSOR;
}
});
service.submit(new Runnable() {
@Override
public void run() {
new ImagePreLoader();
}
});
service.submit(new Runnable() {
@Override
public void run() {
TemplateInfoCollector.getInstance();
}
});
service.shutdown();
}
private static SplashStrategy createSplash() {
// 这里可以开接口加载自定义启动画面
if (OperatingSystem.isWindows()) {
@ -498,6 +534,9 @@ public class Designer extends BaseDesigner {
collector.collectStopTime();
collector.saveXMLFile();
Env currentEnv = FRContext.getCurrentEnv();
if (currentEnv == null) {
return;
}
currentEnv.doWhenServerShutDown();
}

12
designer-realize/src/com/fr/start/EnvSwitcher.java

@ -1,10 +1,10 @@
package com.fr.start;
import com.fr.base.FRContext;
import com.fr.base.Env;
import com.fr.base.env.EnvUpdater;
import com.fr.design.DesignerEnvManager;
import com.fr.design.env.EnvGenerator;
import com.fr.design.mainframe.TemplatePane;
import com.fr.env.SignIn;
import com.fr.general.Inter;
/**
* Created by juhaoyu on 2018/1/31.
@ -16,10 +16,8 @@ public class EnvSwitcher {
try {
String current = DesignerEnvManager.getEnvManager().getCurEnvName();
SignIn.signIn(DesignerEnvManager.getEnvManager().getEnv(current));
if (!FRContext.getCurrentEnv().testServerConnectionWithOutShowMessagePane()) {
throw new Exception(Inter.getLocText("Datasource-Connection_failed"));
}
Env env = EnvGenerator.generate(DesignerEnvManager.getEnvManager().getEnv(current));
EnvUpdater.updateEnv(env);
} catch (Exception e) {
TemplatePane.getInstance().dealEvnExceptionWhenStartDesigner();
}

3
designer-realize/src/com/fr/start/SplashContext.java

@ -23,6 +23,9 @@ import java.util.concurrent.TimeUnit;
*/
public class SplashContext {
public static final String SPLASH_PATH = "/com/fr/design/images/splash_10.gif";
public static final String SPLASH_CACHE_NAME = "splash_10.gif";
private static final SplashContext SPLASH_CONTEXT = new SplashContext();
private SplashStrategy splashStrategy;

6
designer-realize/src/com/fr/start/fx/SplashFxWindow.java

@ -3,6 +3,7 @@ package com.fr.start.fx;
import com.bulenkov.iconloader.util.JBUI;
import com.fr.base.FRContext;
import com.fr.stable.OperatingSystem;
import com.fr.start.SplashContext;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Scene;
@ -37,9 +38,8 @@ public class SplashFxWindow extends Application {
private static final int WINDOW_WIDTH = 640;
private static final int WINDOW_HEIGHT = 360;
private static final int FONT = 12;
private static final int FRAME_COUNT = 254;
private static final int FRAME_COUNT = 315;
private static final String THINKS_COLOR = "#82b1ce";
private static final String SPLASH_PATH = "/com/fr/design/images/splash_10.gif";
private static final CountDownLatch LATCH = new CountDownLatch(1);
private static SplashFxWindow app = null;
@ -78,7 +78,7 @@ public class SplashFxWindow extends Application {
public void start(Stage primaryStage) {
AnchorPane root = new AnchorPane();
primaryStage.initStyle(StageStyle.TRANSPARENT);
Image image = new FastGifImage(SPLASH_PATH, FRAME_COUNT, WINDOW_WIDTH, WINDOW_HEIGHT);
Image image = new FastGifImage(SplashContext.SPLASH_PATH, FRAME_COUNT, WINDOW_WIDTH, WINDOW_HEIGHT);
ImageView gif = new ImageView(image);

12
designer-realize/src/com/fr/start/jni/SplashMac.java

@ -22,8 +22,6 @@ import java.io.InputStream;
*/
public class SplashMac implements SplashStrategy {
private static final String SPLASH_CACHE_NAME = "splash_10.gif";
private static final String SPLASH_PATH = "/com/fr/design/images/splash_10.gif";
private SplashJNI jni;
@ -38,12 +36,12 @@ public class SplashMac implements SplashStrategy {
*/
private static String loadResFromJar() {
File tempLib = null;
try (InputStream inputStream = SplashContext.class.getResourceAsStream(SplashMac.SPLASH_PATH)) {
try (InputStream inputStream = SplashContext.class.getResourceAsStream(SplashContext.SPLASH_PATH)) {
if (inputStream == null) {
FRContext.getLogger().error("Unable to copy " + SplashMac.SPLASH_PATH + " from jar file.");
FRContext.getLogger().error("Unable to copy " + SplashContext.SPLASH_PATH + " from jar file.");
return StringUtils.EMPTY;
}
tempLib = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), SPLASH_CACHE_NAME));
tempLib = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), SplashContext.SPLASH_CACHE_NAME));
byte[] buffer = new byte[1024];
int read = -1;
try (FileOutputStream fileOutputStream = new FileOutputStream(tempLib)) {
@ -57,14 +55,14 @@ public class SplashMac implements SplashStrategy {
tempLib.deleteOnExit();
}
// 直接抛异常
throw new RuntimeException("Unable to copy " + SplashMac.SPLASH_PATH + " from jar file.");
throw new RuntimeException("Unable to copy " + SplashContext.SPLASH_PATH + " from jar file.");
}
}
@Override
public void show() {
if (jni != null) {
File splash = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), SPLASH_CACHE_NAME));
File splash = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), SplashContext.SPLASH_CACHE_NAME));
String path = splash.exists() ? splash.getAbsolutePath() : loadResFromJar();
jni.show(path);
}

18
designer-realize/src/com/fr/start/module/DesignerEnvProvider.java

@ -1,26 +1,23 @@
package com.fr.start.module;
import com.fr.base.FRContext;
import com.fr.base.Env;
import com.fr.base.ModifiedTable;
import com.fr.base.Parameter;
import com.fr.base.StoreProcedureParameter;
import com.fr.base.TableData;
import com.fr.base.env.EnvUpdater;
import com.fr.base.env.serializer.OldSerializerAdapter;
import com.fr.base.env.serializer.ProcedureDataModelSerializer;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.EnvEvent;
import com.fr.core.env.proxy.EnvProxy;
import com.fr.core.env.resource.EnvConfigUtils;
import com.fr.core.env.resource.LocalEnvConfig;
import com.fr.core.env.resource.RemoteEnvConfig;
import com.fr.data.core.db.TableProcedure;
import com.fr.data.impl.Connection;
import com.fr.data.impl.storeproc.ProcedureDataModel;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.dav.DavXMLUtils;
import com.fr.dav.LocalEnv;
import com.fr.design.DesignerEnvManager;
import com.fr.env.RemoteEnv;
import com.fr.design.env.EnvGenerator;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
@ -64,17 +61,12 @@ public class DesignerEnvProvider extends Activator {
EventDispatcher.listen(EnvEvent.BEFORE_SIGN_IN, new Listener<EnvConfig>() {
@Override
public void on(Event event, EnvConfig envConfig) {
if (envConfig instanceof RemoteEnvConfig) {
RemoteEnv remoteEnv = new RemoteEnv(envConfig.getPath(), EnvConfigUtils.getUsername(envConfig), EnvConfigUtils.getPassword(envConfig));
FRContext.setCurrentEnv(remoteEnv);
} else if (envConfig instanceof LocalEnvConfig) {
FRContext.setCurrentEnv(new LocalEnv());
}
Env env = EnvGenerator.generate(envConfig);
EnvUpdater.updateEnv(env);
}
});
}
private void addSerializers() {
EnvProxy.addSerializer(ProcedureDataModel[].class, new ProcedureDataModelSerializer());

406
designer-realize/src/com/fr/start/preload/ImagePreLoader.java

@ -0,0 +1,406 @@
package com.fr.start.preload;
import com.fr.general.IOUtils;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* 在设计器框架加载之前, 先用多个线程把相关的资源文件全部load到缓存中.
*/
public class ImagePreLoader {
public static final int THRESHOLD = 50;
public ImagePreLoader() {
ExecutorService service = Executors.newCachedThreadPool();
int len = preLoadImages.length;
int start = 0;
for (int i = 0; i < len; i++) {
if (i != 0 && i % THRESHOLD == 0) {
loadImage(start,i, service);
start = i;
}
if (len - i < THRESHOLD) {
loadImage(start, len, service);
break;
}
}
service.shutdown();
}
private void loadImage(final int start, final int end, ExecutorService service) {
service.submit(new Runnable() {
@Override
public void run() {
for (int i = start; i < end; i++) {
IOUtils.readImageWithCache(preLoadImages[i]);
}
}
});
}
private String[] preLoadImages = {
"com/fr/design/images/m_file/formExport.png",
"com/fr/base/images/oem/cpt.png",
"com/fr/design/images/data/store_procedure.png",
"/com/fr/design/images/m_file/preview.png",
"com/fr/base/images/cell/blank.gif",
"com/fr/design/images/data/dock/serverdatabase.png",
"/com/fr/design/images/data/dock/serverclasstabledata.png",
"/com/fr/design/images/data/dock/serverdatatable.png",
"/com/fr/design/images/data/file.png",
"/com/fr/design/images/data/tree.png",
"/com/fr/design/images/buttonicon/minus.png",
"/com/fr/design/images/buttonicon/plus.png",
"/com/fr/design/images/data/multi.png",
"/com/fr/design/images/data/store_procedure.png",
"com/fr/design/images/buttonicon/arrowdown.png",
"com/fr/design/images/buttonicon/arrowup.png",
"com/fr/design/images/buttonicon/yes.png",
"com/fr/design/images/buttonicon/select_item.png",
"com/fr/design/images/buttonicon/prewidget.png",
"com/fr/design/images/buttonicon/editn.png",
"com/fr/design/images/buttonicon/editp.png",
"com/fr/design/images/buttonicon/hiden.png",
"com/fr/design/images/buttonicon/hidep.png",
"com/fr/design/images/buttonicon/viewn.png",
"com/fr/design/images/buttonicon/viewp.png",
"com/fr/design/images/buttonicon/run24.png",
"com/fr/design/images/buttonicon/runs.png",
"com/fr/design/mainframe/alphafine/images/smallsearch.png",
"com/fr/design/images/buttonicon/pageb24.png",
"com/fr/design/images/buttonicon/writeb24.png",
"com/fr/design/images/buttonicon/anab24.png",
"com/fr/design/images/buttonicon/pages.png",
"com/fr/design/images/buttonicon/writes.png",
"com/fr/design/images/buttonicon/anas.png",
"com/fr/design/images/buttonicon/refresh.png",
"com/fr/design/images/gui/color/foreground.png",
"com/fr/design/images/buttonicon/history.png",
"com/fr/design/images/m_file/close.png",
"com/fr/design/images/m_file/edit.png",
"com/fr/design/images/data/search.png",
"com/fr/design/images/data/black_search.png",
"com/fr/design/images/data/source/delete.png",
"com/fr/design/images/control/edit.png",
"com/fr/design/images/control/edit_white.png",
"com/fr/design/images/buttonicon/prevew_down_icon.png",
"com/fr/design/images/m_report/close.png",
"com/fr/design/images/m_report/close_over.png",
"com/fr/design/images/m_report/close_press.png",
"com/fr/design/images/buttonicon/save.png",
"com/fr/design/images/buttonicon/undo.png",
"com/fr/design/images/buttonicon/redo.png",
"com/fr/design/images/buttonicon/additicon_grey.png",
"com/fr/design/images/buttonicon/addicon.png",
"com/fr/design/images/buttonicon/list_normal.png",
"com/fr/design/images/buttonicon/list_pressed.png",
"com/fr/design/images/buttonicon/close_icon.png",
"com/fr/design/images/buttonicon/mouseoverclose icon.png",
"com/fr/design/images/buttonicon/pressclose icon.png",
"com/fr/design/images/buttonicon/open.png",
"com/fr/design/images/m_file/view_folder.png",
"com/fr/design/images/data/source/rename.png",
"com/fr/design/images/buttonicon/minus.png",
"com/fr/design/images/buttonicon/plus.png",
"com/fr/design/images/data/database.png",
"com/fr/design/images/data/source/classTableData.png",
"com/fr/design/images/data/dataTable.png",
"com/fr/design/images/data/multi.png",
"com/fr/design/images/data/file.png",
"com/fr/design/images/data/tree.png",
"com/fr/design/images/control/tab/remove.png",
"com/fr/design/images/m_file/preview.png",
"com/fr/design/images/m_web/connection.png",
"com/fr/design/images/control/addPopup.png",
"com/fr/design/images/buttonicon/propertiestab/cellelement_normal.png",
"com/fr/design/images/buttonicon/propertiestab/cellattr_normal.png",
"com/fr/design/images/buttonicon/propertiestab/floatelement_normal.png",
"com/fr/design/images/buttonicon/propertiestab/widgetsettings_normal.png",
"com/fr/design/images/buttonicon/propertiestab/conditionattr_normal.png",
"com/fr/design/images/buttonicon/propertiestab/hyperlink_normal.png",
"com/fr/design/images/buttonicon/propertiestab/widgetlib_normal.png",
"com/fr/design/images/buttonicon/propertiestab/authorityedit_normal.png",
"com/fr/design/images/buttonicon/propertiestab/configuredroles_normal.png",
"com/fr/design/images/buttonicon/propertiestab/cellelement_selected.png",
"com/fr/design/images/log/selectedall.png",
"com/fr/design/images/m_edit/copy.png",
"com/fr/design/images/log/clear.png",
"com/fr/design/images/log/clear.png",
"com/fr/design/images/log/selectedall.png",
"com/fr/design/images/log/setting.png",
"com/fr/design/images/buttonicon/newcpts.png",
"com/fr/base/images/oem/logo.png",
"com/fr/design/images/data/bind/localconnect.png",
"com/fr/design/images/gui/tab_add_normal.png",
"com/fr/design/images/m_help/demo.png",
"com/fr/design/images/gui/tab_add_hover.png",
"com/fr/design/images/gui/tab_add_click.png",
"com/fr/design/images/gui/tab_delete.png",
"com/fr/design/images/bbs.png",
"com/fr/design/images/video.png",
"com/fr/design/images/help.png",
"com/fr/design/images/questions.png",
"com/fr/design/images/update.png",
"com/fr/design/images/need.png",
"com/fr/design/images/bug.png",
"com/fr/design/images/signature.png",
"com/fr/design/images/m_file/switch.png",
"com/fr/design/images/gui/blank.gif",
"com/fr/design/images/gui/folder.png",
"com/fr/design/images/gui/javaFile.gif",
"com/fr/design/images/gui/classFile.gif",
"com/fr/design/images/gui/jspFile.gif",
"com/fr/design/images/gui/jsFile.gif",
"com/fr/design/images/gui/xmlFile.gif",
"com/fr/design/images/gui/htmlFile.gif",
"com/fr/design/images/gui/jarFile.gif",
"com/fr/design/images/gui/gifFile.gif",
"com/fr/design/images/gui/jpgFile.gif",
"com/fr/design/images/gui/bmpFile.gif",
"com/fr/design/images/gui/cptFile.png",
"com/fr/design/images/gui/frm.png",
"com/fr/design/images/gui/cht.png",
"com/fr/design/images/chart/ChartType.png",
"com/fr/van/chart/map/images/mapData.png",
"com/fr/design/images/buttonicon/add.png",
"com/fr/base/images/cell/control/remove.png",
"com/fr/design/images/control/up.png",
"com/fr/design/images/control/down.png",
"com/fr/design/images/control/sortAsc.png",
"com/fr/design/images/m_insert/formula.png",
"com/fr/design/images/calender/year_reduce.png",
"com/fr/design/images/calender/year_reduce_hover.png",
"com/fr/design/images/calender/year_reduce_click.png",
"com/fr/design/images/calender/month_reduce.png",
"com/fr/design/images/calender/month_reduce_hover.png",
"com/fr/design/images/calender/month_reduce_click.png",
"com/fr/design/images/calender/month_add.png",
"com/fr/design/images/calender/month_add_hover.png",
"com/fr/design/images/calender/month_add_click.png",
"com/fr/design/images/calender/year_add.png",
"com/fr/design/images/calender/year_add_hover.png",
"com/fr/design/images/calender/year_add_click.png",
"com/fr/design/images/buttonicon/type_string.png",
"com/fr/base/images/cell/control/add.png",
"com/fr/design/images/expand/cellAttr.gif",
"com/fr/design/images/expand/none16x16.png",
"com/fr/design/images/expand/asc.png",
"com/fr/design/images/expand/des.png",
"com/fr/design/images/form/toolbar/pie.png",
"com/fr/design/images/buttonicon/widget/date_16.png",
"com/fr/design/images/buttonicon/widget/tree_16.png",
"com/fr/design/images/buttonicon/widget/comboboxtree.png",
"com/fr/design/images/buttonicon/widget/checkbox_group_16.png",
"com/fr/design/images/buttonicon/widget/button_group_16.png",
"com/fr/design/images/buttonicon/widget/number_field_16.png",
"com/fr/design/images/buttonicon/widget/label_16.png",
"com/fr/web/images/form/resources/button_16.png",
"com/fr/design/images/buttonicon/widget/button_16.png",
"com/fr/design/images/buttonicon/widget/files_up.png",
"com/fr/design/images/buttonicon/widget/combo_box_16.png",
"com/fr/design/images/buttonicon/widget/combo_check_16.png",
"com/fr/design/images/buttonicon/widget/check_box_16.png",
"com/fr/web/images/form/resources/list_16.png",
"com/fr/design/images/buttonicon/widget/text_field_16.png",
"com/fr/design/images/buttonicon/widget/text_area_16.png",
"com/fr/design/images/buttonicon/widget/password_field_16.png",
"com/fr/web/images/form/resources/iframe_16.png",
"com/fr/design/images/form/toolbar/column.png",
"com/fr/design/images/form/toolbar/bar.png",
"com/fr/design/images/form/toolbar/line.png",
"com/fr/design/images/form/toolbar/area.png",
"com/fr/design/images/form/toolbar/gauge.png",
"com/fr/design/images/form/toolbar/radar.png",
"com/fr/design/images/form/toolbar/scatter.png",
"com/fr/design/images/form/toolbar/bubble.png",
"com/fr/design/images/form/toolbar/custom.png",
"com/fr/design/images/form/toolbar/multiPie.png",
"com/fr/design/images/form/toolbar/map.png",
"com/fr/design/images/form/toolbar/drillmap.png",
"com/fr/design/images/form/toolbar/treeMap.png",
"com/fr/design/images/form/toolbar/funnel.png",
"com/fr/design/images/form/toolbar/heatmap.png",
"com/fr/design/images/form/toolbar/wordcloud.png",
"com/fr/design/images/form/toolbar/gantt.png",
"com/fr/design/images/form/toolbar/structure.png",
"com/fr/design/images/control/help_open.png",
"com/fr/web/images/form/forbid.png",
"com/fr/web/images/form/resources/layout_absolute.png",
"com/fr/design/images/m_edit/cut.png",
"com/fr/design/images/m_edit/paste.png",
"com/fr/design/images/m_report/delete.png",
"com/fr/design/images/toolbarbtn/parametersetting.png",
"com/fr/base/images/oem/addworksheet.png",
"com/fr/design/images/sheet/addpolysheet.png",
"com/fr/base/images/oem/worksheet.png",
"com/fr/design/images/sheet/polysheet.png",
"com/fr/design/images/sheet/left_normal@1x.png",
"com/fr/design/images/sheet/right_normal@1x.png",
"com/fr/design/images/sheet/left_hover@1x.png",
"com/fr/design/images/sheet/right_hover@1x.png",
"com/fr/design/images/data/source/normalDown20.png",
"com/fr/design/images/data/source/hoverDown20.png",
"com/fr/design/images/data/source/normalUp20.png",
"com/fr/design/images/data/source/hoverUp20.png",
"com/fr/design/images/m_edit/formatBrush.png",
"com/fr/design/images/expand/none16x16_selected@1x.png",
"com/fr/design/images/expand/vertical.png",
"com/fr/design/images/expand/vertical_selected@1x.png",
"com/fr/design/images/expand/landspace.png",
"com/fr/design/images/expand/landspace_selected@1x.png",
"com/fr/design/images/buttonicon/select.png",
"com/fr/design/images/expand/asc_selected.png",
"com/fr/design/images/expand/des_selected.png",
"com/fr/design/images/m_format/cellstyle/bold.png",
"com/fr/design/images/m_format/cellstyle/italic.png",
"com/fr/design/images/m_format/cellstyle/underline.png",
"com/fr/design/images/m_format/cellstyle/strikethrough.png",
"com/fr/design/images/m_format/cellstyle/shadow.png",
"com/fr/design/images/m_format/cellstyle/sup.png",
"com/fr/design/images/m_format/cellstyle/sub.png",
"com/fr/base/images/dialog/border/top.png",
"com/fr/design/images/m_format/cellstyle/top_white.png",
"com/fr/base/images/dialog/border/left.png",
"com/fr/design/images/m_format/cellstyle/left_white.png",
"com/fr/base/images/dialog/border/bottom.png",
"com/fr/design/images/m_format/cellstyle/bottom_white.png",
"com/fr/base/images/dialog/border/right.png",
"com/fr/design/images/m_format/cellstyle/right_white.png",
"com/fr/base/images/dialog/border/horizontal.png",
"com/fr/design/images/m_format/cellstyle/horizontal_white.png",
"com/fr/base/images/dialog/border/vertical.png",
"com/fr/design/images/m_format/cellstyle/vertical_white.png",
"com/fr/design/images/m_format/out.png",
"com/fr/design/images/m_format/cellstyle/out_white.png",
"com/fr/design/images/m_format/in.png",
"com/fr/design/images/m_format/cellstyle/in_white.png",
"com/fr/design/images/m_format/cellstyle/h_left_normal.png",
"com/fr/design/images/m_format/cellstyle/h_left_normal_white.png",
"com/fr/design/images/m_format/cellstyle/h_center_normal.png",
"com/fr/design/images/m_format/cellstyle/h_center_normal_white.png",
"com/fr/design/images/m_format/cellstyle/h_right_normal.png",
"com/fr/design/images/m_format/cellstyle/h_right_normal_white.png",
"com/fr/design/images/m_format/cellstyle/h_s_normal.png",
"com/fr/design/images/m_format/cellstyle/h_s_normal_white.png",
"com/fr/design/images/m_format/cellstyle/defaultAlignment.png",
"com/fr/design/images/m_format/cellstyle/defaultAlignment_white.png",
"com/fr/design/images/m_format/cellstyle/v_top_normal.png",
"com/fr/design/images/m_format/cellstyle/v_top_normal_white.png",
"com/fr/design/images/m_format/cellstyle/v_center_normal.png",
"com/fr/design/images/m_format/cellstyle/v_center_normal_white.png",
"com/fr/design/images/m_format/cellstyle/v_down_normal.png",
"com/fr/design/images/m_format/cellstyle/v_down_normal_white.png",
"com/fr/design/images/control/refresh.png",
"com/fr/design/images/toolbarbtn/close.png",
"com/fr/design/images/buttonicon/new_form3.png",
"com/fr/design/images/m_file/save.png",
"com/fr/design/images/m_file/saveAs.png",
"com/fr/design/images/m_edit/undo.png",
"com/fr/design/images/m_edit/redo.png",
"com/fr/design/images/m_file/excel.png",
"com/fr/design/images/m_file/pdf.png",
"com/fr/design/images/m_file/word.png",
"com/fr/design/images/m_file/svg.png",
"com/fr/design/images/m_file/csv.png",
"com/fr/design/images/m_file/text.png",
"com/fr/design/images/m_web/datasource.png",
"com/fr/design/images/m_report/webreportattribute.png",
"com/fr/design/images/m_report/exportAttr.png",
"com/fr/design/images/m_report/p.png",
"com/fr/design/images/m_report/mobile.png",
"com/fr/web/images/print.png",
"com/fr/design/images/m_report/watermark.png",
"com/fr/design/images/m_file/pageSetup.png",
"com/fr/design/images/m_report/header.png",
"com/fr/design/images/m_report/footer.png",
"com/fr/design/images/m_report/background.png",
"com/fr/design/images/m_report/reportWriteAttr.png",
"com/fr/design/images/m_report/linearAttr.png",
"com/fr/design/images/m_report/reportEngineAttr.png",
"com/fr/design/images/m_report/allow_authority_edit.png",
"com/fr/design/images/m_insert/bindColumn.png",
"com/fr/design/images/m_insert/text.png",
"com/fr/design/images/m_insert/richtext.png",
"com/fr/design/images/m_insert/chart.png",
"com/fr/design/images/m_insert/image.png",
"com/fr/design/images/m_insert/bias.png",
"com/fr/design/images/arrow/arrow_up.png",
"com/fr/design/images/m_insert/subReport.png",
"com/fr/design/images/arrow/arrow_down.png",
"com/fr/design/images/toolbarbtn/toolbarbtnsetting.png",
"com/fr/design/images/control/addPopup.png",
"com/fr/design/images/toolbarbtn/toolbarbtnclear.png",
"com/fr/design/images/m_insert/insertRow.png",
"com/fr/design/images/m_insert/insertColumn.png",
"com/fr/design/images/m_format/modified.png",
"com/fr/design/images/m_format/highlight.png",
"com/fr/web/images/form/resources/preview_16.png",
"com/fr/web/images/save.png",
"com/fr/design/images/m_insert/hyperLink.png",
"com/fr/web/images/flashPrint.png",
"com/fr/design/images/m_edit/merge.png",
"com/fr/web/images/appletPrint.png",
"com/fr/design/images/m_edit/unmerge.png",
"com/fr/web/images/pdf.png",
"com/fr/design/images/m_format/cellAttr.png",
"com/fr/web/images/pdfPrint.png",
"com/fr/web/images/serverPrint.png",
"com/fr/web/images/email.png",
"com/fr/web/images/preview.png",
"com/fr/design/images/server/platform_16_16.png",
"com/fr/design/images/data/user_widget.png",
"com/fr/design/images/server/plugin.png",
"com/fr/web/images/excel.png",
"com/fr/design/images/m_web/function.png",
"com/fr/web/images/word.png",
"com/fr/web/images/pageSetup.png",
"com/fr/web/images/export.png",
"com/fr/design/images/m_web/edit.png",
"com/fr/web/images/pageNumber.png",
"com/fr/web/images/first.png",
"com/fr/design/images/m_web/style.png",
"com/fr/web/images/last.png",
"com/fr/web/images/previous.png",
"com/fr/web/images/next.png",
"com/fr/web/images/scale.png",
"com/fr/web/images/appendRow.png",
"com/fr/web/images/deleteRow.png",
"com/fr/web/images/verify.gif",
"com/fr/web/images/save2.png",
"com/fr/design/images/m_file/export.png",
"com/fr/web/images/showValue.png",
"com/fr/web/images/pianyi.png",
"com/fr/web/images/writeOffline.png",
"com/fr/web/images/edit/stash.png",
"com/fr/web/images/edit/clearstash.png",
"com/fr/design/images/m_insert/cell.png",
"com/fr/design/images/m_insert/float.png",
"com/fr/design/images/gui/color/background.png",
"com/fr/design/images/m_format/cell.png",
"com/fr/design/images/data/source/dataDictionary.png",
"com/fr/design/images/m_format/cellstyle/bold_white.png",
"com/fr/design/images/m_format/cellstyle/italic_white.png",
"com/fr/design/images/m_format/cellstyle/underline_white.png",
"com/fr/design/images/m_format/noboder.png",
"com/fr/design/images/gui/popup.gif",
"com/fr/design/images/m_insert/floatPop.png",
"com/fr/web/images/platform/demo.png",
"com/fr/base/images/dialog/pagesetup/down.png",
"com/fr/base/images/dialog/pagesetup/over.png",
"com/fr/web/images/reportlet.png",
"com/fr/design/images/buttonicon/switchShortCuts.png",
"com/fr/design/images/buttonicon/ds_column_name.png",
"com/fr/base/images/cell/control/add.png",
"com/fr/base/images/cell/control/rename.png",
"com/fr/base/images/cell/control/remove.png",
"com/fr/design/images/control/up.png",
"com/fr/design/images/control/down.png",
"com/fr/design/images/condition/bracket.png",
"com/fr/design/images/condition/unBracket.png"
};
}
Loading…
Cancel
Save