Browse Source

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

* commit '3c3fc82d5eb3594de283df0a2ca7107456264df7': (78 commits)
  改成枚举
  unused import
  KERNEL-594 更新好插件管理器后自动刷新
  去重
  去掉针对性接口,转通用appender实现
  KERNEL-594 更新版本需要重新打开
  KERNEL-594 版本信息,需要reload
  KERNEL-594 mime问题
  KERNEL-594 mime问题
  和决策平台里面有点重复,要改
  KERNEL-594 版本信息
  REPORT-15183 10.0远程日志输出接口(日志分类插件需求)
  新方法
  完善一下API
  KERNEL-594 新插件管理版本检查
  KERNEL-493 上传测试文件
  KERNEL-493 设计器数据交换部分的API示例
  去除调试信息
  处理下NPE
  KERNEL-493 统一设计器和平台的数据连接
  ...
research/10.0
neil 6 years ago
parent
commit
1fe483e120
  1. 4
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 41
      designer-base/src/main/java/com/fr/design/actions/community/FacebookFansAction.java
  3. 6
      designer-base/src/main/java/com/fr/design/actions/file/PreferenceAction.java
  4. 13
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  5. 38
      designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java
  6. 10
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  7. 39
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseComponent.java
  8. 32
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseDialog.java
  9. 36
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseOpener.java
  10. 39
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabasePane.java
  11. 34
      designer-base/src/main/java/com/fr/design/dcm/UniversalDcmBridge.java
  12. 4
      designer-base/src/main/java/com/fr/design/editor/editor/DateEditor.java
  13. 14
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  14. 4
      designer-base/src/main/java/com/fr/design/gui/date/SingleObjectComboBoxModel.java
  15. 14
      designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java
  16. 44
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java
  17. 23
      designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java
  18. 9
      designer-base/src/main/java/com/fr/design/icon/BorderIcon.java
  19. 2
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  20. 202
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  21. 5
      designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java
  22. 10
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  23. 45
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  24. 82
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogger.java
  25. 9
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java
  26. 37
      designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java
  27. 5
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  28. 55
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java
  29. 6
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java
  30. 13
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java
  31. 3
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java
  32. 31
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java
  33. 2
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionFirstRowPanel.java
  34. 2
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java
  35. 37
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsDateEditor.java
  36. 32
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsLabel.java
  37. 18
      designer-base/src/main/java/com/fr/design/ui/Assistant.java
  38. 43
      designer-base/src/main/java/com/fr/design/ui/EmbProtocolHandler.java
  39. 19
      designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java
  40. 70
      designer-base/src/main/java/com/fr/design/upm/UpmBridge.java
  41. 10
      designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java
  42. 23
      designer-base/src/main/java/com/fr/design/upm/UpmUtils.java
  43. 2
      designer-base/src/main/java/com/fr/design/upm/event/DownloadEvent.java
  44. 27
      designer-base/src/main/java/com/fr/design/upm/loader/UpmDesignResourceLoader.java
  45. 26
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  46. 74
      designer-base/src/main/java/com/fr/env/TestConnectionResult.java
  47. 2
      designer-base/src/main/resources/com/fr/design/dcm/index.js
  48. 276
      designer-base/src/main/resources/com/fr/design/dcm/style.css
  49. BIN
      designer-base/src/main/resources/com/fr/design/images/bbs/facebook.png
  50. 4
      designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.css
  51. 2
      designer-base/src/main/resources/com/fr/design/upm/warn.js
  52. 4
      designer-chart/src/main/java/com/fr/design/chart/axis/MinMaxValuePane.java
  53. 2
      designer-form/src/main/java/com/fr/design/designer/creator/XTreeEditor.java
  54. 20
      designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  55. 12
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java
  56. 2
      designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java
  57. 105
      designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java
  58. 89
      designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/entity/FileEntityBuilder.java
  59. 4
      designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/impl/AbstractSendDataToCloud.java
  60. 20
      designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/impl/FocusPointMessageUploader.java
  61. 4
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java
  62. 6
      designer-realize/src/main/java/com/fr/design/report/freeze/RepeatColPane.java
  63. 6
      designer-realize/src/main/java/com/fr/design/report/freeze/RepeatRowPane.java
  64. 18
      designer-realize/src/main/java/com/fr/grid/GridUtils.java
  65. 2
      designer-realize/src/main/java/com/fr/start/SplashContext.java

4
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -22,9 +22,9 @@ import com.fr.start.server.ServerTray;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.WorkContextCallback; import com.fr.workspace.WorkContextCallback;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.connect.AuthException;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; import com.fr.workspace.engine.channel.http.FunctionalHttpRequest;
import com.fr.workspace.engine.exception.WorkspaceAuthException;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
@ -120,7 +120,7 @@ public class EnvChangeEntrance {
} }
}); });
} catch (AuthException | RegistEditionException e) { } catch (WorkspaceAuthException | RegistEditionException e) {
// String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed"); // String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed");
// String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote"); // String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote");
strategy.showTip(new PopTip() { strategy.showTip(new PopTip() {

41
designer-base/src/main/java/com/fr/design/actions/community/FacebookFansAction.java

@ -0,0 +1,41 @@
package com.fr.design.actions.community;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter;
import com.fr.general.IOUtils;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
public class FacebookFansAction extends UpAction {
public FacebookFansAction() {
this.setMenuKeySet(FACEBOOKFANS);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/bbs/facebook.png"));
}
@Override
public void actionPerformed(ActionEvent arg0) {
BrowseUtils.browser(CloudCenter.getInstance().acquireUrlByKind("facebook.fans.tw"));
}
public static final MenuKeySet FACEBOOKFANS = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'F';
}
@Override
public String getMenuName() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_FaceBook_Fans");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
}

6
designer-base/src/main/java/com/fr/design/actions/file/PreferenceAction.java

@ -4,9 +4,10 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
@ -38,9 +39,10 @@ public class PreferenceAction extends UpdateAction {
preferencePane.update(DesignerEnvManager.getEnvManager()); preferencePane.update(DesignerEnvManager.getEnvManager());
DesignerEnvManager.loadLogSetting(); DesignerEnvManager.loadLogSetting();
DesignerEnvManager.getEnvManager().saveXMLFile(); DesignerEnvManager.getEnvManager().saveXMLFile();
JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
jt.refreshToolArea(); jt.refreshToolArea();
preferencePane.showRestartDialog(); preferencePane.showRestartDialog();
DesignerFrameFileDealerPane.getInstance().refreshDockingView();
} }
}); });

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

@ -138,6 +138,7 @@ public class PreferencePane extends BasicPane {
private UISpinner cachingTemplateSpinner; private UISpinner cachingTemplateSpinner;
private UICheckBox openDebugComboBox; private UICheckBox openDebugComboBox;
private UICheckBox useOptimizedUPMCheckbox; private UICheckBox useOptimizedUPMCheckbox;
private UICheckBox useUniverseDBMCheckbox;
private UICheckBox joinProductImproveCheckBox; private UICheckBox joinProductImproveCheckBox;
private UICheckBox autoPushUpdateCheckBox; private UICheckBox autoPushUpdateCheckBox;
@ -197,6 +198,11 @@ public class PreferencePane extends BasicPane {
upmSelectorPane.add(useOptimizedUPMCheckbox); upmSelectorPane.add(useOptimizedUPMCheckbox);
advancePane.add(upmSelectorPane); advancePane.add(upmSelectorPane);
JPanel dbmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Manager"));
useUniverseDBMCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Use_Universe_Database_Manager"));
dbmSelectorPane.add(useUniverseDBMCheckbox);
advancePane.add(dbmSelectorPane);
JPanel improvePane = FRGUIPaneFactory.createVerticalTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Product_Improve")); JPanel improvePane = FRGUIPaneFactory.createVerticalTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Product_Improve"));
joinProductImproveCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Join_Product_Improve")); joinProductImproveCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Join_Product_Improve"));
improvePane.add(joinProductImproveCheckBox); improvePane.add(joinProductImproveCheckBox);
@ -217,7 +223,7 @@ public class PreferencePane extends BasicPane {
JPanel vcsPane = FRGUIPaneFactory.createVerticalTitledBorderPane(Toolkit.i18nText("Fine-Design_Vcs_Title")); JPanel vcsPane = FRGUIPaneFactory.createVerticalTitledBorderPane(Toolkit.i18nText("Fine-Design_Vcs_Title"));
generalPane.add(vcsPane); generalPane.add(vcsPane);
remindVcsLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Remind")); remindVcsLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Remind"));
remindVcsLabel.setVisible(!VcsHelper.needInit()); remindVcsLabel.setVisible(!VcsHelper.getInstance().needInit());
vcsEnableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Vcs_SaveAuto")); vcsEnableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Vcs_SaveAuto"));
saveCommitCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Vcs_No_Delete")); saveCommitCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Vcs_No_Delete"));
saveIntervalEditor = new IntegerEditor(60); saveIntervalEditor = new IntegerEditor(60);
@ -602,7 +608,7 @@ public class PreferencePane extends BasicPane {
defaultStringToFormulaBox.setSelected(false); defaultStringToFormulaBox.setSelected(false);
} }
VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager(); VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager();
if (VcsHelper.needInit()) { if (VcsHelper.getInstance().needInit()) {
vcsEnableCheckBox.setSelected(vcsConfigManager.isVcsEnable()); vcsEnableCheckBox.setSelected(vcsConfigManager.isVcsEnable());
} else { } else {
vcsEnableCheckBox.setEnabled(false); vcsEnableCheckBox.setEnabled(false);
@ -639,6 +645,8 @@ public class PreferencePane extends BasicPane {
openDebugComboBox.setSelected(designerEnvManager.isOpenDebug()); openDebugComboBox.setSelected(designerEnvManager.isOpenDebug());
useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM()); useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM());
useUniverseDBMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseUniverseDBM());
this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace()); this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace());
this.cachingTemplateSpinner.setValue(designerEnvManager.getCachingTemplateLimit()); this.cachingTemplateSpinner.setValue(designerEnvManager.getCachingTemplateLimit());
this.joinProductImproveCheckBox.setSelected(designerEnvManager.isJoinProductImprove()); this.joinProductImproveCheckBox.setSelected(designerEnvManager.isJoinProductImprove());
@ -737,6 +745,7 @@ public class PreferencePane extends BasicPane {
@Override @Override
public void run() { public void run() {
ServerPreferenceConfig.getInstance().setUseOptimizedUPM(useOptimizedUPMCheckbox.isSelected()); ServerPreferenceConfig.getInstance().setUseOptimizedUPM(useOptimizedUPMCheckbox.isSelected());
ServerPreferenceConfig.getInstance().setUseUniverseDBM(useUniverseDBMCheckbox.isSelected());
} }
@Override @Override

38
designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java

@ -1,7 +1,6 @@
package com.fr.design.actions.help; package com.fr.design.actions.help;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Utils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
@ -10,9 +9,7 @@ import com.fr.general.http.HttpToolbox;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.CommonUtils; import com.fr.stable.CommonUtils;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.third.org.apache.http.HttpStatus; import com.fr.third.org.apache.http.HttpStatus;
import com.fr.third.org.apache.http.StatusLine; import com.fr.third.org.apache.http.StatusLine;
import com.fr.third.org.apache.http.client.methods.HttpGet; import com.fr.third.org.apache.http.client.methods.HttpGet;
@ -21,12 +18,10 @@ import javax.swing.KeyStroke;
import java.awt.Desktop; import java.awt.Desktop;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.io.File;
import java.io.IOException;
import java.net.URI; import java.net.URI;
public class TutorialAction extends UpdateAction { public class TutorialAction extends UpdateAction {
public TutorialAction() { public TutorialAction() {
this.setMenuKeySet(HELP_TUTORIAL); this.setMenuKeySet(HELP_TUTORIAL);
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
@ -35,27 +30,6 @@ public class TutorialAction extends UpdateAction {
this.setAccelerator(getMenuKeySet().getKeyStroke()); this.setAccelerator(getMenuKeySet().getKeyStroke());
} }
private void nativeExcuteMacInstallHomePrograms(String appName) {
String installHome = StableUtils.getInstallHome();
if(installHome == null) {
FineLoggerFactory.getLogger().error("Can not find the install home, please check it.");
} else {
String appPath = StableUtils.pathJoin(new String[]{installHome, "bin", appName});
if(!(new File(appPath)).exists()) {
FineLoggerFactory.getLogger().error(appPath + " can not be found.");
}
String cmd = "open " + appPath;
Runtime runtime = Runtime.getRuntime();
try {
runtime.exec(cmd);
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
/** /**
* 动作 * 动作
* @param evt 事件 * @param evt 事件
@ -67,14 +41,10 @@ public class TutorialAction extends UpdateAction {
Desktop.getDesktop().browse(new URI(helpURL)); Desktop.getDesktop().browse(new URI(helpURL));
return; return;
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
FineLoggerFactory.getLogger().warn(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Offline_Helptutorial_Msg"));
if (OperatingSystem.isUnix()) {
nativeExcuteMacInstallHomePrograms("helptutorial.app");
} else {
Utils.nativeExcuteInstallHomePrograms("helptutorial.exe");
}
} }
// 生成帮助文档 sitecenter key, help.zh_CN.10 // 生成帮助文档 sitecenter key, help.zh_CN.10
@ -116,4 +86,4 @@ public class TutorialAction extends UpdateAction {
} }
}; };
} }

10
designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java

@ -1,6 +1,7 @@
package com.fr.design.actions.server; package com.fr.design.actions.server;
import com.fr.config.ServerPreferenceConfig;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.connect.ConnectionManagerPane; import com.fr.design.data.datapane.connect.ConnectionManagerPane;
@ -12,6 +13,7 @@ import com.fr.design.gui.NameInspector;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.dcm.UniversalDatabaseOpener;
import com.fr.file.ConnectionConfig; import com.fr.file.ConnectionConfig;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.CallBackAdaptor;
@ -58,6 +60,14 @@ public class ConnectionListAction extends UpdateAction {
* @param evt 事件 * @param evt 事件
*/ */
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
if (ServerPreferenceConfig.getInstance().isUseUniverseDBM()) {
UniversalDatabaseOpener.showUniverseDatabaseDialog();
} else {
openDesignDatabaseManager();
}
}
private void openDesignDatabaseManager() {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final ConnectionConfig datasourceManager = ConnectionConfig.getInstance(); final ConnectionConfig datasourceManager = ConnectionConfig.getInstance();
final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() { final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() {

39
designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseComponent.java

@ -0,0 +1,39 @@
package com.fr.design.dcm;
import com.fr.web.struct.AssembleComponent;
import com.fr.web.struct.Atom;
import com.fr.web.struct.browser.RequestClient;
import com.fr.web.struct.category.ScriptPath;
import com.fr.web.struct.category.StylePath;
import com.fr.web.struct.impl.FineUI;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-05-16
*/
public class UniversalDatabaseComponent extends AssembleComponent {
public static final UniversalDatabaseComponent KEY = new UniversalDatabaseComponent();
private UniversalDatabaseComponent() {
}
@Override
public ScriptPath script(RequestClient req) {
return ScriptPath.build("/com/fr/design/dcm/index.js");
}
@Override
public StylePath style(RequestClient req) {
return StylePath.build("/com/fr/design/dcm/style.css");
}
@Override
public Atom[] refer() {
return new Atom[]{
FineUI.KEY
};
}
}

32
designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseDialog.java

@ -0,0 +1,32 @@
package com.fr.design.dcm;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-05-16
*/
public class UniversalDatabaseDialog extends UIDialog {
public UniversalDatabaseDialog(Frame frame, BasicPane pane) {
super(frame);
setUndecorated(true);
JPanel panel = (JPanel) getContentPane();
panel.setLayout(new BorderLayout());
add(pane, BorderLayout.CENTER);
setSize(new Dimension(1000, 600));
GUICoreUtils.centerWindow(this);
setResizable(false);
}
@Override
public void checkValid() throws Exception {
}
}

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

@ -0,0 +1,36 @@
package com.fr.design.dcm;
import com.fr.design.dialog.UIDialog;
import com.fr.design.mainframe.DesignerContext;
import javax.swing.*;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-05-16
*/
public class UniversalDatabaseOpener {
private static UIDialog dialog = null;
public static UIDialog getDialog() {
return dialog;
}
public static void showUniverseDatabaseDialog() {
UniversalDatabasePane upmPane = new UniversalDatabasePane();
if (dialog == null) {
dialog = new UniversalDatabaseDialog(DesignerContext.getDesignerFrame(), upmPane);
}
dialog.setVisible(true);
}
public static void closeWindow() {
if (dialog != null) {
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
dialog.setVisible(false);
dialog = null;
}
}
}

39
designer-base/src/main/java/com/fr/design/dcm/UniversalDatabasePane.java

@ -0,0 +1,39 @@
package com.fr.design.dcm;
import com.fr.design.dialog.BasicPane;
import com.fr.design.ui.ModernUIPane;
import com.teamdev.jxbrowser.chromium.JSValue;
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
import java.awt.*;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-05-16
*/
public class UniversalDatabasePane extends BasicPane {
private ModernUIPane<Object> modernUIPane;
@Override
protected String title4PopupWindow() {
return "Database";
}
public UniversalDatabasePane() {
setLayout(new BorderLayout());
modernUIPane = new ModernUIPane.Builder<>()
.withComponent(UniversalDatabaseComponent.KEY)
.prepare(new ScriptContextAdapter() {
@Override
public void onScriptContextCreated(ScriptContextEvent event) {
JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window");
window.asObject().setProperty("DcmHelper", UniversalDcmBridge.getBridge(event.getBrowser()));
}
})
.build();
add(modernUIPane, BorderLayout.CENTER);
}
}

34
designer-base/src/main/java/com/fr/design/dcm/UniversalDcmBridge.java

@ -0,0 +1,34 @@
package com.fr.design.dcm;
import com.fr.decision.webservice.bean.BaseBean;
import com.fr.design.bridge.exec.JSBridge;
import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.JSObject;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-05-17
* 桥接Java和JavaScript的类
*/
public class UniversalDcmBridge {
public static UniversalDcmBridge getBridge(Browser browser) {
return new UniversalDcmBridge(browser);
}
private JSObject window;
private UniversalDcmBridge(Browser browser) {
this.window = browser.executeJavaScriptAndReturnValue("window").asObject();
}
/**
* 获取所有的数据连接
* @return 数据连接集合
*/
@JSBridge
public BaseBean getConnections() {
return null;
}
}

4
designer-base/src/main/java/com/fr/design/editor/editor/DateEditor.java

@ -153,6 +153,10 @@ public class DateEditor extends Editor<Date> {
this.uiDatePicker.setSelectedItem(new Date()); this.uiDatePicker.setSelectedItem(new Date());
} }
public UIDatePicker getUiDatePicker() {
return uiDatePicker;
}
/** /**
* Request focus * Request focus
*/ */

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

@ -41,17 +41,17 @@ public class HistoryTemplateListCache implements CallbackEvent {
private List<JTemplate<?, ?>> historyList; private List<JTemplate<?, ?>> historyList;
private JTemplate<?, ?> editingTemplate; private JTemplate<?, ?> editingTemplate;
private static volatile HistoryTemplateListCache THIS; private static volatile HistoryTemplateListCache instacne;
public static HistoryTemplateListCache getInstance() { public static HistoryTemplateListCache getInstance() {
if (THIS == null) { if (instacne == null) {
synchronized (HistoryTemplateListCache.class) { synchronized (HistoryTemplateListCache.class) {
if (THIS == null) { if (instacne == null) {
THIS = new HistoryTemplateListCache(); instacne = new HistoryTemplateListCache();
} }
} }
} }
return THIS; return instacne;
} }
private HistoryTemplateListCache() { private HistoryTemplateListCache() {
@ -66,8 +66,8 @@ public class HistoryTemplateListCache implements CallbackEvent {
public void closeSelectedReport(JTemplate<?, ?> selected) { public void closeSelectedReport(JTemplate<?, ?> selected) {
DesignModuleFactory.clearChartPropertyPane(); DesignModuleFactory.clearChartPropertyPane();
DesignTableDataManager.closeTemplate(selected); DesignTableDataManager.closeTemplate(selected);
//直接关闭模板的时候退出权限编辑 //直接关闭模板的时候(当且仅当设计器tab上只剩一个模板)退出权限编辑
if (DesignModeContext.isAuthorityEditing()) { if (DesignModeContext.isAuthorityEditing() && historyList.size() <= 1) {
DesignerContext.getDesignerFrame().closeAuthorityEditing(); DesignerContext.getDesignerFrame().closeAuthorityEditing();
} }
if (contains(selected) == -1) { if (contains(selected) == -1) {

4
designer-base/src/main/java/com/fr/design/gui/date/SingleObjectComboBoxModel.java

@ -1,6 +1,7 @@
package com.fr.design.gui.date; package com.fr.design.gui.date;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.AbstractListModel; import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel; import javax.swing.ComboBoxModel;
@ -9,7 +10,7 @@ import java.util.Date;
public class SingleObjectComboBoxModel extends AbstractListModel implements ComboBoxModel { public class SingleObjectComboBoxModel extends AbstractListModel implements ComboBoxModel {
private SimpleDateFormat dateFormat; private SimpleDateFormat dateFormat;
private String selectedDate = ""; private String selectedDate = StringUtils.EMPTY;
public SingleObjectComboBoxModel() { public SingleObjectComboBoxModel() {
} }
@ -28,6 +29,7 @@ public class SingleObjectComboBoxModel extends AbstractListModel implements Comb
public void setSelectedItem(Object anItem) { public void setSelectedItem(Object anItem) {
if (anItem == null) { if (anItem == null) {
selectedDate = StringUtils.EMPTY;
return; return;
} }
if (anItem instanceof Date) { if (anItem instanceof Date) {

14
designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java

@ -6,6 +6,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JComboBox; import javax.swing.JComboBox;
@ -157,7 +158,11 @@ public class UIDatePicker extends UIComboBox implements Serializable {
* 设置当前选择的日期 * 设置当前选择的日期
*/ */
public void setSelectedDate(Date date) throws ParseException { public void setSelectedDate(Date date) throws ParseException {
this.setSelectedItem(dateFormat.format(date)); if (date == null) {
this.setSelectedItem(null);
} else {
this.setSelectedItem(dateFormat.format(date));
}
} }
public void setSelectedItem(Object anObject) { public void setSelectedItem(Object anObject) {
@ -215,8 +220,11 @@ public class UIDatePicker extends UIComboBox implements Serializable {
try { try {
String strDate = comboBox.getSelectedItem().toString(); String strDate = comboBox.getSelectedItem().toString();
synchronized (this) { synchronized (this) {
Date selectionDate = dateFormat.parse(strDate); Date selectionDate = new Date();
calendarPanel.setSelectedDate(selectionDate); if (StringUtils.isNotBlank(strDate)) {
selectionDate = dateFormat.parse(strDate);
}
calendarPanel.setSelectedDate(selectionDate);
calendarPanel.updateHMS(); calendarPanel.updateHMS();
} }
} catch (Exception e) { } catch (Exception e) {

44
designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java

@ -25,10 +25,13 @@ import com.fr.stable.StringUtils;
* @since 2012-5-11下午4:28:24 * @since 2012-5-11下午4:28:24
*/ */
public class UIToggleButton extends UIButton implements GlobalNameObserver{ public class UIToggleButton extends UIButton implements GlobalNameObserver{
private static final int ICON_COUNT = 2;
private boolean isSelected; private boolean isSelected;
private boolean isEventBannded = false; private boolean isEventBannded = false;
private String toggleButtonName = ""; private String toggleButtonName = "";
private GlobalNameListener globalNameListener = null; private GlobalNameListener globalNameListener = null;
private Icon[] icons;
public UIToggleButton() { public UIToggleButton() {
this(StringUtils.EMPTY); this(StringUtils.EMPTY);
@ -53,9 +56,9 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
* @param icons * @param icons
*/ */
public UIToggleButton(Icon[] icons) { public UIToggleButton(Icon[] icons) {
super(icons[0], null, icons[1]); super(icons[0], null, null);
setSelectedIcon(icons[1]);
setExtraPainted(true); setExtraPainted(true);
this.icons = icons;
addActionListener(new AbstractAction() { addActionListener(new AbstractAction() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -73,10 +76,10 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
* @param icons * @param icons
*/ */
public UIToggleButton(Icon[] icons, boolean needRelease) { public UIToggleButton(Icon[] icons, boolean needRelease) {
super(icons[0], null, icons[1]); super(icons[0], null, null);
setBorderPainted(true); setBorderPainted(true);
setSelectedIcon(icons[1]);
setExtraPainted(true); setExtraPainted(true);
this.icons = icons;
if (!needRelease) { if (!needRelease) {
addActionListener(new AbstractAction() { addActionListener(new AbstractAction() {
@Override @Override
@ -92,6 +95,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
addMouseListener(getMouseListener()); addMouseListener(getMouseListener());
} }
@Override
public void setGlobalName(String name){ public void setGlobalName(String name){
toggleButtonName = name ; toggleButtonName = name ;
} }
@ -100,6 +104,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
* *
* @return * @return
*/ */
@Override
public boolean isSelected() { public boolean isSelected() {
return isSelected; return isSelected;
} }
@ -115,12 +120,15 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
super.setSelected(isSelected); super.setSelected(isSelected);
if (this.isSelected != isSelected) { if (this.isSelected != isSelected) {
this.isSelected = isSelected; this.isSelected = isSelected;
repaint(); refresh(isSelected);
} }
} }
@Override
protected void initListener(){ protected void initListener(){
if(shouldResponseChangeListener()){ if(shouldResponseChangeListener()){
this.addChangeListener(new ChangeListener() { this.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
if (uiObserverListener == null) { if (uiObserverListener == null) {
return; return;
@ -138,10 +146,30 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
if (this.isSelected != isSelected) { if (this.isSelected != isSelected) {
this.isSelected = isSelected; this.isSelected = isSelected;
fireSelectedChanged(); fireSelectedChanged();
repaint(); refresh(isSelected);
} }
} }
private void refresh(final boolean isSelected) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
Icon[] icons = UIToggleButton.this.icons;
if (icons != null && icons.length == ICON_COUNT) {
if (isSelected) {
UIToggleButton.this.setIcon(icons[1]);
} else {
UIToggleButton.this.setIcon(icons[0]);
}
}
UIToggleButton.this.repaint();
}
});
}
protected MouseListener getMouseListener() { protected MouseListener getMouseListener() {
return new MouseAdapter() { return new MouseAdapter() {
@Override @Override
@ -157,6 +185,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
this.isEventBannded = ban; this.isEventBannded = ban;
} }
@Override
protected void fireStateChanged() { protected void fireStateChanged() {
} }
@ -187,6 +216,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
} }
} }
@Override
protected void paintOtherBorder(Graphics g) { protected void paintOtherBorder(Graphics g) {
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
g2d.setStroke(UIConstants.BS); g2d.setStroke(UIConstants.BS);
@ -200,6 +230,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
* *
* @return 如果需要响应观察者事件则返回true否则返回false * @return 如果需要响应观察者事件则返回true否则返回false
*/ */
@Override
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
return true; return true;
} }
@ -208,6 +239,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
* *
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
@Override
public void registerNameListener(GlobalNameListener listener) { public void registerNameListener(GlobalNameListener listener) {
globalNameListener = listener; globalNameListener = listener;
} }

23
designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java

@ -20,8 +20,10 @@ import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.plugin.ExtraClassManager; import com.fr.plugin.ExtraClassManager;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.manage.PluginFilter;
@ -94,11 +96,11 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
imageLayoutComboBox = new UIComboBox(LAYOUT); imageLayoutComboBox = new UIComboBox(LAYOUT);
initTextRotationCombox(); initTextRotationCombox();
Icon[][] hAlignmentIconArray = {{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal_white.png")}, Icon[][] hAlignmentIconArray = {{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal_white.png")},
{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal_white.png")}, {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal_white.png")},
{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal_white.png")}, {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal_white.png")},
{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal_white.png")}, {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal_white.png")},
{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment_white.png")}}; {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment_white.png")}};
Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT, Integer.valueOf(Constants.DISTRIBUTED), Constants.NULL}; Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT, Integer.valueOf(Constants.DISTRIBUTED), Constants.NULL};
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment); hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment);
hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Left"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Right"), hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Left"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Right"),
@ -106,9 +108,9 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
hPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); hPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
vPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); vPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
Icon[][] vAlignmentIconArray = {{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_top_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_top_normal_white.png")}, Icon[][] vAlignmentIconArray = {{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_top_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_top_normal_white.png")},
{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal_white.png")}, {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal_white.png")},
{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal_white.png")}}; {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal_white.png")}};
Integer[] vAlignment = new Integer[]{Constants.TOP, Constants.CENTER, Constants.BOTTOM}; Integer[] vAlignment = new Integer[]{Constants.TOP, Constants.CENTER, Constants.BOTTOM};
vAlignmentPane = new UIButtonGroup<Integer>(vAlignmentIconArray, vAlignment); vAlignmentPane = new UIButtonGroup<Integer>(vAlignmentIconArray, vAlignment);
vAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Top"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Bottom")}); vAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Top"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Bottom")});
@ -210,9 +212,11 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
private JPanel basicPane() { private JPanel basicPane() {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
UILabel horizontalLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Horizontal") + " ", SwingConstants.LEFT);
UIComponentUtils.setLineWrap(horizontalLabel);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Horizontal") + " ", SwingConstants.LEFT), hPaneContainer}, new Component[]{horizontalLabel, hPaneContainer},
new Component[]{null, null}, new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Vertical") + " ", SwingConstants.RIGHT), vPaneContainer}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Vertical") + " ", SwingConstants.RIGHT), vPaneContainer},
new Component[]{null, null} new Component[]{null, null}
@ -304,6 +308,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
* *
* @param style the new style. * @param style the new style.
*/ */
@Override
public void populateBean(Style style) { public void populateBean(Style style) {
hAlignmentPane.setSelectedItem(BaseUtils.getAlignment4Horizontal(style)); hAlignmentPane.setSelectedItem(BaseUtils.getAlignment4Horizontal(style));
vAlignmentPane.setSelectedItem(style.getVerticalAlignment()); vAlignmentPane.setSelectedItem(style.getVerticalAlignment());

9
designer-base/src/main/java/com/fr/design/icon/BorderIcon.java

@ -22,16 +22,18 @@ public class BorderIcon implements Icon {
this.cellBorderStyle = cellBorderStyle; this.cellBorderStyle = cellBorderStyle;
} }
@Override
public int getIconHeight() { public int getIconHeight() {
return height; return height;
} }
@Override
public int getIconWidth() { public int getIconWidth() {
return width; return width;
} }
public static void drawLine(Graphics g, double x1, double y1, double x2, private void drawLine(Graphics g, double x1, double y1, double x2,
double y2, int lineStyle, Color color) { double y2, int lineStyle, Color color) {
g.setColor(color); g.setColor(color);
x1--; x1--;
@ -63,6 +65,7 @@ public class BorderIcon implements Icon {
} }
} }
@Override
public void paintIcon(Component c, Graphics g, int x, int y) { public void paintIcon(Component c, Graphics g, int x, int y) {
int defaultWidth = c.getWidth(); int defaultWidth = c.getWidth();
int defaultHeight = c.getHeight(); int defaultHeight = c.getHeight();
@ -81,9 +84,9 @@ public class BorderIcon implements Icon {
cellBorderStyle.getBottomColor()); cellBorderStyle.getBottomColor());
drawLine(gr, x1, y1, x1, y2, cellBorderStyle.getLeftStyle(), drawLine(gr, x1, y1, x1, y2, cellBorderStyle.getLeftStyle(),
cellBorderStyle.getLeftColor()); cellBorderStyle.getLeftColor());
drawLine(gr, defaultWidth / 2, x1, defaultWidth / 2, x2, drawLine(gr, defaultWidth / 2, y1, defaultWidth / 2, y2,
cellBorderStyle.getVerticalStyle(), cellBorderStyle.getVerticalColor()); cellBorderStyle.getVerticalStyle(), cellBorderStyle.getVerticalColor());
drawLine(gr, y1, defaultHeight / 2, y2, defaultHeight / 2, drawLine(gr, x1, defaultHeight / 2, x2, defaultHeight / 2,
cellBorderStyle.getHorizontalStyle(), cellBorderStyle.getHorizontalColor()); cellBorderStyle.getHorizontalStyle(), cellBorderStyle.getHorizontalColor());
} }

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

@ -37,6 +37,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.loghandler.LogMessageBar; import com.fr.design.mainframe.loghandler.LogMessageBar;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.menu.MenuManager; import com.fr.design.menu.MenuManager;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
@ -924,6 +925,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} }
jt.addJTemplateActionListener(this); jt.addJTemplateActionListener(this);
jt.addTargetModifiedListener(this); jt.addTargetModifiedListener(this);
jt.addJTemplateActionListener(VcsHelper.getInstance());
centerTemplateCardPane.showJTemplate(jt); centerTemplateCardPane.showJTemplate(jt);
setTitle(); setTitle();
layeredPane.repaint(); layeredPane.repaint();

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

@ -2,6 +2,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.cluster.engine.base.FineClusterConfig;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
@ -26,6 +27,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.mainframe.vcs.ui.FileVersionsPanel; import com.fr.design.mainframe.vcs.ui.FileVersionsPanel;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
@ -49,7 +51,6 @@ import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.third.org.apache.commons.io.FilenameUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.design.mainframe.vcs.common.VcsHelper;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JDialog; import javax.swing.JDialog;
@ -79,6 +80,9 @@ import static javax.swing.JOptionPane.WARNING_MESSAGE;
public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarStateChangeListener, ResponseDataSourceChange { public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarStateChangeListener, ResponseDataSourceChange {
private static final String FILE = "file";
private static volatile DesignerFrameFileDealerPane THIS;
static { static {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() { GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@ -95,10 +99,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
}); });
} }
private static final String FILE = "file";
private static volatile DesignerFrameFileDealerPane THIS;
private List<FileToolbarStateChangeListener> otherToolbarStateChangeListeners = new ArrayList<>(); private List<FileToolbarStateChangeListener> otherToolbarStateChangeListeners = new ArrayList<>();
private FileOperations selectedOperation; private FileOperations selectedOperation;
@ -118,25 +118,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
private VcsAction vcsAction = new VcsAction(); private VcsAction vcsAction = new VcsAction();
/**
* 刷新
*/
public void refresh() {
selectedOperation.refresh();
}
public static DesignerFrameFileDealerPane getInstance() {
if (THIS == null) {
synchronized (DesignerFrameFileDealerPane.class) {
if (THIS == null) {
THIS = new DesignerFrameFileDealerPane();
}
}
}
return THIS;
}
private DesignerFrameFileDealerPane() { private DesignerFrameFileDealerPane() {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
@ -164,6 +145,24 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
stateChange(); stateChange();
} }
public static DesignerFrameFileDealerPane getInstance() {
if (THIS == null) {
synchronized (DesignerFrameFileDealerPane.class) {
if (THIS == null) {
THIS = new DesignerFrameFileDealerPane();
}
}
}
return THIS;
}
/**
* 刷新
*/
public void refresh() {
selectedOperation.refresh();
}
public final void setCurrentEditingTemplate(JTemplate<?, ?> jt) { public final void setCurrentEditingTemplate(JTemplate<?, ?> jt) {
@ -202,15 +201,31 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
for (ShortCut shortCut : extraShortCuts) { for (ShortCut shortCut : extraShortCuts) {
toolbarDef.addShortCut(shortCut); toolbarDef.addShortCut(shortCut);
} }
if (VcsHelper.needInit()) { addVcsAction(toolbarDef);
toolbarDef.addShortCut(vcsAction);
}
toolbarDef.updateToolBar(toolBar); toolbarDef.updateToolBar(toolBar);
resetActionStatus(); resetActionStatus();
refresh(); refresh();
} }
/**
* 添加VcsAction
* @param toolbarDef
*/
private void addVcsAction(ToolBarDef toolbarDef) {
if (VcsHelper.getInstance().needInit()) {
vcsAction = new VcsAction();
if (FineClusterConfig.getInstance().isCluster()) {
vcsAction.setName(Toolkit.i18nText("Fine-Design_Vcs_NotSupportRemote"));
} else {
vcsAction.setName(Toolkit.i18nText("Fine-Design_Vcs_Title"));
}
toolbarDef.addShortCut(vcsAction);
}
}
private void resetActionStatus() { private void resetActionStatus() {
newFolderAction.setEnabled(false); newFolderAction.setEnabled(false);
@ -255,6 +270,41 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
} }
} }
private boolean isCurrentEditing(String path) {
JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
String editing = jt.getEditingFILE().getPath();
return ComparatorUtils.equals(editing, path);
}
/**
* 按钮状态改变
*/
@Override
public void stateChange() {
int selectedPathNum = TemplateTreePane.getInstance().countSelectedPath();
// 新建文件夹,重命名操作,在explorer中打开三个操作在选中单个文件夹或者文件时可用,其他情况不可用
boolean singleSelected = selectedPathNum == 1;
newFolderAction.setEnabled(singleSelected);
renameAction.setEnabled(singleSelected);
showInExplorerAction.setEnabled(singleSelected);
// 删除操作在至少选中一个时可用
boolean selected = selectedPathNum > 0;
delFileAction.setEnabled(selected);
// 刷新操作始终可用
refreshTreeAction.setEnabled(true);
//触发vcsAction变化
vcsAction.fireVcsActionChange();
// 其他状态
otherStateChange();
}
public FileOperations getSelectedOperation() {
return selectedOperation;
}
/* /*
* 新建文件夹 * 新建文件夹
*/ */
@ -287,8 +337,8 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
* 版本管理 * 版本管理
*/ */
private class VcsAction extends UpdateAction { private class VcsAction extends UpdateAction {
public VcsAction() { public VcsAction() {
this.setName(Toolkit.i18nText("Fine-Design_Vcs_Title"));
this.setSmallIcon(VcsHelper.VCS_LIST_PNG); this.setSmallIcon(VcsHelper.VCS_LIST_PNG);
} }
@ -303,6 +353,40 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
closeOpenedTemplate(path, isCurrentEditing); closeOpenedTemplate(path, isCurrentEditing);
FileVersionsPanel fileVersionTablePanel = FileVersionsPanel.getInstance(); FileVersionsPanel fileVersionTablePanel = FileVersionsPanel.getInstance();
fileVersionTablePanel.showFileVersionsPane(); fileVersionTablePanel.showFileVersionsPane();
stateChange();
}
/**
* 版本管理可用状态的监控
*/
private void fireVcsActionChange() {
if (!DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable() || VcsHelper.getInstance().isUnSelectedTemplate() || FineClusterConfig.getInstance().isCluster()) {
setEnabled(false);
return;
}
if (WorkContext.getCurrent() != null) {
if (!WorkContext.getCurrent().isLocal()) {
//当前环境为远程环境时
FileNode node = TemplateTreePane.getInstance().getTemplateFileTree().getSelectedFileNode();
if (selectedOperation.getFilePath() != null) {
if (node.getLock() != null && !ComparatorUtils.equals(node.getUserID(), node.getLock())) {
setEnabled(false);
} else {
setEnabled(true);
}
} else {
setEnabled(false);
}
} else {
//当前环境为本地环境时
setEnabled(selectedOperation.getFilePath() != null);
}
}
} }
private void closeOpenedTemplate(String path, boolean isCurrentEditing) { private void closeOpenedTemplate(String path, boolean isCurrentEditing) {
@ -321,12 +405,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
} }
private boolean isCurrentEditing(String path) {
JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
String editing = jt.getEditingFILE().getPath();
return ComparatorUtils.equals(editing, path);
}
/** /**
* 在系统资源管理器中打开 * 在系统资源管理器中打开
*/ */
@ -428,62 +506,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
} }
} }
/**
* 按钮状态改变
*/
@Override
public void stateChange() {
int selectedPathNum = TemplateTreePane.getInstance().countSelectedPath();
// 新建文件夹,重命名操作,在explorer中打开三个操作在选中单个文件夹或者文件时可用,其他情况不可用
boolean singleSelected = selectedPathNum == 1;
newFolderAction.setEnabled(singleSelected);
renameAction.setEnabled(singleSelected);
showInExplorerAction.setEnabled(singleSelected);
// 删除操作在至少选中一个时可用
boolean selected = selectedPathNum > 0;
delFileAction.setEnabled(selected);
// 刷新操作始终可用
refreshTreeAction.setEnabled(true);
handleVcsAction();
// 其他状态
otherStateChange();
}
private void handleVcsAction() {
if (!DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable() || VcsHelper.isUnSelectedTemplate()) {
vcsAction.setEnabled(false);
return;
}
if (WorkContext.getCurrent() != null) {
if (!WorkContext.getCurrent().isLocal()) {
//当前环境为远程环境时
FileNode node = TemplateTreePane.getInstance().getTemplateFileTree().getSelectedFileNode();
if (selectedOperation.getFilePath() != null) {
if (node.getLock() != null && !ComparatorUtils.equals(node.getUserID(), node.getLock())) {
vcsAction.setEnabled(false);
} else {
vcsAction.setEnabled(true);
}
} else {
vcsAction.setEnabled(false);
}
} else {
//当前环境为本地环境时
vcsAction.setEnabled(selectedOperation.getFilePath() != null);
}
}
}
public FileOperations getSelectedOperation() {
return selectedOperation;
}
/** /**
* 重命名对话框 * 重命名对话框
* 支持快捷键EnterESC * 支持快捷键EnterESC

5
designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java

@ -30,7 +30,7 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
// 判断是否切换设计器状态到禁止拷贝剪切 // 判断是否切换设计器状态到禁止拷贝剪切
if (jt.getTarget().getAttrMark(DesignBanCopyAttrMark.XML_TAG) != null) { if (jt.getTarget().getAttrMark(DesignBanCopyAttrMark.XML_TAG) != null) {
DesignModeContext.switchTo(DesignerMode.BAN_COPY_AND_CUT); DesignModeContext.switchTo(DesignerMode.BAN_COPY_AND_CUT);
} else if (!DesignModeContext.isVcsMode()){ } else if (!DesignModeContext.isVcsMode() && !DesignModeContext.isAuthorityEditing()){
DesignModeContext.switchTo(DesignerMode.NORMAL); DesignModeContext.switchTo(DesignerMode.NORMAL);
} }
DesignerFrameFileDealerPane.getInstance().setCurrentEditingTemplate(jt); DesignerFrameFileDealerPane.getInstance().setCurrentEditingTemplate(jt);
@ -38,7 +38,8 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
component.onLostFocus(); component.onLostFocus();
remove(component); remove(component);
} }
add(component = jt, BorderLayout.CENTER); component = jt;
add(component, BorderLayout.CENTER);
validate(); validate();
repaint(); repaint();
revalidate(); revalidate();

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

@ -12,6 +12,7 @@ import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.AllowAuthorityEditAction;
import com.fr.design.actions.TableDataSourceAction; import com.fr.design.actions.TableDataSourceAction;
import com.fr.design.actions.edit.RedoAction; import com.fr.design.actions.edit.RedoAction;
import com.fr.design.actions.edit.UndoAction; import com.fr.design.actions.edit.UndoAction;
@ -39,7 +40,6 @@ import com.fr.design.mainframe.template.info.TemplateProcessInfo;
import com.fr.design.mainframe.template.info.TimeConsumeTimer; import com.fr.design.mainframe.template.info.TimeConsumeTimer;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.mainframe.toolbar.VcsScene; import com.fr.design.mainframe.toolbar.VcsScene;
import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.NameSeparator; import com.fr.design.menu.NameSeparator;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
@ -112,7 +112,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
// 判断是否切换设计器状态到禁止拷贝剪切 // 判断是否切换设计器状态到禁止拷贝剪切
if (t.getAttrMark(DesignBanCopyAttrMark.XML_TAG) != null) { if (t.getAttrMark(DesignBanCopyAttrMark.XML_TAG) != null) {
DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.BAN_COPY_AND_CUT); DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.BAN_COPY_AND_CUT);
} else if (!DesignModeContext.isVcsMode()) { } else if (!DesignModeContext.isVcsMode() && !DesignModeContext.isAuthorityEditing()) {
DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL);
} }
this.template = t; this.template = t;
@ -687,10 +687,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
this.saved = true; this.saved = true;
this.authoritySaved = true; this.authoritySaved = true;
DesignerContext.getDesignerFrame().setTitle(); DesignerContext.getDesignerFrame().setTitle();
if (DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable()) {
VcsHelper.dealWithVcs(this);
}
this.fireJTemplateSaved(); this.fireJTemplateSaved();
return true; return true;
} }
@ -831,7 +827,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
// Process the listeners last to first, notifying // Process the listeners last to first, notifying
// those that are interested in this event // those that are interested in this event
for (int i = listeners.length - 2; i >= 0; i -= 2) { for (int i = listeners.length - 1; i >= 0; i -= 1) {
if (listeners[i] == JTemplateActionListener.class) { if (listeners[i] == JTemplateActionListener.class) {
((JTemplateActionListener) listeners[i + 1]).templateSaved(this); ((JTemplateActionListener) listeners[i + 1]).templateSaved(this);
} }

45
designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java

@ -44,14 +44,6 @@ public class DesignerLogHandler {
private static final SimpleDateFormat LOG_SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private static final SimpleDateFormat LOG_SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private static final int INFO_INT = Level.INFO.toInt();
private static final int ERROR_INT = Level.ERROR.toInt();
private static final int WARN_INT = Level.WARN.toInt();
private static final int DEBUG_INT = Level.DEBUG.toInt();
private static final int GAP_X = -150; private static final int GAP_X = -150;
private static final int INFO_GAP_Y = -60; private static final int INFO_GAP_Y = -60;
@ -127,12 +119,12 @@ public class DesignerLogHandler {
JPopupMenu jPopupMenu = new JPopupMenu(); JPopupMenu jPopupMenu = new JPopupMenu();
int logLevelInt = Log4jConfig.getInstance().getRootLevel().toInt(); int logLevelInt = Log4jConfig.getInstance().getRootLevel().toInt();
if (logLevelInt <= INFO_INT) { if (logLevelInt <= DesignerLogger.INFO_INT) {
jPopupMenu.add(showInfo); jPopupMenu.add(showInfo);
jPopupMenu.add(showError); jPopupMenu.add(showError);
jPopupMenu.add(showServer); jPopupMenu.add(showServer);
jPopupMenu.show(caption, caption.getWidth() + GAP_X, INFO_GAP_Y); jPopupMenu.show(caption, caption.getWidth() + GAP_X, INFO_GAP_Y);
} else if (logLevelInt == ERROR_INT) { } else if (logLevelInt == DesignerLogger.ERROR_INT) {
jPopupMenu.add(showError); jPopupMenu.add(showError);
jPopupMenu.add(showServer); jPopupMenu.add(showServer);
jPopupMenu.show(caption, caption.getWidth() + GAP_X, ERRO_GAP_Y); jPopupMenu.show(caption, caption.getWidth() + GAP_X, ERRO_GAP_Y);
@ -241,11 +233,11 @@ public class DesignerLogHandler {
int intLevel = event.getLevel().toInt(); int intLevel = event.getLevel().toInt();
Date date = new Date(event.getTimeStamp()); Date date = new Date(event.getTimeStamp());
ThrowableInformation information = event.getThrowableInformation(); ThrowableInformation information = event.getThrowableInformation();
if (intLevel == INFO_INT && showInfo.isSelected()) { if (intLevel == DesignerLogger.INFO_INT && showInfo.isSelected()) {
printMessage(event.getRenderedMessage(), intLevel, date, information == null ? null : information.getThrowable()); printMessage(event.getRenderedMessage(), intLevel, date, information == null ? null : information.getThrowable());
} else if (intLevel == ERROR_INT && showError.isSelected()) { } else if (intLevel == DesignerLogger.ERROR_INT && showError.isSelected()) {
printMessage(event.getRenderedMessage(), intLevel, date, information == null ? null : information.getThrowable()); printMessage(event.getRenderedMessage(), intLevel, date, information == null ? null : information.getThrowable());
} else if (intLevel == WARN_INT && showServer.isSelected()) { } else if (intLevel == DesignerLogger.WARN_INT && showServer.isSelected()) {
printMessage(event.getRenderedMessage(), intLevel, date, information == null ? null : information.getThrowable()); printMessage(event.getRenderedMessage(), intLevel, date, information == null ? null : information.getThrowable());
} }
} }
@ -253,11 +245,11 @@ public class DesignerLogHandler {
public void printStackTrace(String message, Level level, Date date) { public void printStackTrace(String message, Level level, Date date) {
int intLevel = level.toInt(); int intLevel = level.toInt();
if (intLevel == INFO_INT && showInfo.isSelected()) { if (intLevel == DesignerLogger.INFO_INT && showInfo.isSelected()) {
printMessage(message, intLevel, date); printMessage(message, intLevel, date);
} else if (intLevel == ERROR_INT && showError.isSelected()) { } else if (intLevel == DesignerLogger.ERROR_INT && showError.isSelected()) {
printMessage(message, intLevel, date); printMessage(message, intLevel, date);
} else if (intLevel == WARN_INT && showServer.isSelected()) { } else if (intLevel == DesignerLogger.WARN_INT && showServer.isSelected()) {
printMessage(message, intLevel, date); printMessage(message, intLevel, date);
} }
@ -287,13 +279,13 @@ public class DesignerLogHandler {
private void log(String str, int style) { private void log(String str, int style) {
SimpleAttributeSet attrSet = new SimpleAttributeSet(); SimpleAttributeSet attrSet = new SimpleAttributeSet();
if (style == ERROR_INT) { if (style == DesignerLogger.ERROR_INT) {
StyleConstants.setForeground(attrSet, new Color(247, 148, 29)); StyleConstants.setForeground(attrSet, new Color(247, 148, 29));
StyleConstants.setBold(attrSet, true); StyleConstants.setBold(attrSet, true);
} else if (style == WARN_INT) { } else if (style == DesignerLogger.WARN_INT) {
StyleConstants.setForeground(attrSet, Color.red); StyleConstants.setForeground(attrSet, Color.red);
StyleConstants.setBold(attrSet, true); StyleConstants.setBold(attrSet, true);
} else if (style == INFO_INT) { } else if (style == DesignerLogger.INFO_INT) {
StyleConstants.setForeground(attrSet, Color.black); StyleConstants.setForeground(attrSet, Color.black);
StyleConstants.setBold(attrSet, false); StyleConstants.setBold(attrSet, false);
} else { } else {
@ -310,9 +302,9 @@ public class DesignerLogHandler {
private String appendLocaleMark(String str, int style) { private String appendLocaleMark(String str, int style) {
if (style == ERROR_INT) { if (style == DesignerLogger.ERROR_INT) {
str = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert") + ":" + str + "\n"; str = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert") + ":" + str + "\n";
} else if (style == WARN_INT) { } else if (style == DesignerLogger.WARN_INT) {
str = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Seriously") + ":" + str + "\n"; str = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Seriously") + ":" + str + "\n";
} else { } else {
str = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Normal") + ":" + str + "\n"; str = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Normal") + ":" + str + "\n";
@ -323,11 +315,11 @@ public class DesignerLogHandler {
private void setMessage(String message, int level) { private void setMessage(String message, int level) {
LogMessageBar.getInstance().setMessage(message); LogMessageBar.getInstance().setMessage(message);
if (level == DesignerLogHandler.INFO_INT && showInfo.isSelected()) { if (level == DesignerLogger.INFO_INT && showInfo.isSelected()) {
caption.infoAdd(); caption.infoAdd();
} else if (level == DesignerLogHandler.ERROR_INT && showError.isSelected()) { } else if (level == DesignerLogger.ERROR_INT && showError.isSelected()) {
caption.errorAdd(); caption.errorAdd();
} else if (level == DesignerLogHandler.WARN_INT && showServer.isSelected()) { } else if (level == DesignerLogger.WARN_INT && showServer.isSelected()) {
caption.serverAdd(); caption.serverAdd();
} }
} }
@ -368,9 +360,4 @@ public class DesignerLogHandler {
}; };
} }
public void printLoggingEvent(LoggingEvent event) {
logHandlerArea.printStackTrace(event);
}
} }

82
designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogger.java

@ -0,0 +1,82 @@
package com.fr.design.mainframe.loghandler;
import com.fr.log.FineLoggerFactory;
import com.fr.third.apache.log4j.Level;
import com.fr.third.apache.log4j.spi.LoggingEvent;
import com.fr.third.apache.log4j.spi.ThrowableInformation;
/**
* 设计器日志记录
*/
public class DesignerLogger {
public static final int INFO_INT = Level.INFO.toInt();
public static final int ERROR_INT = Level.ERROR.toInt();
public static final int WARN_INT = Level.WARN.toInt();
/**
* 记录LoggingEvent对象
*
* @param event
*/
public static void log(LoggingEvent event) {
if (event == null) {
return;
}
LogParser.parse(event).log(event);
}
public enum LogParser {
DEFAULT(-1) {
@Override
public void log(LoggingEvent event) {
}
},
INFO(Level.INFO.toInt()) {
@Override
public void log(LoggingEvent event) {
FineLoggerFactory.getLogger().info(event.getRenderedMessage());
}
},
WARN(Level.WARN.toInt()) {
@Override
public void log(LoggingEvent event) {
ThrowableInformation information = event.getThrowableInformation();
FineLoggerFactory.getLogger().warn(event.getRenderedMessage(), information == null ? null : information.getThrowable());
}
},
ERROR(Level.ERROR.toInt()) {
@Override
public void log(LoggingEvent event) {
ThrowableInformation information = event.getThrowableInformation();
FineLoggerFactory.getLogger().error(event.getRenderedMessage(), information == null ? null : information.getThrowable());
}
};
private int level;
LogParser(int level) {
this.level = level;
}
public int getLevel() {
return level;
}
public static LogParser parse(LoggingEvent event) {
int intLevel = event.getLevel().toInt();
for (LogParser logParser : values()) {
if (logParser.getLevel() == intLevel) {
return logParser;
}
}
return DEFAULT;
}
public void log(LoggingEvent event) {
}
}
}

9
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java

@ -2,7 +2,6 @@ package com.fr.design.mainframe.mobile.ui;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.Icon; import com.fr.base.Icon;
import com.fr.base.IconManager;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -11,6 +10,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.UITitleSplitLine; import com.fr.design.mainframe.widget.UITitleSplitLine;
import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane; import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane;
import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.WidgetInfoConfig;
import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.cardtag.mobile.DownMenuStyle; import com.fr.general.cardtag.mobile.DownMenuStyle;
@ -40,6 +40,7 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf {
super(tagLayout); super(tagLayout);
} }
@Override
protected void createExtraConfPane(JPanel centerPane) { protected void createExtraConfPane(JPanel centerPane) {
JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 0); JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 0);
panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 5, 20)); panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 5, 20));
@ -134,12 +135,13 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf {
private static final int GAP = 6; private static final int GAP = 6;
private static final String PAINT_ICON = "fund_white"; private static final String PAINT_ICON = "fund_white";
private static final String ICON_PATH = "/com/fr/web/images/fund_white.png"; private static final String ICON_PATH = "/com/fr/web/images/fund_white.png";
private LineDescription splitLine; private transient LineDescription splitLine;
public DownMenuStylePreviewPane() { public DownMenuStylePreviewPane() {
this.setBackground(Color.decode("#3888EE")); this.setBackground(Color.decode("#3888EE"));
} }
@Override
public void repaint() { public void repaint() {
super.repaint(); super.repaint();
} }
@ -172,7 +174,7 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf {
g2d.setColor(oldColor); g2d.setColor(oldColor);
} }
Icon icon = new Icon(PAINT_ICON, ICON_PATH); Icon icon = new Icon(PAINT_ICON, ICON_PATH);
g2d.drawImage(IconManager.getIconManager().getDefaultIconImage(icon), (eachWidth - ICON_OFFSET) / 2, (panelHeight - ICON_OFFSET - GAP - fontHeight) / 2, null); g2d.drawImage(WidgetInfoConfig.getInstance().getIconManager().getDefaultIconImage(icon), (eachWidth - ICON_OFFSET) / 2, (panelHeight - ICON_OFFSET - GAP - fontHeight) / 2, null);
g2d.drawString(displayName, (eachWidth - width) / 2, (panelHeight + ICON_OFFSET + GAP - fontHeight) / 2 + ascent); g2d.drawString(displayName, (eachWidth - width) / 2, (panelHeight + ICON_OFFSET + GAP - fontHeight) / 2 + ascent);
Stroke oldStroke = g2d.getStroke(); Stroke oldStroke = g2d.getStroke();
if (splitLine.getLineStyle() != 0) { if (splitLine.getLineStyle() != 0) {
@ -187,6 +189,7 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf {
} }
@Override
public void populateConfig(MobileTemplateStyle templateStyle) { public void populateConfig(MobileTemplateStyle templateStyle) {
super.populateConfig(templateStyle); super.populateConfig(templateStyle);
this.splitLine = ((DownMenuStyle) templateStyle).getSplitLine(); this.splitLine = ((DownMenuStyle) templateStyle).getSplitLine();

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

@ -1,6 +1,7 @@
package com.fr.design.mainframe.template.info; package com.fr.design.mainframe.template.info;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.io.XMLReadHelper;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
@ -12,12 +13,15 @@ import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLWriter; import com.fr.stable.xml.XMLWriter;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import com.fr.third.javax.xml.stream.XMLStreamException; import com.fr.third.javax.xml.stream.XMLStreamException;
import com.fr.workspace.WorkContext; import com.fr.third.org.apache.commons.io.FileUtils;
import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.IOException;
import java.io.FileReader; import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -132,13 +136,24 @@ public class TemplateInfoCollector implements XMLReadable, XMLWriter {
if (!getInfoFile().exists()) { if (!getInfoFile().exists()) {
return; return;
} }
try {
XMLableReader xmlReader = XMLableReader.createXMLableReader(new FileReader(getInfoFile())); XMLableReader reader = null;
xmlReader.readXMLObject(this); try (InputStream in = new FileInputStream(getInfoFile())) {
} catch (XMLStreamException e) { // XMLableReader 还是应该考虑实现 Closable 接口的,这样就能使用 try-with 语句了
FineLoggerFactory.getLogger().error(e.getMessage(), e); reader = XMLReadHelper.createXMLableReader(in, XMLPrintWriter.XML_ENCODER);
reader.readXMLObject(this);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
// do nothing // do nothing
} catch (XMLStreamException | IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {
try {
if (reader != null) {
reader.close();
}
} catch (XMLStreamException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
} }
} }
@ -160,8 +175,12 @@ public class TemplateInfoCollector implements XMLReadable, XMLWriter {
*/ */
private void saveInfo() { private void saveInfo() {
try { try {
FileOutputStream out = new FileOutputStream(getInfoFile()); ByteArrayOutputStream out = new ByteArrayOutputStream();
XMLTools.writeOutputStreamXML(this, out); XMLTools.writeOutputStreamXML(this, out);
out.flush();
out.close();
String fileContent = new String(out.toByteArray(), StandardCharsets.UTF_8);
FileUtils.writeStringToFile(getInfoFile(), fileContent, StandardCharsets.UTF_8);
} catch (Exception ex) { } catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage()); FineLoggerFactory.getLogger().error(ex.getMessage());
} }

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

@ -13,6 +13,7 @@ import com.fr.design.actions.community.BBSAction;
import com.fr.design.actions.community.BugAction; import com.fr.design.actions.community.BugAction;
import com.fr.design.actions.community.CenterAction; import com.fr.design.actions.community.CenterAction;
import com.fr.design.actions.community.CusDemandAction; import com.fr.design.actions.community.CusDemandAction;
import com.fr.design.actions.community.FacebookFansAction;
import com.fr.design.actions.community.NeedAction; import com.fr.design.actions.community.NeedAction;
import com.fr.design.actions.community.QuestionAction; import com.fr.design.actions.community.QuestionAction;
import com.fr.design.actions.community.SignAction; import com.fr.design.actions.community.SignAction;
@ -151,7 +152,6 @@ public abstract class ToolBarMenuDock {
} }
}; };
private static final String FINEREPORT = "FineReport";
private static final int MENUBAR_HEIGHT = 22; private static final int MENUBAR_HEIGHT = 22;
private static final List<PluginEventListener> PLUGIN_LISTENERS = new ArrayList<>(); private static final List<PluginEventListener> PLUGIN_LISTENERS = new ArrayList<>();
@ -543,6 +543,9 @@ public abstract class ToolBarMenuDock {
shortCuts.add(new CusDemandAction()); shortCuts.add(new CusDemandAction());
shortCuts.add(new CenterAction()); shortCuts.add(new CenterAction());
shortCuts.add(new SignAction()); shortCuts.add(new SignAction());
if (Locale.TAIWAN.equals(GeneralContext.getLocale())) {
shortCuts.add(new FacebookFansAction());
}
return shortCuts.toArray(new ShortCut[shortCuts.size()]); return shortCuts.toArray(new ShortCut[shortCuts.size()]);
} }

55
designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.vcs.common; package com.fr.design.mainframe.vcs.common;
import com.fr.cluster.engine.base.FineClusterConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.TemplateTreePane; import com.fr.design.file.TemplateTreePane;
@ -7,6 +8,7 @@ import com.fr.design.gui.itree.filetree.TemplateFileTree;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JTemplateActionListener;
import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.mainframe.vcs.ui.FileVersionTable; import com.fr.design.mainframe.vcs.ui.FileVersionTable;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
@ -28,7 +30,7 @@ import static com.fr.stable.StableUtils.pathJoin;
/** /**
* Created by XiaXiang on 2019/4/17. * Created by XiaXiang on 2019/4/17.
*/ */
public class VcsHelper { public class VcsHelper implements JTemplateActionListener {
public final static Color TABLE_SELECT_BACKGROUND = new Color(0xD8F2FD); public final static Color TABLE_SELECT_BACKGROUND = new Color(0xD8F2FD);
public final static Color COPY_VERSION_BTN_COLOR = new Color(0x419BF9); public final static Color COPY_VERSION_BTN_COLOR = new Color(0x419BF9);
@ -42,12 +44,18 @@ public class VcsHelper {
public final static Icon VCS_DELETE_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/icon_delete.png"); public final static Icon VCS_DELETE_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/icon_delete.png");
public final static Icon VCS_USER_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/icon_user@1x.png"); public final static Icon VCS_USER_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/icon_user@1x.png");
public final static Icon VCS_REVERT = IOUtils.readIcon("/com/fr/design/images/vcs/icon_revert.png"); public final static Icon VCS_REVERT = IOUtils.readIcon("/com/fr/design/images/vcs/icon_revert.png");
public final static int OFFSET = 2;
private final static String VCS_DIR = "vcs"; private final static String VCS_DIR = "vcs";
public final static String VCS_CACHE_DIR = pathJoin(VCS_DIR, "cache"); public final static String VCS_CACHE_DIR = pathJoin(VCS_DIR, "cache");
private static final int MINUTE = 60 * 1000; private static final int MINUTE = 60 * 1000;
private final static String VCS_PLUGIN_ID = "com.fr.plugin.vcs.v10"; private final static String VCS_PLUGIN_ID = "com.fr.plugin.vcs.v10";
private static final VcsHelper instance = new VcsHelper();
private static int containsFolderCounts() { public static VcsHelper getInstance() {
return instance;
}
private int containsFolderCounts() {
TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree(); TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree();
if (fileTree.getSelectionPaths() == null) { if (fileTree.getSelectionPaths() == null) {
return 0; return 0;
@ -61,13 +69,13 @@ public class VcsHelper {
return fileTree.getSelectionPaths().length - fileTree.getSelectedTemplatePaths().length; return fileTree.getSelectionPaths().length - fileTree.getSelectedTemplatePaths().length;
} }
public static String getCurrentUsername() { public String getCurrentUsername() {
return WorkContext.getCurrent().isLocal() return WorkContext.getCurrent().isLocal()
? Toolkit.i18nText("Fine-Design_Vcs_Local_User") ? Toolkit.i18nText("Fine-Design_Vcs_Local_User")
: WorkContext.getCurrent().getConnection().getUserName(); : WorkContext.getCurrent().getConnection().getUserName();
} }
private static int selectedTemplateCounts() { private int selectedTemplateCounts() {
TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree(); TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree();
if (fileTree.getSelectionPaths() == null) { if (fileTree.getSelectionPaths() == null) {
return 0; return 0;
@ -76,11 +84,11 @@ public class VcsHelper {
return fileTree.getSelectedTemplatePaths().length; return fileTree.getSelectedTemplatePaths().length;
} }
public static boolean isUnSelectedTemplate() { public boolean isUnSelectedTemplate() {
return VcsHelper.containsFolderCounts() + VcsHelper.selectedTemplateCounts() != 1; return containsFolderCounts() + selectedTemplateCounts() != 1;
} }
public static String getEditingFilename() { private String getEditingFilename() {
JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
String editingFilePath = jt.getEditingFILE().getPath(); String editingFilePath = jt.getEditingFILE().getPath();
if (editingFilePath.startsWith(ProjectConstants.REPORTLETS_NAME)) { if (editingFilePath.startsWith(ProjectConstants.REPORTLETS_NAME)) {
@ -94,7 +102,7 @@ public class VcsHelper {
return editingFilePath; return editingFilePath;
} }
public static boolean needDeleteVersion(VcsEntity entity) { private boolean needDeleteVersion(VcsEntity entity) {
VcsConfigManager configManager = DesignerEnvManager.getEnvManager().getVcsConfigManager(); VcsConfigManager configManager = DesignerEnvManager.getEnvManager().getVcsConfigManager();
if (entity == null || !configManager.isUseInterval()) { if (entity == null || !configManager.isUseInterval()) {
return false; return false;
@ -105,9 +113,9 @@ public class VcsHelper {
return new Date().getTime() - entity.getTime().getTime() < DesignerEnvManager.getEnvManager().getVcsConfigManager().getSaveInterval() * MINUTE; return new Date().getTime() - entity.getTime().getTime() < DesignerEnvManager.getEnvManager().getVcsConfigManager().getSaveInterval() * MINUTE;
} }
public static boolean needInit() { public boolean needInit() {
PluginContext context = PluginManager.getContext(VCS_PLUGIN_ID); PluginContext context = PluginManager.getContext(VCS_PLUGIN_ID);
return context == null || !context.isActive(); return context == null || !context.isRunning();
} }
/** /**
@ -115,7 +123,7 @@ public class VcsHelper {
* *
* @param jt * @param jt
*/ */
public static void dealWithVcs(final JTemplate jt) { public void fireVcs(final JTemplate jt) {
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -134,8 +142,8 @@ public class VcsHelper {
} else { } else {
operator.saveVersion(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1); operator.saveVersion(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1);
} }
VcsEntity oldEntity = WorkContext.getCurrent().get(VcsOperator.class).getFileVersionByIndex(fileName, 1); VcsEntity oldEntity = WorkContext.getCurrent().get(VcsOperator.class).getFileVersionByIndexAndUsername(fileName, getCurrentUsername(), 1);
if (VcsHelper.needDeleteVersion(oldEntity)) { if (needDeleteVersion(oldEntity)) {
operator.deleteVersion(oldEntity.getFilename(), oldEntity.getVersion()); operator.deleteVersion(oldEntity.getFilename(), oldEntity.getVersion());
} }
@ -145,4 +153,25 @@ public class VcsHelper {
} }
@Override
public void templateOpened(JTemplate<?, ?> jt) {
}
/**
* 模板保存时 处理.
*
* @param jt 模板
*/
@Override
public void templateSaved(JTemplate<?, ?> jt) {
if (needInit() && DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable() && !FineClusterConfig.getInstance().isCluster()) {
fireVcs(jt);
}
}
@Override
public void templateClosed(JTemplate<?, ?> jt) {
}
} }

6
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java

@ -7,8 +7,11 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.VcsOperator;
@ -81,6 +84,9 @@ public class EditFileVersionDialog extends UIDialog {
entity.setCommitMsg(msgTestArea.getText()); entity.setCommitMsg(msgTestArea.getText());
WorkContext.getCurrent().get(VcsOperator.class).updateVersion(entity); WorkContext.getCurrent().get(VcsOperator.class).updateVersion(entity);
setVisible(false); setVisible(false);
String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath();
FileVersionTable table = FileVersionTable.getInstance();
table.updateModel(table.getSelectedRow(), WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", StringUtils.EMPTY)));
} }
}); });

13
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java

@ -8,6 +8,7 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.mainframe.vcs.common.VcsCacheFileNodeFile; import com.fr.design.mainframe.vcs.common.VcsCacheFileNodeFile;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -53,9 +54,13 @@ public class FileVersionCellEditor extends AbstractCellEditor implements TableCe
//先关闭当前打开的模板版本 //先关闭当前打开的模板版本
JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
jt.stopEditing(); jt.stopEditing();
MutilTempalteTabPane.getInstance().setIsCloseCurrent(true); //只有模板路径一致时关闭当前模板
MutilTempalteTabPane.getInstance().closeFormat(jt); if (ComparatorUtils.equals(fileOfVersion, jt.getPath())) {
MutilTempalteTabPane.getInstance().closeSpecifiedTemplate(jt); MutilTempalteTabPane.getInstance().setIsCloseCurrent(true);
MutilTempalteTabPane.getInstance().closeFormat(jt);
MutilTempalteTabPane.getInstance().closeSpecifiedTemplate(jt);
}
//再打开cache中的模板 //再打开cache中的模板
DesignerContext.getDesignerFrame().openTemplate(new VcsCacheFileNodeFile(new FileNode(fileOfVersion, false))); DesignerContext.getDesignerFrame().openTemplate(new VcsCacheFileNodeFile(new FileNode(fileOfVersion, false)));
@ -63,7 +68,7 @@ public class FileVersionCellEditor extends AbstractCellEditor implements TableCe
double height = editor.getPreferredSize().getHeight(); double height = editor.getPreferredSize().getHeight();
if (table.getRowHeight(row) != height) { if (table.getRowHeight(row) != height) {
table.setRowHeight(row, (int) height); table.setRowHeight(row, (int) height + VcsHelper.OFFSET);
} }
return editor; return editor;
} }

3
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.vcs.ui; package com.fr.design.mainframe.vcs.ui;
import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -34,7 +35,7 @@ public class FileVersionCellRender implements TableCellRenderer {
double height = editor.getPreferredSize().getHeight(); double height = editor.getPreferredSize().getHeight();
if (table.getRowHeight(row) != height) { if (table.getRowHeight(row) != height) {
table.setRowHeight(row, (int) height); table.setRowHeight(row, (int) height + VcsHelper.OFFSET);
} }
return editor; return editor;
} }

31
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.vcs.ui; package com.fr.design.mainframe.vcs.ui;
import com.fr.analysis.cloud.DateUtils;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.editor.editor.DateEditor; import com.fr.design.editor.editor.DateEditor;
import com.fr.design.gui.date.UIDatePicker; import com.fr.design.gui.date.UIDatePicker;
@ -14,6 +15,7 @@ import com.fr.workspace.WorkContext;
import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.VcsOperator;
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.Box; import javax.swing.Box;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -45,7 +47,7 @@ public class FileVersionDialog extends UIDialog {
upBox.setBorder(VcsHelper.EMPTY_BORDER); upBox.setBorder(VcsHelper.EMPTY_BORDER);
upBox.add(new UILabel(Toolkit.i18nText("Fine-Design_Vcs_buildTime") + " ")); upBox.add(new UILabel(Toolkit.i18nText("Fine-Design_Vcs_buildTime") + " "));
upBox.add(Box.createHorizontalGlue()); upBox.add(Box.createHorizontalGlue());
dateEditor = new DateEditor(new Date(), true, StringUtils.EMPTY, UIDatePicker.STYLE_CN_DATE1); dateEditor = new VcsDateEditor(new Date(), true, StringUtils.EMPTY, UIDatePicker.STYLE_CN_DATE1);
upBox.add(dateEditor); upBox.add(dateEditor);
Box downBox = Box.createHorizontalBox(); Box downBox = Box.createHorizontalBox();
downBox.setBorder(VcsHelper.EMPTY_BORDER); downBox.setBorder(VcsHelper.EMPTY_BORDER);
@ -62,8 +64,10 @@ public class FileVersionDialog extends UIDialog {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
FileVersionDialog.this.setVisible(false); FileVersionDialog.this.setVisible(false);
Date date = dateEditor.getValue(); Date editorDate = dateEditor.getValue();
List<VcsEntity> vcsEntities = WorkContext.getCurrent().get(VcsOperator.class).getFilterVersions(fileName, date, new Date(date.getTime() + DELAY), textField.getText()); Date start = editorDate == null ? new Date(0) : editorDate;
Date end = editorDate == null ? DateUtils.getLastHour() : new Date(start.getTime() + DELAY);
List<VcsEntity> vcsEntities = WorkContext.getCurrent().get(VcsOperator.class).getFilterVersions(fileName, start, end, textField.getText());
FileVersionTable.getInstance().updateModel(1, vcsEntities); FileVersionTable.getInstance().updateModel(1, vcsEntities);
} }
@ -74,16 +78,29 @@ public class FileVersionDialog extends UIDialog {
FileVersionDialog.this.setVisible(false); FileVersionDialog.this.setVisible(false);
} }
}); });
VcsLabel resetLabel = new VcsLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Vcs_resetValue"), VcsHelper.COPY_VERSION_BTN_COLOR);
resetLabel.setBorder(BorderFactory.createEmptyBorder(10, 160, 0, 10));
resetLabel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dateEditor.setValue(null);
textField.setText(null);
FileVersionDialog.this.repaint();
}
});
panel.add(upBox, BorderLayout.NORTH); panel.add(upBox, BorderLayout.NORTH);
panel.add(downBox, BorderLayout.CENTER); panel.add(downBox, BorderLayout.CENTER);
panel.add(buttonPane, BorderLayout.SOUTH); panel.add(buttonPane, BorderLayout.SOUTH);
add(panel); JPanel filterPane = new JPanel(new BorderLayout());
setSize(new Dimension(230, 105)); filterPane.add(resetLabel, BorderLayout.NORTH);
centerWindow(this); filterPane.add(panel, BorderLayout.CENTER);
add(filterPane);
setSize(new Dimension(230, 125));
centerWindow(frame);
} }
private void centerWindow(Window window) { private void centerWindow(Window window) {
window.setLocation(0, 95); this.setLocation(window.getX(), 95);
} }

2
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionFirstRowPanel.java

@ -15,7 +15,7 @@ public class FileVersionFirstRowPanel extends JPanel {
super(new BorderLayout()); super(new BorderLayout());
Box upPane = Box.createVerticalBox(); Box upPane = Box.createVerticalBox();
upPane.setBorder(new EmptyBorder(5, 10, 5, 10)); upPane.setBorder(new EmptyBorder(5, 10, 5, 10));
upPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Local_User"))); upPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Current")));
add(upPane, BorderLayout.CENTER); add(upPane, BorderLayout.CENTER);
} }
} }

2
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java

@ -63,7 +63,7 @@ public class FileVersionRowPanel extends JPanel {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
if (JOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Confirm"), Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Title"), if (JOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Confirm"), Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Title"),
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
vcsEntity.setUsername(VcsHelper.getCurrentUsername()); vcsEntity.setUsername(VcsHelper.getInstance().getCurrentUsername());
WorkContext.getCurrent().get(VcsOperator.class).rollbackTo(vcsEntity); WorkContext.getCurrent().get(VcsOperator.class).rollbackTo(vcsEntity);
FileVersionsPanel.getInstance().exitVcs(vcsEntity.getFilename()); FileVersionsPanel.getInstance().exitVcs(vcsEntity.getFilename());
} }

37
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsDateEditor.java

@ -0,0 +1,37 @@
package com.fr.design.mainframe.vcs.ui;
import com.fr.design.editor.editor.DateEditor;
import com.fr.log.FineLoggerFactory;
import java.text.ParseException;
import java.util.Date;
/**
* Created by XiaXiang on 2019/5/14.
*/
public class VcsDateEditor extends DateEditor {
private Date tempValue;
public VcsDateEditor(Date value, boolean format, String name, int dateFormat) {
super(value, format, name, dateFormat);
this.tempValue = value;
}
@Override
public Date getValue() {
if (tempValue == null) {
return null;
}
return super.getValue();
}
@Override
public void setValue(Date value) {
this.tempValue = value;
try {
getUiDatePicker().setSelectedDate(value);
} catch (ParseException parseException) {
FineLoggerFactory.getLogger().error(parseException.getMessage(), parseException);
}
}
}

32
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsLabel.java

@ -0,0 +1,32 @@
package com.fr.design.mainframe.vcs.ui;
import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.UILabel;
import java.awt.Color;
import java.awt.Graphics;
/**
* Created by XiaXiang on 2019/5/15.
*/
public class VcsLabel extends ActionLabel {
public VcsLabel(String text, Color color) {
super(text);
this.setForeground(color);
}
public void paintComponent(Graphics g) {
if (ui != null) {
Graphics scratchGraphics = (g == null) ? null : g.create();
try {
ui.update(scratchGraphics, this);
}
finally {
scratchGraphics.dispose();
}
}
}
}

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

@ -6,8 +6,14 @@ import com.teamdev.jxbrowser.chromium.BrowserContext;
import com.teamdev.jxbrowser.chromium.ProtocolService; import com.teamdev.jxbrowser.chromium.ProtocolService;
import com.teamdev.jxbrowser.chromium.URLResponse; import com.teamdev.jxbrowser.chromium.URLResponse;
import javax.activation.MimetypesFileTypeMap;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
/** /**
* @author richie * @author richie
@ -41,7 +47,15 @@ public class Assistant {
if (path.endsWith(".js")) { if (path.endsWith(".js")) {
return "text/javascript"; return "text/javascript";
} }
return "text/html"; if (path.endsWith(".svg")) {
return "image/svg+xml";
}
Path file = new File(path).toPath();
try {
return Files.probeContentType(file);
} catch (IOException e) {
return "text/html";
}
} }
public static void setEmbProtocolHandler(Browser browser, EmbProtocolHandler handler) { public static void setEmbProtocolHandler(Browser browser, EmbProtocolHandler handler) {
@ -49,6 +63,6 @@ public class Assistant {
ProtocolService protocolService = browserContext.getProtocolService(); ProtocolService protocolService = browserContext.getProtocolService();
// 支持读取jar包中文件的自定义协议————emb:/com/fr/design/images/bbs.png // 支持读取jar包中文件的自定义协议————emb:/com/fr/design/images/bbs.png
protocolService.setProtocolHandler("emb", handler); protocolService.setProtocolHandler("emb", handler);
//protocolService.setProtocolHandler("file", handler); protocolService.setProtocolHandler("file", handler);
} }
} }

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

@ -2,6 +2,8 @@ package com.fr.design.ui;
import com.fr.base.TemplateUtils; import com.fr.base.TemplateUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.org.apache.commons.codec.net.URLCodec; import com.fr.third.org.apache.commons.codec.net.URLCodec;
import com.fr.third.org.apache.commons.io.FileUtils; import com.fr.third.org.apache.commons.io.FileUtils;
@ -15,11 +17,14 @@ import com.teamdev.jxbrowser.chromium.ProtocolHandler;
import com.teamdev.jxbrowser.chromium.URLRequest; import com.teamdev.jxbrowser.chromium.URLRequest;
import com.teamdev.jxbrowser.chromium.URLResponse; import com.teamdev.jxbrowser.chromium.URLResponse;
import java.io.ByteArrayInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.StringReader; import java.io.StringReader;
import java.net.URI; import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.Map; import java.util.Map;
/** /**
@ -51,21 +56,20 @@ public class EmbProtocolHandler implements ProtocolHandler {
@Override @Override
public URLResponse onRequest(URLRequest req) { public URLResponse onRequest(URLRequest req) {
InputStream inputStream = null;
try { try {
String path = req.getURL(); String path = req.getURL();
if (path.startsWith("file:")) { if (path.startsWith("file:")) {
String url = new URLCodec().decode(path); String url = new URLCodec().decode(path);
String filePath = TemplateUtils.renderParameter4Tpl(url, map); String filePath = TemplateUtils.renderParameter4Tpl(url, map);
File file = new File(URI.create(filePath).getPath()); File file = new File(URI.create(filePath).getPath());
InputStream inputStream = new FileInputStream(file); inputStream = IOUtils.readResource(file.getAbsolutePath());
if (path.endsWith(".svg")) { String text = IOUtils.inputStream2String(inputStream, EncodeConstants.ENCODING_UTF_8);
System.out.println(path); text = TemplateUtils.renderParameter4Tpl(text, map);
} return Assistant.inputStream2Response(new ByteArrayInputStream(text.getBytes(StandardCharsets.UTF_8)), path);
return Assistant.inputStream2Response(inputStream, "file:///" + file.getAbsolutePath()); } else if (path.startsWith("emb:dynamic")) {
}
else if (path.startsWith("emb:dynamic")) {
URLResponse response = new URLResponse(); URLResponse response = new URLResponse();
response.setData(htmlText().getBytes()); response.setData(htmlText(map).getBytes());
response.getHeaders().setHeader("Content-Type", "text/html"); response.getHeaders().setHeader("Content-Type", "text/html");
return response; return response;
} else { } else {
@ -75,16 +79,24 @@ public class EmbProtocolHandler implements ProtocolHandler {
} else { } else {
path = path.substring(4); path = path.substring(4);
} }
InputStream inputStream = IOUtils.readResource(path); inputStream = IOUtils.readResource(path);
return Assistant.inputStream2Response(inputStream, path); return Assistant.inputStream2Response(inputStream, path);
} }
} catch (Exception ignore) { } catch (Exception e) {
ignore.printStackTrace(); FineLoggerFactory.getLogger().info(e.getMessage());
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
} }
return null; return null;
} }
private String htmlText() { private String htmlText(Map<String, String> map) {
PathGroup pathGroup = AtomBuilder.create().buildAssembleFilePath(ModernRequestClient.KEY, component); PathGroup pathGroup = AtomBuilder.create().buildAssembleFilePath(ModernRequestClient.KEY, component);
StylePath[] stylePaths = pathGroup.toStylePathGroup(); StylePath[] stylePaths = pathGroup.toStylePathGroup();
StringBuilder styleText = new StringBuilder(); StringBuilder styleText = new StringBuilder();
@ -106,6 +118,13 @@ public class EmbProtocolHandler implements ProtocolHandler {
} }
} }
result = result.replaceAll("##script##", scriptText.toString()); result = result.replaceAll("##script##", scriptText.toString());
if (map != null) {
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
result = result.replaceAll("\\$\\{" + key + "}", value);
}
}
return result; return result;
} }
} }

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

@ -52,6 +52,8 @@ public class ModernUIPane<T> extends BasicPane {
toolbar.add(openDebugButton); toolbar.add(openDebugButton);
UIButton reloadButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Reload")); UIButton reloadButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Reload"));
toolbar.add(reloadButton); toolbar.add(reloadButton);
UIButton closeButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Close_Window"));
toolbar.add(closeButton);
openDebugButton.addActionListener(new ActionListener() { openDebugButton.addActionListener(new ActionListener() {
@Override @Override
@ -66,6 +68,13 @@ public class ModernUIPane<T> extends BasicPane {
browser.reloadIgnoringCache(); browser.reloadIgnoringCache();
} }
}); });
closeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
SwingUtilities.getWindowAncestor(ModernUIPane.this).setVisible(false);
}
});
BrowserPreferences.setChromiumSwitches("--remote-debugging-port=9222"); BrowserPreferences.setChromiumSwitches("--remote-debugging-port=9222");
initializeBrowser(); initializeBrowser();
add(new BrowserView(browser), BorderLayout.CENTER); add(new BrowserView(browser), BorderLayout.CENTER);
@ -107,6 +116,16 @@ public class ModernUIPane<T> extends BasicPane {
browser.loadURL(url); browser.loadURL(url);
} }
/**
* 转向一个新的地址相当于重新加载
* @param url 新的地址
* @param map 初始化参数
*/
public void redirect(String url, Map<String, String> map) {
Assistant.setEmbProtocolHandler(browser, new EmbProtocolHandler(map));
browser.loadURL(url);
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "Modern"; return "Modern";

70
designer-base/src/main/java/com/fr/design/upm/UpmBridge.java

@ -2,6 +2,7 @@ package com.fr.design.upm;
import com.fr.base.passport.FinePassportManager; import com.fr.base.passport.FinePassportManager;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
import com.fr.config.ServerPreferenceConfig;
import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoader; import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoader;
import com.fr.design.bridge.exec.JSBridge; import com.fr.design.bridge.exec.JSBridge;
import com.fr.design.bridge.exec.JSCallback; import com.fr.design.bridge.exec.JSCallback;
@ -10,6 +11,7 @@ import com.fr.design.extra.PluginUtils;
import com.fr.design.extra.exe.GetInstalledPluginsExecutor; import com.fr.design.extra.exe.GetInstalledPluginsExecutor;
import com.fr.design.extra.exe.GetPluginCategoriesExecutor; import com.fr.design.extra.exe.GetPluginCategoriesExecutor;
import com.fr.design.extra.exe.GetPluginFromStoreExecutor; import com.fr.design.extra.exe.GetPluginFromStoreExecutor;
import com.fr.design.extra.exe.GetPluginPrefixExecutor;
import com.fr.design.extra.exe.PluginLoginExecutor; import com.fr.design.extra.exe.PluginLoginExecutor;
import com.fr.design.extra.exe.ReadUpdateOnlineExecutor; import com.fr.design.extra.exe.ReadUpdateOnlineExecutor;
import com.fr.design.extra.exe.SearchOnlineExecutor; import com.fr.design.extra.exe.SearchOnlineExecutor;
@ -60,12 +62,34 @@ public class UpmBridge {
this.window = browser.executeJavaScriptAndReturnValue("window").asObject(); this.window = browser.executeJavaScriptAndReturnValue("window").asObject();
} }
public void startDownload(final JSFunction callback) { /**
* 更新插件管理中心资源文件这个方法仅仅是为了语义上的作用更新
* @param callback 安装完成后的回调函数
*/
@JSBridge
public void update(final JSFunction callback) {
callback.invoke(window, "start", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start"));
try {
UpmResourceLoader.INSTANCE.download();
UpmResourceLoader.INSTANCE.install();
callback.invoke(window, "success", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success"));
EventDispatcher.fire(DownloadEvent.UPDATE, "success");
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
callback.invoke(window, "error", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error"));
}
}
/**
* 下载并安装插件管理中心的资源文件
* @param callback 安装完成后的回调函数
*/
@JSBridge
public void startDownload(final JSFunction callback) {
callback.invoke(window, "start", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start"));
new SwingWorker<Void, Void>(){ new SwingWorker<Void, Void>(){
@Override @Override
protected Void doInBackground() throws Exception { protected Void doInBackground() throws Exception {
callback.invoke(window, Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start"));
UpmResourceLoader.INSTANCE.download(); UpmResourceLoader.INSTANCE.download();
UpmResourceLoader.INSTANCE.install(); UpmResourceLoader.INSTANCE.install();
return null; return null;
@ -75,10 +99,10 @@ public class UpmBridge {
protected void done() { protected void done() {
try { try {
get(); get();
callback.invoke(window, Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success")); callback.invoke(window, "success", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success"));
EventDispatcher.fire(DownloadEvent.SUCCESS, "success"); EventDispatcher.fire(DownloadEvent.SUCCESS, "success");
} catch (Exception e) { } catch (Exception e) {
callback.invoke(window, Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error")); callback.invoke(window, "error", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error"));
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
EventDispatcher.fire(DownloadEvent.ERROR, "error"); EventDispatcher.fire(DownloadEvent.ERROR, "error");
} }
@ -86,6 +110,15 @@ public class UpmBridge {
}.execute(); }.execute();
} }
/**
* 获取upm的版本信息
* @return 版本信息
*/
@JSBridge
public String getVersion() {
return ServerPreferenceConfig.getInstance().getOptimizedUPMVersion();
}
@JSBridge @JSBridge
public String i18nText(String key) { public String i18nText(String key) {
return Toolkit.i18nText(key); return Toolkit.i18nText(key);
@ -107,6 +140,12 @@ public class UpmBridge {
callback.invoke(window, StringUtils.EMPTY); callback.invoke(window, StringUtils.EMPTY);
} }
@JSBridge
public void getPluginPrefix(final JSFunction callback) {
UpmTaskWorker<Void> task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new GetPluginPrefixExecutor());
task.execute();
}
/** /**
* 在线获取插件分类 * 在线获取插件分类
* *
@ -403,4 +442,27 @@ public class UpmBridge {
FineLoggerFactory.getLogger().info(e.getMessage()); FineLoggerFactory.getLogger().info(e.getMessage());
} }
} }
/**
* 使用系统浏览器打开网页
* @param url 要打开的网页
*/
@JSBridge
public void openShopUrlAtWebBrowser(String url) {
if (Desktop.isDesktopSupported()) {
try {
//创建一个URI实例,注意不是URL
URI uri = URI.create(url);
//获取当前系统桌面扩展
Desktop desktop = Desktop.getDesktop();
//判断系统桌面是否支持要执行的功能
if (desktop.isSupported(Desktop.Action.BROWSE)) {
//获取系统默认浏览器打开链接
desktop.browse(uri);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
} }

10
designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java

@ -38,8 +38,14 @@ public class UpmShowPane extends BasicPane {
window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser())); window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser()));
} }
}) })
.withURL(UpmFinder.getMainResourcePath()) .withURL(UpmFinder.getMainResourcePath(), UpmUtils.renderMap())
.build(); .build();
EventDispatcher.listen(DownloadEvent.UPDATE, new Listener<String>() {
@Override
public void on(Event event, String param) {
modernUIPane.redirect(UpmFinder.getMainResourcePath(), UpmUtils.renderMap());
}
});
} else { } else {
modernUIPane = new ModernUIPane.Builder<>() modernUIPane = new ModernUIPane.Builder<>()
.withComponent(WarnComponent.KEY) .withComponent(WarnComponent.KEY)
@ -53,7 +59,7 @@ public class UpmShowPane extends BasicPane {
EventDispatcher.listen(DownloadEvent.SUCCESS, new Listener<String>() { EventDispatcher.listen(DownloadEvent.SUCCESS, new Listener<String>() {
@Override @Override
public void on(Event event, String param) { public void on(Event event, String param) {
modernUIPane.redirect(UpmFinder.getMainResourcePath()); modernUIPane.redirect(UpmFinder.getMainResourcePath(), UpmUtils.renderMap());
} }
}); });
} }

23
designer-base/src/main/java/com/fr/design/upm/UpmUtils.java

@ -1,7 +1,14 @@
package com.fr.design.upm; package com.fr.design.upm;
import com.fr.common.annotations.Negative;
import com.fr.config.ServerPreferenceConfig;
import com.fr.general.CloudCenter;
import com.fr.stable.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author richie * @author richie
@ -18,4 +25,20 @@ public class UpmUtils {
} }
return list.toArray(new String[0]); return list.toArray(new String[0]);
} }
@Negative(until = "2019-08-30")
public static Map<String, String> renderMap() {
Map<String, String> map4Tpl = new HashMap<>();
map4Tpl.put("version", ServerPreferenceConfig.getInstance().getOptimizedUPMVersion());
map4Tpl.put("new_version", fetchLatestVersion());
return map4Tpl;
}
private static String fetchLatestVersion() {
String version = CloudCenter.getInstance().acquireUrlByKind("upm.script.version");
if (StringUtils.isBlank(version)) {
version = "1.0";
}
return version;
}
} }

2
designer-base/src/main/java/com/fr/design/upm/event/DownloadEvent.java

@ -9,5 +9,5 @@ import com.fr.event.Event;
*/ */
public enum DownloadEvent implements Event<String> { public enum DownloadEvent implements Event<String> {
SUCCESS, ERROR SUCCESS, ERROR, UPDATE
} }

27
designer-base/src/main/java/com/fr/design/upm/loader/UpmDesignResourceLoader.java

@ -1,27 +0,0 @@
package com.fr.design.upm.loader;
import com.fr.decision.webservice.bean.plugin.store.ProjectInfoBean;
import com.fr.decision.webservice.v10.plugin.helper.category.impl.BaseResourceLoader;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-04-18
*/
public class UpmDesignResourceLoader extends BaseResourceLoader {
@Override
public String getPluginPath() {
return "upm/plugin_design.html";
}
@Override
public void checkResourceExist(ProjectInfoBean projectInfoBean) throws Exception {
}
@Override
public String getDownloadPath() throws Exception {
return "http://fanruan-market.oss-cn-shanghai.aliyuncs.com/upm/1.0/upm-10.0.zip";
}
}

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

@ -19,8 +19,8 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.guava.base.Strings; import com.fr.third.guava.base.Strings;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.connect.AuthException;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.exception.WorkspaceAuthException;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
@ -523,7 +523,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
DesignerEnvManager.getEnvManager().setCertificatePass(connection.getCertSecretKey()); DesignerEnvManager.getEnvManager().setCertificatePass(connection.getCertSecretKey());
try { try {
return WorkContext.getConnector().testConnection(connection); return WorkContext.getConnector().testConnection(connection);
} catch (AuthException ignored) { } catch (WorkspaceAuthException ignored) {
return null; return null;
} }
} }
@ -532,27 +532,9 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
protected void done() { protected void done() {
okButton.setEnabled(true); okButton.setEnabled(true);
try { try {
TestConnectionResult result = TestConnectionResult.parse(get(), connection); TestConnectionResult result = TestConnectionResult.parse(get(), connection);
if (result == TestConnectionResult.Fully_Success) { message.setText(result.getText());
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Successful")); uiLabel.setIcon(result.getIcon());
uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon"));
}
if (result == TestConnectionResult.Partly_Sucess) {
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistence_Test"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.warningIcon"));
}
if (result == TestConnectionResult.Fully_Failed) {
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
}
if (result == TestConnectionResult.Auth_Failed) {
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
}
} catch (InterruptedException | ExecutionException e) { } catch (InterruptedException | ExecutionException e) {
FineLoggerFactory.getLogger().error(e, e.getMessage()); FineLoggerFactory.getLogger().error(e, e.getMessage());
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed")); message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed"));

74
designer-base/src/main/java/com/fr/env/TestConnectionResult.java vendored

@ -1,62 +1,104 @@
package com.fr.env; package com.fr.env;
import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; import com.fr.workspace.engine.channel.http.FunctionalHttpRequest;
import javax.swing.Icon;
import javax.swing.UIManager;
/** /**
* 测试连接的结果 * 测试连接的结果
* 不改变原有逻辑的情况下加入一层转化 * 不改变原有逻辑的情况下加入一层转化
* 根据这里的转化结果判断需要提示哪些内容 * 根据这里的转化结果判断需要提示哪些内容
* * <p>
* created by Harrison on 2018/12/20 * created by Harrison on 2018/12/20
**/ **/
public enum TestConnectionResult { public enum TestConnectionResult {
/** /**
* 完全成功, 版本匹配测试连接成功 * 完全成功, 版本匹配测试连接成功
*/ */
Fully_Success, FULLY_SUCCESS {
@Override
public Icon getIcon() {
return UIManager.getIcon("OptionPane.informationIcon");
}
@Override
public String getText() {
return Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Successful");
}
},
/** /**
* 不完全成功版本不匹配但测试连接成功 * 不完全成功版本不匹配但测试连接成功
*/ */
Partly_Sucess, PARTLY_SUCCESS {
@Override
public Icon getIcon() {
return UIManager.getIcon("OptionPane.warningIcon");
}
@Override
public String getText() {
return Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistence_Test");
}
},
/** /**
* 完全失败直接没连上 * 完全失败直接没连上
*/ */
Fully_Failed, FULLY_FAILED {
@Override
public Icon getIcon() {
return UIManager.getIcon("OptionPane.errorIcon");
}
@Override
public String getText() {
return Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed");
}
},
/** /**
* 验证 Token 失败 * 验证 Token 失败
*/ */
Auth_Failed; AUTH_FAILED {
@Override
public Icon getIcon() {
return UIManager.getIcon("OptionPane.errorIcon");
}
@Override
public String getText() {
return Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed");
}
};
public abstract Icon getIcon();
public abstract String getText();
public static TestConnectionResult parse(Boolean value, WorkspaceConnectionInfo info) { public static TestConnectionResult parse(Boolean value, WorkspaceConnectionInfo info) {
if (value == null) { if (value == null) {
return Auth_Failed; return AUTH_FAILED;
} }
if (!value) { if (!value) {
return Fully_Failed; return FULLY_FAILED;
} }
try { try {
String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); String serverVersion = new FunctionalHttpRequest(info).getServerVersion();
if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) { if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) {
return Fully_Success; return FULLY_SUCCESS;
} }
return PARTLY_SUCCESS;
return Partly_Sucess;
} catch (Exception e) { } catch (Exception e) {
// 发生异常,说明没连接上。返回完全失败。 // 发生异常,说明没连接上。返回完全失败。
FineLoggerFactory.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
return Fully_Failed; return FULLY_FAILED;
} }
} }
} }

2
designer-base/src/main/resources/com/fr/design/dcm/index.js

File diff suppressed because one or more lines are too long

276
designer-base/src/main/resources/com/fr/design/dcm/style.css

@ -0,0 +1,276 @@
.bi-plugin-redis {
padding: 20px; }
.database-connection-layout {
width: 100%;
height: 100%;
background-color: #f7f8fa; }
.database-connection-layout .title {
background-color: #fff;
border-bottom: 1px solid #e8eaed; }
.database-connection-layout .title .title-item {
height: 39px;
line-height: 39px;
padding-left: 15px;
padding-right: 15px;
text-align: center;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
position: relative;
flex-shrink: 0;
font-weight: 700;
cursor: pointer; }
.database-connection-layout .title .close-button {
position: absolute !important;
right: 5px;
top: 5px;
width: 30px;
height: 30px;
cursor: pointer;
background-image: url(./img/icon_close9x9_normal.png);
background-repeat: no-repeat;
background-position: center; }
.database-connection-layout .linkset {
margin: 10px;
bottom: 0px;
background-color: #ffffff; }
.database-connection-layout .linkStatus {
margin: 10px;
top: 40px;
background-color: #ffffff; }
.database-left {
border-right: 1px solid #e8eaed; }
.database-left .select-group {
border-bottom: 1px solid #e8eaed; }
.database-left .select-group .select {
margin: 10px; }
.database-left .select-group .select .database-link-items {
padding-left: 10px; }
.database-left .select-group .select .database-link-items .link-item {
border-top: 1px solid #e8eaed; }
.database-left .select-group .status-title {
font-weight: 700;
margin-left: 12px;
margin-top: 12px; }
.database-left .left-list {
margin: 10px; }
.database-left .left-list .left-item {
height: 24px;
line-height: 24px;
cursor: pointer; }
.database-left .left-list .left-item:hover {
background-color: rgba(54, 133, 242, 0.05); }
.database-left .left-list .left-item:hover .icons .action-icon {
visibility: visible !important; }
.database-left .left-list .left-item .icons {
float: right !important; }
.database-left .left-list .left-item .icons .action-icon {
visibility: hidden; }
.database-left .left-list .left-item .icons .b-font {
font-size: 16px; }
.database-left .left-list .left-item-selected {
background-color: rgba(54, 133, 242, 0.05); }
.database-left .left-list .left-item-selected .link-title {
color: #3685f2; }
.database-right {
min-width: 400px;
overflow: auto; }
.database-right .bi-flex-center-adapt-layout {
height: 100%; }
.database-right .bi-flex-center-adapt-layout .data-connection-background {
background: url(./img/resources.png) center center no-repeat;
background-size: contain; }
.database-right .right-status-title {
border-bottom: 1px solid #e8eaed;
color: #3d4d66;
line-height: 40px;
padding-left: 10px;
font-weight: 700; }
.database-right .right-status-body {
margin: 10px 30px 0px 30px;
height: 50%; }
.database-right .right-status-body .right-status-item {
height: 150px;
width: 50%;
top: 0;
left: 0;
position: absolute !important; }
.database-right .right-status-body .right-status-item .right-status-board {
margin-left: 25px;
position: relative !important;
left: -25px; }
.database-right .right-status-body .right-status-right {
height: 150px;
width: 50%;
top: 0;
right: 0;
position: absolute !important; }
.database-right .right-status-body .right-status-right .right-status-board {
margin-right: 25px;
position: relative !important;
left: 25px; }
.database-right .right-status-body .right-status-board {
background-color: #f7f8fa;
color: #3d4d66;
width: 100%;
height: 100%; }
.database-right .right-status-body .right-status-board .right-status-board-item {
text-align: center;
margin-top: 38px; }
.database-right .right-status-body .right-status-board .right-status-board-item .right-status-text {
display: inline-block; }
.database-right .right-status-body .right-status-board .right-status-board-item .card-font1 {
color: #13CD66;
font-size: 32px; }
.database-right .right-status-body .right-status-board .right-status-board-item .card-font2 {
color: #3685F2;
font-size: 32px; }
.database-right .right-content {
height: 100%; }
.database-right .right-content .right-title {
border-bottom: 1px solid #e8eaed;
color: #3d4d66;
line-height: 40px;
padding-left: 10px; }
.database-right .right-content .right-title .right-title-text {
font-weight: 700; }
.database-right .right-content .right-title .right-title-button {
float: right !important;
margin-right: 10px;
margin-top: 8px; }
.database-right .right-content .right-show {
margin: 10px; }
.database-right .right-content .right-show .right-form {
width: 100%; }
.both-side {
line-height: 24px;
margin-bottom: 10px; }
.both-side .left {
white-space: nowrap;
text-overflow: ellipsis;
position: relative;
flex-shrink: 0;
font-weight: 700; }
.both-side .hint {
padding-left: 5px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
position: relative;
flex-shrink: 0;
margin-left: 5px;
color: #9ea6b2; }
.shared-component-title {
height: 24px;
line-height: 24px;
margin-bottom: 10px;
color: #9ea6b2;
border-bottom: 1px solid #e8eaed; }
.comfirm-content {
margin-top: 40px;
margin-left: 20px; }
.comfirm-content .comfirm-icon {
background-image: url(./img/warning.png);
background-size: contain;
margin-right: 12px; }
.comfirm-content .bi-text {
height: 50px;
line-height: 50px;
margin-left: 12px; }
.more-link .more-link-item {
width: 538px;
overflow: hidden auto;
left: -10px !important;
right: 0px;
top: 10px;
bottom: 0px;
position: absolute;
height: 380px; }
.more-link .more-link-item .link-item {
margin-left: 10px;
margin-bottom: 10px;
cursor: pointer;
border: solid 1px #fff; }
.more-link .more-link-item .link-item:hover {
border: solid 1px #3480f2; }
.more-link .more-link-item .link-item .selected {
position: absolute !important;
right: -1px;
top: -1px;
height: 30px;
width: 30px;
background: url(./img/database-selected.png) center center no-repeat;
background-size: contain; }
.more-link .more-link-item .link-item .text {
height: 27px;
line-height: 27px;
padding-left: 2px;
padding-right: 2px;
text-align: center;
white-space: nowrap;
background: #F0F3F7; }
.popover-notitle .bi-header-background {
display: none; }
.popover-notitle .bi-absolute-layout {
top: 0px !important; }
.bi-custom-show .show-content {
text-align: center; }
.bi-custom-show .show-content .loading-icon {
display: block;
background: url(./img/loading.gif) center center no-repeat;
background-size: contain;
margin: 0 auto;
margin-bottom: 18px; }
.bi-custom-show .show-content .success-icon {
display: block;
background: url(./img/success.png) center center no-repeat;
background-size: contain;
margin: 0 auto;
margin-bottom: 18px; }
.bi-custom-show .show-content .error-icon {
display: block;
background: url(./img/error.png) center center no-repeat;
background-size: contain;
margin: 0 auto;
margin-bottom: 18px; }
.bi-custom-show .show-content .buttons {
margin-top: 18px; }
.bi-custom-show .show-content .buttons div {
margin: 0 4px; }
.bi-custom-show .show-more {
text-align: left !important;
height: 73px;
background: #F2F4F7;
margin-bottom: 10px;
padding: 5px;
margin-top: 10px; }
.link-font .b-font:before {
content: "\e759";
color: inherit; }
.link-text-font .b-font:before {
content: "\e763";
color: inherit; }
.info-font .b-font:before {
content: "\e63c";
color: inherit; }
.delete-font .b-font:before {
content: "\e6c4";
color: inherit; }
/*# sourceMappingURL=style.css.map*/

BIN
designer-base/src/main/resources/com/fr/design/images/bbs/facebook.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

4
designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.css

@ -5,7 +5,7 @@ body {
background-size: 100% 100% !important; background-size: 100% 100% !important;
-moz-background-size: 100% 100% !important; -moz-background-size: 100% 100% !important;
font-family: PingFangSC-Regular, Georgia, "Nimbus Roman No9 L", "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif CN", STSong, "AR PL New Sung", "AR PL SungtiL GB", NSimSun, SimSun, "TW\-Sung", "WenQuanYi Bitmap Song", "AR PL UMing CN", "AR PL UMing HK", "AR PL UMing TW", "AR PL UMing TW MBE", PMingLiU, MingLiU, serif !important; font-family: "PingFang SC", "Microsoft YaHei", "Myriad Pro", "OpenSans", Verdana, SimSun, sans-serif !important;
} }
.close-btn { .close-btn {
@ -27,7 +27,7 @@ body {
} }
.font-bold { .font-bold {
font-weight: bold; font-weight: 500;
} }
.title { .title {

2
designer-base/src/main/resources/com/fr/design/upm/warn.js

@ -4,7 +4,7 @@ window.onload = function () {
text: PluginHelper.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Resource_Warn"), text: PluginHelper.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Resource_Warn"),
height: 30 height: 30
}); });
let callback = function(text) { let callback = function(status, text) {
download.setValue(text); download.setValue(text);
}; };
let buttonOK = BI.createWidget({ let buttonOK = BI.createWidget({

4
designer-chart/src/main/java/com/fr/design/chart/axis/MinMaxValuePane.java

@ -35,9 +35,9 @@ public class MinMaxValuePane extends JPanel {
minValueField = new UITextField(6); minValueField = new UITextField(6);
maxCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Max_Value")); maxCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Max_Value"));
maxValueField = new UITextField(6); maxValueField = new UITextField(6);
isCustomMainUnitBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Main_Graduation_Unit")); isCustomMainUnitBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Main_Type"));
mainUnitField = new UITextField(6); mainUnitField = new UITextField(6);
isCustomSecUnitBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Second_Graduation_Unit")); isCustomSecUnitBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Second_Type"));
secUnitField = new UITextField(6); secUnitField = new UITextField(6);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;

2
designer-form/src/main/java/com/fr/design/designer/creator/XTreeEditor.java

@ -73,7 +73,7 @@ public class XTreeEditor extends XWidgetCreator {
crp = (CRPropertyDescriptor[]) ArrayUtils.add(crp, new CRPropertyDescriptor("ajax", this.data.getClass()).setI18NName( crp = (CRPropertyDescriptor[]) ArrayUtils.add(crp, new CRPropertyDescriptor("ajax", this.data.getClass()).setI18NName(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Load_By_Async")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Load_By_Async")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY,
"Advanced")); "Fine-Design_Basic_Advanced"));
crp = this.addAllowEdit(crp); crp = this.addAllowEdit(crp);
crp = this.addCustomData(crp); crp = this.addCustomData(crp);

20
designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java

@ -28,6 +28,7 @@ import com.fr.design.widget.Operator;
import com.fr.design.widget.ui.designer.component.WidgetAbsoluteBoundPane; import com.fr.design.widget.ui.designer.component.WidgetAbsoluteBoundPane;
import com.fr.design.widget.ui.designer.component.WidgetBoundPane; import com.fr.design.widget.ui.designer.component.WidgetBoundPane;
import com.fr.design.widget.ui.designer.component.WidgetCardTagBoundPane; import com.fr.design.widget.ui.designer.component.WidgetCardTagBoundPane;
import com.fr.form.ui.FormWidgetHelper;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WScaleLayout; import com.fr.form.ui.container.WScaleLayout;
import com.fr.form.ui.container.WTitleLayout; import com.fr.form.ui.container.WTitleLayout;
@ -102,6 +103,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
/** /**
* 后台初始化所有事件. * 后台初始化所有事件.
*/ */
@Override
public void initAllListeners() { public void initAllListeners() {
} }
@ -113,7 +115,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
initListener(this); initListener(this);
} }
@Override
protected void initContentPane() { protected void initContentPane() {
} }
@ -214,13 +216,23 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
Widget widget = currentEditorDefinePane.updateBean(); Widget widget = currentEditorDefinePane.updateBean();
if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic")) && widgetPropertyPane != null) { if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic")) && widgetPropertyPane != null) {
UITextField widgetNameField = widgetPropertyPane.getWidgetNameField(); UITextField widgetNameField = widgetPropertyPane.getWidgetNameField();
if (designer.getTarget().isNameExist(widgetNameField.getText()) && !ComparatorUtils.equals(widgetNameField.getText(), widget.getWidgetName())) { String toSetWidgetName = widgetNameField.getText();
widgetNameField.setText(widget.getWidgetName()); String currentWidgetName = widget.getWidgetName();
// 设置的组件名和当前组件名相同 直接返回
if (ComparatorUtils.equals(toSetWidgetName, currentWidgetName)) {
return;
}
String containerName = designer.getTarget().getContainer().getWidgetName();
Widget existWidget = FormWidgetHelper.findWidgetByName(widget, widgetNameField.getText());
// 判断设置的组件名是否和容器同名以及组件是否在容器在存在 满足任何其一 抛出提示
boolean exist = ComparatorUtils.equals(containerName, toSetWidgetName) || existWidget != null;
if (exist) {
widgetNameField.setText(currentWidgetName);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Rename_Failure"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News"), JOptionPane.ERROR_MESSAGE, BaseUtils.readIcon("com/fr/design/form/images/joption_failure.png")); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Rename_Failure"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News"), JOptionPane.ERROR_MESSAGE, BaseUtils.readIcon("com/fr/design/form/images/joption_failure.png"));
return; return;
} }
widgetPropertyPane.update(widget); widgetPropertyPane.update(widget);
xCreator.resetCreatorName(widget.getWidgetName()); xCreator.resetCreatorName(toSetWidgetName);
xCreator.resetVisible(widget.isVisible()); xCreator.resetVisible(widget.isVisible());
designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED); designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED);
return; return;

12
designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java

@ -174,6 +174,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
private CellSelection cellNeedTOFormat = null; private CellSelection cellNeedTOFormat = null;
private FormatBrushAction formatBrushAction; private FormatBrushAction formatBrushAction;
private ActionListener keyListener = new ActionListener() { private ActionListener keyListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (!formatBrush.isSelected()) { if (!formatBrush.isSelected()) {
DesignerContext.setFormatState(DesignerContext.FORMAT_STATE_ONCE); DesignerContext.setFormatState(DesignerContext.FORMAT_STATE_ONCE);
@ -188,6 +189,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
} }
}; };
private ActionListener escKey = new ActionListener() { private ActionListener escKey = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
cancelFormatBrush(); cancelFormatBrush();
} }
@ -212,6 +214,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
/** /**
* 取消格式化 * 取消格式化
*/ */
@Override
public void cancelFormat() { public void cancelFormat() {
return; return;
} }
@ -240,7 +243,6 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
verScrollBar = new DynamicScrollBar(Adjustable.VERTICAL, this, this.resolution); verScrollBar = new DynamicScrollBar(Adjustable.VERTICAL, this, this.resolution);
horScrollBar = new DynamicScrollBar(Adjustable.HORIZONTAL, this, this.resolution); horScrollBar = new DynamicScrollBar(Adjustable.HORIZONTAL, this, this.resolution);
this.add(RGridLayout.VerticalBar, this.verScrollBar); this.add(RGridLayout.VerticalBar, this.verScrollBar);
// this.add(RGridLayout.HorizontalBar, this.horScrollBar);
// Init input/action map defaultly. // Init input/action map defaultly.
initInputActionMap(); initInputActionMap();
@ -253,7 +255,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
initFormatBrush(); initFormatBrush();
} }
@Override
public int getMenuState() { public int getMenuState() {
return DesignState.WORK_SHEET; return DesignState.WORK_SHEET;
} }
@ -265,6 +267,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
formatBrush.setSelected(DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL); formatBrush.setSelected(DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL);
formatBrush.removeActionListener(formatBrushAction); formatBrush.removeActionListener(formatBrushAction);
formatBrush.addMouseListener(new MouseAdapter() { formatBrush.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
//如果没有格式刷,点击时就是想使用格式刷 //如果没有格式刷,点击时就是想使用格式刷
if (e.getClickCount() == 1) { if (e.getClickCount() == 1) {
@ -528,8 +531,8 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
FineLoggerFactory.getLogger().info("Nothing to release"); FineLoggerFactory.getLogger().info("Nothing to release");
} }
this.selection = selection; this.selection = selection;
fireSelectionChanged();
} }
fireSelectionChanged();
} }
@ -1210,6 +1213,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
/** /**
* 请求焦点 * 请求焦点
*/ */
@Override
public void requestFocus() { public void requestFocus() {
super.requestFocus(); super.requestFocus();
this.getGrid().requestFocus(); this.getGrid().requestFocus();
@ -1338,6 +1342,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
* *
* @return 返回正在编辑的状态. * @return 返回正在编辑的状态.
*/ */
@Override
public EditingState createEditingState() { public EditingState createEditingState() {
return new ElementCaseEditingState(this.selection, this.verScrollBar.getValue(), this.horScrollBar.getValue(), this.resolution); return new ElementCaseEditingState(this.selection, this.verScrollBar.getValue(), this.horScrollBar.getValue(), this.resolution);
} }
@ -1380,7 +1385,6 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
ElementCasePane.this.getVerticalScrollBar().setValue(this.verticalValue); ElementCasePane.this.getVerticalScrollBar().setValue(this.verticalValue);
ElementCasePane.this.getHorizontalScrollBar().setValue(this.horizontalValue); ElementCasePane.this.getHorizontalScrollBar().setValue(this.horizontalValue);
// ElementCasePane.this.setResolution(this.resolution);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(this.resolution); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(this.resolution);
// 重绘. // 重绘.
ElementCasePane.this.repaint(); ElementCasePane.this.repaint();

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

@ -205,7 +205,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
TemplateInfoCollector.getInstance().sendTemplateInfo(); TemplateInfoCollector.getInstance().sendTemplateInfo();
ErrorInfoUploader.getInstance().sendErrorInfo(); ErrorInfoUploader.getInstance().sendErrorInfo();
} }
}, SEND_DELAY, TimeUnit.SECONDS); }, SEND_DELAY, TimeUnit.MILLISECONDS);
} }
/** /**

105
designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java

@ -3,6 +3,8 @@ package com.fr.design.mainframe;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener; import java.awt.event.MouseMotionListener;
@ -24,7 +26,7 @@ import com.fr.base.GraphHelper;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
@ -35,6 +37,7 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.poly.PolyDesigner; import com.fr.poly.PolyDesigner;
import com.fr.report.poly.PolyWorkSheet; import com.fr.report.poly.PolyWorkSheet;
@ -52,15 +55,15 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
private static final Color LINE_COLOR = new Color(0xababab); private static final Color LINE_COLOR = new Color(0xababab);
private static final Icon ADD_WORK_SHEET = BaseUtils.readIcon("com/fr/base/images/oem/addworksheet.png"); private static final Icon ADD_WORK_SHEET = IOUtils.readIcon("com/fr/base/images/oem/addworksheet.png");
protected static final Icon ADD_POLY_SHEET = BaseUtils.readIcon("com/fr/design/images/sheet/addpolysheet.png"); protected static final Icon ADD_POLY_SHEET = IOUtils.readIcon("com/fr/design/images/sheet/addpolysheet.png");
private static final Icon WORK_SHEET_ICON = BaseUtils.readIcon("com/fr/base/images/oem/worksheet.png"); private static final Icon WORK_SHEET_ICON = IOUtils.readIcon("com/fr/base/images/oem/worksheet.png");
private static final Icon POLY_SHEET_ICON = BaseUtils.readIcon("com/fr/design/images/sheet/polysheet.png"); private static final Icon POLY_SHEET_ICON = IOUtils.readIcon("com/fr/design/images/sheet/polysheet.png");
private static final Image DESIGN_IMAGE = BaseUtils.readImage("com/fr/design/images/sheet/left_right_btn.png"); private static final Icon LEFT_ICON = IOUtils.readIcon("com/fr/design/images/sheet/left_normal@1x.png");
private static final Icon LEFT_ICON = BaseUtils.readIcon("com/fr/design/images/sheet/left_normal@1x.png"); private static final Icon RIGHT_ICON = IOUtils.readIcon("com/fr/design/images/sheet/right_normal@1x.png");
private static final Icon RIGHT_ICON = BaseUtils.readIcon("com/fr/design/images/sheet/right_normal@1x.png"); private static final Icon DISABLED_LEFT_ICON = IOUtils.readIcon("com/fr/design/images/sheet/left_hover@1x.png");
private static final Icon DISABLED_LEFT_ICON = BaseUtils.readIcon("com/fr/design/images/sheet/left_hover@1x.png"); private static final Icon DISABLED_RIGHT_ICON = IOUtils.readIcon("com/fr/design/images/sheet/right_hover@1x.png");
private static final Icon DISABLED_RIGHT_ICON = BaseUtils.readIcon("com/fr/design/images/sheet/right_hover@1x.png"); private static final int NUM = 10;
private static final int ICON_SEP_DISTANCE = 8; private static final int ICON_SEP_DISTANCE = 8;
private static final int TOOLBAR_HEIGHT = 16; private static final int TOOLBAR_HEIGHT = 16;
@ -144,6 +147,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
this.setBorder(null); this.setBorder(null);
this.setForeground(new Color(99, 99, 99)); this.setForeground(new Color(99, 99, 99));
leftButton = new UIButton(LEFT_ICON) { leftButton = new UIButton(LEFT_ICON) {
@Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT); return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT);
} }
@ -163,6 +167,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
leftButton.set4ToolbarButton(); leftButton.set4ToolbarButton();
leftButton.setDisabledIcon(DISABLED_LEFT_ICON); leftButton.setDisabledIcon(DISABLED_LEFT_ICON);
rightButton = new UIButton(RIGHT_ICON) { rightButton = new UIButton(RIGHT_ICON) {
@Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT); return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT);
} }
@ -197,7 +202,14 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
} }
} }
}); });
DesignerContext.getDesignerFrame().addComponentListener(new ComponentAdapter(){
@Override public void componentResized(ComponentEvent e) {
for (int i = 0; i < lastOneIndex * NUM; i++) {
moveLeft();
}
}
});
} }
private ActionListener createLeftButtonActionListener() { private ActionListener createLeftButtonActionListener() {
@ -205,27 +217,31 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
int s = scrollIndex; moveLeft();
if (s == lastOneIndex && s != 0) {
scrollIndex--;
lastOneIndex--;
repaint();
} else {
while (s > lastOneIndex && showCount != 0) {
scrollIndex++;
lastOneIndex++;
repaint();
}
while (s < lastOneIndex && scrollIndex > 0) {
scrollIndex--;
lastOneIndex--;
repaint();
}
}
} }
}; };
} }
private void moveLeft() {
int s = scrollIndex;
if (s == lastOneIndex && s != 0) {
scrollIndex--;
lastOneIndex--;
repaint();
} else {
while (s > lastOneIndex && showCount != 0) {
scrollIndex++;
lastOneIndex++;
repaint();
}
while (s < lastOneIndex && scrollIndex > 0) {
scrollIndex--;
lastOneIndex--;
repaint();
}
}
}
/** /**
* 设置选择index * 设置选择index
* *
@ -282,6 +298,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
* *
* @param e 鼠标事件 * @param e 鼠标事件
*/ */
@Override
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
if (isAuthorityEditing) { if (isAuthorityEditing) {
return; return;
@ -295,6 +312,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
* *
* @param e 鼠标事件 * @param e 鼠标事件
*/ */
@Override
public void mouseMoved(MouseEvent e) { public void mouseMoved(MouseEvent e) {
} }
@ -423,15 +441,6 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
} }
generalPath.closePath(); generalPath.closePath();
g2d.fill(generalPath); g2d.fill(generalPath);
// g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
// g2d.setPaint(UIConstants.LINE_COLOR);
// if (selectedIndex == scrollIndex) {
// g2d.draw(new Line2D.Double(x[0], y[0], x[1], y[1]));
// }
// g2d.draw(new Line2D.Double(x[1], y[1], x[2], y[2]));
// g2d.draw(new Line2D.Double(x[2], y[2], x[3], y[3]));
// g2d.draw(new Line2D.Double(x[3], y[3], x[4], y[4]));
// g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
sheeticon.paintIcon(this, g2d, (int) textX + charWidth, 2); sheeticon.paintIcon(this, g2d, (int) textX + charWidth, 2);
// peter:画字符 // peter:画字符
g2d.setPaint(getForeground()); g2d.setPaint(getForeground());
@ -470,13 +479,6 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
g2d.fill(generalPath); g2d.fill(generalPath);
g2d.setPaint(LINE_COLOR); g2d.setPaint(LINE_COLOR);
// if (i == scrollIndex) {
// g2d.draw(new Line2D.Double(x[0], y[0], x[1], y[1]));
// }
// g2d.draw(new Line2D.Double(x[1], y[1], x[2], y[2]));
// g2d.draw(new Line2D.Double(x[2], y[2], x[3], y[3]));
// g2d.draw(new Line2D.Double(x[3], y[3], x[4], y[4]));
// g2d.draw(new Line2D.Double(x[4], y[4], x[5], y[5]));
double startX = textX > 0 ? textX - 1 : textX; double startX = textX > 0 ? textX - 1 : textX;
g2d.drawRect((int)startX, 0, width, (int)textHeight); g2d.drawRect((int)startX, 0, width, (int)textHeight);
@ -560,6 +562,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
* *
* @param e 鼠标事件 * @param e 鼠标事件
*/ */
@Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
} }
@ -568,6 +571,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
* *
* @param evt 鼠标事件 * @param evt 鼠标事件
*/ */
@Override
public void mousePressed(MouseEvent evt) { public void mousePressed(MouseEvent evt) {
isReleased = false; isReleased = false;
int reportcount = reportComposite.getEditingWorkBook().getReportCount(); int reportcount = reportComposite.getEditingWorkBook().getReportCount();
@ -586,7 +590,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
boolean needRefreshPropertiesPane = getSelectedIndex() != i; boolean needRefreshPropertiesPane = getSelectedIndex() != i;
setSelectedIndex(i); setSelectedIndex(i);
if (needRefreshPropertiesPane) { if (needRefreshPropertiesPane) {
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
} }
isBlank = false; isBlank = false;
@ -629,11 +633,11 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
} }
} }
protected void addInsertGridShortCut(MenuDef def){ protected void addInsertGridShortCut(MenuDef def){
def.addShortCut(new GridReportInsertAction()); def.addShortCut(new GridReportInsertAction());
} }
protected void firstInsertActionPerformed(){ protected void firstInsertActionPerformed(){
new GridReportInsertAction().actionPerformed(null); new GridReportInsertAction().actionPerformed(null);
} }
@ -644,6 +648,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
* *
* @param e 鼠标事件 * @param e 鼠标事件
*/ */
@Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
this.isReleased = true; this.isReleased = true;
this.setReleasedXY(e.getX(), e.getY()); this.setReleasedXY(e.getX(), e.getY());
@ -737,6 +742,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
* *
* @param e 鼠标事件 * @param e 鼠标事件
*/ */
@Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
} }
@ -745,6 +751,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
* *
* @param e 鼠标事件 * @param e 鼠标事件
*/ */
@Override
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
} }
@ -772,7 +779,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
protected abstract class SheetInsertAction extends UpdateAction { protected abstract class SheetInsertAction extends UpdateAction {
SheetInsertAction() { SheetInsertAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Insert") + getTemplateReportType()); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Insert") + getTemplateReportType());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/base/images/cell/control/add.png"));
} }
@Override @Override
@ -945,7 +952,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
private class CopySheetAction extends UpdateAction { private class CopySheetAction extends UpdateAction {
CopySheetAction() { CopySheetAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy")); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_edit/copy.png"));
} }
@Override @Override

89
designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/entity/FileEntityBuilder.java

@ -1,47 +1,42 @@
package com.fr.design.mainframe.messagecollect.entity; package com.fr.design.mainframe.messagecollect.entity;
import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.CloudClient;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.http.HttpToolbox; import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.CommonUtils; import com.fr.stable.CommonUtils;
import com.fr.stable.CoreConstants;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.jodd.datetime.JDateTime; import com.fr.third.jodd.datetime.JDateTime;
import com.fr.third.org.apache.http.HttpEntity;
import com.fr.third.org.apache.http.HttpResponse;
import com.fr.third.org.apache.http.client.HttpClient;
import com.fr.third.org.apache.http.client.methods.HttpPut;
import com.fr.third.org.apache.http.entity.FileEntity;
import com.fr.third.org.apache.http.impl.client.DefaultHttpClient;
import com.fr.third.org.apache.http.util.EntityUtils;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URLEncoder;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
import static com.fr.third.org.apache.http.HttpStatus.SC_OK;
/** /**
* @author alex sung * @author alex sung
* @date 2019/4/8 * @date 2019/4/8
*/ */
public class FileEntityBuilder { public class FileEntityBuilder {
private static final String INTELLI_OPERATION_URL = "intelli.operation.url";
private static final String OPERATION_URL = "https://cloud.fanruan.com/config/protect/operation";
private static final String ATTR_SIGNATURE = "signature";
private static final String ATTR_KEY = "key";
private static final String FOCUS_POINT_FILE_ROOT_PATH = "FocusPoint"; private static final String FOCUS_POINT_FILE_ROOT_PATH = "FocusPoint";
private static final String FOCUS_POINT_FILE_UPLOAD_TOPIC = "__fine_intelli_file_upload__";
private static final String FILE_FROM = "design";
private static final String FOCUS_POINT_FILE_UPLOAD_TYPE = "FocusPoint";
private static final String FOCUS_POINT_FILE_UPLOAD_URL = CloudCenter.getInstance().acquireUrlByKind("design.feedback");
private static final String FOCUS_POINT_URL_KEY = "focuspoint";
/** /**
* 文件夹路径 * 文件夹路径
@ -61,6 +56,9 @@ public class FileEntityBuilder {
} }
public File generateZipFile(String pathName) { public File generateZipFile(String pathName) {
if (pathName == null) {
return null;
}
File zipFile = null; File zipFile = null;
try { try {
zipFile = new File(pathName + ".zip"); zipFile = new File(pathName + ".zip");
@ -100,53 +98,40 @@ public class FileEntityBuilder {
/** /**
* 上传文件到云中心 * 上传文件到云中心
* @param file 待上传文件 *
* @param file 待上传文件
* @param keyFileName 目标文件 * @param keyFileName 目标文件
* @throws IOException * @throws IOException
*/ */
public static void uploadFile(File file, String keyFileName) throws IOException { public static void uploadFile(File file, String keyFileName) throws IOException {
CloudClient client = CloudClient.getInstance();
String today = new JDateTime().toString("YYYY-MM-DD"); String today = new JDateTime().toString("YYYY-MM-DD");
HttpClient httpclient = new DefaultHttpClient(); String filePath = FOCUS_POINT_FILE_ROOT_PATH + CoreConstants.SEPARATOR + today + CoreConstants.SEPARATOR + keyFileName;
try { String bbsUserName = MarketConfig.getInstance().getBbsUsername();
String signedUrl = generateSignedUploadUrl(FOCUS_POINT_FILE_ROOT_PATH + File.separator + today + File.separator +keyFileName); String uuid = DesignerEnvManager.getEnvManager().getUUID();
if(StringUtils.isEmpty(signedUrl)){ String name = bbsUserName == null ? uuid : bbsUserName;
FineLoggerFactory.getLogger().error("signedUrl is null.");
return;
}
HttpPut httpPost = new HttpPut(signedUrl);
httpPost.addHeader("Content-Type","application/octet-stream");
FileEntity fileEntity = new FileEntity(file);
httpPost.setEntity(fileEntity);
HttpResponse response = httpclient.execute(httpPost);
int statusCode = response.getStatusLine().getStatusCode(); client.uploadFile(file, filePath, name, FILE_FROM);
if (statusCode == SC_OK) { addMessageQueue(filePath, bbsUserName, uuid);
HttpEntity resEntity = response.getEntity();
EntityUtils.consume(resEntity);
} else {
HttpEntity entity = response.getEntity();
String result = EntityUtils.toString(entity, "utf-8");
FineLoggerFactory.getLogger().info("upload file result:" + result);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
} }
private static String generateSignedUploadUrl(String fileKeyName) throws IOException { private static void addMessageQueue(String filePath, String userName, String uuid) {
String url = CloudCenter.getInstance().acquireUrlByKind(INTELLI_OPERATION_URL, OPERATION_URL); JSONObject uploadInfo = new JSONObject(FOCUS_POINT_FILE_UPLOAD_URL);
Map<String, String> parameters = new HashMap<String, String>(); String focusPointUrl = uploadInfo.optString(FOCUS_POINT_URL_KEY);
parameters.put(ATTR_KEY, fileKeyName);
parameters.put(ATTR_SIGNATURE, String.valueOf(CommonUtils.signature()));
String responseText = HttpToolbox.get(url, parameters);
try { try {
JSONObject data = new JSONObject(responseText); HashMap<String, Object> params = new HashMap<>();
if ("success".equals(data.optString("status"))) { params.put("topic", FOCUS_POINT_FILE_UPLOAD_TOPIC);
return data.optString("url"); params.put("username", URLEncoder.encode(userName, EncodeConstants.ENCODING_UTF_8));
params.put("uuid", uuid);
params.put("filepath", filePath);
params.put("timestamp", String.valueOf(System.currentTimeMillis()));
params.put("signature", String.valueOf(CommonUtils.signature()));
params.put("type", FOCUS_POINT_FILE_UPLOAD_TYPE);
if(StringUtils.isNotEmpty(focusPointUrl)){
HttpToolbox.post(focusPointUrl, params);
} }
} catch (JSONException e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error("Illegal response text."+e, e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return null;
} }
} }

4
designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/impl/AbstractSendDataToCloud.java

@ -98,9 +98,11 @@ public abstract class AbstractSendDataToCloud implements XMLable {
} }
private <T> void generateThisPageFile(DataList<T> points) { private <T> void generateThisPageFile(DataList<T> points) {
File file = null;
try { try {
JSONArray jsonArray = dealWithSendFunctionContent(points); JSONArray jsonArray = dealWithSendFunctionContent(points);
if (jsonArray == null) {
return;
}
//生成json文件 //生成json文件
fileEntityBuilder.generateFile(jsonArray, getFileEntityBuilder().getFolderName()); fileEntityBuilder.generateFile(jsonArray, getFileEntityBuilder().getFolderName());
} catch (Exception e) { } catch (Exception e) {

20
designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/impl/FocusPointMessageUploader.java

@ -1,7 +1,5 @@
package com.fr.design.mainframe.messagecollect.impl; package com.fr.design.mainframe.messagecollect.impl;
import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.messagecollect.entity.FileEntityBuilder; import com.fr.design.mainframe.messagecollect.entity.FileEntityBuilder;
import com.fr.design.mainframe.messagecollect.utils.MessageCollectUtils; import com.fr.design.mainframe.messagecollect.utils.MessageCollectUtils;
import com.fr.intelli.record.FocusPoint; import com.fr.intelli.record.FocusPoint;
@ -24,8 +22,6 @@ import java.util.UUID;
public class FocusPointMessageUploader extends AbstractSendDataToCloud { public class FocusPointMessageUploader extends AbstractSendDataToCloud {
private static final String TAG = "FocusPointMessageTag"; private static final String TAG = "FocusPointMessageTag";
private static final String SEPARATOR = "_";
private static final String FOCUS_POINT = "FocusPoint";
private static final long DELTA = 24 * 3600 * 1000L; private static final long DELTA = 24 * 3600 * 1000L;
private static volatile FocusPointMessageUploader instance; private static volatile FocusPointMessageUploader instance;
@ -42,6 +38,9 @@ public class FocusPointMessageUploader extends AbstractSendDataToCloud {
@Override @Override
public <T> JSONArray dealWithSendFunctionContent(DataList<T> focusPoints) { public <T> JSONArray dealWithSendFunctionContent(DataList<T> focusPoints) {
if (focusPoints == null) {
return null;
}
JSONArray ja = new JSONArray(); JSONArray ja = new JSONArray();
for(T t:focusPoints.getList()){ for(T t:focusPoints.getList()){
FocusPoint focusPoint = (FocusPoint)t; FocusPoint focusPoint = (FocusPoint)t;
@ -91,17 +90,8 @@ public class FocusPointMessageUploader extends AbstractSendDataToCloud {
} }
private void generatePath() { private void generatePath() {
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); //文件夹名称是uuid.zip,版本信息已经在edition中体现了
String bbsUserName = MarketConfig.getInstance().getBbsUsername(); String folderName = StableUtils.pathJoin(ProductConstants.getEnvHome(), String.valueOf(UUID.randomUUID()));
String uuid = envManager.getUUID();
//文件夹名称的格式是: "FocusPoint" + 大版本号 + 小版本号 + uuid + bbsUserName + randomUuid,均以下划线分隔
StringBuilder sb = new StringBuilder();
sb.append(FOCUS_POINT).append(SEPARATOR).
append(ProductConstants.MAIN_VERSION).append(SEPARATOR).
append(ProductConstants.MINOR_VERSION).append(SEPARATOR).
append(uuid).append(SEPARATOR).append(bbsUserName).append(SEPARATOR).
append(UUID.randomUUID());
String folderName = StableUtils.pathJoin(ProductConstants.getEnvHome(), sb.toString());
setFileEntityBuilder(new FileEntityBuilder(folderName)); setFileEntityBuilder(new FileEntityBuilder(folderName));
} }
} }

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

@ -5,7 +5,7 @@ import com.fr.decision.webservice.utils.DecisionServiceConstants;
import com.fr.design.EnvChangeEntrance; import com.fr.design.EnvChangeEntrance;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.loghandler.DesignerLogHandler; import com.fr.design.mainframe.loghandler.DesignerLogger;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.RemoteDesignConstants; import com.fr.report.RemoteDesignConstants;
@ -46,7 +46,7 @@ public class DesignerSocketIO {
if (ArrayUtils.isNotEmpty(objects)) { if (ArrayUtils.isNotEmpty(objects)) {
try { try {
LoggingEvent event = SerializerHelper.deserialize((byte[]) objects[0]); LoggingEvent event = SerializerHelper.deserialize((byte[]) objects[0]);
DesignerLogHandler.getInstance().printLoggingEvent(event); DesignerLogger.log(event);
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }

6
designer-realize/src/main/java/com/fr/design/report/freeze/RepeatColPane.java

@ -21,8 +21,10 @@ public class RepeatColPane extends FreezeAndRepeatPane {
@Override @Override
public void populateBean(FT ob) { public void populateBean(FT ob) {
((ColSpinner)start).setValue((ob.getFrom() + 1)); if (ob.getFrom() <= ob.getTo()) {
((ColSpinner)end).setValue((ob.getTo() + 1)); ((ColSpinner)start).setValue((ob.getFrom() + 1));
((ColSpinner)end).setValue((ob.getTo() + 1));
}
} }
@Override @Override

6
designer-realize/src/main/java/com/fr/design/report/freeze/RepeatRowPane.java

@ -21,8 +21,10 @@ public class RepeatRowPane extends FreezeAndRepeatPane {
@Override @Override
public void populateBean(FT ob) { public void populateBean(FT ob) {
((RowSpinner)start).setValue((ob.getFrom() + 1)); if (ob.getFrom() <= ob.getTo()) {
((RowSpinner)end).setValue((ob.getTo() + 1)); ((RowSpinner)start).setValue((ob.getFrom() + 1));
((RowSpinner)end).setValue((ob.getTo() + 1));
}
} }
@Override @Override

18
designer-realize/src/main/java/com/fr/grid/GridUtils.java

@ -12,6 +12,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
import com.fr.poly.creator.ECBlockPane;
import com.fr.report.ReportHelper; import com.fr.report.ReportHelper;
import com.fr.report.cell.CellElement; import com.fr.report.cell.CellElement;
import com.fr.report.cell.FloatElement; import com.fr.report.cell.FloatElement;
@ -48,8 +49,7 @@ public class GridUtils {
//peter:下面这几个量是在Drag列的时候用. //peter:下面这几个量是在Drag列的时候用.
public final static int DRAG_CELL_SIZE = 1; //peter:drag的时候改变格子的宽度. public final static int DRAG_CELL_SIZE = 1; //peter:drag的时候改变格子的宽度.
public final static int DRAG_SELECT_UNITS = 2; //peter:drag的时候,选中单元格. public final static int DRAG_SELECT_UNITS = 2; //peter:drag的时候,选中单元格.// public static int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
// public static int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
/** /**
* Is above float element.(the return may be null). <br> * Is above float element.(the return may be null). <br>
@ -125,7 +125,6 @@ public class GridUtils {
*/ */
public static double[] caculateFloatElementLocations(FloatElement floatElement, DynamicUnitList columnWidthList, DynamicUnitList rowHeightList, public static double[] caculateFloatElementLocations(FloatElement floatElement, DynamicUnitList columnWidthList, DynamicUnitList rowHeightList,
int verticalValue, int horizentalValue) { int verticalValue, int horizentalValue) {
// int resolution = ScreenResolution.getScreenResolution();
int resolution = (int) (ScreenResolution.getScreenResolution() * JSliderPane.getInstance().resolutionTimes); int resolution = (int) (ScreenResolution.getScreenResolution() * JSliderPane.getInstance().resolutionTimes);
double floatX = columnWidthList.getRangeValue(horizentalValue, 0).toPixD(resolution) + floatElement.getLeftDistance().toPixD(resolution); double floatX = columnWidthList.getRangeValue(horizentalValue, 0).toPixD(resolution) + floatElement.getLeftDistance().toPixD(resolution);
@ -180,7 +179,6 @@ public class GridUtils {
private static int cc_selected_column_or_row(double mouseEvtPosition, int beginValue, int value, DynamicUnitList sizeList) { private static int cc_selected_column_or_row(double mouseEvtPosition, int beginValue, int value, DynamicUnitList sizeList) {
double tmpIntIndex = 0; double tmpIntIndex = 0;
int selectedCellIndex = 0; int selectedCellIndex = 0;
// int resolution = ScreenResolution.getScreenResolution();
int resolution = (int) (ScreenResolution.getScreenResolution() * JSliderPane.getInstance().resolutionTimes); int resolution = (int) (ScreenResolution.getScreenResolution() * JSliderPane.getInstance().resolutionTimes);
if (mouseEvtPosition < 0) { if (mouseEvtPosition < 0) {
selectedCellIndex = value; selectedCellIndex = value;
@ -239,7 +237,6 @@ public class GridUtils {
private static int cc_selected_column_or_row_withresolution(double mouseEvtPosition, int beginValue, int value, DynamicUnitList sizeList, int resolution) { private static int cc_selected_column_or_row_withresolution(double mouseEvtPosition, int beginValue, int value, DynamicUnitList sizeList, int resolution) {
double tmpIntIndex = 0; double tmpIntIndex = 0;
int selectedCellIndex = 0; int selectedCellIndex = 0;
// int resolution = ScreenResolution.getScreenResolution();
if (mouseEvtPosition < 0) { if (mouseEvtPosition < 0) {
selectedCellIndex = value; selectedCellIndex = value;
for (; true; selectedCellIndex--) { for (; true; selectedCellIndex--) {
@ -311,6 +308,7 @@ public class GridUtils {
public static boolean canMove(ElementCasePane reportPane, int cellColumn, int cellRow) { public static boolean canMove(ElementCasePane reportPane, int cellColumn, int cellRow) {
if (reportPane.mustInVisibleRange()) { if (reportPane.mustInVisibleRange()) {
Grid grid = reportPane.getGrid(); Grid grid = reportPane.getGrid();
checkGridCount(reportPane);
int verticalEndValue = grid.getVerticalValue() + grid.getVerticalExtent() - 1; int verticalEndValue = grid.getVerticalValue() + grid.getVerticalExtent() - 1;
int horizontalEndValue = grid.getHorizontalValue() + grid.getHorizontalExtent() - 1; int horizontalEndValue = grid.getHorizontalValue() + grid.getHorizontalExtent() - 1;
if (cellColumn > horizontalEndValue) { if (cellColumn > horizontalEndValue) {
@ -323,6 +321,16 @@ public class GridUtils {
return true; return true;
} }
/**
*聚合报表的报表块增加单元格的数量时 当单元格拉动一半会自动扩展成完整的单元格
* 该单元格不被记录 check下重新计算下单元格数量
*/
private static void checkGridCount(Object obj) {
if (obj instanceof ECBlockPane) {
((ECBlockPane) obj).getTarget().firePropertyChange();
}
}
/** /**
* 选择一个Cell, 支持Merge. * 选择一个Cell, 支持Merge.
*/ */

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

@ -167,7 +167,7 @@ public class SplashContext {
private static String getSplashPath() { private static String getSplashPath() {
Locale locale = DesignerEnvManager.getEnvManager().getLanguage(); Locale locale = DesignerEnvManager.getEnvManager().getLanguage();
if (Locale.US.equals(locale) || Locale.KOREA.equals(locale)) { if (Locale.US.equals(locale) || Locale.KOREA.equals(locale) || Locale.TAIWAN.equals(locale)) {
return "/com/fr/design/images/splash_10_en.gif"; return "/com/fr/design/images/splash_10_en.gif";
} else if (Locale.JAPAN.equals(locale)) { } else if (Locale.JAPAN.equals(locale)) {
return "/com/fr/design/images/splash_10_jp.gif"; return "/com/fr/design/images/splash_10_jp.gif";

Loading…
Cancel
Save