Browse Source

Merge pull request #943 in DESIGN/design from ~NEIL/design:final/10.0 to final/10.0

* commit '78bea7a321343d9ced3f4ec1d7275ba497bce6ad': (48 commits)
  ct
  update
  REPORT-17908 启动动画“初始化”的国际化问题
  REPORT-17887 数字控件最大值最小值部分场景保存失败
  REPORT-17277 frm的body点击事件不见了  && REPORT-17897 设计器文件-选项显示不完整  && REPORT-17873 模板-报表填报属性-刷新按钮提示框的国际化问题
  CHART-9401 fix list
  fix list
  CHART-3647 删除多余代码
  update
  REPORT-17656 决策报表报表块复制后值被清空
  MOBILE-21196 【性能】移动端》报表》打开少数单元格插入图片的模板,出现加载缓慢,时间在5s以上不等  设计器部分
  update
  REPORT-17527 推送远程设计触发的报表预览日志
  KERNEL-582 国际化定制的地方会越来越多,想办法去掉这种if else写法
  REPORT-17494 模板版本管理,选项灰化问题
  REPORT-17730 控件名无法保存
  REPORT-15183 有一个改远程url的接口补一下10.0
  update
  REPORT-17186 【决策报表】条件属性添加超链,会自动在超级链接里生成一条
  删除无用import
  ...
final/10.0
Kara 6 years ago
parent
commit
331684d799
  1. 9
      designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java
  2. 84
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  3. 89
      designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java
  4. 10
      designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java
  5. 10
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  6. 5
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.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. 77
      designer-base/src/main/java/com/fr/design/dialog/BasicPane.java
  13. 4
      designer-base/src/main/java/com/fr/design/gui/frpane/ImgChooseWrapper.java
  14. 2
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java
  15. 2
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImagePreviewPane.java
  16. 45
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  17. 82
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogger.java
  18. 2
      designer-base/src/main/java/com/fr/design/style/background/image/ImagePreviewPane.java
  19. 18
      designer-base/src/main/java/com/fr/design/ui/Assistant.java
  20. 43
      designer-base/src/main/java/com/fr/design/ui/EmbProtocolHandler.java
  21. 19
      designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java
  22. 70
      designer-base/src/main/java/com/fr/design/upm/UpmBridge.java
  23. 10
      designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java
  24. 23
      designer-base/src/main/java/com/fr/design/upm/UpmUtils.java
  25. 2
      designer-base/src/main/java/com/fr/design/upm/event/DownloadEvent.java
  26. 27
      designer-base/src/main/java/com/fr/design/upm/loader/UpmDesignResourceLoader.java
  27. 19
      designer-base/src/main/java/com/fr/design/utils/ImageUtils.java
  28. 42
      designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java
  29. 15
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  30. 2
      designer-base/src/main/resources/com/fr/design/dcm/index.js
  31. 276
      designer-base/src/main/resources/com/fr/design/dcm/style.css
  32. 2
      designer-base/src/main/resources/com/fr/design/upm/warn.js
  33. 13
      designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java
  34. 91
      designer-form/src/main/java/com/fr/design/designer/properties/FormWidgetAuthorityEditPane.java
  35. 5
      designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPaneNoPop.java
  36. 3
      designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  37. 3
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java
  38. 4
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  39. 4
      designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/impl/AbstractSendDataToCloud.java
  40. 3
      designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/impl/FocusPointMessageUploader.java
  41. 4
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java
  42. 22
      designer-realize/src/main/java/com/fr/design/report/SelectImagePane.java
  43. 2
      designer-realize/src/main/java/com/fr/design/widget/ui/ParameterTreeComboBox.java
  44. 2
      designer-realize/src/main/java/com/fr/grid/GridCornerMouseHandler.java
  45. 6
      designer-realize/src/main/java/com/fr/start/SplashContext.java

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

@ -6,6 +6,7 @@ import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -19,7 +20,7 @@ public class VideoAction extends UpdateAction
this.setMenuKeySet(VIDEO); this.setMenuKeySet(VIDEO);
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/video.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/bbs/video.png"));
} }
@ -27,12 +28,10 @@ public class VideoAction extends UpdateAction
public void actionPerformed(ActionEvent arg0) public void actionPerformed(ActionEvent arg0)
{ {
String url; String url;
if (Locale.US.equals(GeneralContext.getLocale())) { if (GeneralContext.getLocale().equals(Locale.US)) {
url = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en"); url = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en");
} else if (Locale.TAIWAN.equals(GeneralContext.getLocale())) {
url = CloudCenter.getInstance().acquireUrlByKind("bbs.video.tw");
} else { } else {
url = CloudCenter.getInstance().acquireUrlByKind("bbs.video"); url = CloudCenter.getInstance().acquireUrlByKind("bbs.video");
} }
BrowseUtils.browser(url); BrowseUtils.browser(url);

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

@ -8,6 +8,7 @@ import com.fr.design.RestartHelper;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.DialogActionListener;
import com.fr.design.editor.editor.IntegerEditor; import com.fr.design.editor.editor.IntegerEditor;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
@ -31,6 +32,7 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.log.Log4jConfig; import com.fr.general.log.Log4jConfig;
import com.fr.locale.InterProviderFactory; import com.fr.locale.InterProviderFactory;
@ -79,6 +81,7 @@ public class PreferencePane extends BasicPane {
private static final int CACHING_DEFAULT = 5; private static final int CACHING_DEFAULT = 5;
private static final int CACHING_GAP = 5; private static final int CACHING_GAP = 5;
private static final int MEMORY_TIP_LABEL_MAX_WIDTH = 230; private static final int MEMORY_TIP_LABEL_MAX_WIDTH = 230;
private static final int OFFSET_HEIGHT = 50;
private static final String TYPE = "pressed"; private static final String TYPE = "pressed";
private static final String DISPLAY_TYPE = "+"; private static final String DISPLAY_TYPE = "+";
@ -133,11 +136,11 @@ public class PreferencePane extends BasicPane {
private UIComboBox logLevelComboBox, pageLengthComboBox, reportLengthComboBox; private UIComboBox logLevelComboBox, pageLengthComboBox, reportLengthComboBox;
private UIDictionaryComboBox<Locale> languageComboBox; private UIDictionaryComboBox<Locale> languageComboBox;
private IntegerEditor portEditor; private IntegerEditor portEditor;
private UITextField jdkHomeTextField;
private UICheckBox oracleSpace; private UICheckBox oracleSpace;
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;
@ -186,16 +189,21 @@ public class PreferencePane extends BasicPane {
JPanel oraclePane = FRGUIPaneFactory.createTitledBorderPane("Oracle" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Oracle_All_Tables")); JPanel oraclePane = FRGUIPaneFactory.createTitledBorderPane("Oracle" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Oracle_All_Tables"));
oracleSpace = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_All_Oracle_Tables")); oracleSpace = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_All_Oracle_Tables"));
oraclePane.add(oracleSpace); oraclePane.add(oracleSpace);
//
// JPanel debuggerPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Basic_Develop_Tools"));
// openDebugComboBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Open_Debug_Window"));
// debuggerPane.add(openDebugComboBox, BorderLayout.CENTER);
// advancePane.add(debuggerPane);
// JPanel upmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager")); JPanel debuggerPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Basic_Develop_Tools"));
// useOptimizedUPMCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Use_New_Update_Plugin_Manager")); openDebugComboBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Open_Debug_Window"));
// upmSelectorPane.add(useOptimizedUPMCheckbox); debuggerPane.add(openDebugComboBox, BorderLayout.CENTER);
// advancePane.add(upmSelectorPane); advancePane.add(debuggerPane);
JPanel upmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager"));
useOptimizedUPMCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Use_New_Update_Plugin_Manager"));
upmSelectorPane.add(useOptimizedUPMCheckbox);
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"));
@ -206,10 +214,10 @@ public class PreferencePane extends BasicPane {
improvePane.add(autoPushUpdateCheckBox); improvePane.add(autoPushUpdateCheckBox);
} }
JPanel spaceUpPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); JPanel spaceUpPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
spaceUpPane.add(oraclePane); spaceUpPane.add(oraclePane, BorderLayout.NORTH);
spaceUpPane.add(createMemoryPane()); spaceUpPane.add(createMemoryPane(), BorderLayout.CENTER);
spaceUpPane.add(improvePane); spaceUpPane.add(improvePane, BorderLayout.SOUTH);
advancePane.add(spaceUpPane); advancePane.add(spaceUpPane);
} }
@ -226,8 +234,8 @@ public class PreferencePane extends BasicPane {
enableVcsPanel.add(vcsEnableCheckBox); enableVcsPanel.add(vcsEnableCheckBox);
enableVcsPanel.add(remindVcsLabel); enableVcsPanel.add(remindVcsLabel);
JPanel intervalPanel = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); JPanel intervalPanel = new JPanel(FRGUIPaneFactory.createLeftZeroLayout());
UILabel everyLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Every")); final UILabel everyLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Every"));
UILabel delayLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Delay")); final UILabel delayLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Delay"));
intervalPanel.add(useIntervalCheckBox); intervalPanel.add(useIntervalCheckBox);
intervalPanel.add(everyLabel); intervalPanel.add(everyLabel);
intervalPanel.add(saveIntervalEditor); intervalPanel.add(saveIntervalEditor);
@ -240,10 +248,14 @@ public class PreferencePane extends BasicPane {
saveCommitCheckBox.setEnabled(true); saveCommitCheckBox.setEnabled(true);
saveIntervalEditor.setEnabled(true); saveIntervalEditor.setEnabled(true);
useIntervalCheckBox.setEnabled(true); useIntervalCheckBox.setEnabled(true);
everyLabel.setEnabled(true);
delayLabel.setEnabled(true);
} else { } else {
saveCommitCheckBox.setEnabled(false); saveCommitCheckBox.setEnabled(false);
saveIntervalEditor.setEnabled(false); saveIntervalEditor.setEnabled(false);
useIntervalCheckBox.setEnabled(false); useIntervalCheckBox.setEnabled(false);
everyLabel.setEnabled(false);
delayLabel.setEnabled(false);
} }
} }
}); });
@ -383,10 +395,10 @@ public class PreferencePane extends BasicPane {
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Pagination_Line_Color")); new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Pagination_Line_Color"));
gridLineColorTBButton = new UIColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/foreground.png")); gridLineColorTBButton = new UIColorButton(IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png"));
gridLineColorTBButton.setEnabled(this.isEnabled()); gridLineColorTBButton.setEnabled(this.isEnabled());
paginationLineColorTBButton = new UIColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/foreground.png")); paginationLineColorTBButton = new UIColorButton(IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png"));
paginationLineColorTBButton.setEnabled(this.isEnabled()); paginationLineColorTBButton.setEnabled(this.isEnabled());
JPanel leftPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel leftPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
@ -636,8 +648,10 @@ public class PreferencePane extends BasicPane {
this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort())); this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort()));
// 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());
@ -702,7 +716,7 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setJettyServerPort(portEditor.getValue().intValue()); designerEnvManager.setJettyServerPort(portEditor.getValue().intValue());
// designerEnvManager.setOpenDebug(openDebugComboBox.isSelected()); designerEnvManager.setOpenDebug(openDebugComboBox.isSelected());
designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected()); designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected());
designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue()); designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue());
@ -733,17 +747,18 @@ public class PreferencePane extends BasicPane {
} }
}); });
// Configurations.update(new Worker() { Configurations.update(new Worker() {
// @Override @Override
// public void run() { public void run() {
// ServerPreferenceConfig.getInstance().setUseOptimizedUPM(useOptimizedUPMCheckbox.isSelected()); ServerPreferenceConfig.getInstance().setUseOptimizedUPM(useOptimizedUPMCheckbox.isSelected());
// } ServerPreferenceConfig.getInstance().setUseUniverseDBM(useUniverseDBMCheckbox.isSelected());
// }
// @Override
// public Class<? extends Configuration>[] targets() { @Override
// return new Class[] {ServerPreferenceConfig.class}; public Class<? extends Configuration>[] targets() {
// } return new Class[] {ServerPreferenceConfig.class};
// }); }
});
} }
@ -777,4 +792,9 @@ public class PreferencePane extends BasicPane {
} }
}); });
} }
@Override
public BasicDialog showWindow(Window window, DialogActionListener l) {
return showWindowWithCustomSize(window, l, new Dimension(BasicDialog.DEFAULT.width, this.getPreferredSize().height + OFFSET_HEIGHT));
}
} }

89
designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java

@ -1,7 +1,8 @@
package com.fr.design.actions.file; package com.fr.design.actions.file;
import com.fr.base.vcs.DesignerMode; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PreviewProvider;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
@ -10,41 +11,56 @@ import com.fr.file.FileNodeFILE;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.general.web.ParameterConstants; import com.fr.general.web.ParameterConstants;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.web.referrer.DesignSessionReferrer;
import javax.swing.JOptionPane; import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
import static javax.swing.JOptionPane.OK_OPTION;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
import static javax.swing.JOptionPane.showConfirmDialog;
public final class WebPreviewUtils { public final class WebPreviewUtils {
public static void preview(JTemplate<?, ?> jt) { public static void preview(JTemplate<?, ?> jt) {
preview(jt, jt.getPreviewType()); preview(jt, jt.getPreviewType());
} }
@SuppressWarnings("unchecked")
public static void preview(JTemplate<?, ?> jt, PreviewProvider provider) { public static void preview(JTemplate<?, ?> jt, PreviewProvider provider) {
String baseRoute = jt.route(); String baseRoute = jt.route();
if (provider == null) {
actionPerformed(jt, baseRoute, Collections.EMPTY_MAP, ParameterConstants.VIEWLET); String previewType = ParameterConstants.VIEWLET;
} else { Map<String, Object> paraMap = new HashMap<>(getExtraPara());
actionPerformed(jt, baseRoute, provider.parametersForPreview(), provider.getActionType());
if (provider != null) {
Map<String, Object> providerParaMap = provider.parametersForPreview();
if (providerParaMap != null) {
paraMap.putAll(providerParaMap);
}
previewType = provider.getActionType();
} }
actionPerformed(jt, baseRoute, paraMap, previewType);
}
private static Map<String, Object> getExtraPara() {
Map<String, Object> extraPara = new HashMap<>();
if (DesignModeContext.isVcsMode()) {
extraPara.put("mode", DesignModeContext.getMode().toString());
}
extraPara.putAll(new DesignSessionReferrer.Builder().referrerMap());
return extraPara;
} }
private static void actionPerformed(JTemplate<?, ?> jt, String baseRoute, Map<String, Object> map, String actionType) { private static void actionPerformed(JTemplate<?, ?> jt, String baseRoute, Map<String, Object> map, String actionType) {
if (jt == null) { if (jt == null) {
return; return;
} }
if (map == null || map == Collections.EMPTY_MAP) {
map = new HashMap<>();
}
if (DesignerMode.isVcsMode()) {
map.put("mode", DesignerMode.getMode().toString());
}
DesignerContext.getDesignerFrame().refreshToolbar(); DesignerContext.getDesignerFrame().refreshToolbar();
jt.stopEditing(); jt.stopEditing();
/* /*
* alex:如果没有保存,先保存到Env * alex:如果没有保存,先保存到Env
@ -54,17 +70,20 @@ public final class WebPreviewUtils {
if (!jt.isSaved() && !jt.saveTemplate2Env()) { if (!jt.isSaved() && !jt.saveTemplate2Env()) {
return; return;
} }
FILE currentTemplate = jt.getEditingFILE(); FILE currentTemplate = jt.getEditingFILE();
// carl:是否是保存在运行环境下的模板,不是就不能被预览 // carl:是否是保存在运行环境下的模板,不是就不能被预览
if (currentTemplate instanceof FileNodeFILE) { if (currentTemplate instanceof FileNodeFILE) {
browseUrl(currentTemplate, baseRoute, map, actionType, jt); browseUrl(currentTemplate, baseRoute, map, actionType, jt);
} else { } else {
// 说明模板没有保存在报表运行环境下面,提示用户 // 说明模板没有保存在报表运行环境下面,提示用户
int selVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"), int selVal = showConfirmDialog(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview_Tool_Tips"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"),
Toolkit.i18nText("Fine-Design_Basic_Preview_Tool_Tips"),
OK_CANCEL_OPTION,
WARNING_MESSAGE);
if (JOptionPane.OK_OPTION == selVal) { if (OK_OPTION == selVal) {
if (!jt.saveAsTemplate2Env()) { if (!jt.saveAsTemplate2Env()) {
return; return;
} }
@ -74,7 +93,10 @@ public final class WebPreviewUtils {
} }
} }
private static void browseUrl(FILE currentTemplate, String baseRoute, Map<String, Object> map, String actionType, JTemplate<?, ?> jt) { private static void browseUrl(FILE currentTemplate,
String baseRoute,
Map<String, Object> map,
String actionType, JTemplate<?, ?> jt) {
if (!(currentTemplate instanceof FileNodeFILE)) { if (!(currentTemplate instanceof FileNodeFILE)) {
return; return;
} }
@ -85,8 +107,8 @@ public final class WebPreviewUtils {
path = path.substring(ProjectConstants.REPORTLETS_NAME.length() + 1); path = path.substring(ProjectConstants.REPORTLETS_NAME.length() + 1);
} }
java.util.List<String> parameterNameList = new java.util.ArrayList<String>(); List<String> parameterNameList = new ArrayList<>();
java.util.List<String> parameterValueList = new java.util.ArrayList<String>(); List<String> parameterValueList = new ArrayList<>();
parameterNameList.add(actionType); parameterNameList.add(actionType);
parameterValueList.add(path); parameterValueList.add(path);
@ -96,14 +118,21 @@ public final class WebPreviewUtils {
parameterValueList.add(GeneralUtils.objectToString(map.get(key))); parameterValueList.add(GeneralUtils.objectToString(map.get(key)));
} }
} }
DesignUtils.visitEnvServerByParameters(baseRoute, parameterNameList.toArray(new String[parameterNameList.size()]), parameterValueList.toArray(new String[parameterValueList.size()])); DesignUtils.visitEnvServerByParameters(
baseRoute,
parameterNameList.toArray(new String[0]),
parameterValueList.toArray(new String[0])
);
} else { } else {
int selVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"), int selVal = showConfirmDialog(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview_Tool_Tips"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); DesignerContext.getDesignerFrame(),
if (JOptionPane.OK_OPTION == selVal) { Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"),
if (!jt.saveAsTemplate()) { Toolkit.i18nText("Fine-Design_Basic_Preview_Tool_Tips"),
return; OK_CANCEL_OPTION,
} WARNING_MESSAGE
);
if (OK_OPTION == selVal) {
jt.saveAsTemplate();
} }
} }
} }

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

@ -1,10 +1,10 @@
package com.fr.design.actions.help; package com.fr.design.actions.help;
import com.fr.base.BaseUtils;
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;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.http.HttpToolbox; 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;
@ -22,11 +22,13 @@ import java.net.URI;
public class TutorialAction extends UpdateAction { public class TutorialAction extends UpdateAction {
private static final String URL_FOR_TEST_NETWORK = "https://www.baidu.com";
public TutorialAction() { public TutorialAction() {
this.setMenuKeySet(HELP_TUTORIAL); this.setMenuKeySet(HELP_TUTORIAL);
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/help.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/bbs/help.png"));
this.setAccelerator(getMenuKeySet().getKeyStroke()); this.setAccelerator(getMenuKeySet().getKeyStroke());
} }
@ -34,9 +36,11 @@ public class TutorialAction extends UpdateAction {
* 动作 * 动作
* @param evt 事件 * @param evt 事件
*/ */
@Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
String helpURL = CloudCenter.getInstance().acquireUrlByKind(createDocKey()); String helpURL = CloudCenter.getInstance().acquireUrlByKind(createDocKey());
if (isServerOnline(helpURL)) { // 用第三方网址去判断是否处在离线状态
if (isServerOnline(URL_FOR_TEST_NETWORK)) {
try { try {
Desktop.getDesktop().browse(new URI(helpURL)); Desktop.getDesktop().browse(new URI(helpURL));
return; return;

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

5
designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java

@ -32,6 +32,7 @@ import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.ConnectionConfig; import com.fr.file.ConnectionConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -331,7 +332,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
DBUtils.refreshDatabase(); DBUtils.refreshDatabase();
String schema = StringUtils.isEmpty(schemaBox.getSelectedItem()) ? null : schemaBox.getSelectedItem(); String schema = StringUtils.isEmpty(schemaBox.getSelectedItem()) ? null : schemaBox.getSelectedItem();
DataCoreUtils.refreshTables(getConnection(), TableProcedure.TABLE, schema); DataCoreUtils.refreshTables(getConnection(), TableProcedure.TABLE, schema);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh_Successfully") + "!", com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Refresh_Database"), JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh_Successfully") + "!", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh_Database"),
JOptionPane.INFORMATION_MESSAGE); JOptionPane.INFORMATION_MESSAGE);
} }
@ -343,7 +344,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
Object userObj = node.getUserObject(); Object userObj = node.getUserObject();
if (userObj instanceof String) { if (userObj instanceof String) {
this.setIcon(BaseUtils.readIcon("com/fr/design/images/m_insert/expandCell.gif")); this.setIcon(IOUtils.readIcon("com/fr/design/images/m_insert/expandCell.gif"));
} else if (userObj instanceof TableProcedure) { } else if (userObj instanceof TableProcedure) {
this.setText(((TableProcedure) userObj).getName()); this.setText(((TableProcedure) userObj).getName());
} }

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

77
designer-base/src/main/java/com/fr/design/dialog/BasicPane.java

@ -40,21 +40,7 @@ public abstract class BasicPane extends JPanel {
* @return 对话框 * @return 对话框
*/ */
public BasicDialog showWindow(Window window, DialogActionListener l) { public BasicDialog showWindow(Window window, DialogActionListener l) {
BasicDialog dg; return showWindowWithCustomSize(window, l, BasicDialog.DEFAULT);
if (window instanceof Frame) {
dg = new DIALOG((Frame) window);
} else {
dg = new DIALOG((Dialog) window);
}
if (l != null) {
dg.addDialogActionListener(l);
}
dg.setBasicDialogSize(BasicDialog.DEFAULT);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
} }
/** /**
@ -100,21 +86,7 @@ public abstract class BasicPane extends JPanel {
* @return 对话框 * @return 对话框
*/ */
public BasicDialog showWindow4ChartType(Window window, DialogActionListener l) { public BasicDialog showWindow4ChartType(Window window, DialogActionListener l) {
BasicDialog dg; return showWindowWithCustomSize(window, l, BasicDialog.CHART);
if (window instanceof Frame) {
dg = new DIALOG((Frame) window);
} else {
dg = new DIALOG((Dialog) window);
}
if (l != null) {
dg.addDialogActionListener(l);
}
dg.setBasicDialogSize(BasicDialog.CHART);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
} }
/** /**
@ -125,20 +97,7 @@ public abstract class BasicPane extends JPanel {
* @return 对话框 * @return 对话框
*/ */
public BasicDialog showSmallWindow(Window window, DialogActionListener l) { public BasicDialog showSmallWindow(Window window, DialogActionListener l) {
BasicDialog dg; return showWindowWithCustomSize(window, l, BasicDialog.SMALL);
if (window instanceof Frame) {
dg = new DIALOG((Frame) window);
} else {
dg = new DIALOG((Dialog) window);
}
if (l != null) {
dg.addDialogActionListener(l);
}
dg.setBasicDialogSize(BasicDialog.SMALL);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
} }
/** /**
@ -149,20 +108,7 @@ public abstract class BasicPane extends JPanel {
* @return 对话框 * @return 对话框
*/ */
public BasicDialog showMediumWindow(Window window, DialogActionListener l) { public BasicDialog showMediumWindow(Window window, DialogActionListener l) {
BasicDialog dg; return showWindowWithCustomSize(window, l, BasicDialog.MEDIUM);
if (window instanceof Frame) {
dg = new DIALOG((Frame) window);
} else {
dg = new DIALOG((Dialog) window);
}
if (l != null) {
dg.addDialogActionListener(l);
}
dg.setBasicDialogSize(BasicDialog.MEDIUM);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
} }
/** /**
@ -173,6 +119,17 @@ public abstract class BasicPane extends JPanel {
* @return 对话框 * @return 对话框
*/ */
public BasicDialog showLargeWindow(Window window, DialogActionListener l) { public BasicDialog showLargeWindow(Window window, DialogActionListener l) {
return showWindowWithCustomSize(window, l, BasicDialog.LARGE);
}
/**
* 以自定义的宽高显示窗口
* @param window 窗口
* @param l 对话框监听器
* @param dimension 自定义尺寸
* @return 对话框
*/
protected BasicDialog showWindowWithCustomSize(Window window, DialogActionListener l, Dimension dimension) {
BasicDialog dg; BasicDialog dg;
if (window instanceof Frame) { if (window instanceof Frame) {
dg = new DIALOG((Frame) window); dg = new DIALOG((Frame) window);
@ -183,7 +140,7 @@ public abstract class BasicPane extends JPanel {
if (l != null) { if (l != null) {
dg.addDialogActionListener(l); dg.addDialogActionListener(l);
} }
dg.setBasicDialogSize(BasicDialog.LARGE); dg.setBasicDialogSize(dimension);
GUICoreUtils.centerWindow(dg); GUICoreUtils.centerWindow(dg);
dg.setResizable(false); dg.setResizable(false);
return dg; return dg;
@ -350,6 +307,7 @@ public abstract class BasicPane extends JPanel {
} }
} }
@Override
public void setVisible(boolean isVisible) { public void setVisible(boolean isVisible) {
this.nameTextField.setVisible(isVisible); this.nameTextField.setVisible(isVisible);
this.Name.setVisible(isVisible); this.Name.setVisible(isVisible);
@ -377,6 +335,7 @@ public abstract class BasicPane extends JPanel {
* *
* @throws Exception 异常 * @throws Exception 异常
*/ */
@Override
public void checkValid() throws Exception { public void checkValid() throws Exception {
super.checkValid(); super.checkValid();

4
designer-base/src/main/java/com/fr/design/gui/frpane/ImgChooseWrapper.java

@ -7,7 +7,6 @@ import com.fr.design.style.background.image.ImageFileChooser;
import com.fr.design.style.background.image.ImagePreviewer; import com.fr.design.style.background.image.ImagePreviewer;
import com.fr.design.utils.ImageUtils; import com.fr.design.utils.ImageUtils;
import com.fr.general.ImageWithSuffix; import com.fr.general.ImageWithSuffix;
import com.fr.stable.CoreGraphHelper; import com.fr.stable.CoreGraphHelper;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -16,6 +15,7 @@ import javax.swing.SwingWorker;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.Image; import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
/** /**
@ -103,7 +103,7 @@ public class ImgChooseWrapper {
if (imageFileChooser.isCheckSelected()) { if (imageFileChooser.isCheckSelected()) {
imageWithSuffix = ImageUtils.defaultImageCompWithSuff(selectedFile); imageWithSuffix = ImageUtils.defaultImageCompWithSuff(selectedFile);
} else { } else {
Image image = BaseUtils.readImage(selectedFile.getPath()); BufferedImage image = BaseUtils.readImage(selectedFile.getPath());
String type = ImageUtils.getImageType(selectedFile); String type = ImageUtils.getImageType(selectedFile);
imageWithSuffix = new ImageWithSuffix(image, type); imageWithSuffix = new ImageWithSuffix(image, type);
} }

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

@ -114,7 +114,7 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
@Override @Override
public Background updateBean() { public Background updateBean() {
ImageFileBackground imageBackground = new ImageFileBackground(previewPane.getImage(), suffix); ImageFileBackground imageBackground = new ImageFileBackground(previewPane.getImageWithSuffix());
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(imageLayoutPane.getSelectedItem()); imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(imageLayoutPane.getSelectedItem());
imageBackground.setLayout(imageStyle.getImageLayout()); imageBackground.setLayout(imageStyle.getImageLayout());
return imageBackground; return imageBackground;

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

@ -304,7 +304,7 @@ public class ImagePreviewPane extends JComponent implements Scrollable, ImagePre
@Override @Override
public void setImage(Image image) { public void setImage(Image image) {
setImageWithSuffix(image == null ? null : new ImageWithSuffix(image)); setImageWithSuffix(ImageWithSuffix.build(image));
} }

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

2
designer-base/src/main/java/com/fr/design/style/background/image/ImagePreviewPane.java

@ -63,7 +63,7 @@ public class ImagePreviewPane extends JComponent implements Scrollable, ImagePre
@Override @Override
public void setImage(Image image) { public void setImage(Image image) {
setImageWithSuffix(image == null ? null : new ImageWithSuffix(image)); setImageWithSuffix(ImageWithSuffix.build(image));
} }

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

19
designer-base/src/main/java/com/fr/design/utils/ImageUtils.java

@ -1,6 +1,7 @@
package com.fr.design.utils; package com.fr.design.utils;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.frpx.util.ImageIOHelper;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.ImageWithSuffix; import com.fr.general.ImageWithSuffix;
@ -70,7 +71,7 @@ public class ImageUtils {
return null; return null;
} }
BufferedImage srcImg = BaseUtils.readImage(imageFile.getPath()); BufferedImage srcImg = BaseUtils.readImage(imageFile.getPath());
Image desImg = srcImg; BufferedImage desImg = srcImg;
try { try {
if (canbeCompressedToJPEG(imageFile)) { if (canbeCompressedToJPEG(imageFile)) {
@ -186,11 +187,23 @@ public class ImageUtils {
/** /**
* 获取图片类型 * 获取图片类型
* 先根据ImageReader获取ImageReader获取不到就拿后缀
* *
* @param imageFile 图片文件 * @param imageFile 图片文件
* @return 图片类型(JPEG, PNG, GIF) * @return 图片类型(JPEG, PNG, GIF)
*/ */
public static String getImageType(File imageFile) { public static String getImageType(File imageFile) {
String imageType = getImageTypeByImageReader(imageFile);
return StringUtils.EMPTY.equals(imageType) ? ImageIOHelper.getSuffix(imageFile) : imageType;
}
/**
* 根据ImageReader获取图片类型
*
* @param imageFile 图片文件
* @return 图片类型(JPEG, PNG, GIF)
*/
public static String getImageTypeByImageReader(File imageFile) {
try { try {
ImageInputStream iis = ImageIO.createImageInputStream(imageFile); ImageInputStream iis = ImageIO.createImageInputStream(imageFile);
Iterator<ImageReader> iter = ImageIO.getImageReaders(iis); Iterator<ImageReader> iter = ImageIO.getImageReaders(iis);
@ -226,7 +239,7 @@ public class ImageUtils {
* @param scale 缩放比例比例大于1时为放大小于1大于0为缩小 * @param scale 缩放比例比例大于1时为放大小于1大于0为缩小
* @param opacityCompatible 是否处理背景透明 * @param opacityCompatible 是否处理背景透明
*/ */
public static Image scale(BufferedImage srcImg, float scale, boolean opacityCompatible) { public static BufferedImage scale(BufferedImage srcImg, float scale, boolean opacityCompatible) {
if (scale < 0) { if (scale < 0) {
// 自动修正负数 // 自动修正负数
scale = -scale; scale = -scale;
@ -234,7 +247,7 @@ public class ImageUtils {
int width = mul(Integer.toString(srcImg.getWidth(null)), Float.toString(scale)).intValue(); // 得到源图宽 int width = mul(Integer.toString(srcImg.getWidth(null)), Float.toString(scale)).intValue(); // 得到源图宽
int height = mul(Integer.toString(srcImg.getHeight(null)), Float.toString(scale)).intValue(); // 得到源图长 int height = mul(Integer.toString(srcImg.getHeight(null)), Float.toString(scale)).intValue(); // 得到源图长
return scale(srcImg, width, height, opacityCompatible); return CoreGraphHelper.toBufferedImage(scale(srcImg, width, height, opacityCompatible));
} }
private static BigDecimal mul(String v1, String v2) { private static BigDecimal mul(String v1, String v2) {

42
designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java

@ -9,13 +9,15 @@ 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.form.ui.NumberEditor; import com.fr.form.ui.NumberEditor;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -23,6 +25,7 @@ import java.awt.event.ActionListener;
* Created by kerry on 2017/9/10. * Created by kerry on 2017/9/10.
*/ */
public class NumberEditorValidatePane extends JPanel { public class NumberEditorValidatePane extends JPanel {
private UICheckBox allowDecimalsCheckBox; private UICheckBox allowDecimalsCheckBox;
private UICheckBox allowNegativeCheckBox; private UICheckBox allowNegativeCheckBox;
private UICheckBox setMaxValueCheckBox; private UICheckBox setMaxValueCheckBox;
@ -104,6 +107,7 @@ public class NumberEditorValidatePane extends JPanel {
private void initListeners() { private void initListeners() {
allowDecimalsListener = new ActionListener() { allowDecimalsListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (allowDecimalsCheckBox.isSelected()) { if (allowDecimalsCheckBox.isSelected()) {
limitNumberPane.setVisible(true); limitNumberPane.setVisible(true);
@ -129,8 +133,8 @@ public class NumberEditorValidatePane extends JPanel {
if (!setMinValueCheckBox.isSelected()) { if (!setMinValueCheckBox.isSelected()) {
maxValueSpinner.getTextField().setMinValue(0.0); maxValueSpinner.getTextField().setMinValue(0.0);
} }
Double minValue = Double.parseDouble("" + minValueSpinner.getValue()); double minValue = Double.parseDouble("" + minValueSpinner.getValue());
Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue()); double maxValue = Double.parseDouble("" + maxValueSpinner.getValue());
if (minValue < 0.0) { if (minValue < 0.0) {
minValueSpinner.setValue(0.0); minValueSpinner.setValue(0.0);
} }
@ -143,10 +147,11 @@ public class NumberEditorValidatePane extends JPanel {
setMaxListener = new ActionListener() { setMaxListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (setMaxValueCheckBox.isSelected()) { if (setMaxValueCheckBox.isSelected()) {
maxValueSpinner.setEnabled(true); maxValueSpinner.setEnabled(true);
Double value = new Double(0); Double value = (double) 0;
if (setMinValueCheckBox.isSelected()) { if (setMinValueCheckBox.isSelected()) {
Double minValue = Double.parseDouble("" + minValueSpinner.getValue()); Double minValue = Double.parseDouble("" + minValueSpinner.getValue());
if (minValue > value) { if (minValue > value) {
@ -163,10 +168,11 @@ public class NumberEditorValidatePane extends JPanel {
setMinListener = new ActionListener() { setMinListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (setMinValueCheckBox.isSelected()) { if (setMinValueCheckBox.isSelected()) {
minValueSpinner.setEnabled(true); minValueSpinner.setEnabled(true);
Double value = new Double(0); Double value = (double) 0;
if (setMaxValueCheckBox.isSelected()) { if (setMaxValueCheckBox.isSelected()) {
Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue()); Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue());
if (maxValue < value) { if (maxValue < value) {
@ -177,7 +183,7 @@ public class NumberEditorValidatePane extends JPanel {
maxValueSpinner.getTextField().setMinValue(value); maxValueSpinner.getTextField().setMinValue(value);
} else { } else {
minValueSpinner.setEnabled(false); minValueSpinner.setEnabled(false);
maxValueSpinner.getTextField().setMinValue(allowNegativeCheckBox.isSelected() ? (-Double.MAX_VALUE) : new Double(0)); maxValueSpinner.getTextField().setMinValue(allowNegativeCheckBox.isSelected() ? (-Double.MAX_VALUE) : (double) 0);
} }
} }
}; };
@ -222,28 +228,28 @@ public class NumberEditorValidatePane extends JPanel {
allowNegativeCheckBox.setSelected(e.isAllowNegative()); allowNegativeCheckBox.setSelected(e.isAllowNegative());
if (e.getMaxValue() == Double.MAX_VALUE) { if (e.getMaxValue() == Double.MAX_VALUE) {
setMaxValueCheckBox.setSelected(false); setMaxValueCheckBox.setSelected(false);
maxValueSpinner.setValue(new Double(Double.MAX_VALUE)); maxValueSpinner.setValue(Double.MAX_VALUE);
maxValueSpinner.setEnabled(false); maxValueSpinner.setEnabled(false);
} else { } else {
setMaxValueCheckBox.setSelected(true); setMaxValueCheckBox.setSelected(true);
maxValueSpinner.setEnabled(true); maxValueSpinner.setEnabled(true);
maxValueSpinner.setValue(new Double(e.getMaxValue())); maxValueSpinner.setValue(e.getMaxValue());
} }
if (e.getMinValue() == -Double.MAX_VALUE) { if (e.getMinValue() == -Double.MAX_VALUE) {
setMinValueCheckBox.setSelected(false); setMinValueCheckBox.setSelected(false);
minValueSpinner.setValue(new Double(-Double.MAX_VALUE)); minValueSpinner.setValue(-Double.MAX_VALUE);
minValueSpinner.setEnabled(false); minValueSpinner.setEnabled(false);
} else { } else {
setMinValueCheckBox.setSelected(true); setMinValueCheckBox.setSelected(true);
minValueSpinner.setEnabled(true); minValueSpinner.setEnabled(true);
minValueSpinner.setValue(new Double(e.getMinValue())); minValueSpinner.setValue(e.getMinValue());
} }
if(setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()){ if (setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()) {
errorMsgTextFieldPane.setVisible(true); errorMsgTextFieldPane.setVisible(true);
errorMsgTextField.setText(e.getRegErrorMessage()); errorMsgTextField.setText(e.getRegErrorMessage());
}else{ } else {
errorMsgTextFieldPane.setVisible(false); errorMsgTextFieldPane.setVisible(false);
errorMsgTextField.setText(StringUtils.EMPTY); errorMsgTextField.setText(StringUtils.EMPTY);
} }
@ -259,15 +265,19 @@ public class NumberEditorValidatePane extends JPanel {
if (setMinValueCheckBox.isSelected()) { if (setMinValueCheckBox.isSelected()) {
ob.setMinValue(minValueSpinner.getValue()); ob.setMinValue(minValueSpinner.getValue());
} else {
ob.setMinValue(-Double.MAX_VALUE);
} }
if (setMaxValueCheckBox.isSelected()) { if (setMaxValueCheckBox.isSelected()) {
ob.setMaxValue(maxValueSpinner.getValue()); ob.setMaxValue(maxValueSpinner.getValue());
} else {
ob.setMaxValue(Double.MAX_VALUE);
} }
if(setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()){ if (setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()) {
errorMsgTextFieldPane.setVisible(true); errorMsgTextFieldPane.setVisible(true);
}else{ } else {
errorMsgTextFieldPane.setVisible(false); errorMsgTextFieldPane.setVisible(false);
errorMsgTextField.setText(StringUtils.EMPTY); errorMsgTextField.setText(StringUtils.EMPTY);
} }

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

@ -3,9 +3,11 @@ package com.fr.env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.ServerConfig; import com.fr.base.ServerConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.UITitledBorder; import com.fr.design.border.UITitledBorder;
import com.fr.design.env.RemoteDesignerWorkspaceInfo; import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.design.fun.DesignerEnvProcessor;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -303,10 +305,17 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
@Override @Override
public RemoteDesignerWorkspaceInfo updateBean() { public RemoteDesignerWorkspaceInfo updateBean() {
String url = this.remoteWorkspaceURL.getURL();
String username = this.usernameInput.getText();
String password = new String(this.passwordInput.getPassword());
DesignerEnvProcessor envProcessor = ExtraDesignClassManager.getInstance().getSingle(DesignerEnvProcessor.XML_TAG);
if (envProcessor != null) {
url = envProcessor.changeEnvPathBeforeConnect(username, password, url);
}
WorkspaceConnectionInfo connection = new WorkspaceConnectionInfo( WorkspaceConnectionInfo connection = new WorkspaceConnectionInfo(
this.remoteWorkspaceURL.getURL(), url,
this.usernameInput.getText(), username,
new String(this.passwordInput.getPassword()), password,
this.certPathInput.getText(), this.certPathInput.getText(),
new String(this.certSecretKeyInput.getPassword())); new String(this.certSecretKeyInput.getPassword()));

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*/

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

13
designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java

@ -2,6 +2,7 @@ package com.fr.van.chart.map.designer.type;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.decision.webservice.v10.map.WMSFactory;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
@ -19,6 +20,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.geojson.helper.GEOJSONHelper;
import com.fr.plugin.chart.base.GisLayer; import com.fr.plugin.chart.base.GisLayer;
import com.fr.plugin.chart.base.ViewCenter; import com.fr.plugin.chart.base.ViewCenter;
import com.fr.plugin.chart.map.VanChartMapPlot; import com.fr.plugin.chart.map.VanChartMapPlot;
@ -26,9 +28,7 @@ import com.fr.plugin.chart.map.designer.type.GEOJSONTreeHelper;
import com.fr.plugin.chart.map.layer.WMSLayer; import com.fr.plugin.chart.map.layer.WMSLayer;
import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; import com.fr.plugin.chart.map.server.ChartGEOJSONHelper;
import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper; import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper;
import com.fr.geojson.helper.GEOJSONHelper;
import com.fr.plugin.chart.map.server.MapLayerConfigManager; import com.fr.plugin.chart.map.server.MapLayerConfigManager;
import com.fr.plugin.chart.service.WMSFactory;
import com.fr.plugin.chart.type.GISLayerType; import com.fr.plugin.chart.type.GISLayerType;
import com.fr.plugin.chart.type.MapType; import com.fr.plugin.chart.type.MapType;
import com.fr.plugin.chart.type.ZoomLevel; import com.fr.plugin.chart.type.ZoomLevel;
@ -57,6 +57,7 @@ import java.awt.event.ItemListener;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
/** /**
* Created by Mitisky on 16/5/11. * Created by Mitisky on 16/5/11.
@ -380,7 +381,7 @@ public class VanChartMapSourceChoosePane extends JPanel implements UIObserver {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
new SwingWorker<Void, Double>() { new SwingWorker<Void, Double>() {
private java.util.List<WMSLayer> list; private java.util.List<WMSLayer> list = new ArrayList<>();
@Override @Override
protected Void doInBackground() throws Exception { protected Void doInBackground() throws Exception {
@ -392,7 +393,11 @@ public class VanChartMapSourceChoosePane extends JPanel implements UIObserver {
} }
String res = httpClient.getResponseText(); String res = httpClient.getResponseText();
list = WMSFactory.readLayers(res); List<String> layers = WMSFactory.readLayers(res);
list.clear();
for (String layer : layers) {
list.add(new WMSLayer(layer, false));
}
return null; return null;
} }

91
designer-form/src/main/java/com/fr/design/designer/properties/FormWidgetAuthorityEditPane.java

@ -4,14 +4,18 @@ import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.tree.TreePath;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
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.AuthorityEditPane; import com.fr.design.mainframe.AuthorityEditPane;
@ -22,6 +26,9 @@ import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
/** /**
@ -34,15 +41,21 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane {
private Widget[] widgets = null; private Widget[] widgets = null;
private UICheckBox widgetVisible = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Visible")); private UICheckBox widgetVisible = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Visible"));
private UICheckBox widgetAvailable = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Enabled")); private UICheckBox widgetAvailable = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Enabled"));
private String[] selectedArray;
private ItemListener visibleItemListener = new ItemListener() { private ItemListener visibleItemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName(); String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName();
if (selectedRoles == null) { if (selectedRoles == null) {
return; return;
} }
if (widgets != null && widgets.length > 0) { initSelectedArray();
for (int i = 0; i < widgets.length; i++) { if (ArrayUtils.isEmpty(selectedArray)) {
widgets[i].changeVisibleAuthorityState(selectedRoles, widgetVisible.isSelected()); return;
}
for (String selectedRole : selectedArray) {
for (Widget widget : widgets) {
widget.changeVisibleAuthorityState(selectedRole, widgetVisible.isSelected());
} }
} }
doAfterAuthority(); doAfterAuthority();
@ -51,6 +64,7 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane {
private ItemListener usableItemListener = new ItemListener() { private ItemListener usableItemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName(); String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName();
if (ComparatorUtils.equals(selectedRoles, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Role"))) { if (ComparatorUtils.equals(selectedRoles, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Role"))) {
@ -59,9 +73,13 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane {
if (selectedRoles == null) { if (selectedRoles == null) {
return; return;
} }
if (widgets != null && widgets.length > 0) { initSelectedArray();
for (int i = 0; i < widgets.length; i++) { if (ArrayUtils.isEmpty(selectedArray)) {
widgets[i].changeUsableAuthorityState(selectedRoles, widgetAvailable.isSelected()); return;
}
for (String selectedRole : selectedArray) {
for (Widget widget : widgets) {
widget.changeUsableAuthorityState(selectedRole, widgetAvailable.isSelected());
} }
} }
doAfterAuthority(); doAfterAuthority();
@ -78,7 +96,7 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane {
private void doAfterAuthority() { private void doAfterAuthority() {
designer.repaint(); designer.repaint();
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified(); HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified();
RolesAlreadyEditedPane.getInstance().refreshDockingView(); RolesAlreadyEditedPane.getInstance().refreshDockingView();
RolesAlreadyEditedPane.getInstance().setReportAndFSSelectedRoles(); RolesAlreadyEditedPane.getInstance().setReportAndFSSelectedRoles();
RolesAlreadyEditedPane.getInstance().repaint(); RolesAlreadyEditedPane.getInstance().repaint();
@ -90,6 +108,7 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane {
* *
* @date 2014-12-21-下午6:19:43 * @date 2014-12-21-下午6:19:43
*/ */
@Override
public void populateType() { public void populateType() {
type.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Form_Widget_Config")); type.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Form_Widget_Config"));
} }
@ -99,15 +118,16 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane {
* *
* @date 2014-12-21-下午7:12:27 * @date 2014-12-21-下午7:12:27
*/ */
@Override
public void populateName() { public void populateName() {
String nameText = "";
if (widgets == null || widgets.length <= 0) { if (widgets == null || widgets.length <= 0) {
return; return;
} }
for (int i = 0; i < widgets.length; i++) { List<String> widgetNames = new ArrayList<String>();
nameText += "," + widgets[i].getClass().getSimpleName(); for (Widget widget : widgets) {
widgetNames.add(widget.getClass().getSimpleName());
} }
name.setText(nameText.substring(1)); name.setText(StableUtils.join(widgetNames, ","));
} }
/** /**
@ -116,6 +136,7 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane {
* @return 面板 * @return 面板
* @date 2014-12-21-下午6:19:03 * @date 2014-12-21-下午6:19:03
*/ */
@Override
public JPanel populateCheckPane() { public JPanel populateCheckPane() {
checkPane.add(populateWidgetCheckPane(), BorderLayout.CENTER); checkPane.add(populateWidgetCheckPane(), BorderLayout.CENTER);
checkPane.setBorder(BorderFactory.createEmptyBorder(0, LEFT_CHECKPANE, 0, 0)); checkPane.setBorder(BorderFactory.createEmptyBorder(0, LEFT_CHECKPANE, 0, 0));
@ -138,10 +159,11 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane {
/** /**
* 对单元格区域进行操作时的权限编辑页面 * 对单元格区域进行操作时的权限编辑页面
*/ */
@Override
public void populateDetials() { public void populateDetials() {
//更新说明要是JWorkBook的话,说明鼠标焦点又改变了 //更新说明要是JWorkBook的话,说明鼠标焦点又改变了
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setAuthorityMode(true); HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().setAuthorityMode(true);
signelSelection(); singleSelection();
refreshCreator(); refreshCreator();
//如果是布局选中不支持的元素则显示“该元素不支持权限控制” //如果是布局选中不支持的元素则显示“该元素不支持权限控制”
@ -186,8 +208,8 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane {
//实现单选 //实现单选
private void signelSelection() { private void singleSelection() {
if (HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().isJWorkBook()) { if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().isJWorkBook()) {
//清工具栏 //清工具栏
JComponent component = DesignerContext.getDesignerFrame().getToolbarComponent(); JComponent component = DesignerContext.getDesignerFrame().getToolbarComponent();
if (component instanceof AuthorityEditToolBarComponent) { if (component instanceof AuthorityEditToolBarComponent) {
@ -195,7 +217,7 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane {
} }
//清空报表主体的单元格选择 //清空报表主体的单元格选择
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().removeTemplateSelection(); HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().removeTemplateSelection();
} }
} }
@ -204,5 +226,40 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane {
widgets = size == 0 ? null : designer.getSelectionModel().getSelection().getSelectedWidgets(); widgets = size == 0 ? null : designer.getSelectionModel().getSelection().getSelectedWidgets();
} }
private void initSelectedArray() {
TreePath[] selectionPaths = ReportAndFSManagePane.getInstance().getRoleTree().getCheckBoxTreeSelectionModel().getSelectionPaths();
if (selectionPaths.length == 1) {
if (((ExpandMutableTreeNode) (selectionPaths[0].getLastPathComponent())).getChildCount() > 0) {
ExpandMutableTreeNode node = (ExpandMutableTreeNode) ((ExpandMutableTreeNode) (selectionPaths[0].getLastPathComponent())).getLastChild();
selectedArray = new String[node.getChildCount()];
for (int i = 0, len = node.getChildCount(); i < len; i++) {
ExpandMutableTreeNode treeNode = (ExpandMutableTreeNode) node.getChildAt(i);
String nodeName = treeNode.getUserObject().toString();
selectedArray[i] = nodeName;
}
} else {
selectedArray = pathToString(selectionPaths);
}
} else {
selectedArray = pathToString(selectionPaths);
}
}
private String[] pathToString(TreePath[] path) {
List<String> roles = new ArrayList<String>();
if (!ArrayUtils.isEmpty(path)) {
for (TreePath tempPath : path) {
String temp = tempPath.toString();
boolean exist = StringUtils.isNotEmpty(temp) && temp.startsWith("[") && temp.endsWith("]");
if (exist) {
temp = temp.substring(1, temp.length() - 1);
String[] selectedRoles = temp.split("," + StringUtils.BLANK);
String role = selectedRoles[2].trim();
roles.add(role);
}
}
}
return roles.toArray(new String[0]);
}
} }

5
designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPaneNoPop.java

@ -23,4 +23,9 @@ public class FormHyperlinkGroupPaneNoPop extends FormHyperlinkGroupPane{
protected boolean isNewStyle() { protected boolean isNewStyle() {
return false; return false;
} }
@Override
public void saveSettings() {
// do nothing
}
} }

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

@ -225,7 +225,8 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
return; return;
} }
widgetPropertyPane.update(widget); widgetPropertyPane.update(widget);
xCreator.resetCreatorName(currentWidgetName); // 上面一行更新了组件 这里必须重新调用getWidgetName
xCreator.resetCreatorName(widget.getWidgetName());
xCreator.resetVisible(widget.isVisible()); xCreator.resetVisible(widget.isVisible());
designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED); designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED);
return; return;

3
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java

@ -195,7 +195,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
Component[] components = xWFitLayout.getComponents(); Component[] components = xWFitLayout.getComponents();
xWFitLayout.removeAll(); xWFitLayout.removeAll();
layout.resetStyle(); layout.resetStyle();
XWAbsoluteBodyLayout xwAbsoluteBodyLayout = new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0)); XWAbsoluteBodyLayout xwAbsoluteBodyLayout = xWFitLayout.getBackupParent() == null ? new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0)) : (XWAbsoluteBodyLayout) xWFitLayout.getBackupParent();
xWFitLayout.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0); xWFitLayout.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0);
for (Component component : components) { for (Component component : components) {
XCreator xCreator = (XCreator) component; XCreator xCreator = (XCreator) component;
@ -208,6 +208,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
} }
xwAbsoluteBodyLayout.add(component); xwAbsoluteBodyLayout.add(component);
} }
xWFitLayout.setBackupParent(xwAbsoluteBodyLayout);
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
formDesigner.getSelectionModel().setSelectedCreators( formDesigner.getSelectionModel().setSelectedCreators(
FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{wAbsoluteBodyLayout})); FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{wAbsoluteBodyLayout}));

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

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

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

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

@ -38,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;

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

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

@ -2,16 +2,15 @@ package com.fr.design.report;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.frpx.pack.PictureCollection;
import com.fr.base.frpx.util.ImageIOHelper;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.image.ImageFileChooser; import com.fr.design.style.background.image.ImageFileChooser;
import com.fr.design.style.background.image.ImagePreviewPane; import com.fr.design.style.background.image.ImagePreviewPane;
import com.fr.design.utils.ImageUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ImageWithSuffix;
import com.fr.report.cell.Elem; import com.fr.report.cell.Elem;
import com.fr.report.cell.cellattr.CellImage; import com.fr.report.cell.cellattr.CellImage;
import com.fr.report.cell.painter.CellImagePainter; import com.fr.report.cell.painter.CellImagePainter;
@ -28,6 +27,7 @@ import java.awt.GridLayout;
import java.awt.Image; import java.awt.Image;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
/** /**
@ -46,11 +46,6 @@ public class SelectImagePane extends BasicPane {
private Image previewImage = null; private Image previewImage = null;
/**
* 默认格式
*/
private String suffix = PictureCollection.DEFAULT_SUFFIX;
private File imageFile; private File imageFile;
public SelectImagePane() { public SelectImagePane() {
@ -127,13 +122,12 @@ public class SelectImagePane extends BasicPane {
if (selectedFile != null && selectedFile.isFile()) { if (selectedFile != null && selectedFile.isFile()) {
String filePath = selectedFile.getPath(); String filePath = selectedFile.getPath();
suffix = ImageIOHelper.getSuffix(filePath); BufferedImage image = BaseUtils.readImage(filePath);
Image image = BaseUtils.readImage(filePath);
CoreGraphHelper.waitForImage(image); CoreGraphHelper.waitForImage(image);
imageFile = selectedFile; imageFile = selectedFile;
setImageStyle(); setImageStyle();
previewPane.setImage(image); previewPane.setImageWithSuffix(ImageWithSuffix.build(image, ImageUtils.getImageType(selectedFile)));
previewPane.setImageStyle(imageStyle); previewPane.setImageStyle(imageStyle);
previewImage = image; previewImage = image;
} else { } else {
@ -184,7 +178,6 @@ public class SelectImagePane extends BasicPane {
setImage((Image) value); setImage((Image) value);
} else if (value instanceof CellImagePainter) { } else if (value instanceof CellImagePainter) {
setImage(((CellImagePainter) value).getImage()); setImage(((CellImagePainter) value).getImage());
suffix = ((CellImagePainter) value).getSuffix();
} }
style = cell.getStyle(); style = cell.getStyle();
@ -214,11 +207,8 @@ public class SelectImagePane extends BasicPane {
public CellImage update() { public CellImage update() {
CellImage cellImage = new CellImage(); CellImage cellImage = new CellImage();
cellImage.setImage(previewPane.getImage()); cellImage.setImage(previewPane.getImageWithSuffix());
cellImage.setStyle(this.imageStyle); cellImage.setStyle(this.imageStyle);
if (suffix != null) {
cellImage.setSuffix(suffix);
}
return cellImage; return cellImage;
} }

2
designer-realize/src/main/java/com/fr/design/widget/ui/ParameterTreeComboBox.java

@ -161,7 +161,7 @@ public class ParameterTreeComboBox extends FRTreeComboBox {
// 全局数据源参数 // 全局数据源参数
parameters = new Parameter[0]; parameters = new Parameter[0];
Calculator c = Calculator.createCalculator(); Calculator c = Calculator.createCalculator();
TableDataConfig tableDataConfig = TableDataConfig.getInstance(); TableDataConfig tableDataConfig = TableDataConfig.getInstance().mirror();
Iterator<String> nameIt = tableDataConfig.getTableDatas().keySet().iterator(); Iterator<String> nameIt = tableDataConfig.getTableDatas().keySet().iterator();
while (nameIt.hasNext()) { while (nameIt.hasNext()) {
TableData tableData = tableDataConfig.getTableData(nameIt.next()); TableData tableData = tableDataConfig.getTableData(nameIt.next());

2
designer-realize/src/main/java/com/fr/grid/GridCornerMouseHandler.java

@ -29,6 +29,8 @@ public class GridCornerMouseHandler extends MouseInputAdapter {
private void doSelectAll() { private void doSelectAll() {
ElementCasePane reportPane = this.gridCorner.getElementCasePane(); ElementCasePane reportPane = this.gridCorner.getElementCasePane();
// 全选时,停止编辑状态
reportPane.getGrid().stopEditing();
ColumnRow lastColumnRow = GridUtils.getAdjustLastColumnRowOfReportPane(reportPane); ColumnRow lastColumnRow = GridUtils.getAdjustLastColumnRowOfReportPane(reportPane);
reportPane.setSelection(new CellSelection(0, 0, lastColumnRow.getColumn(), lastColumnRow.getRow())); reportPane.setSelection(new CellSelection(0, 0, lastColumnRow.getColumn(), lastColumnRow.getRow()));

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

@ -1,6 +1,7 @@
package com.fr.start; package com.fr.start;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.bbs.BBSConstants; import com.fr.design.mainframe.bbs.BBSConstants;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
@ -26,6 +27,7 @@ public class SplashContext {
public static final String SPLASH_PATH = getSplashPath(); public static final String SPLASH_PATH = getSplashPath();
public static final String SPLASH_CACHE_NAME = SPLASH_PATH.substring(SPLASH_PATH.lastIndexOf("/") + 1); public static final String SPLASH_CACHE_NAME = SPLASH_PATH.substring(SPLASH_PATH.lastIndexOf("/") + 1);
private static final int FETCH_ONLINE_MAX_TIMES = 50; private static final int FETCH_ONLINE_MAX_TIMES = 50;
private static final String THANKS = Toolkit.i18nText("Fine-Design_Report_Thanks_To");
private static final SplashContext SPLASH_CONTEXT = new SplashContext(); private static final SplashContext SPLASH_CONTEXT = new SplashContext();
@ -147,7 +149,7 @@ public class SplashContext {
if (shouldShowThanks()) { if (shouldShowThanks()) {
tryFetchOnline(); tryFetchOnline();
if (StringUtils.isNotEmpty(guest)) { if (StringUtils.isNotEmpty(guest)) {
updateThanksLog(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Thanks_To") + guest); updateThanksLog(THANKS + guest);
} }
} }
} }
@ -175,4 +177,4 @@ public class SplashContext {
return "/com/fr/design/images/splash_10.gif"; return "/com/fr/design/images/splash_10.gif";
} }
} }
} }
Loading…
Cancel
Save