Browse Source

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

# Conflicts:
#	designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
feature/big-screen
MrAngryRookie 6 years ago
parent
commit
cc7a0c32d3
  1. 5
      designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java
  2. 89
      designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java
  3. 10
      designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java
  4. 10
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  5. 5
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java
  6. 39
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseComponent.java
  7. 32
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseDialog.java
  8. 36
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseOpener.java
  9. 39
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabasePane.java
  10. 34
      designer-base/src/main/java/com/fr/design/dcm/UniversalDcmBridge.java
  11. 77
      designer-base/src/main/java/com/fr/design/dialog/BasicPane.java
  12. 4
      designer-base/src/main/java/com/fr/design/gui/frpane/ImgChooseWrapper.java
  13. 2
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java
  14. 2
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImagePreviewPane.java
  15. 45
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  16. 82
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogger.java
  17. 2
      designer-base/src/main/java/com/fr/design/style/background/image/ImagePreviewPane.java
  18. 18
      designer-base/src/main/java/com/fr/design/ui/Assistant.java
  19. 43
      designer-base/src/main/java/com/fr/design/ui/EmbProtocolHandler.java
  20. 19
      designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java
  21. 39
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.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. 19
      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

5
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.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import javax.swing.*;
import java.awt.event.ActionEvent;
@ -19,7 +20,7 @@ public class VideoAction extends UpdateAction
this.setMenuKeySet(VIDEO);
this.setName(getMenuKeySet().getMenuName());
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"));
}
@ -30,7 +31,7 @@ public class VideoAction extends UpdateAction
if (GeneralContext.getLocale().equals(Locale.US)) {
url = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en");
} else {
url = CloudCenter.getInstance().acquireUrlByKind("bbs.video");
url = CloudCenter.getInstance().acquireUrlByKind("bbs.video");
}
BrowseUtils.browser(url);

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

@ -1,7 +1,8 @@
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.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.DesignUtils;
@ -10,41 +11,56 @@ import com.fr.file.FileNodeFILE;
import com.fr.general.GeneralUtils;
import com.fr.general.web.ParameterConstants;
import com.fr.stable.project.ProjectConstants;
import com.fr.web.referrer.DesignSessionReferrer;
import javax.swing.JOptionPane;
import java.util.Collections;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
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 static void preview(JTemplate<?, ?> jt) {
preview(jt, jt.getPreviewType());
}
@SuppressWarnings("unchecked")
public static void preview(JTemplate<?, ?> jt, PreviewProvider provider) {
String baseRoute = jt.route();
if (provider == null) {
actionPerformed(jt, baseRoute, Collections.EMPTY_MAP, ParameterConstants.VIEWLET);
} else {
actionPerformed(jt, baseRoute, provider.parametersForPreview(), provider.getActionType());
String previewType = ParameterConstants.VIEWLET;
Map<String, Object> paraMap = new HashMap<>(getExtraPara());
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) {
if (jt == null) {
return;
}
if (map == null || map == Collections.EMPTY_MAP) {
map = new HashMap<>();
}
if (DesignerMode.isVcsMode()) {
map.put("mode", DesignerMode.getMode().toString());
}
DesignerContext.getDesignerFrame().refreshToolbar();
jt.stopEditing();
/*
* alex:如果没有保存,先保存到Env
@ -54,17 +70,20 @@ public final class WebPreviewUtils {
if (!jt.isSaved() && !jt.saveTemplate2Env()) {
return;
}
FILE currentTemplate = jt.getEditingFILE();
// carl:是否是保存在运行环境下的模板,不是就不能被预览
if (currentTemplate instanceof FileNodeFILE) {
browseUrl(currentTemplate, baseRoute, map, actionType, jt);
} else {
// 说明模板没有保存在报表运行环境下面,提示用户
int selVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview_Tool_Tips"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
int selVal = showConfirmDialog(
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()) {
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)) {
return;
}
@ -85,8 +107,8 @@ public final class WebPreviewUtils {
path = path.substring(ProjectConstants.REPORTLETS_NAME.length() + 1);
}
java.util.List<String> parameterNameList = new java.util.ArrayList<String>();
java.util.List<String> parameterValueList = new java.util.ArrayList<String>();
List<String> parameterNameList = new ArrayList<>();
List<String> parameterValueList = new ArrayList<>();
parameterNameList.add(actionType);
parameterValueList.add(path);
@ -96,14 +118,21 @@ public final class WebPreviewUtils {
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 {
int selVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview_Tool_Tips"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
if (JOptionPane.OK_OPTION == selVal) {
if (!jt.saveAsTemplate()) {
return;
}
int selVal = showConfirmDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"),
Toolkit.i18nText("Fine-Design_Basic_Preview_Tool_Tips"),
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;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.http.HttpToolbox;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.CommonUtils;
@ -22,11 +22,13 @@ import java.net.URI;
public class TutorialAction extends UpdateAction {
private static final String URL_FOR_TEST_NETWORK = "https://www.baidu.com";
public TutorialAction() {
this.setMenuKeySet(HELP_TUTORIAL);
this.setName(getMenuKeySet().getMenuName());
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());
}
@ -34,9 +36,11 @@ public class TutorialAction extends UpdateAction {
* 动作
* @param evt 事件
*/
@Override
public void actionPerformed(ActionEvent evt) {
String helpURL = CloudCenter.getInstance().acquireUrlByKind(createDocKey());
if (isServerOnline(helpURL)) {
// 用第三方网址去判断是否处在离线状态
if (isServerOnline(URL_FOR_TEST_NETWORK)) {
try {
Desktop.getDesktop().browse(new URI(helpURL));
return;

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

@ -1,6 +1,7 @@
package com.fr.design.actions.server;
import com.fr.config.ServerPreferenceConfig;
import com.fr.data.impl.Connection;
import com.fr.design.actions.UpdateAction;
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.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.dcm.UniversalDatabaseOpener;
import com.fr.file.ConnectionConfig;
import com.fr.general.IOUtils;
import com.fr.transaction.CallBackAdaptor;
@ -58,6 +60,14 @@ public class ConnectionListAction extends UpdateAction {
* @param evt 事件
*/
public void actionPerformed(ActionEvent evt) {
if (ServerPreferenceConfig.getInstance().isUseUniverseDBM()) {
UniversalDatabaseOpener.showUniverseDatabaseDialog();
} else {
openDesignDatabaseManager();
}
}
private void openDesignDatabaseManager() {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final ConnectionConfig datasourceManager = ConnectionConfig.getInstance();
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.file.ConnectionConfig;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
@ -331,7 +332,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
DBUtils.refreshDatabase();
String schema = StringUtils.isEmpty(schemaBox.getSelectedItem()) ? null : schemaBox.getSelectedItem();
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);
}
@ -343,7 +344,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
Object userObj = node.getUserObject();
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) {
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 对话框
*/
public BasicDialog showWindow(Window window, DialogActionListener l) {
BasicDialog dg;
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;
return showWindowWithCustomSize(window, l, BasicDialog.DEFAULT);
}
/**
@ -100,21 +86,7 @@ public abstract class BasicPane extends JPanel {
* @return 对话框
*/
public BasicDialog showWindow4ChartType(Window window, DialogActionListener l) {
BasicDialog dg;
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;
return showWindowWithCustomSize(window, l, BasicDialog.CHART);
}
/**
@ -125,20 +97,7 @@ public abstract class BasicPane extends JPanel {
* @return 对话框
*/
public BasicDialog showSmallWindow(Window window, DialogActionListener l) {
BasicDialog dg;
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;
return showWindowWithCustomSize(window, l, BasicDialog.SMALL);
}
/**
@ -149,20 +108,7 @@ public abstract class BasicPane extends JPanel {
* @return 对话框
*/
public BasicDialog showMediumWindow(Window window, DialogActionListener l) {
BasicDialog dg;
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;
return showWindowWithCustomSize(window, l, BasicDialog.MEDIUM);
}
/**
@ -173,6 +119,17 @@ public abstract class BasicPane extends JPanel {
* @return 对话框
*/
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;
if (window instanceof Frame) {
dg = new DIALOG((Frame) window);
@ -183,7 +140,7 @@ public abstract class BasicPane extends JPanel {
if (l != null) {
dg.addDialogActionListener(l);
}
dg.setBasicDialogSize(BasicDialog.LARGE);
dg.setBasicDialogSize(dimension);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
@ -350,6 +307,7 @@ public abstract class BasicPane extends JPanel {
}
}
@Override
public void setVisible(boolean isVisible) {
this.nameTextField.setVisible(isVisible);
this.Name.setVisible(isVisible);
@ -377,6 +335,7 @@ public abstract class BasicPane extends JPanel {
*
* @throws Exception 异常
*/
@Override
public void checkValid() throws Exception {
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.utils.ImageUtils;
import com.fr.general.ImageWithSuffix;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.StringUtils;
@ -16,6 +15,7 @@ import javax.swing.SwingWorker;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;
/**
@ -103,7 +103,7 @@ public class ImgChooseWrapper {
if (imageFileChooser.isCheckSelected()) {
imageWithSuffix = ImageUtils.defaultImageCompWithSuff(selectedFile);
} else {
Image image = BaseUtils.readImage(selectedFile.getPath());
BufferedImage image = BaseUtils.readImage(selectedFile.getPath());
String type = ImageUtils.getImageType(selectedFile);
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
public Background updateBean() {
ImageFileBackground imageBackground = new ImageFileBackground(previewPane.getImage(), suffix);
ImageFileBackground imageBackground = new ImageFileBackground(previewPane.getImageWithSuffix());
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(imageLayoutPane.getSelectedItem());
imageBackground.setLayout(imageStyle.getImageLayout());
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
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 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 INFO_GAP_Y = -60;
@ -127,12 +119,12 @@ public class DesignerLogHandler {
JPopupMenu jPopupMenu = new JPopupMenu();
int logLevelInt = Log4jConfig.getInstance().getRootLevel().toInt();
if (logLevelInt <= INFO_INT) {
if (logLevelInt <= DesignerLogger.INFO_INT) {
jPopupMenu.add(showInfo);
jPopupMenu.add(showError);
jPopupMenu.add(showServer);
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(showServer);
jPopupMenu.show(caption, caption.getWidth() + GAP_X, ERRO_GAP_Y);
@ -241,11 +233,11 @@ public class DesignerLogHandler {
int intLevel = event.getLevel().toInt();
Date date = new Date(event.getTimeStamp());
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());
} 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());
} 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());
}
}
@ -253,11 +245,11 @@ public class DesignerLogHandler {
public void printStackTrace(String message, Level level, Date date) {
int intLevel = level.toInt();
if (intLevel == INFO_INT && showInfo.isSelected()) {
if (intLevel == DesignerLogger.INFO_INT && showInfo.isSelected()) {
printMessage(message, intLevel, date);
} else if (intLevel == ERROR_INT && showError.isSelected()) {
} else if (intLevel == DesignerLogger.ERROR_INT && showError.isSelected()) {
printMessage(message, intLevel, date);
} else if (intLevel == WARN_INT && showServer.isSelected()) {
} else if (intLevel == DesignerLogger.WARN_INT && showServer.isSelected()) {
printMessage(message, intLevel, date);
}
@ -287,13 +279,13 @@ public class DesignerLogHandler {
private void log(String str, int style) {
SimpleAttributeSet attrSet = new SimpleAttributeSet();
if (style == ERROR_INT) {
if (style == DesignerLogger.ERROR_INT) {
StyleConstants.setForeground(attrSet, new Color(247, 148, 29));
StyleConstants.setBold(attrSet, true);
} else if (style == WARN_INT) {
} else if (style == DesignerLogger.WARN_INT) {
StyleConstants.setForeground(attrSet, Color.red);
StyleConstants.setBold(attrSet, true);
} else if (style == INFO_INT) {
} else if (style == DesignerLogger.INFO_INT) {
StyleConstants.setForeground(attrSet, Color.black);
StyleConstants.setBold(attrSet, false);
} else {
@ -310,9 +302,9 @@ public class DesignerLogHandler {
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";
} else if (style == WARN_INT) {
} else if (style == DesignerLogger.WARN_INT) {
str = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Seriously") + ":" + str + "\n";
} else {
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) {
LogMessageBar.getInstance().setMessage(message);
if (level == DesignerLogHandler.INFO_INT && showInfo.isSelected()) {
if (level == DesignerLogger.INFO_INT && showInfo.isSelected()) {
caption.infoAdd();
} else if (level == DesignerLogHandler.ERROR_INT && showError.isSelected()) {
} else if (level == DesignerLogger.ERROR_INT && showError.isSelected()) {
caption.errorAdd();
} else if (level == DesignerLogHandler.WARN_INT && showServer.isSelected()) {
} else if (level == DesignerLogger.WARN_INT && showServer.isSelected()) {
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
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.URLResponse;
import javax.activation.MimetypesFileTypeMap;
import java.io.DataInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
* @author richie
@ -41,7 +47,15 @@ public class Assistant {
if (path.endsWith(".js")) {
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) {
@ -49,6 +63,6 @@ public class Assistant {
ProtocolService protocolService = browserContext.getProtocolService();
// 支持读取jar包中文件的自定义协议————emb:/com/fr/design/images/bbs.png
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.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils;
import com.fr.third.org.apache.commons.codec.net.URLCodec;
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.URLResponse;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.Map;
/**
@ -51,21 +56,20 @@ public class EmbProtocolHandler implements ProtocolHandler {
@Override
public URLResponse onRequest(URLRequest req) {
InputStream inputStream = null;
try {
String path = req.getURL();
if (path.startsWith("file:")) {
String url = new URLCodec().decode(path);
String filePath = TemplateUtils.renderParameter4Tpl(url, map);
File file = new File(URI.create(filePath).getPath());
InputStream inputStream = new FileInputStream(file);
if (path.endsWith(".svg")) {
System.out.println(path);
}
return Assistant.inputStream2Response(inputStream, "file:///" + file.getAbsolutePath());
}
else if (path.startsWith("emb:dynamic")) {
inputStream = IOUtils.readResource(file.getAbsolutePath());
String text = IOUtils.inputStream2String(inputStream, EncodeConstants.ENCODING_UTF_8);
text = TemplateUtils.renderParameter4Tpl(text, map);
return Assistant.inputStream2Response(new ByteArrayInputStream(text.getBytes(StandardCharsets.UTF_8)), path);
} else if (path.startsWith("emb:dynamic")) {
URLResponse response = new URLResponse();
response.setData(htmlText().getBytes());
response.setData(htmlText(map).getBytes());
response.getHeaders().setHeader("Content-Type", "text/html");
return response;
} else {
@ -75,16 +79,24 @@ public class EmbProtocolHandler implements ProtocolHandler {
} else {
path = path.substring(4);
}
InputStream inputStream = IOUtils.readResource(path);
inputStream = IOUtils.readResource(path);
return Assistant.inputStream2Response(inputStream, path);
}
} catch (Exception ignore) {
ignore.printStackTrace();
} catch (Exception e) {
FineLoggerFactory.getLogger().info(e.getMessage());
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
return null;
}
private String htmlText() {
private String htmlText(Map<String, String> map) {
PathGroup pathGroup = AtomBuilder.create().buildAssembleFilePath(ModernRequestClient.KEY, component);
StylePath[] stylePaths = pathGroup.toStylePathGroup();
StringBuilder styleText = new StringBuilder();
@ -106,6 +118,13 @@ public class EmbProtocolHandler implements ProtocolHandler {
}
}
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;
}
}

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);
UIButton reloadButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Reload"));
toolbar.add(reloadButton);
UIButton closeButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Close_Window"));
toolbar.add(closeButton);
openDebugButton.addActionListener(new ActionListener() {
@Override
@ -66,6 +68,13 @@ public class ModernUIPane<T> extends BasicPane {
browser.reloadIgnoringCache();
}
});
closeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
SwingUtilities.getWindowAncestor(ModernUIPane.this).setVisible(false);
}
});
BrowserPreferences.setChromiumSwitches("--remote-debugging-port=9222");
initializeBrowser();
add(new BrowserView(browser), BorderLayout.CENTER);
@ -107,6 +116,16 @@ public class ModernUIPane<T> extends BasicPane {
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
protected String title4PopupWindow() {
return "Modern";

39
designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java

@ -22,6 +22,7 @@ import com.fr.design.update.ui.widget.UpdateInfoTableCellRender;
import com.fr.design.update.ui.widget.UpdateInfoTableModel;
import com.fr.design.update.ui.widget.UpdateInfoTextAreaCellRender;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.DateUtils;
import com.fr.general.GeneralContext;
@ -29,6 +30,7 @@ import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
@ -37,6 +39,7 @@ import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.third.org.apache.commons.codec.digest.DigestUtils;
import com.fr.workspace.WorkContext;
import com.sun.java.swing.plaf.motif.MotifProgressBarUI;
@ -371,9 +374,7 @@ public class UpdateMainDialog extends UIDialog {
new SwingWorker<JSONObject, Void>() {
@Override
protected JSONObject doInBackground() throws Exception {
HttpClient hc = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("jar10.update"));
hc.setTimeout(UpdateConstants.CONNECTION_TIMEOUT);
return new JSONObject(hc.getResponseText());
return new JSONObject(HttpToolbox.get(CloudCenter.getInstance().acquireUrlByKind("jar10.update")));
}
@Override
@ -620,8 +621,11 @@ public class UpdateMainDialog extends UIDialog {
long downloadSize = jo.optLong("size");
if (ComparatorUtils.equals(category, "server")) {
File currentJAR = new File(StableUtils.pathJoin(WorkContext.getCurrent().getPath(), ProjectConstants.LIB_NAME, downloadName));
if (currentJAR.exists() && ComparatorUtils.equals(currentJAR.length(), downloadSize)) {
//假如大小一样的jar包就不要下载了
String currentMD5 = getCurrentJarMD5(currentJAR);
String downloadMD5 = jo.optString("md5");
boolean exist = currentJAR.exists() && ComparatorUtils.equals(currentJAR.length(), downloadSize) && ComparatorUtils.equals(currentMD5, downloadMD5);
if (exist) {
// 如果jar包存在且MD5值和大小与oss上的一致 不下载
continue;
}
}
@ -630,6 +634,31 @@ public class UpdateMainDialog extends UIDialog {
}
}
/**
* 获取当前jar的md5
* @param currentJAR
* @return
*/
private String getCurrentJarMD5(File currentJAR) {
String md5 = StringUtils.EMPTY;
FileInputStream input = null;
try {
input = new FileInputStream(currentJAR);
md5 = DigestUtils.md5Hex(input);
} catch (Exception ignore) {
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
return md5;
}
/**
* jar包更新按钮监听器
*/

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.config.MarketConfig;
import com.fr.config.ServerPreferenceConfig;
import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoader;
import com.fr.design.bridge.exec.JSBridge;
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.GetPluginCategoriesExecutor;
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.ReadUpdateOnlineExecutor;
import com.fr.design.extra.exe.SearchOnlineExecutor;
@ -60,12 +62,34 @@ public class UpmBridge {
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>(){
@Override
protected Void doInBackground() throws Exception {
callback.invoke(window, Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start"));
UpmResourceLoader.INSTANCE.download();
UpmResourceLoader.INSTANCE.install();
return null;
@ -75,10 +99,10 @@ public class UpmBridge {
protected void done() {
try {
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");
} 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);
EventDispatcher.fire(DownloadEvent.ERROR, "error");
}
@ -86,6 +110,15 @@ public class UpmBridge {
}.execute();
}
/**
* 获取upm的版本信息
* @return 版本信息
*/
@JSBridge
public String getVersion() {
return ServerPreferenceConfig.getInstance().getOptimizedUPMVersion();
}
@JSBridge
public String i18nText(String key) {
return Toolkit.i18nText(key);
@ -107,6 +140,12 @@ public class UpmBridge {
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());
}
}
/**
* 使用系统浏览器打开网页
* @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()));
}
})
.withURL(UpmFinder.getMainResourcePath())
.withURL(UpmFinder.getMainResourcePath(), UpmUtils.renderMap())
.build();
EventDispatcher.listen(DownloadEvent.UPDATE, new Listener<String>() {
@Override
public void on(Event event, String param) {
modernUIPane.redirect(UpmFinder.getMainResourcePath(), UpmUtils.renderMap());
}
});
} else {
modernUIPane = new ModernUIPane.Builder<>()
.withComponent(WarnComponent.KEY)
@ -53,7 +59,7 @@ public class UpmShowPane extends BasicPane {
EventDispatcher.listen(DownloadEvent.SUCCESS, new Listener<String>() {
@Override
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;
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.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author richie
@ -18,4 +25,20 @@ public class UpmUtils {
}
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> {
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;
import com.fr.base.BaseUtils;
import com.fr.base.frpx.util.ImageIOHelper;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.ImageWithSuffix;
@ -70,7 +71,7 @@ public class ImageUtils {
return null;
}
BufferedImage srcImg = BaseUtils.readImage(imageFile.getPath());
Image desImg = srcImg;
BufferedImage desImg = srcImg;
try {
if (canbeCompressedToJPEG(imageFile)) {
@ -186,11 +187,23 @@ public class ImageUtils {
/**
* 获取图片类型
* 先根据ImageReader获取ImageReader获取不到就拿后缀
*
* @param imageFile 图片文件
* @return 图片类型(JPEG, PNG, GIF)
*/
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 {
ImageInputStream iis = ImageIO.createImageInputStream(imageFile);
Iterator<ImageReader> iter = ImageIO.getImageReaders(iis);
@ -226,7 +239,7 @@ public class ImageUtils {
* @param scale 缩放比例比例大于1时为放大小于1大于0为缩小
* @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) {
// 自动修正负数
scale = -scale;
@ -234,7 +247,7 @@ public class ImageUtils {
int width = mul(Integer.toString(srcImg.getWidth(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) {

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.TableLayoutHelper;
import com.fr.form.ui.NumberEditor;
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.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.ActionListener;
@ -23,6 +25,7 @@ import java.awt.event.ActionListener;
* Created by kerry on 2017/9/10.
*/
public class NumberEditorValidatePane extends JPanel {
private UICheckBox allowDecimalsCheckBox;
private UICheckBox allowNegativeCheckBox;
private UICheckBox setMaxValueCheckBox;
@ -104,6 +107,7 @@ public class NumberEditorValidatePane extends JPanel {
private void initListeners() {
allowDecimalsListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (allowDecimalsCheckBox.isSelected()) {
limitNumberPane.setVisible(true);
@ -129,8 +133,8 @@ public class NumberEditorValidatePane extends JPanel {
if (!setMinValueCheckBox.isSelected()) {
maxValueSpinner.getTextField().setMinValue(0.0);
}
Double minValue = Double.parseDouble("" + minValueSpinner.getValue());
Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue());
double minValue = Double.parseDouble("" + minValueSpinner.getValue());
double maxValue = Double.parseDouble("" + maxValueSpinner.getValue());
if (minValue < 0.0) {
minValueSpinner.setValue(0.0);
}
@ -143,10 +147,11 @@ public class NumberEditorValidatePane extends JPanel {
setMaxListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (setMaxValueCheckBox.isSelected()) {
maxValueSpinner.setEnabled(true);
Double value = new Double(0);
Double value = (double) 0;
if (setMinValueCheckBox.isSelected()) {
Double minValue = Double.parseDouble("" + minValueSpinner.getValue());
if (minValue > value) {
@ -163,10 +168,11 @@ public class NumberEditorValidatePane extends JPanel {
setMinListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (setMinValueCheckBox.isSelected()) {
minValueSpinner.setEnabled(true);
Double value = new Double(0);
Double value = (double) 0;
if (setMaxValueCheckBox.isSelected()) {
Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue());
if (maxValue < value) {
@ -177,7 +183,7 @@ public class NumberEditorValidatePane extends JPanel {
maxValueSpinner.getTextField().setMinValue(value);
} else {
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());
if (e.getMaxValue() == Double.MAX_VALUE) {
setMaxValueCheckBox.setSelected(false);
maxValueSpinner.setValue(new Double(Double.MAX_VALUE));
maxValueSpinner.setValue(Double.MAX_VALUE);
maxValueSpinner.setEnabled(false);
} else {
setMaxValueCheckBox.setSelected(true);
maxValueSpinner.setEnabled(true);
maxValueSpinner.setValue(new Double(e.getMaxValue()));
maxValueSpinner.setValue(e.getMaxValue());
}
if (e.getMinValue() == -Double.MAX_VALUE) {
setMinValueCheckBox.setSelected(false);
minValueSpinner.setValue(new Double(-Double.MAX_VALUE));
minValueSpinner.setValue(-Double.MAX_VALUE);
minValueSpinner.setEnabled(false);
} else {
setMinValueCheckBox.setSelected(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);
errorMsgTextField.setText(e.getRegErrorMessage());
}else{
} else {
errorMsgTextFieldPane.setVisible(false);
errorMsgTextField.setText(StringUtils.EMPTY);
}
@ -259,15 +265,19 @@ public class NumberEditorValidatePane extends JPanel {
if (setMinValueCheckBox.isSelected()) {
ob.setMinValue(minValueSpinner.getValue());
} else {
ob.setMinValue(-Double.MAX_VALUE);
}
if (setMaxValueCheckBox.isSelected()) {
ob.setMaxValue(maxValueSpinner.getValue());
} else {
ob.setMaxValue(Double.MAX_VALUE);
}
if(setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()){
if (setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()) {
errorMsgTextFieldPane.setVisible(true);
}else{
} else {
errorMsgTextFieldPane.setVisible(false);
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.ServerConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.UITitledBorder;
import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.design.fun.DesignerEnvProcessor;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
@ -303,10 +305,17 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
@Override
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(
this.remoteWorkspaceURL.getURL(),
this.usernameInput.getText(),
new String(this.passwordInput.getPassword()),
url,
username,
password,
this.certPathInput.getText(),
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"),
height: 30
});
let callback = function(text) {
let callback = function(status, text) {
download.setValue(text);
};
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.Utils;
import com.fr.decision.webservice.v10.map.WMSFactory;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
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.general.ComparatorUtils;
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.ViewCenter;
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.server.ChartGEOJSONHelper;
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.service.WMSFactory;
import com.fr.plugin.chart.type.GISLayerType;
import com.fr.plugin.chart.type.MapType;
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.MouseListener;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Mitisky on 16/5/11.
@ -380,7 +381,7 @@ public class VanChartMapSourceChoosePane extends JPanel implements UIObserver {
public void actionPerformed(ActionEvent e) {
new SwingWorker<Void, Double>() {
private java.util.List<WMSLayer> list;
private java.util.List<WMSLayer> list = new ArrayList<>();
@Override
protected Void doInBackground() throws Exception {
@ -392,7 +393,11 @@ public class VanChartMapSourceChoosePane extends JPanel implements UIObserver {
}
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;
}

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.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.tree.TreePath;
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.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
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.form.ui.Widget;
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 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 String[] selectedArray;
private ItemListener visibleItemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName();
if (selectedRoles == null) {
return;
}
if (widgets != null && widgets.length > 0) {
for (int i = 0; i < widgets.length; i++) {
widgets[i].changeVisibleAuthorityState(selectedRoles, widgetVisible.isSelected());
initSelectedArray();
if (ArrayUtils.isEmpty(selectedArray)) {
return;
}
for (String selectedRole : selectedArray) {
for (Widget widget : widgets) {
widget.changeVisibleAuthorityState(selectedRole, widgetVisible.isSelected());
}
}
doAfterAuthority();
@ -51,6 +64,7 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane {
private ItemListener usableItemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName();
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) {
return;
}
if (widgets != null && widgets.length > 0) {
for (int i = 0; i < widgets.length; i++) {
widgets[i].changeUsableAuthorityState(selectedRoles, widgetAvailable.isSelected());
initSelectedArray();
if (ArrayUtils.isEmpty(selectedArray)) {
return;
}
for (String selectedRole : selectedArray) {
for (Widget widget : widgets) {
widget.changeUsableAuthorityState(selectedRole, widgetAvailable.isSelected());
}
}
doAfterAuthority();
@ -78,7 +96,7 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane {
private void doAfterAuthority() {
designer.repaint();
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified();
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified();
RolesAlreadyEditedPane.getInstance().refreshDockingView();
RolesAlreadyEditedPane.getInstance().setReportAndFSSelectedRoles();
RolesAlreadyEditedPane.getInstance().repaint();
@ -90,6 +108,7 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane {
*
* @date 2014-12-21-下午6:19:43
*/
@Override
public void populateType() {
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
*/
@Override
public void populateName() {
String nameText = "";
if (widgets == null || widgets.length <= 0) {
return;
}
for (int i = 0; i < widgets.length; i++) {
nameText += "," + widgets[i].getClass().getSimpleName();
List<String> widgetNames = new ArrayList<String>();
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 面板
* @date 2014-12-21-下午6:19:03
*/
@Override
public JPanel populateCheckPane() {
checkPane.add(populateWidgetCheckPane(), BorderLayout.CENTER);
checkPane.setBorder(BorderFactory.createEmptyBorder(0, LEFT_CHECKPANE, 0, 0));
@ -138,10 +159,11 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane {
/**
* 对单元格区域进行操作时的权限编辑页面
*/
@Override
public void populateDetials() {
//更新说明要是JWorkBook的话,说明鼠标焦点又改变了
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setAuthorityMode(true);
signelSelection();
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().setAuthorityMode(true);
singleSelection();
refreshCreator();
//如果是布局选中不支持的元素则显示“该元素不支持权限控制”
@ -186,8 +208,8 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane {
//实现单选
private void signelSelection() {
if (HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().isJWorkBook()) {
private void singleSelection() {
if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().isJWorkBook()) {
//清工具栏
JComponent component = DesignerContext.getDesignerFrame().getToolbarComponent();
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();
}
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() {
return false;
}
@Override
public void saveSettings() {
// do nothing
}
}

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

@ -1,6 +1,5 @@
package com.fr.design.mainframe.widget.ui;
import com.fr.base.BaseUtils;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator;
@ -28,13 +27,13 @@ import com.fr.design.widget.Operator;
import com.fr.design.widget.ui.designer.component.WidgetAbsoluteBoundPane;
import com.fr.design.widget.ui.designer.component.WidgetBoundPane;
import com.fr.design.widget.ui.designer.component.WidgetCardTagBoundPane;
import com.fr.form.ui.FormWidgetHelper;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WScaleLayout;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
@ -91,6 +90,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
return new WidgetBoundPane(xCreator);
}
@Override
protected JPanel createContentPane() {
return null;
}
@ -218,21 +218,15 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
UITextField widgetNameField = widgetPropertyPane.getWidgetNameField();
String toSetWidgetName = widgetNameField.getText();
String currentWidgetName = widget.getWidgetName();
// 设置的组件名和当前组件名相同 直接返回
if (ComparatorUtils.equals(toSetWidgetName, currentWidgetName)) {
return;
}
String containerName = designer.getTarget().getContainer().getWidgetName();
Widget existWidget = FormWidgetHelper.findWidgetByName(widget, widgetNameField.getText());
// 判断设置的组件名是否和容器同名以及组件是否在容器在存在 满足任何其一 抛出提示
boolean exist = ComparatorUtils.equals(containerName, toSetWidgetName) || existWidget != null;
boolean exist = designer.getTarget().isNameExist(toSetWidgetName) && !ComparatorUtils.equals(toSetWidgetName, currentWidgetName);
if (exist) {
widgetNameField.setText(currentWidgetName);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Rename_Failure"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News"), JOptionPane.ERROR_MESSAGE, BaseUtils.readIcon("com/fr/design/form/images/joption_failure.png"));
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Rename_Failure"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News"), JOptionPane.ERROR_MESSAGE, IOUtils.readIcon("com/fr/design/form/images/joption_failure.png"));
return;
}
widgetPropertyPane.update(widget);
xCreator.resetCreatorName(toSetWidgetName);
// 上面一行更新了组件 这里必须重新调用getWidgetName
xCreator.resetCreatorName(widget.getWidgetName());
xCreator.resetVisible(widget.isVisible());
designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED);
return;
@ -262,6 +256,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
creator.firePropertyChange();
}
@Override
public String getIconPath() {
return StringUtils.EMPTY;
}

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();
xWFitLayout.removeAll();
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);
for (Component component : components) {
XCreator xCreator = (XCreator) component;
@ -208,6 +208,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
}
xwAbsoluteBodyLayout.add(component);
}
xWFitLayout.setBackupParent(xwAbsoluteBodyLayout);
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
formDesigner.getSelectionModel().setSelectedCreators(
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.filetree.FileNode;
import com.fr.general.ComparatorUtils;
import com.fr.general.ImageWithSuffix;
import com.fr.general.ModuleContext;
import com.fr.grid.Grid;
import com.fr.grid.GridUtils;
@ -89,6 +90,7 @@ import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.poly.PolyWorkSheet;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ArrayUtils;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.module.Module;
@ -621,7 +623,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
if (workBook instanceof WorkBookAdapter) {
elem.setValue(new CellImagePainter(cellImage));
} 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) {
File file = null;
try {
JSONArray jsonArray = dealWithSendFunctionContent(points);
if (jsonArray == null) {
return;
}
//生成json文件
fileEntityBuilder.generateFile(jsonArray, getFileEntityBuilder().getFolderName());
} 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
public <T> JSONArray dealWithSendFunctionContent(DataList<T> focusPoints) {
if (focusPoints == null) {
return null;
}
JSONArray ja = new JSONArray();
for(T t:focusPoints.getList()){
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.i18n.Toolkit;
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.log.FineLoggerFactory;
import com.fr.report.RemoteDesignConstants;
@ -46,7 +46,7 @@ public class DesignerSocketIO {
if (ArrayUtils.isNotEmpty(objects)) {
try {
LoggingEvent event = SerializerHelper.deserialize((byte[]) objects[0]);
DesignerLogHandler.getInstance().printLoggingEvent(event);
DesignerLogger.log(event);
} catch (Exception 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.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.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.image.ImageFileChooser;
import com.fr.design.style.background.image.ImagePreviewPane;
import com.fr.design.utils.ImageUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ImageWithSuffix;
import com.fr.report.cell.Elem;
import com.fr.report.cell.cellattr.CellImage;
import com.fr.report.cell.painter.CellImagePainter;
@ -28,6 +27,7 @@ import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.File;
/**
@ -46,11 +46,6 @@ public class SelectImagePane extends BasicPane {
private Image previewImage = null;
/**
* 默认格式
*/
private String suffix = PictureCollection.DEFAULT_SUFFIX;
private File imageFile;
public SelectImagePane() {
@ -127,13 +122,12 @@ public class SelectImagePane extends BasicPane {
if (selectedFile != null && selectedFile.isFile()) {
String filePath = selectedFile.getPath();
suffix = ImageIOHelper.getSuffix(filePath);
Image image = BaseUtils.readImage(filePath);
BufferedImage image = BaseUtils.readImage(filePath);
CoreGraphHelper.waitForImage(image);
imageFile = selectedFile;
setImageStyle();
previewPane.setImage(image);
previewPane.setImageWithSuffix(ImageWithSuffix.build(image, ImageUtils.getImageType(selectedFile)));
previewPane.setImageStyle(imageStyle);
previewImage = image;
} else {
@ -184,7 +178,6 @@ public class SelectImagePane extends BasicPane {
setImage((Image) value);
} else if (value instanceof CellImagePainter) {
setImage(((CellImagePainter) value).getImage());
suffix = ((CellImagePainter) value).getSuffix();
}
style = cell.getStyle();
@ -214,11 +207,8 @@ public class SelectImagePane extends BasicPane {
public CellImage update() {
CellImage cellImage = new CellImage();
cellImage.setImage(previewPane.getImage());
cellImage.setImage(previewPane.getImageWithSuffix());
cellImage.setStyle(this.imageStyle);
if (suffix != null) {
cellImage.setSuffix(suffix);
}
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];
Calculator c = Calculator.createCalculator();
TableDataConfig tableDataConfig = TableDataConfig.getInstance();
TableDataConfig tableDataConfig = TableDataConfig.getInstance().mirror();
Iterator<String> nameIt = tableDataConfig.getTableDatas().keySet().iterator();
while (nameIt.hasNext()) {
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() {
ElementCasePane reportPane = this.gridCorner.getElementCasePane();
// 全选时,停止编辑状态
reportPane.getGrid().stopEditing();
ColumnRow lastColumnRow = GridUtils.getAdjustLastColumnRowOfReportPane(reportPane);
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;
import com.fr.design.DesignerEnvManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.bbs.BBSConstants;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
@ -26,6 +27,7 @@ public class SplashContext {
public static final String SPLASH_PATH = getSplashPath();
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 String THANKS = Toolkit.i18nText("Fine-Design_Report_Thanks_To");
private static final SplashContext SPLASH_CONTEXT = new SplashContext();
@ -147,7 +149,7 @@ public class SplashContext {
if (shouldShowThanks()) {
tryFetchOnline();
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";
}
}
}
}
Loading…
Cancel
Save