Browse Source

Merge remote-tracking branch 'origin/feature/x' into feature/x

feature/x
Hoky 3 years ago
parent
commit
e9c26f63c2
  1. 3
      build.gradle
  2. 107
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java
  3. 0
      designer-base/src/main/java/com/fr/design/deeplink/DeepLink.java
  4. 184
      designer-base/src/main/java/com/fr/design/deeplink/DeepLinkCore.java
  5. 16
      designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java
  6. 3
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  7. 4
      designer-base/src/main/java/com/fr/design/report/fit/FormFitAttrModelType.java
  8. 14
      designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java
  9. 14
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  10. 2
      designer-base/src/main/java/com/fr/file/FILEFactory.java
  11. 55
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java
  12. 5
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java
  13. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java
  14. 16
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java
  15. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java
  16. 14
      designer-form/src/main/java/com/fr/design/designer/beans/events/AddingWidgetListenerTable.java
  17. 10
      designer-form/src/main/java/com/fr/design/designer/beans/models/DraggingModel.java
  18. 10
      designer-form/src/main/java/com/fr/design/fit/NewJForm.java
  19. 2
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java
  20. 6
      designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java
  21. 56
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  22. 17
      designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java
  23. 67
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java
  24. 48
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineDownloadPackagePane.java
  25. 13
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java
  26. 21
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java
  27. 31
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopPane.java
  28. 19
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/ComposedNativeBridges.java
  29. 3
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeAuthBridge.java
  30. 13
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeBrowserBridge.java
  31. 170
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java
  32. 27
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeTaskBridge.java
  33. 29
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/SafeJSFunctionInvoker.java
  34. 15
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/widgetpackage/OnlineWidgetPackagesShowPane.java
  35. 7
      designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java
  36. 20
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java
  37. 144
      designer-realize/src/main/java/com/fr/design/deeplink/DeepLinkManager.java
  38. 171
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  39. 7
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java
  40. 12
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java
  41. 3
      designer-realize/src/main/java/com/fr/start/MainDesigner.java

3
build.gradle

@ -9,6 +9,7 @@ plugins {
// //
ext { ext {
frVersion = "" frVersion = ""
cbbVersion = ""
outputPath = "build" outputPath = "build"
ignoreTestFailureSetting = true ignoreTestFailureSetting = true
languageLevelSetting = 1.8 languageLevelSetting = 1.8
@ -60,6 +61,8 @@ allprojects {
} }
dependencies { dependencies {
implementation 'com.fr.essential:fine-essential:' + cbbVersion
implementation 'com.fr.cbb:fine-universal-skeleton:' + cbbVersion
implementation 'com.install4j:install4j-runtime:8.0.4' implementation 'com.install4j:install4j-runtime:8.0.4'
implementation 'com.fr.third:jxbrowser:6.23' implementation 'com.fr.third:jxbrowser:6.23'
implementation 'com.fr.third:jxbrowser-mac:6.23' implementation 'com.fr.third:jxbrowser-mac:6.23'

107
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java

@ -65,24 +65,25 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
} }
/** /**
* @param: component loadingBar的父弹框如果不设置父弹框的话可能出现loadingBar隐藏在一个弹框后的情况 * @param component loadingBar的父弹框如果不设置父弹框的话可能出现loadingBar隐藏在一个弹框后的情况
* @param: storeProcedure 存储过程 * @param storeProcedure 存储过程
* @param: storeprocedureName 存储过程的名字(某些情况下可以为空) * @param storeprocedureName 存储过程的名字(某些情况下可以为空)
* @param: dsName 存储过程一个返回数据集的名字 * @param dsName 存储过程一个返回数据集的名字
* @param: needLoad 是否要加载 * @param needLoad 是否要加载
**/ **/
public StoreProcedureDataWrapper(Component component, StoreProcedure storeProcedure, String storeprocedureName, String dsName, boolean needLoad) { public StoreProcedureDataWrapper(Component component, StoreProcedure storeProcedure, String storeprocedureName, String dsName, boolean needLoad) {
this.dsName = dsName; this.dsName = dsName;
this.storeProcedure = storeProcedure; this.storeProcedure = storeProcedure;
this.storeProcedure.setCalculating(false); this.storeProcedure.setCalculating(false);
this.storeprocedureName = storeprocedureName; this.storeprocedureName = storeprocedureName;
if (needLoad) {
setWorker();
}
if (component == null) { if (component == null) {
component = new JFrame(); component = new JFrame();
} }
if (needLoad) {
setWorker(component);
}
loadingBar = new AutoProgressBar(component, Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) { loadingBar = new AutoProgressBar(component, Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) {
@Override
public void doMonitorCanceled() { public void doMonitorCanceled() {
getWorker().cancel(true); getWorker().cancel(true);
} }
@ -93,16 +94,17 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
* 数据集执行结果返回的所有字段 * 数据集执行结果返回的所有字段
* *
* @return 数据集执行结果返回的所有字段 * @return 数据集执行结果返回的所有字段
* * @date 2014-12-3-下午7:43:17
* */
* @date 2014-12-3-下午7:43:17 @Override
*
*/
public List<String> calculateColumnNameList() { public List<String> calculateColumnNameList() {
if (columnNameList != null) { if (columnNameList != null) {
return columnNameList; return columnNameList;
} }
if (!createStore(false)) {
try {
createStore(false);
} catch (Exception e) {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Engine_No_TableData")); FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Engine_No_TableData"));
return new ArrayList<String>(); return new ArrayList<String>();
} }
@ -114,11 +116,9 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
* 生成子节点 * 生成子节点
* *
* @return 节点数组 * @return 节点数组
* * @date 2014-12-3-下午7:06:47
* */
* @date 2014-12-3-下午7:06:47 @Override
*
*/
public ExpandMutableTreeNode[] load() { public ExpandMutableTreeNode[] load() {
List<String> namelist; List<String> namelist;
if (storeProcedure.isCalculating()) { if (storeProcedure.isCalculating()) {
@ -134,23 +134,16 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
return res; return res;
} }
private boolean createStore(boolean needLoadingBar) { private void createStore(boolean needLoadingBar) throws Exception {
try { dataModels = DesignTableDataManager.createLazyDataModel(storeProcedure, needLoadingBar);
dataModels = DesignTableDataManager.createLazyDataModel(storeProcedure, needLoadingBar); if (dataModels != null && dataModels.length != 0) {
if (dataModels == null || dataModels.length == 0) { for (ProcedureDataModel dataModel : dataModels) {
return false; if (ComparatorUtils.equals(this.dsName, storeprocedureName + "_" + dataModel.getName())) {
} procedureDataModel = dataModel;
for (int i = 0; i < dataModels.length; i++) {
if (ComparatorUtils.equals(this.dsName, storeprocedureName + "_" + dataModels[i].getName())) {
procedureDataModel = dataModels[i];
break; break;
} }
} }
return true;
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return false;
} }
@Override @Override
@ -159,17 +152,15 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
} }
/** /**
* 预览数据 * 预览数据
* *
* @param previewModel 预览模式, 全部还是一个 * @param previewModel 预览模式, 全部还是一个
* * @date 2014-12-3-下午7:05:50
* */
* @date 2014-12-3-下午7:05:50
*
*/
public void previewData(final int previewModel) { public void previewData(final int previewModel) {
this.previewModel = previewModel; this.previewModel = previewModel;
connectionBar = new AutoProgressBar(new JFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Now_Create_Connection"), "", 0, 100) { connectionBar = new AutoProgressBar(new JFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Now_Create_Connection"), "", 0, 100) {
@Override
public void doMonitorCanceled() { public void doMonitorCanceled() {
connectionBar.close(); connectionBar.close();
worker.cancel(true); worker.cancel(true);
@ -178,8 +169,9 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
worker.execute(); worker.execute();
} }
private void setWorker() { private void setWorker(final Component parent) {
worker = new SwingWorker<Void, Void>() { worker = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception { protected Void doInBackground() throws Exception {
loadingBar.close(); loadingBar.close();
PreviewTablePane.resetPreviewTable(); PreviewTablePane.resetPreviewTable();
@ -195,6 +187,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
return null; return null;
} }
@Override
public void done() { public void done() {
try { try {
get(); get();
@ -206,13 +199,15 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
case StoreProcedureDataWrapper.PREVIEW_ONE: case StoreProcedureDataWrapper.PREVIEW_ONE:
previewData(); previewData();
break; break;
default:
break;
} }
} catch (Exception e) { } catch (Exception e) {
loadingBar.close();
if (!(e instanceof CancellationException)) { if (!(e instanceof CancellationException)) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage()); FineJOptionPane.showMessageDialog(parent, e.getMessage());
} }
loadingBar.close();
} }
} }
}; };
@ -227,10 +222,9 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
/** /**
* 预览返回的一个数据集 * 预览返回的一个数据集
* *
* * @date 2014-12-3-下午7:42:53
* @date 2014-12-3-下午7:42:53 */
* @Override
*/
public void previewData() { public void previewData() {
previewData(-1, -1); previewData(-1, -1);
} }
@ -240,13 +234,11 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
/** /**
* 预览返回的一个数据集带有显示值和实际值的标记结果 * 预览返回的一个数据集带有显示值和实际值的标记结果
* *
* @param keyIndex 实际值 * @param keyIndex 实际值
* @param valueIndex 显示值 * @param valueIndex 显示值
* * @date 2014-12-3-下午7:42:27
* */
* @date 2014-12-3-下午7:42:27 @Override
*
*/
public void previewData(final int keyIndex, final int valueIndex) { public void previewData(final int keyIndex, final int valueIndex) {
PreviewTablePane.previewStoreData(procedureDataModel, keyIndex, valueIndex); PreviewTablePane.previewStoreData(procedureDataModel, keyIndex, valueIndex);
} }
@ -257,7 +249,9 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
*/ */
public void previewAllTable() { public void previewAllTable() {
if (procedureDataModel == null) { if (procedureDataModel == null) {
if (!createStore(true)) { try {
createStore(true);
} catch (Exception e) {
return; return;
} }
} }
@ -269,6 +263,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
return dsName; return dsName;
} }
@Override
public TableData getTableData() { public TableData getTableData() {
return storeProcedure; return storeProcedure;
} }
@ -282,10 +277,12 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
* *
* @return 是否异常 * @return 是否异常
*/ */
@Override
public boolean isUnusual() { public boolean isUnusual() {
return false; return false;
} }
@Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
return obj instanceof StoreProcedureDataWrapper return obj instanceof StoreProcedureDataWrapper
&& ComparatorUtils.equals(this.dsName, ((StoreProcedureDataWrapper) obj).getTableDataName()) && ComparatorUtils.equals(this.dsName, ((StoreProcedureDataWrapper) obj).getTableDataName())

0
designer-realize/src/main/java/com/fr/design/deeplink/DeepLink.java → designer-base/src/main/java/com/fr/design/deeplink/DeepLink.java

184
designer-base/src/main/java/com/fr/design/deeplink/DeepLinkCore.java

@ -0,0 +1,184 @@
package com.fr.design.deeplink;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.startup.FineStartupNotificationFactory;
import com.fr.design.startup.FineStartupNotificationProvider;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.third.org.apache.http.NameValuePair;
import com.fr.web.URLUtils;
import javax.swing.SwingUtilities;
import java.awt.Color;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2022/1/6
*/
public class DeepLinkCore {
protected DeepLinkCore(){}
private static final DeepLinkCore instance = new DeepLinkCore();
public static DeepLinkCore getInstance(){
return instance;
}
private String pendingURL;
private final List<DeepLink> deepLinkList = new ArrayList<>();
private boolean isDesignerStartupCompleted = false;
public void register(DeepLink deepLink) {
if (deepLink != null) {
deepLinkList.add(deepLink);
}
}
public void start(String[] args) {
if (OperatingSystem.isWindows()) {
if (args.length > 0) {
receiveDeeplink(args[0]);
}
}
if (OperatingSystem.isWindows() && args.length > 0) {
receiveDeeplink(args[0]);
}
FineStartupNotificationFactory.getNotification()
.registerStartupListener(new FineStartupNotificationProvider.Listener() {
@Override
public void startupPerformed(String parameters) {
receiveDeeplink(parameters);
}
});
EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener<Null>() {
@Override
public void on(Event event, Null param) {
EventDispatcher.stopListen(this);
isDesignerStartupCompleted = true;
if (canConsumePendingURL()) {
consumePendingURL();
}
}
});
}
public void receiveDeeplink(String url) {
if (canAcceptNewURL()) {
acceptNewURL(url);
if (canConsumePendingURL()) {
consumePendingURL();
}
}
}
public void receiveDeeplink2(String url) {
if (canAcceptNewURL()) {
acceptNewURL(url);
if (canConsumePendingURL()) {
consumePendingURL();
} else {
Frame frame = new Frame("can not ConsumePendingURL");
frame.setSize(400, 400);
frame.setBackground(Color.BLACK);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowEvent){
frame.dispose();
}
});
frame.setVisible(true);
}
} else {
Frame frame = new Frame("can not AcceptNewURL");
frame.setSize(400, 400);
frame.setBackground(Color.BLACK);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowEvent){
frame.dispose();
}
});
frame.setVisible(true);
}
}
private boolean canAcceptNewURL() {
return StringUtils.isEmpty(this.pendingURL);
}
private void acceptNewURL(String url) {
this.pendingURL = url;
}
private boolean canConsumePendingURL() {
return StringUtils.isNotEmpty(this.pendingURL) && isDesignerStartupCompleted;
}
private void consumePendingURL() {
String host = null;
String path = null;
Map<String, Object> params = new HashMap<>();
URL url = null;
try {
url = new URL(null, this.pendingURL, new URLStreamHandler() {
@Override
protected URLConnection openConnection(URL u) throws IOException {
return null;
}
});
} catch (MalformedURLException ignored) {}
if (url != null) {
host = url.getHost();
path = url.getPath();
List<NameValuePair> pairs = URLUtils.parse(url.getQuery());
for (NameValuePair pair: pairs) {
params.put(pair.getName(), pair.getValue());
}
}
FineLoggerFactory.getLogger().info("consume deep link: " + this.pendingURL);
performDeepLinks(this.pendingURL, host, path, params);
markPendingURLConsumed();
}
private void performDeepLinks(String url, String host, String path, Map<String, Object> params) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
for (DeepLink deepLink: deepLinkList) {
if (deepLink.accept(url, host, path, params)) {
deepLink.run(url, host, path, params);
}
}
}
});
}
private void markPendingURLConsumed() {
this.pendingURL = null;
}
}

16
designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java

@ -441,19 +441,21 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
Object value = helpDOCList.getSelectedValue(); Object value = helpDOCList.getSelectedValue();
if (value instanceof HelpDocument) { if (value instanceof HelpDocument) {
String url = ((HelpDocument) value).getDocumentUrl(); String url = ((HelpDocument) value).getDocumentUrl();
try { browse(url);
Desktop.getDesktop().browse(new URI(url));
} catch (IOException ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
} catch (URISyntaxException ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
}
} }
} }
} }
}); });
} }
private void browse(String url){
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException | URISyntaxException ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
}
}
private void initHelpDOCListRender() { private void initHelpDOCListRender() {
helpDOCList.setCellRenderer(new DefaultListCellRenderer() { helpDOCList.setCellRenderer(new DefaultListCellRenderer() {
@Override @Override

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

@ -51,7 +51,6 @@ import java.awt.event.ItemListener;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayDeque; import java.util.ArrayDeque;
@ -259,7 +258,7 @@ public class DesignerLogHandler {
return; return;
} }
TRL trl = new TRL(href); TRL trl = new TRL(href);
DesignerContext.getDesignerFrame().openTemplate(FILEFactory.createFILE(ProjectConstants.REPORTLETS_NAME + File.separator + trl.getTemplatePath())); DesignerContext.getDesignerFrame().openTemplate(FILEFactory.createFILE(ProjectConstants.REPORTLETS_NAME + FILEFactory.SEPARATOR + trl.getTemplatePath()));
JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (currentEditingTemplate != null) { if (currentEditingTemplate != null) {
currentEditingTemplate.navigate(trl); currentEditingTemplate.navigate(trl);

4
designer-base/src/main/java/com/fr/design/report/fit/FormFitAttrModelType.java

@ -27,8 +27,8 @@ public enum FormFitAttrModelType {
@Override @Override
public Item[] getAbsoluteLayoutSaleAttr() { public Item[] getAbsoluteLayoutSaleAttr() {
return new Item[]{ return new Item[]{
new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Scaling_Mode_Fit"), WAbsoluteLayout.STATE_FIT), new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Bidirectional_Adaptive"), WAbsoluteLayout.STATE_FIT),
new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Scaling_Mode_Fixed"), WAbsoluteLayout.STATE_FIXED) new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-No"), WAbsoluteLayout.STATE_FIXED)
}; };
} }

14
designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java

@ -17,8 +17,11 @@ import com.teamdev.jxbrowser.engine.EngineOptions;
import com.teamdev.jxbrowser.engine.RenderingMode; import com.teamdev.jxbrowser.engine.RenderingMode;
import com.teamdev.jxbrowser.event.Observer; import com.teamdev.jxbrowser.event.Observer;
import com.teamdev.jxbrowser.js.JsObject; import com.teamdev.jxbrowser.js.JsObject;
import com.teamdev.jxbrowser.net.Network;
import com.teamdev.jxbrowser.net.Scheme; import com.teamdev.jxbrowser.net.Scheme;
import com.teamdev.jxbrowser.net.callback.VerifyCertificateCallback;
import com.teamdev.jxbrowser.view.swing.BrowserView; import com.teamdev.jxbrowser.view.swing.BrowserView;
import org.jetbrains.annotations.Nullable;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -108,6 +111,17 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
} }
Engine engine = Engine.newInstance(builder.build()); Engine engine = Engine.newInstance(builder.build());
if (DesignerEnvManager.getEnvManager().isOpenDebug()) {
// 调试模式下,禁止HTTPS证书验证,使得可以正常访问商城测试服务器等
Network network = engine.network();
network.set(VerifyCertificateCallback.class, new VerifyCertificateCallback() {
@Nullable
@Override
public Response on(Params params) {
return VerifyCertificateCallback.Response.valid();
}
});
}
browser = engine.newBrowser(); browser = engine.newBrowser();
// 初始化的时候,就把命名空间对象初始化好,确保window.a.b.c("a.b.c"为命名空间)对象都是初始化过的 // 初始化的时候,就把命名空间对象初始化好,确保window.a.b.c("a.b.c"为命名空间)对象都是初始化过的

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

@ -5,6 +5,7 @@ import com.fr.base.ServerConfig;
import com.fr.concurrent.NamedThreadFactory; import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.deeplink.DeepLinkCore;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.fun.DesignerEnvProcessor;
import com.fr.design.gui.UILookAndFeel; import com.fr.design.gui.UILookAndFeel;
@ -26,10 +27,15 @@ import com.fr.start.ServerStarter;
import com.fr.value.NotNullLazyValue; import com.fr.value.NotNullLazyValue;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.UIManager; import javax.swing.UIManager;
import java.awt.Color;
import java.awt.Desktop; import java.awt.Desktop;
import java.awt.Font; import java.awt.Font;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.File; import java.io.File;
@ -213,6 +219,14 @@ public class DesignUtils {
DesignerContext.getDesignerFrame().openTemplate(new FileFILE(f)); DesignerContext.getDesignerFrame().openTemplate(new FileFILE(f));
} }
}); });
} else {
String url = line;
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
DeepLinkCore.getInstance().receiveDeeplink2(url);
}
});
} }
} }
} }

2
designer-base/src/main/java/com/fr/file/FILEFactory.java

@ -1,6 +1,5 @@
package com.fr.file; package com.fr.file;
import com.fr.base.FRContext;
import com.fr.design.file.NodeAuthProcessor; import com.fr.design.file.NodeAuthProcessor;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -10,6 +9,7 @@ public class FILEFactory {
public static final String FILE_PREFIX = "file://"; public static final String FILE_PREFIX = "file://";
public static final String ENV_PREFIX = "env://"; public static final String ENV_PREFIX = "env://";
public static final String WEBREPORT_PREFIX = "webreport://"; public static final String WEBREPORT_PREFIX = "webreport://";
public static final String SEPARATOR = "/";
private FILEFactory() { private FILEFactory() {
} }

55
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java

@ -10,7 +10,9 @@ import com.fr.chart.base.AttrChangeConfig;
import com.fr.chart.base.AttrChangeType; import com.fr.chart.base.AttrChangeType;
import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.SwitchTitle;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.AttrScrollPane;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
@ -22,6 +24,7 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -77,11 +80,26 @@ public class ChangeConfigPane extends BasicBeanPane<ChartCollection> {
private int selectedChart; // 设置面板里面选取的图表,不是真正切换的图表 private int selectedChart; // 设置面板里面选取的图表,不是真正切换的图表
public ChangeConfigPane(){ public ChangeConfigPane(){
init();
this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 15, 10, 15));
this.add(createScrollPane(), BorderLayout.CENTER);
}
private JPanel createScrollPane() {
return new AttrScrollPane() {
@Override
protected JPanel createContentPane() {
return contentPane;
}
};
}
private void init() {
initButtonGroup(); initButtonGroup();
configPane = createConfigPane(); configPane = createConfigPane();
contentPane = createContentPane(); contentPane = createContentPane();
contentPane.setBorder(BorderFactory.createEmptyBorder(CONSTANT_TEN, CONSTANT_THIRTY, CONSTANT_TEN, CONSTANT_THIRTY)); contentPane.setBorder(BorderFactory.createEmptyBorder(CONSTANT_TEN, CONSTANT_THIRTY, CONSTANT_TEN, CONSTANT_THIRTY));
this.add(contentPane, BorderLayout.CENTER);
} }
private JPanel createContentPane() { private JPanel createContentPane() {
@ -172,17 +190,18 @@ public class ChangeConfigPane extends BasicBeanPane<ChartCollection> {
chartTypesPane = new JPanel(); chartTypesPane = new JPanel();
chartTypesPane.setLayout(new BoxLayout(chartTypesPane, BoxLayout.Y_AXIS)); chartTypesPane.setLayout(new BoxLayout(chartTypesPane, BoxLayout.Y_AXIS));
chartTypesPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
switchTitlePane.setLayout(new CardLayout()); switchTitlePane.setLayout(new CardLayout());
buttonContentPane.add(chartTypesPane, BorderLayout.NORTH); JPanel titleEditPane = TableLayout4VanChartHelper.createGapTableLayoutPane(
buttonContentPane.add( Toolkit.i18nText("Fine-Design_Chart_Switch_Title_Label"),
TableLayout4VanChartHelper.createGapTableLayoutPane( switchTitlePane,
Toolkit.i18nText("Fine-Design_Chart_Switch_Title_Label"), EDIT_AREA_WIDTH
switchTitlePane,
EDIT_AREA_WIDTH
),
BorderLayout.CENTER
); );
titleEditPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
buttonContentPane.add(chartTypesPane, BorderLayout.NORTH);
buttonContentPane.add(titleEditPane, BorderLayout.CENTER);
UIExpandablePane expandablePane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Button_And_Rotation_Content"), 20, buttonContentPane) { UIExpandablePane expandablePane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Button_And_Rotation_Content"), 20, buttonContentPane) {
protected void setcontentPanelontentPanelBorder() { protected void setcontentPanelontentPanelBorder() {
@ -220,18 +239,16 @@ public class ChangeConfigPane extends BasicBeanPane<ChartCollection> {
private void populateSwitchTitlePane(int chartIndex, ChartCollection collection) { private void populateSwitchTitlePane(int chartIndex, ChartCollection collection) {
Chart chart = collection.getChart(chartIndex, Chart.class); Chart chart = collection.getChart(chartIndex, Chart.class);
Object switchTitle = chart.getSwitchTitle(); SwitchTitle switchTitle = chart.getSwitchTitle();
String result; Object content = switchTitle.getContent();
if (switchTitle != null) { String result = StringUtils.EMPTY;
if (switchTitle instanceof BaseFormula) { if (content != null) {
result = ((BaseFormula) switchTitle).getContent(); if (content instanceof BaseFormula) {
result = ((BaseFormula) content).getContent();
} else { } else {
result = Utils.objectToString(switchTitle); result = Utils.objectToString(content);
} }
} else {
result = Toolkit.i18nText("Fine-Design_Chart_Chart") + (chartIndex + 1);
} }
TinyFormulaPane title = new TinyFormulaPane(); TinyFormulaPane title = new TinyFormulaPane();
title.populateBean(result); title.populateBean(result);
switchTitles.add(title); switchTitles.add(title);
@ -330,7 +347,7 @@ public class ChangeConfigPane extends BasicBeanPane<ChartCollection> {
} else { } else {
titleObj = titleString; titleObj = titleString;
} }
collection.getChart(i, Chart.class).setSwitchTitle(titleObj); collection.getChart(i, Chart.class).setSwitchTitle(new SwitchTitle(titleObj));
} }
} }

5
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java

@ -7,7 +7,6 @@ import com.fr.chart.chartattr.Bar2DPlot;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartdata.NormalReportDataDefinition; import com.fr.chart.chartdata.NormalReportDataDefinition;
import com.fr.decision.base.util.UUIDUtil;
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.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
@ -28,7 +27,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
@ -192,10 +190,9 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor
Plot plot = collection.getSelectedChart().getPlot(); Plot plot = collection.getSelectedChart().getPlot();
if (definition instanceof NormalReportDataDefinition) { if (definition instanceof NormalReportDataDefinition) {
NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition; NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition;
reportDefinition.clearMoreCate(); reportDefinition.clearMoreCate();
updateMoreCate(reportDefinition, plot); updateMoreCate(reportDefinition, plot);
collection.updateAxisCategoryStyles();
} }
} }

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java

@ -246,6 +246,7 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD
normal.clearMoreCate(); normal.clearMoreCate();
updateMoreCate(normal, plot); updateMoreCate(normal, plot);
} }
collection.updateAxisCategoryStyles();
} }
protected void updateMoreCate(NormalTableDataDefinition normal, Plot plot) { protected void updateMoreCate(NormalTableDataDefinition normal, Plot plot) {
@ -256,5 +257,4 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD
} }
} }
} }
} }

16
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java

@ -46,6 +46,7 @@ import javax.swing.event.ChangeListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Component; 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;
import java.util.ArrayList; import java.util.ArrayList;
@ -264,7 +265,20 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
private JPanel createLabelContentPane() { private JPanel createLabelContentPane() {
labelContentPane = new JPanel(new BorderLayout()); labelContentPane = new JPanel(new BorderLayout());
showLogicPane = new JPanel(new BorderLayout()); showLogicPane = new JPanel(new BorderLayout());
labelStylePane = new JPanel(new CardLayout()); labelStylePane = new JPanel(new CardLayout()) {
@Override
public Dimension getPreferredSize() {
switch (showLogic.getSelectedIndex()) {
case 0:
return wholeDisplayLabelPanel.getPreferredSize();
case 1:
return categoryStylePane.getPreferredSize();
case -1:
default:
return super.getPreferredSize();
}
}
};
labelStylePane.add(wholeDisplayLabelPanel, WHOLE_DISPLAY); labelStylePane.add(wholeDisplayLabelPanel, WHOLE_DISPLAY);
labelStylePane.add(createCategoryStylePane(), LAYER_DISPLAY); labelStylePane.add(createCategoryStylePane(), LAYER_DISPLAY);
showLogicPane.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show_Logic"), showLogic), BorderLayout.NORTH); showLogicPane.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show_Logic"), showLogic), BorderLayout.NORTH);

2
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java

@ -68,7 +68,7 @@ public class VanChartCategoryStylePaneWithCheckBox extends JPanel {
Point comPoint = settingButton.getLocationOnScreen(); Point comPoint = settingButton.getLocationOnScreen();
Point arrowPoint = new Point(comPoint.x +settingButton.getWidth() - 25, comPoint.y + settingButton.getHeight()); Point arrowPoint = new Point(comPoint.x +settingButton.getWidth() - 25, comPoint.y + settingButton.getHeight());
Dimension size = settingPane.getPreferredSize(); Dimension size = settingPane.getPreferredSize();
UIBubbleFloatPane<VanChartAxisLabelStyle> pane = new UIBubbleFloatPane(Constants.LEFT, arrowPoint, settingPane, size.width, 216) { UIBubbleFloatPane<VanChartAxisLabelStyle> pane = new UIBubbleFloatPane(Constants.LEFT, arrowPoint, settingPane, size.width, 230) {
@Override @Override
public void updateContentPane() { public void updateContentPane() {

14
designer-form/src/main/java/com/fr/design/designer/beans/events/AddingWidgetListenerTable.java

@ -28,23 +28,13 @@ public class AddingWidgetListenerTable {
public void beforeAdded() { public void beforeAdded() {
for (final AddingWidgetListener listener : listeners) { for (final AddingWidgetListener listener : listeners) {
SwingUtilities.invokeLater(new Runnable() { listener.beforeAdded();
@Override
public void run() {
listener.beforeAdded();
}
});
} }
} }
public void afterAdded(boolean addResult) { public void afterAdded(boolean addResult) {
for (final AddingWidgetListener listener : listeners) { for (final AddingWidgetListener listener : listeners) {
SwingUtilities.invokeLater(new Runnable() { listener.afterAdded(addResult);
@Override
public void run() {
listener.afterAdded(addResult);
}
});
} }
} }

10
designer-form/src/main/java/com/fr/design/designer/beans/models/DraggingModel.java

@ -14,7 +14,6 @@ public class DraggingModel {
private MouseEvent currentDragEvent; private MouseEvent currentDragEvent;
private int creatorLeftTopX = -999; // 隐藏 private int creatorLeftTopX = -999; // 隐藏
private int creatorLeftTopY = -999; // 隐藏 private int creatorLeftTopY = -999; // 隐藏
private boolean dragNewWidget; // 是否正在拖拽一个新的组件下来
public DraggingModel() { public DraggingModel() {
@ -40,11 +39,6 @@ public class DraggingModel {
return this; return this;
} }
public DraggingModel dragNewWidget(boolean dragNewWidget) {
this.dragNewWidget = dragNewWidget;
return this;
}
public FormDesigner getDesigner() { public FormDesigner getDesigner() {
return designer; return designer;
} }
@ -79,10 +73,6 @@ public class DraggingModel {
return creatorLeftTopY; return creatorLeftTopY;
} }
public boolean isDragNewWidget() {
return dragNewWidget;
}
public void moveTo(int x, int y) { public void moveTo(int x, int y) {
XLayoutContainer container = designer.getDraggingHotspotLayout(); XLayoutContainer container = designer.getDraggingHotspotLayout();
LayoutAdapter adapter = container.getLayoutAdapter(); LayoutAdapter adapter = container.getLayoutAdapter();

10
designer-form/src/main/java/com/fr/design/fit/NewJForm.java

@ -179,11 +179,13 @@ public class NewJForm extends JForm {
FRFitLayoutAdapter layoutAdapter = (FRFitLayoutAdapter) adapter; FRFitLayoutAdapter layoutAdapter = (FRFitLayoutAdapter) adapter;
layoutAdapter.setEdit(true); layoutAdapter.setEdit(true);
layoutAdapter.calculateBounds(backupBounds, xwTitleLayout.getBounds(), xwTitleLayout, row, difference); layoutAdapter.calculateBounds(backupBounds, xwTitleLayout.getBounds(), xwTitleLayout, row, difference);
} else {
XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(xwTitleLayout);
if (parent != null && parent.toData() != null) {
parent.toData().setBounds(xwTitleLayout.toData(), xwTitleLayout.getBounds());
}
} }
XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(xwTitleLayout);
if (parent != null && parent.toData() != null) {
parent.toData().setBounds(xwTitleLayout.toData(), xwTitleLayout.getBounds());
}
} }

2
designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java

@ -459,13 +459,11 @@ public class EditingMouseListener extends MouseInputAdapter {
if (isSelectionDrag()) { if (isSelectionDrag()) {
stateModel.changeSelection(e); stateModel.changeSelection(e);
return;
} }
// 调整大小这边单独提出来,不跟后面拖组件混在一起,实在不好管理 // 调整大小这边单独提出来,不跟后面拖组件混在一起,实在不好管理
if (stateModel.isDraggingSize()) { if (stateModel.isDraggingSize()) {
stateModel.dragging(e); stateModel.dragging(e);
return;
} }
designer.startDraggingFormWidget(lastXCreator, lastPressEvent, e); designer.startDraggingFormWidget(lastXCreator, lastPressEvent, e);

6
designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java

@ -264,11 +264,7 @@ public class FormCreatorDropTarget extends DropTarget {
Point loc = dtde.getLocation(); Point loc = dtde.getLocation();
int x = designer.getRelativeX(loc.x); int x = designer.getRelativeX(loc.x);
int y = designer.getRelativeY(loc.y); int y = designer.getRelativeY(loc.y);
if (model.isDragNewWidget()) { designer.addWidgetToForm(creator, x, y);
designer.addNewWidget(creator, x, y);
} else {
designer.changeWidgetPlace(creator, x, y);
}
// 放到事件末尾执行 // 放到事件末尾执行
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override @Override

56
designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

@ -1248,16 +1248,16 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
* @param currentDragEvent * @param currentDragEvent
*/ */
public void startDraggingNewWidget(XCreator xCreator, MouseEvent startDragEvent, MouseEvent currentDragEvent) { public void startDraggingNewWidget(XCreator xCreator, MouseEvent startDragEvent, MouseEvent currentDragEvent) {
if (currentDragEvent == null || this.getDropTarget() != null) { if (currentDragEvent == null) {
return; return;
} }
instantiateCreator(xCreator);
draggingModel = new DraggingModel() draggingModel = new DraggingModel()
.designer(this) .designer(this)
.creator(xCreator) .creator(xCreator)
.startDragEvent(startDragEvent) .startDragEvent(startDragEvent)
.currentDragEvent(currentDragEvent) .currentDragEvent(currentDragEvent);
.dragNewWidget(true);
this.setDropTarget(new FormCreatorDropTarget(this, xCreator)); this.setDropTarget(new FormCreatorDropTarget(this, xCreator));
repaint(); repaint();
} }
@ -1270,15 +1270,15 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
* @param currentDragEvent * @param currentDragEvent
*/ */
public void startDraggingFormWidget(XCreator xCreator, MouseEvent startDragEvent, MouseEvent currentDragEvent) { public void startDraggingFormWidget(XCreator xCreator, MouseEvent startDragEvent, MouseEvent currentDragEvent) {
if (currentDragEvent == null || this.getDropTarget() != null) { if (currentDragEvent == null) {
return; return;
} }
backUpCreator(xCreator);
draggingModel = new DraggingModel() draggingModel = new DraggingModel()
.designer(this) .designer(this)
.creator(xCreator) .creator(xCreator)
.startDragEvent(startDragEvent) .startDragEvent(startDragEvent)
.currentDragEvent(currentDragEvent) .currentDragEvent(currentDragEvent);
.dragNewWidget(false);
XLayoutContainer container = this.getDraggingHotspotLayout(); XLayoutContainer container = this.getDraggingHotspotLayout();
LayoutAdapter adapter = container.getLayoutAdapter(); LayoutAdapter adapter = container.getLayoutAdapter();
adapter.dragging(this.getDraggingModel()); adapter.dragging(this.getDraggingModel());
@ -1318,7 +1318,14 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
DraggingModel model = this.draggingModel; DraggingModel model = this.draggingModel;
MouseEvent dragEvent = model.getCurrentDragEvent(); MouseEvent dragEvent = model.getCurrentDragEvent();
XCreator hotspot = this.getComponentAt(dragEvent.getX(), dragEvent.getY()); XCreator hotspot = this.getComponentAt(dragEvent.getX(), dragEvent.getY());
return XCreatorUtils.getHotspotContainer(hotspot); XLayoutContainer container = XCreatorUtils.getHotspotContainer(hotspot);
XLayoutContainer topLayout = container.getTopLayout();
// REPORT-66939 Tab比较特殊,它是又多个LayoutContainer组成,直接返回container会导致误判,需要先找到最上层topLayout,取其父layout才是正确结果
if (topLayout != null && container != topLayout) {
return (XLayoutContainer) topLayout.getParent();
} else {
return container;
}
} }
/** /**
@ -1520,7 +1527,10 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
private DesignerBaseOperate getLayoutBaseOperate(){ private DesignerBaseOperate getLayoutBaseOperate(){
FormSelection selection = this.getSelectionModel().getSelection(); FormSelection selection = this.getSelectionModel().getSelection();
XCreator creator = selection.getSelectedCreator(); XCreator creator = selection.getSelectedCreator();
XLayoutContainer container = (XLayoutContainer) creator.getParent(); XLayoutContainer container = null;
if (creator != null) {
container = (XLayoutContainer) creator.getParent();
}
if (container == null) { if (container == null) {
return new DefaultDesignerBaseOperate(); return new DefaultDesignerBaseOperate();
} }
@ -1987,27 +1997,25 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
return spacingLineDrawer; return spacingLineDrawer;
} }
private void instantiateCreator(XCreator creator) { public void instantiateCreator(XCreator creator) {
ModelUtil.renameWidgetName(this.getTarget(), creator); if (creator != null) {
creator.addNotify(); ModelUtil.renameWidgetName(this.getTarget(), creator);
creator.addNotify();
ComponentAdapter adapter = new CompositeComponentAdapter(this, creator);
adapter.initialize();
creator.putClientProperty(AdapterBus.CLIENT_PROPERTIES, adapter);
}
public void addNewWidget(XCreator creator, int x, int y) { ComponentAdapter adapter = new CompositeComponentAdapter(this, creator);
instantiateCreator(creator); adapter.initialize();
addWidgetToForm(creator, x, y); creator.putClientProperty(AdapterBus.CLIENT_PROPERTIES, adapter);
}
} }
public void changeWidgetPlace(XCreator creator, int x, int y) { public void backUpCreator(XCreator creator) {
creator.backupCurrentSize(); if (creator != null) {
creator.backupParent(); creator.backupCurrentSize();
addWidgetToForm(creator, x, y); creator.backupParent();
}
} }
private void addWidgetToForm(XCreator creator, int x, int y) { public void addWidgetToForm(XCreator creator, int x, int y) {
if(creator == null) { if(creator == null) {
return; return;
} }

17
designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java

@ -116,8 +116,8 @@ public class FormDesignerUI extends ComponentUI {
designer.getPainter().paint(g, designer.getArea().getHorizontalValue(), designer.getPainter().paint(g, designer.getArea().getHorizontalValue(),
designer.getArea().getVerticalValue() + designer.getParaHeight()); designer.getArea().getVerticalValue() + designer.getParaHeight());
} }
DraggingModel draggingModel = designer.getDraggingModel();
if (draggingModel != null && draggingModel.getCreator() != null) { if (needPaintDraggingBean()) {
// 当前正在添加的组件 // 当前正在添加的组件
paintDraggingBean(g); paintDraggingBean(g);
} }
@ -217,6 +217,19 @@ public class FormDesignerUI extends ComponentUI {
ComponentUtils.resetBuffer(dbcomponents); ComponentUtils.resetBuffer(dbcomponents);
} }
private boolean needPaintDraggingBean() {
DraggingModel draggingModel = designer.getDraggingModel();
if (draggingModel == null || draggingModel.getCreator() == null) {
return false;
}
XCreator creator = draggingModel.getCreator();
int leftTopX = draggingModel.getCreatorLeftTopX();
int leftTopY = draggingModel.getCreatorLeftTopY();
return leftTopX + creator.getWidth() > 0 && leftTopY + creator.getHeight() > 0;
}
private void paintAuthorityCreator(Graphics2D g2d, Rectangle creatorBounds) { private void paintAuthorityCreator(Graphics2D g2d, Rectangle creatorBounds) {
back_or_selection_rect.setRect(creatorBounds.getX(), creatorBounds.getY(), back_or_selection_rect.setRect(creatorBounds.getX(), creatorBounds.getY(),

67
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java

@ -337,41 +337,42 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
null, null,
this this
); );
return; } else {
} //如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层
//如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层 if (!isRightClickPopupMenuVisible() && (isMouseEnter || downloading)) {
if (!isRightClickPopupMenuVisible() && (isMouseEnter || downloading)) { Graphics2D g2d = (Graphics2D) g;
Graphics2D g2d = (Graphics2D) g; Composite oldComposite = g2d.getComposite();
Composite oldComposite = g2d.getComposite(); //画白色的编辑层
//画白色的编辑层 g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 20 / 100.0F));
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 20 / 100.0F)); g2d.setColor(COVER_COLOR);
g2d.setColor(COVER_COLOR); g2d.fillRect(x, y, w, h);
g2d.fillRect(x, y, w, h); g2d.setComposite(oldComposite);
g2d.setComposite(oldComposite); //画编辑按钮图标
//画编辑按钮图标 BufferedImage image = (process > 0 || downloading) ? WIDGET_DOWNLOADING_ICON : WIDGET_DOWNLOAD_ICON;
BufferedImage image = (process > 0 || downloading) ? WIDGET_DOWNLOADING_ICON : WIDGET_DOWNLOAD_ICON; g2d.drawImage(
g2d.drawImage( image,
image, (x + w / 2 - 12),
(x + w / 2 - 12), (y + h / 2 - 16),
(y + h / 2 - 16), image.getWidth(),
image.getWidth(), image.getHeight(),
image.getHeight(), null,
null, this
this );
); Stroke oldStroke = g2d.getStroke();
Stroke oldStroke = g2d.getStroke(); g2d.setStroke(XCreatorConstants.STROKE);
g2d.setStroke(XCreatorConstants.STROKE); g2d.setColor(Color.decode("#419BF9"));
g2d.setColor(Color.decode("#419BF9")); double arcAngle = downloading ? (36 + 360 * 0.9 * process) : 0.0;
double arcAngle = downloading ? (36 + 360 * 0.9 * process) : 0.0; g2d.drawArc(x + w / 2 - 12, y + h / 2 - 16, 24, 24, 90, -(int) arcAngle);
g2d.drawArc(x + w / 2 - 12, y + h / 2 - 16, 24, 24, 90, -(int) arcAngle); g2d.setColor(Color.WHITE);
g2d.setColor(Color.WHITE); g2d.setStroke(oldStroke);
g2d.setStroke(oldStroke); }
}
boolean isUnusable = !getWidget().isCompatibleWithCurrentEnv(); boolean isUnusable = !getWidget().isCompatibleWithCurrentEnv();
if (isUnusable) { if (isUnusable) {
paintUnusableMask((Graphics2D) g); paintUnusableMask((Graphics2D) g);
}
} }
if (this.parentPane != null) { if (this.parentPane != null) {
this.parentPane.refreshShowPaneUI(); this.parentPane.refreshShowPaneUI();
} }

48
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineDownloadPackagePane.java

@ -72,22 +72,6 @@ public class OnlineDownloadPackagePane extends OnlineWidgetSelectPane {
return false; return false;
} }
protected JPanel createWidgetPane() {
return new JPanel() {
@Override
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2d = (Graphics2D) g;
Composite oldComposite = g2d.getComposite();
AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.65f);
g2d.setComposite(composite);
g2d.setColor(Color.DARK_GRAY);
g2d.fillRect(0, 0, getWidth(), getHeight());
g2d.setComposite(oldComposite);
}
};
}
protected JPanel createContentPane(JPanel widgetPane) { protected JPanel createContentPane(JPanel widgetPane) {
JPanel panel = new JPanel() { JPanel panel = new JPanel() {
@Override @Override
@ -114,7 +98,20 @@ public class OnlineDownloadPackagePane extends OnlineWidgetSelectPane {
parentPane.resetWidgetDetailPane(packageId, getSharableWidgetProviders()); parentPane.resetWidgetDetailPane(packageId, getSharableWidgetProviders());
} }
} }
}); }) {
@Override
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Composite oldComposite = g2d.getComposite();
AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.65f);
g2d.setComposite(composite);
g2d.setColor(Color.DARK_GRAY);
g2d.fillRect(0, 0, getWidth(), getHeight());
g2d.setComposite(oldComposite);
super.paint(g);
}
};
panel.add(downloadProgressPane); panel.add(downloadProgressPane);
panel.add(widgetPane, BorderLayout.CENTER); panel.add(widgetPane, BorderLayout.CENTER);
return panel; return panel;
@ -125,10 +122,16 @@ public class OnlineDownloadPackagePane extends OnlineWidgetSelectPane {
final com.fr.design.extra.Process<Double> downloadProcess = aDouble -> { final com.fr.design.extra.Process<Double> downloadProcess = aDouble -> {
OnlineDownloadPackagePane.this.process = 0.8 * aDouble; OnlineDownloadPackagePane.this.process = 0.8 * aDouble;
downloadProgressPane.updateProgress(process); downloadProgressPane.updateProgress(process);
if (downloadProgressPane != null) {
downloadProgressPane.repaint();
}
}; };
final com.fr.design.extra.Process<Double> installProcess = aDouble -> { final com.fr.design.extra.Process<Double> installProcess = aDouble -> {
OnlineDownloadPackagePane.this.process = 0.8 + 0.2 * aDouble; OnlineDownloadPackagePane.this.process = 0.8 + 0.2 * aDouble;
downloadProgressPane.updateProgress(process); downloadProgressPane.updateProgress(process);
if (downloadProgressPane != null) {
downloadProgressPane.repaint();
}
}; };
downloadProcess.process(0.0D); downloadProcess.process(0.0D);
@ -220,6 +223,9 @@ public class OnlineDownloadPackagePane extends OnlineWidgetSelectPane {
File file = new File(filePath); File file = new File(filePath);
installProcess.process(0.0D); installProcess.process(0.0D);
downloadProgressPane.changeState(); downloadProgressPane.changeState();
if (downloadProgressPane != null) {
downloadProgressPane.repaint();
}
InstallUtils.InstallResult result = null; InstallUtils.InstallResult result = null;
try { try {
if (file.exists()) { if (file.exists()) {
@ -250,4 +256,12 @@ public class OnlineDownloadPackagePane extends OnlineWidgetSelectPane {
} }
} }
} }
@Override
public void refreshShowPaneUI() {
if (downloadProgressPane != null && downloadProgressPane.isShowing()) {
downloadProgressPane.invalidate();
downloadProgressPane.repaint();
}
}
} }

13
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java

@ -16,6 +16,7 @@ import com.fr.form.share.bean.OnlineShareWidget;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.plaf.basic.BasicButtonUI; import javax.swing.plaf.basic.BasicButtonUI;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -44,6 +45,7 @@ public class OnlineWidgetTabPane extends JPanel {
private boolean packagePaneCreated = false; private boolean packagePaneCreated = false;
private final List<TabChangeListener> tabChangeListeners; private final List<TabChangeListener> tabChangeListeners;
private OnlineEmbedFilterShowPane embedFilterShowPane; private OnlineEmbedFilterShowPane embedFilterShowPane;
private OnlineWidgetPackagesShowPane widgetPackagesShowPane;
public OnlineWidgetTabPane(OnlineShareWidget[] sharableWidgets, OnlineShareWidget[] sharableWidgetPackage) { public OnlineWidgetTabPane(OnlineShareWidget[] sharableWidgets, OnlineShareWidget[] sharableWidgetPackage) {
tabChangeListeners = new ArrayList<>(); tabChangeListeners = new ArrayList<>();
@ -70,7 +72,8 @@ public class OnlineWidgetTabPane extends JPanel {
ComponentCollector.getInstance().collectCmpPktClick(); ComponentCollector.getInstance().collectCmpPktClick();
//延迟组件包面板的初始化,防止组件面板里组件和缩略图和组件包面板里组件的缩略图一起加载 //延迟组件包面板的初始化,防止组件面板里组件和缩略图和组件包面板里组件的缩略图一起加载
if (!packagePaneCreated) { if (!packagePaneCreated) {
centerPane.add(new OnlineWidgetPackagesShowPane(sharableWidgetPackages), COMPONENT_PACKAGE); widgetPackagesShowPane = new OnlineWidgetPackagesShowPane(sharableWidgetPackages);
centerPane.add(widgetPackagesShowPane, COMPONENT_PACKAGE);
packagePaneCreated = true; packagePaneCreated = true;
} }
cardLayout.show(centerPane, COMPONENT_PACKAGE); cardLayout.show(centerPane, COMPONENT_PACKAGE);
@ -89,6 +92,8 @@ public class OnlineWidgetTabPane extends JPanel {
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
} }
private JPanel createMiniShopEntryPane() { private JPanel createMiniShopEntryPane() {
JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane();
container.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); container.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
@ -104,7 +109,7 @@ public class OnlineWidgetTabPane extends JPanel {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (OnlineShopUtils.testConnection() && ComponentShareUtil.isShowMiniShopWindow()) { if (OnlineShopUtils.testConnection() && ComponentShareUtil.isShowMiniShopWindow()) {
MiniComponentShopDialog.getInstance().show(); MiniComponentShopDialog.getInstance().showFromOnlineRepoPane();
FormWidgetDetailPane.getInstance().switch2Local(); FormWidgetDetailPane.getInstance().switch2Local();
FormWidgetDetailPane.getInstance().enterWidgetLib(); FormWidgetDetailPane.getInstance().enterWidgetLib();
} else { } else {
@ -136,6 +141,10 @@ public class OnlineWidgetTabPane extends JPanel {
if (embedFilterShowPane != null) { if (embedFilterShowPane != null) {
this.embedFilterShowPane.refreshUI(); this.embedFilterShowPane.refreshUI();
} }
if (headGroup.getSelectedIndex() == COMPONENT_PACKAGE_TAB_INDEX && widgetPackagesShowPane != null) {
widgetPackagesShowPane.refreshShowPaneUI();
}
} }

21
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java

@ -1,8 +1,12 @@
package com.fr.design.mainframe.share.ui.online.mini; package com.fr.design.mainframe.share.ui.online.mini;
import com.fr.base.ScreenResolution;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.share.mini.MiniShopDisposingChecker; import com.fr.design.mainframe.share.mini.MiniShopDisposingChecker;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.Constants;
import com.fr.stable.unit.FU;
import com.fr.stable.unit.UNIT;
import javax.swing.JFrame; import javax.swing.JFrame;
import java.awt.Container; import java.awt.Container;
@ -32,7 +36,10 @@ public class MiniComponentShopDialog {
final JFrame frame = new JFrame(); final JFrame frame = new JFrame();
final MiniComponentShopPane shopPane = new MiniComponentShopPane(); final MiniComponentShopPane shopPane = new MiniComponentShopPane();
frame.setSize(1200, 800); final UNIT width = FU.getInstance(900 * Constants.FU_PER_OLD_PIX);
final UNIT height = FU.getInstance(600 * Constants.FU_PER_OLD_PIX);
int resolution = ScreenResolution.getScreenResolution();
frame.setSize(width.toPixI(resolution), height.toPixI(resolution));
frame.setTitle(Toolkit.i18nText("Fine-Design_Share_Online_Mini_Shop_Window_Title")); frame.setTitle(Toolkit.i18nText("Fine-Design_Share_Online_Mini_Shop_Window_Title"));
frame.add(shopPane); frame.add(shopPane);
frame.setResizable(false); frame.setResizable(false);
@ -60,8 +67,7 @@ public class MiniComponentShopDialog {
for (WindowListener listener: windowListeners) { for (WindowListener listener: windowListeners) {
listener.windowClosed(e); listener.windowClosed(e);
} }
getInstance().frame = null; shopPane.reload();
shopPane.dispose();
} }
@Override @Override
@ -100,9 +106,18 @@ public class MiniComponentShopDialog {
if (frame == null) { if (frame == null) {
frame = createFrame(); frame = createFrame();
} }
if (!frame.isVisible()) {
for (WindowListener listener: windowListeners) {
listener.windowOpened(null);
}
}
frame.setVisible(true); frame.setVisible(true);
} }
public void showFromOnlineRepoPane() {
show();
}
public Container getContentPane() { public Container getContentPane() {
if (frame != null) { if (frame != null) {
return frame.getContentPane(); return frame.getContentPane();

31
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopPane.java

@ -3,15 +3,18 @@ package com.fr.design.mainframe.share.ui.online.mini;
import com.fr.design.mainframe.share.ui.online.mini.bridge.ComposedNativeBridges; import com.fr.design.mainframe.share.ui.online.mini.bridge.ComposedNativeBridges;
import com.fr.design.mainframe.share.util.OnlineShopUtils; import com.fr.design.mainframe.share.util.OnlineShopUtils;
import com.fr.design.ui.ModernUIPane; import com.fr.design.ui.ModernUIPane;
import com.fr.design.ui.compatible.ModernUIPaneFactory;
import com.fr.design.upm.event.CertificateEvent; import com.fr.design.upm.event.CertificateEvent;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.teamdev.jxbrowser.browser.callback.InjectJsCallback;
import com.teamdev.jxbrowser.chromium.JSObject; import com.teamdev.jxbrowser.chromium.JSObject;
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
import com.teamdev.jxbrowser.js.JsObject;
import org.jetbrains.annotations.Nullable;
import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -27,14 +30,26 @@ public class MiniComponentShopPane extends JPanel {
public MiniComponentShopPane() { public MiniComponentShopPane() {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
modernUIPane = new ModernUIPane.Builder<>() modernUIPane = ModernUIPaneFactory.modernUIPaneBuilder()
.withURL(OnlineShopUtils.getWebMiniShopPath()) .withURL(OnlineShopUtils.getWebMiniShopPath())
.prepare(new ScriptContextAdapter() { .prepareForV6(new ScriptContextAdapter() {
@Override @Override
public void onScriptContextCreated(ScriptContextEvent event) { public void onScriptContextCreated(ScriptContextEvent event) {
super.onScriptContextCreated(event); super.onScriptContextCreated(event);
JSObject window = event.getBrowser().executeJavaScriptAndReturnValue("window").asObject(); JSObject window = event.getBrowser().executeJavaScriptAndReturnValue("window").asObject();
window.asObject().setProperty("ShopHelper", new ComposedNativeBridges(window, JOptionPane.getFrameForComponent(MiniComponentShopPane.this))); window.setProperty("ShopHelper", new ComposedNativeBridges(window));
}
})
.prepareForV7(new InjectJsCallback() {
@Nullable
@Override
public Response on(Params params) {
// 7.x
JsObject window = params.frame().executeJavaScript("window");
if (window != null) {
window.putProperty("ShopHelper", new ComposedNativeBridges(window));
}
return InjectJsCallback.Response.proceed();
} }
}) })
.build(); .build();
@ -44,13 +59,13 @@ public class MiniComponentShopPane extends JPanel {
loginListener = new Listener<String>() { loginListener = new Listener<String>() {
@Override @Override
public void on(Event event, String param) { public void on(Event event, String param) {
modernUIPane.redirect(OnlineShopUtils.getWebMiniShopPath()); reload();
} }
}; };
logoutListener = new Listener<String>() { logoutListener = new Listener<String>() {
@Override @Override
public void on(Event event, String param) { public void on(Event event, String param) {
modernUIPane.redirect(OnlineShopUtils.getWebMiniShopPath()); reload();
} }
}; };
@ -63,4 +78,8 @@ public class MiniComponentShopPane extends JPanel {
EventDispatcher.stopListen(loginListener); EventDispatcher.stopListen(loginListener);
EventDispatcher.stopListen(logoutListener); EventDispatcher.stopListen(logoutListener);
} }
public void reload() {
modernUIPane.redirect(OnlineShopUtils.getWebMiniShopPath());
}
} }

19
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/ComposedNativeBridges.java

@ -1,9 +1,7 @@
package com.fr.design.mainframe.share.ui.online.mini.bridge; package com.fr.design.mainframe.share.ui.online.mini.bridge;
import com.teamdev.jxbrowser.chromium.JSAccessible; import com.teamdev.jxbrowser.chromium.JSAccessible;
import com.teamdev.jxbrowser.chromium.JSObject; import com.teamdev.jxbrowser.js.JsAccessible;
import java.awt.Window;
/** /**
* @author Starryi * @author Starryi
@ -12,14 +10,19 @@ import java.awt.Window;
*/ */
public class ComposedNativeBridges { public class ComposedNativeBridges {
@JSAccessible @JSAccessible
public final NativeBrowserBridge Browser; @JsAccessible
public final Object Browser;
@JSAccessible @JSAccessible
public final NativeAuthBridge Auth; @JsAccessible
public final Object Auth;
@JSAccessible @JSAccessible
public final NativeProductBridge Product; @JsAccessible
public final Object Product;
public ComposedNativeBridges(JSObject window, Window nativeWindow) { public ComposedNativeBridges(Object window) {
this.Browser = new NativeBrowserBridge(nativeWindow); this.Browser = new NativeBrowserBridge();
this.Auth = new NativeAuthBridge(); this.Auth = new NativeAuthBridge();
this.Product = new NativeProductBridge(window); this.Product = new NativeProductBridge(window);
} }

3
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeAuthBridge.java

@ -6,6 +6,7 @@ import com.fr.design.login.DesignerLoginHelper;
import com.fr.design.login.DesignerLoginSource; import com.fr.design.login.DesignerLoginSource;
import com.fr.design.mainframe.share.ui.online.mini.MiniComponentShopDialog; import com.fr.design.mainframe.share.ui.online.mini.MiniComponentShopDialog;
import com.teamdev.jxbrowser.chromium.JSAccessible; import com.teamdev.jxbrowser.chromium.JSAccessible;
import com.teamdev.jxbrowser.js.JsAccessible;
import java.awt.Window; import java.awt.Window;
import java.util.HashMap; import java.util.HashMap;
@ -17,12 +18,14 @@ import java.util.HashMap;
*/ */
public class NativeAuthBridge { public class NativeAuthBridge {
@JSAccessible @JSAccessible
@JsAccessible
@JSBridge @JSBridge
public String getLoginUsername() { public String getLoginUsername() {
return DesignerEnvManager.getEnvManager().getDesignerLoginUsername(); return DesignerEnvManager.getEnvManager().getDesignerLoginUsername();
} }
@JSAccessible @JSAccessible
@JsAccessible
@JSBridge @JSBridge
public void goLogin() { public void goLogin() {
Window parentWindow = MiniComponentShopDialog.getInstance().getWindow(); Window parentWindow = MiniComponentShopDialog.getInstance().getWindow();

13
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeBrowserBridge.java

@ -1,7 +1,9 @@
package com.fr.design.mainframe.share.ui.online.mini.bridge; package com.fr.design.mainframe.share.ui.online.mini.bridge;
import com.fr.design.bridge.exec.JSBridge; import com.fr.design.bridge.exec.JSBridge;
import com.fr.design.mainframe.share.ui.online.mini.MiniComponentShopDialog;
import com.teamdev.jxbrowser.chromium.JSAccessible; import com.teamdev.jxbrowser.chromium.JSAccessible;
import com.teamdev.jxbrowser.js.JsAccessible;
import java.awt.Window; import java.awt.Window;
@ -11,15 +13,14 @@ import java.awt.Window;
* Created by Starryi on 2021/12/20 * Created by Starryi on 2021/12/20
*/ */
public class NativeBrowserBridge { public class NativeBrowserBridge {
private final Window nativeWindow;
public NativeBrowserBridge(Window nativeWindow) {
this.nativeWindow = nativeWindow;
}
@JSAccessible @JSAccessible
@JsAccessible
@JSBridge @JSBridge
public void dispose() { public void dispose() {
this.nativeWindow.dispose(); Window nativeWindow = MiniComponentShopDialog.getInstance().getWindow();
if (nativeWindow != null) {
nativeWindow.dispose();
}
} }
} }

170
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java

@ -13,6 +13,7 @@ import com.fr.design.mainframe.share.ui.online.installation.ComponentInstallatio
import com.fr.design.mainframe.share.ui.online.installation.ComponentsPackageInstallation; import com.fr.design.mainframe.share.ui.online.installation.ComponentsPackageInstallation;
import com.fr.design.mainframe.share.ui.online.installation.TemplateThemeInstallation; import com.fr.design.mainframe.share.ui.online.installation.TemplateThemeInstallation;
import com.fr.design.mainframe.share.ui.online.mini.MiniComponentShopDialog; import com.fr.design.mainframe.share.ui.online.mini.MiniComponentShopDialog;
import com.fr.design.mainframe.share.util.OnlineShopUtils;
import com.fr.form.share.Group; import com.fr.form.share.Group;
import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.SharableWidgetProvider;
import com.fr.form.share.bean.OnlineShareWidget; import com.fr.form.share.bean.OnlineShareWidget;
@ -20,8 +21,7 @@ import com.fr.form.share.group.DefaultShareGroupManager;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.teamdev.jxbrowser.chromium.JSAccessible; import com.teamdev.jxbrowser.chromium.JSAccessible;
import com.teamdev.jxbrowser.chromium.JSFunction; import com.teamdev.jxbrowser.js.JsAccessible;
import com.teamdev.jxbrowser.chromium.JSObject;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
@ -37,20 +37,26 @@ import java.util.Set;
* Created by Starryi on 2021/12/20 * Created by Starryi on 2021/12/20
*/ */
public class NativeProductBridge { public class NativeProductBridge {
private final JSObject window; private static final Map<String, ComponentInstallationTask> createdComponentInstallationTasks = new HashMap<>();
private static final Map<String, ComponentInstallationTask> executingComponentInstallationTasks = new HashMap<>(); private static final Map<String, ComponentsPackageInstallationTask> createdComponentsPackageInstallationTasks = new HashMap<>();
private static final Map<String, ComponentsPackageInstallationTask> executingComponentsPackageInstallationTasks = new HashMap<>(); private static final Map<String, TemplateThemeInstallationTask> createdTemplateThemeInstallationTasks = new HashMap<>();
private static final Map<String, TemplateThemeInstallationTask> executingTemplateThemeInstallationTasks = new HashMap<>();
private final Map<String, Set<JSFunction>> componentDownloadTaskStartListeners = new HashMap<>(); private static final Map<String, ComponentInstallationTask> startedComponentInstallationTasks = new HashMap<>();
private final Map<String, Set<JSFunction>> componentsPackageDownloadTaskStartListeners = new HashMap<>(); private static final Map<String, ComponentsPackageInstallationTask> startedComponentsPackageInstallationTasks = new HashMap<>();
private final Map<String, Set<JSFunction>> themeDownloadTaskStartListeners = new HashMap<>(); private static final Map<String, TemplateThemeInstallationTask> startedTemplateThemeInstallationTasks = new HashMap<>();
public NativeProductBridge(JSObject window) { private final Object window;
private final Map<String, Set<Object>> componentDownloadTaskStartListeners = new HashMap<>();
private final Map<String, Set<Object>> componentsPackageDownloadTaskStartListeners = new HashMap<>();
private final Map<String, Set<Object>> themeDownloadTaskStartListeners = new HashMap<>();
public NativeProductBridge(Object window) {
this.window = window; this.window = window;
} }
@JSAccessible @JSAccessible
@JsAccessible
@JSBridge @JSBridge
public boolean isProductDownloaded(String uuid) { public boolean isProductDownloaded(String uuid) {
for (Group group : DefaultShareGroupManager.getInstance().getAllGroup()) { for (Group group : DefaultShareGroupManager.getInstance().getAllGroup()) {
@ -65,16 +71,17 @@ public class NativeProductBridge {
} }
@JSAccessible @JSAccessible
@JsAccessible
@JSBridge @JSBridge
public void addProductDownloadTaskStartListener(String json, JSFunction function) { public void addProductDownloadTaskStartListener(String json, Object function) {
JSONObject object = new JSONObject(json); JSONObject object = new JSONObject(json);
OnlineShareWidget widget = OnlineShareWidget.parseFromJSONObject(object); OnlineShareWidget widget = OnlineShareWidget.parseFromJSONObject(object);
String uuid = widget.getUuid(); String uuid = widget.getUuid();
boolean isPackage = widget.isWidgetPackage(); boolean isPackage = widget.isWidgetPackage();
Map<String, Set<JSFunction>> downloadTaskGetters = Map<String, Set<Object>> downloadTaskGetters =
isPackage ? componentsPackageDownloadTaskStartListeners : componentDownloadTaskStartListeners; isPackage ? componentsPackageDownloadTaskStartListeners : componentDownloadTaskStartListeners;
Set<JSFunction> startListeners = downloadTaskGetters.get(widget.getUuid()); Set<Object> startListeners = downloadTaskGetters.get(widget.getUuid());
if (startListeners == null) { if (startListeners == null) {
startListeners = new HashSet<>(); startListeners = new HashSet<>();
} }
@ -85,16 +92,17 @@ public class NativeProductBridge {
} }
@JSAccessible @JSAccessible
@JsAccessible
@JSBridge @JSBridge
public void removeProductDownloadTaskStartListener(String json, JSFunction function) { public void removeProductDownloadTaskStartListener(String json, Object function) {
JSONObject object = new JSONObject(json); JSONObject object = new JSONObject(json);
OnlineShareWidget widget = OnlineShareWidget.parseFromJSONObject(object); OnlineShareWidget widget = OnlineShareWidget.parseFromJSONObject(object);
String uuid = widget.getUuid(); String uuid = widget.getUuid();
boolean isPackage = widget.isWidgetPackage(); boolean isPackage = widget.isWidgetPackage();
Map<String, Set<JSFunction>> downloadTaskGetters = isPackage ? componentsPackageDownloadTaskStartListeners : componentDownloadTaskStartListeners; Map<String, Set<Object>> downloadTaskGetters = isPackage ? componentsPackageDownloadTaskStartListeners : componentDownloadTaskStartListeners;
Set<JSFunction> startListeners = downloadTaskGetters.get(uuid); Set<Object> startListeners = downloadTaskGetters.get(uuid);
if (startListeners == null) { if (startListeners == null) {
startListeners = new HashSet<>(); startListeners = new HashSet<>();
} }
@ -103,6 +111,7 @@ public class NativeProductBridge {
} }
@JSAccessible @JSAccessible
@JsAccessible
@JSBridge @JSBridge
public Object getExecutingProductDownloadTask(String json) { public Object getExecutingProductDownloadTask(String json) {
JSONObject object = new JSONObject(json); JSONObject object = new JSONObject(json);
@ -111,7 +120,7 @@ public class NativeProductBridge {
boolean isPackage = widget.isWidgetPackage(); boolean isPackage = widget.isWidgetPackage();
Map<String, ? extends NativeTaskBridge> executingDownloadTask = Map<String, ? extends NativeTaskBridge> executingDownloadTask =
isPackage ? executingComponentsPackageInstallationTasks : executingComponentInstallationTasks; isPackage ? startedComponentsPackageInstallationTasks : startedComponentInstallationTasks;
NativeTaskBridge task = executingDownloadTask.get(uuid); NativeTaskBridge task = executingDownloadTask.get(uuid);
if (task != null) { if (task != null) {
task.checkJSEnvChange(this.window); task.checkJSEnvChange(this.window);
@ -120,22 +129,37 @@ public class NativeProductBridge {
} }
@JSAccessible @JSAccessible
@JsAccessible
@JSBridge @JSBridge
public Object createProductDownloadTask(String json) { public Object createProductDownloadTask(String json) {
JSONObject object = new JSONObject(json); JSONObject object = new JSONObject(json);
OnlineShareWidget widget = OnlineShareWidget.parseFromJSONObject(object); OnlineShareWidget widget = OnlineShareWidget.parseFromJSONObject(object);
int childrenCount = object.optInt("pkgsize", 0); int childrenCount = object.optInt("pkgsize", 0);
if (childrenCount > 0) { if (childrenCount > 0) {
return new ComponentsPackageInstallationTask(window, widget, childrenCount); if (createdComponentsPackageInstallationTasks.containsKey(widget.getUuid())) {
return createdComponentsPackageInstallationTasks.get(widget.getUuid());
} else {
ComponentsPackageInstallationTask task = new ComponentsPackageInstallationTask(this, window, widget, childrenCount);
createdComponentsPackageInstallationTasks.put(widget.getUuid(), task);
return task;
}
} else { } else {
return new ComponentInstallationTask(window, widget); if (createdComponentInstallationTasks.containsKey(widget.getUuid())) {
return createdComponentInstallationTasks.get(widget.getUuid());
} else {
ComponentInstallationTask task = new ComponentInstallationTask(this, window, widget);
createdComponentInstallationTasks.put(widget.getUuid(), task);
return task;
}
} }
} }
@JSAccessible @JSAccessible
@JsAccessible
@JSBridge @JSBridge
public void addThemeDownloadTaskStartListener(String themePath, JSFunction function) { public void addThemeDownloadTaskStartListener(String themePath, Object function) {
Set<JSFunction> startListeners = themeDownloadTaskStartListeners.get(themePath); Set<Object> startListeners = themeDownloadTaskStartListeners.get(themePath);
if (startListeners == null) { if (startListeners == null) {
startListeners = new HashSet<>(); startListeners = new HashSet<>();
} }
@ -144,9 +168,10 @@ public class NativeProductBridge {
} }
@JSAccessible @JSAccessible
@JsAccessible
@JSBridge @JSBridge
public void removeThemeDownloadTaskStartListener(String themePath, JSFunction function) { public void removeThemeDownloadTaskStartListener(String themePath, Object function) {
Set<JSFunction> startListeners = themeDownloadTaskStartListeners.get(themePath); Set<Object> startListeners = themeDownloadTaskStartListeners.get(themePath);
if (startListeners == null) { if (startListeners == null) {
startListeners = new HashSet<>(); startListeners = new HashSet<>();
} }
@ -155,9 +180,10 @@ public class NativeProductBridge {
} }
@JSAccessible @JSAccessible
@JsAccessible
@JSBridge @JSBridge
public Object getExecutingThemeDownloadTask(String themePath) { public Object getExecutingThemeDownloadTask(String themePath) {
NativeTaskBridge task = executingTemplateThemeInstallationTasks.get(themePath); NativeTaskBridge task = startedTemplateThemeInstallationTasks.get(themePath);
if (task != null) { if (task != null) {
task.checkJSEnvChange(this.window); task.checkJSEnvChange(this.window);
} }
@ -165,17 +191,26 @@ public class NativeProductBridge {
} }
@JSAccessible @JSAccessible
@JsAccessible
@JSBridge @JSBridge
public Object createTemplateThemeDownloadTask(String themePath) { public Object createTemplateThemeDownloadTask(String themePath) {
return new TemplateThemeInstallationTask(window, themePath); if (createdTemplateThemeInstallationTasks.containsKey(themePath)) {
return createdTemplateThemeInstallationTasks.get(themePath);
} else {
TemplateThemeInstallationTask task = new TemplateThemeInstallationTask(this, window, themePath);
createdTemplateThemeInstallationTasks.put(themePath, task);
return task;
}
} }
public class ComponentInstallationTask extends NativeTaskBridge { public static class ComponentInstallationTask extends NativeTaskBridge {
private final NativeProductBridge env;
private final OnlineShareWidget widget; private final OnlineShareWidget widget;
private final ComponentInstallation action; private final ComponentInstallation action;
public ComponentInstallationTask(JSObject window, OnlineShareWidget widget) { public ComponentInstallationTask(NativeProductBridge env, Object window, OnlineShareWidget widget) {
super(window); super(window);
this.env = env;
this.widget = widget; this.widget = widget;
action = new ComponentInstallation(widget); action = new ComponentInstallation(widget);
action.setActionListener(new AsyncInstallation.AsyncActionListener() { action.setActionListener(new AsyncInstallation.AsyncActionListener() {
@ -202,9 +237,13 @@ public class NativeProductBridge {
} }
@JSAccessible @JSAccessible
@JsAccessible
@JSBridge @JSBridge
@Override @Override
public void execute() { public void execute() {
if (isExecuting) {
return;
}
super.execute(); super.execute();
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override @Override
@ -230,6 +269,7 @@ public class NativeProductBridge {
} }
@JSAccessible @JSAccessible
@JsAccessible
@JSBridge @JSBridge
@Override @Override
public void cancel() { public void cancel() {
@ -244,33 +284,37 @@ public class NativeProductBridge {
@Override @Override
protected void fireStartEvent(String event) { protected void fireStartEvent(String event) {
executingComponentInstallationTasks.put(widget.getUuid(), this); startedComponentInstallationTasks.put(widget.getUuid(), this);
Set<JSFunction> startListeners = componentDownloadTaskStartListeners.get(widget.getUuid()); Set<Object> startListeners = env.componentDownloadTaskStartListeners.get(widget.getUuid());
SafeJSFunctionInvoker.invoke(startListeners, window); SafeJSFunctionInvoker.invoke(startListeners, env.window);
super.fireStartEvent(event); super.fireStartEvent(event);
} }
@Override @Override
protected void fireFailureEvent(String event) { protected void fireFailureEvent(String event) {
executingComponentInstallationTasks.remove(widget.getUuid()); startedComponentInstallationTasks.remove(widget.getUuid());
createdComponentInstallationTasks.remove(widget.getUuid());
super.fireFailureEvent(event); super.fireFailureEvent(event);
} }
@Override @Override
protected void fireSuccessEvent(String event) { protected void fireSuccessEvent(String event) {
executingComponentInstallationTasks.remove(widget.getUuid()); startedComponentInstallationTasks.remove(widget.getUuid());
createdComponentInstallationTasks.remove(widget.getUuid());
super.fireSuccessEvent(event); super.fireSuccessEvent(event);
} }
} }
public class ComponentsPackageInstallationTask extends NativeTaskBridge { public static class ComponentsPackageInstallationTask extends NativeTaskBridge {
private final NativeProductBridge env;
private final ComponentsPackageInstallation action; private final ComponentsPackageInstallation action;
private final OnlineShareWidget widget; private final OnlineShareWidget widget;
private final int childrenCount; private final int childrenCount;
public ComponentsPackageInstallationTask(JSObject window, OnlineShareWidget widget, int childrenCount) { public ComponentsPackageInstallationTask(NativeProductBridge env, Object window, OnlineShareWidget widget, int childrenCount) {
super(window); super(window);
this.env = env;
this.widget = widget; this.widget = widget;
this.childrenCount = childrenCount; this.childrenCount = childrenCount;
action = new ComponentsPackageInstallation(widget, childrenCount); action = new ComponentsPackageInstallation(widget, childrenCount);
@ -298,31 +342,43 @@ public class NativeProductBridge {
} }
@JSAccessible @JSAccessible
@JsAccessible
@JSBridge @JSBridge
@Override @Override
public void execute() { public void execute() {
if (isExecuting) {
return;
}
super.execute(); super.execute();
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override @Override
public void run() { public void run() {
boolean allowedDownload; boolean allowedDownload;
if (!widget.isCompatibleWithCurrentEnv()) { OnlineShareWidget[] childrenWidgets = OnlineShopUtils.getPackageWidgets(widget, false);
int result = FineJOptionPane.showConfirmDialog( boolean isCompatibleWithCurrentEnv = true;
for (OnlineShareWidget children: childrenWidgets) {
if (!children.isCompatibleWithCurrentEnv()) {
isCompatibleWithCurrentEnv = false;
break;
}
}
int result;
if (!isCompatibleWithCurrentEnv) {
result = FineJOptionPane.showConfirmDialog(
MiniComponentShopDialog.getInstance().getContentPane(), MiniComponentShopDialog.getInstance().getContentPane(),
Toolkit.i18nText("Fine-Design_Share_Online_Mini_Shop_Download_Incompatible_Components_Package_Tip", childrenCount), Toolkit.i18nText("Fine-Design_Share_Online_Mini_Shop_Download_Incompatible_Components_Package_Tip", childrenCount),
"", "",
FineJOptionPane.YES_NO_OPTION FineJOptionPane.YES_NO_OPTION
); );
allowedDownload = result == JOptionPane.YES_OPTION;
} else { } else {
int result = FineJOptionPane.showConfirmDialog( result = FineJOptionPane.showConfirmDialog(
MiniComponentShopDialog.getInstance().getContentPane(), MiniComponentShopDialog.getInstance().getContentPane(),
Toolkit.i18nText("Fine-Design_Share_Online_Mini_Shop_Download_Components_Package_Tip", childrenCount), Toolkit.i18nText("Fine-Design_Share_Online_Mini_Shop_Download_Components_Package_Tip", childrenCount),
"", "",
FineJOptionPane.YES_NO_OPTION FineJOptionPane.YES_NO_OPTION
); );
allowedDownload = result == JOptionPane.YES_OPTION;
} }
allowedDownload = result == JOptionPane.YES_OPTION;
if (allowedDownload) { if (allowedDownload) {
fireStartEvent(null); fireStartEvent(null);
action.install(); action.install();
@ -334,6 +390,7 @@ public class NativeProductBridge {
} }
@JSAccessible @JSAccessible
@JsAccessible
@JSBridge @JSBridge
@Override @Override
public void cancel() { public void cancel() {
@ -348,31 +405,35 @@ public class NativeProductBridge {
@Override @Override
protected void fireStartEvent(String event) { protected void fireStartEvent(String event) {
executingComponentsPackageInstallationTasks.put(widget.getUuid(), this); startedComponentsPackageInstallationTasks.put(widget.getUuid(), this);
super.fireStartEvent(event); super.fireStartEvent(event);
Set<JSFunction> startListeners = componentsPackageDownloadTaskStartListeners.get(widget.getUuid()); Set<Object> startListeners = env.componentsPackageDownloadTaskStartListeners.get(widget.getUuid());
SafeJSFunctionInvoker.invoke(startListeners, window); SafeJSFunctionInvoker.invoke(startListeners, env.window);
} }
@Override @Override
protected void fireFailureEvent(String event) { protected void fireFailureEvent(String event) {
executingComponentsPackageInstallationTasks.remove(widget.getUuid()); startedComponentsPackageInstallationTasks.remove(widget.getUuid());
createdComponentsPackageInstallationTasks.remove(widget.getUuid());
super.fireFailureEvent(event); super.fireFailureEvent(event);
} }
@Override @Override
protected void fireSuccessEvent(String event) { protected void fireSuccessEvent(String event) {
executingComponentsPackageInstallationTasks.remove(widget.getUuid()); startedComponentsPackageInstallationTasks.remove(widget.getUuid());
createdComponentsPackageInstallationTasks.remove(widget.getUuid());
super.fireSuccessEvent(event); super.fireSuccessEvent(event);
} }
} }
public class TemplateThemeInstallationTask extends NativeTaskBridge { public static class TemplateThemeInstallationTask extends NativeTaskBridge {
private final NativeProductBridge env;
private final String themePath; private final String themePath;
private final TemplateThemeInstallation action; private final TemplateThemeInstallation action;
public TemplateThemeInstallationTask(JSObject window, String themePath) { public TemplateThemeInstallationTask(NativeProductBridge env, Object window, String themePath) {
super(window); super(window);
this.env = env;
this.themePath = themePath; this.themePath = themePath;
Window miniShopWindow = MiniComponentShopDialog.getInstance().getWindow(); Window miniShopWindow = MiniComponentShopDialog.getInstance().getWindow();
action = new TemplateThemeInstallation(miniShopWindow, themePath); action = new TemplateThemeInstallation(miniShopWindow, themePath);
@ -395,9 +456,13 @@ public class NativeProductBridge {
} }
@JSAccessible @JSAccessible
@JsAccessible
@JSBridge @JSBridge
@Override @Override
public void execute() { public void execute() {
if (isExecuting) {
return;
}
super.execute(); super.execute();
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override @Override
@ -409,6 +474,7 @@ public class NativeProductBridge {
} }
@JSAccessible @JSAccessible
@JsAccessible
@JSBridge @JSBridge
@Override @Override
public void cancel() { public void cancel() {
@ -423,21 +489,23 @@ public class NativeProductBridge {
@Override @Override
protected void fireStartEvent(String event) { protected void fireStartEvent(String event) {
executingTemplateThemeInstallationTasks.put(themePath, this); startedTemplateThemeInstallationTasks.put(themePath, this);
Set<JSFunction> startListeners = themeDownloadTaskStartListeners.get(themePath); Set<Object> startListeners = env.themeDownloadTaskStartListeners.get(themePath);
SafeJSFunctionInvoker.invoke(startListeners, window); SafeJSFunctionInvoker.invoke(startListeners, env.window);
super.fireStartEvent(event); super.fireStartEvent(event);
} }
@Override @Override
protected void fireFailureEvent(String event) { protected void fireFailureEvent(String event) {
executingTemplateThemeInstallationTasks.remove(themePath); startedTemplateThemeInstallationTasks.remove(themePath);
createdTemplateThemeInstallationTasks.remove(themePath);
super.fireFailureEvent(event); super.fireFailureEvent(event);
} }
@Override @Override
protected void fireSuccessEvent(String event) { protected void fireSuccessEvent(String event) {
executingTemplateThemeInstallationTasks.remove(themePath); startedTemplateThemeInstallationTasks.remove(themePath);
createdTemplateThemeInstallationTasks.remove(themePath);
super.fireSuccessEvent(event); super.fireSuccessEvent(event);
} }
} }

27
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeTaskBridge.java

@ -4,12 +4,9 @@ import com.fr.design.bridge.exec.JSBridge;
import com.fr.design.mainframe.share.mini.MiniShopNativeTask; import com.fr.design.mainframe.share.mini.MiniShopNativeTask;
import com.fr.design.mainframe.share.mini.MiniShopNativeTaskManager; import com.fr.design.mainframe.share.mini.MiniShopNativeTaskManager;
import com.teamdev.jxbrowser.chromium.JSAccessible; import com.teamdev.jxbrowser.chromium.JSAccessible;
import com.teamdev.jxbrowser.chromium.JSFunction; import com.teamdev.jxbrowser.js.JsAccessible;
import com.teamdev.jxbrowser.chromium.JSObject;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map;
import java.util.Set; import java.util.Set;
/** /**
@ -19,14 +16,15 @@ import java.util.Set;
*/ */
public class NativeTaskBridge implements MiniShopNativeTask { public class NativeTaskBridge implements MiniShopNativeTask {
private JSObject window; private Object window;
protected final Set<JSFunction> statusCbs = new HashSet<>(); protected final Set<Object> statusCbs = new HashSet<>();
protected boolean isExecuting = false;
public NativeTaskBridge(JSObject window) { public NativeTaskBridge(Object window) {
this.window = window; this.window = window;
} }
public void checkJSEnvChange(JSObject window) { public void checkJSEnvChange(Object window) {
if (this.window != window) { if (this.window != window) {
this.window = window; this.window = window;
this.statusCbs.clear(); this.statusCbs.clear();
@ -35,24 +33,31 @@ public class NativeTaskBridge implements MiniShopNativeTask {
@JSBridge @JSBridge
@JSAccessible @JSAccessible
public void addStatusCallback(JSFunction cb) { @JsAccessible
public void addStatusCallback(Object cb) {
this.statusCbs.add(cb); this.statusCbs.add(cb);
} }
@JSBridge @JSBridge
@JSAccessible @JSAccessible
public void removeStatusCallback(JSFunction cb) { @JsAccessible
public void removeStatusCallback(Object cb) {
this.statusCbs.remove(cb); this.statusCbs.remove(cb);
} }
@JSBridge @JSBridge
@JSAccessible @JSAccessible
@JsAccessible
@Override @Override
public void execute() { public void execute() {
if (!isExecuting) {
isExecuting = true;
}
} }
@JSBridge @JSBridge
@JSAccessible @JSAccessible
@JsAccessible
@Override @Override
public void cancel() { public void cancel() {
MiniShopNativeTaskManager.getInstance().removeCompletedTask(this); MiniShopNativeTaskManager.getInstance().removeCompletedTask(this);
@ -67,10 +72,12 @@ public class NativeTaskBridge implements MiniShopNativeTask {
SafeJSFunctionInvoker.invoke(statusCbs, window, "PROGRESS", event); SafeJSFunctionInvoker.invoke(statusCbs, window, "PROGRESS", event);
} }
protected void fireSuccessEvent(String event) { protected void fireSuccessEvent(String event) {
isExecuting = false;
MiniShopNativeTaskManager.getInstance().removeCompletedTask(this); MiniShopNativeTaskManager.getInstance().removeCompletedTask(this);
SafeJSFunctionInvoker.invoke(statusCbs, window, "SUCCESS", event); SafeJSFunctionInvoker.invoke(statusCbs, window, "SUCCESS", event);
} }
protected void fireFailureEvent(String event) { protected void fireFailureEvent(String event) {
isExecuting = false;
MiniShopNativeTaskManager.getInstance().removeCompletedTask(this); MiniShopNativeTaskManager.getInstance().removeCompletedTask(this);
SafeJSFunctionInvoker.invoke(statusCbs, window, "FAILURE", event); SafeJSFunctionInvoker.invoke(statusCbs, window, "FAILURE", event);
} }

29
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/SafeJSFunctionInvoker.java

@ -2,6 +2,8 @@ package com.fr.design.mainframe.share.ui.online.mini.bridge;
import com.teamdev.jxbrowser.chromium.JSFunction; import com.teamdev.jxbrowser.chromium.JSFunction;
import com.teamdev.jxbrowser.chromium.JSObject; import com.teamdev.jxbrowser.chromium.JSObject;
import com.teamdev.jxbrowser.js.JsFunction;
import com.teamdev.jxbrowser.js.JsObject;
import java.util.Collection; import java.util.Collection;
@ -12,18 +14,31 @@ import java.util.Collection;
*/ */
public class SafeJSFunctionInvoker { public class SafeJSFunctionInvoker {
public static void invoke(Collection<JSFunction> functions, JSObject instance, Object... args) { public static void invoke(Collection<Object> functions, Object instance, Object... args) {
if (functions != null) { if (functions != null) {
for (JSFunction function: functions) { for (Object function: functions) {
if (function != null && !function.getContext().isDisposed()) { invoke(function, instance, args);
function.invoke(instance, args);
}
} }
} }
} }
public static void invoke(JSFunction function, JSObject instance, Object... args) {
if (function != null && !function.getContext().isDisposed()) { public static void invoke(Object function, Object instance, Object... args) {
if (function != null) {
if (function instanceof JSFunction && instance instanceof JSObject) {
invokeV6((JSFunction) function, (JSObject) instance, args);
} else if (function instanceof JsFunction && instance instanceof JsObject) {
invokeV7((JsFunction) function, (JsObject) instance, args);
}
}
}
private static void invokeV6(JSFunction function, JSObject instance, Object... args) {
if (!function.getContext().isDisposed()) {
function.invoke(instance, args); function.invoke(instance, args);
} }
} }
private static void invokeV7(JsFunction function, JsObject instance, Object... args) {
function.invoke(instance, args);
}
} }

15
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/widgetpackage/OnlineWidgetPackagesShowPane.java

@ -48,6 +48,7 @@ public class OnlineWidgetPackagesShowPane extends AbstractOnlineWidgetShowPane {
private JPanel detailPane; private JPanel detailPane;
private String currentPackageId; private String currentPackageId;
private OnlineWidgetSelectPane onlineWidgetSelectPane; private OnlineWidgetSelectPane onlineWidgetSelectPane;
private OnlineDownloadPackagePane onlineDownloadPackagePane;
private UILabel downloadLabel; private UILabel downloadLabel;
private final Map<String, OnlineWidgetSelectPane> cachePanelMap = new HashMap<>(); private final Map<String, OnlineWidgetSelectPane> cachePanelMap = new HashMap<>();
@ -109,15 +110,15 @@ public class OnlineWidgetPackagesShowPane extends AbstractOnlineWidgetShowPane {
private void downLoadPackage() { private void downLoadPackage() {
downloadLabel.setVisible(false); downloadLabel.setVisible(false);
detailPane.removeAll(); detailPane.removeAll();
OnlineDownloadPackagePane widgetSelectPane = new OnlineDownloadPackagePane(this, onlineWidgetSelectPane.getSharableWidgetProviders(), 50); onlineDownloadPackagePane = new OnlineDownloadPackagePane(this, onlineWidgetSelectPane.getSharableWidgetProviders(), 50);
detailPane.add(widgetSelectPane, BorderLayout.CENTER); detailPane.add(onlineDownloadPackagePane, BorderLayout.CENTER);
cardLayout.show(centerPane, WIDGET_DETAIL); cardLayout.show(centerPane, WIDGET_DETAIL);
cachePanelMap.put(currentPackageId, widgetSelectPane); cachePanelMap.put(currentPackageId, onlineDownloadPackagePane);
for (OnlineShareWidget onlineShareWidget : getSharableWidgetProviders()) { for (OnlineShareWidget onlineShareWidget : getSharableWidgetProviders()) {
if (StringUtils.equals(onlineShareWidget.getId(), currentPackageId)) { if (StringUtils.equals(onlineShareWidget.getId(), currentPackageId)) {
widgetSelectPane.downloadWidget(onlineShareWidget); onlineDownloadPackagePane.downloadWidget(onlineShareWidget);
break; break;
} }
} }
@ -193,4 +194,10 @@ public class OnlineWidgetPackagesShowPane extends AbstractOnlineWidgetShowPane {
protected FilterPane createFilterPane() { protected FilterPane createFilterPane() {
return FilterPane.createOnlinePackageFilterPane(); return FilterPane.createOnlinePackageFilterPane();
} }
public void refreshShowPaneUI() {
if (onlineDownloadPackagePane != null && onlineDownloadPackagePane.isShowing()) {
onlineDownloadPackagePane.refreshShowPaneUI();
}
}
} }

7
designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java

@ -256,7 +256,12 @@ public class OnlineShopUtils {
} }
public static OnlineShareWidget[] getPackageWidgets(OnlineShareWidget widgetPackage) { public static OnlineShareWidget[] getPackageWidgets(OnlineShareWidget widgetPackage) {
String plistUrl = getPackageChildrenPath() + widgetPackage.getId() + "?designerVersion="+ ProductConstants.RELEASE_VERSION; return getPackageWidgets(widgetPackage, true);
}
public static OnlineShareWidget[] getPackageWidgets(OnlineShareWidget widgetPackage, boolean requireCompatible) {
String targetDesignerVersion = requireCompatible ? ProductConstants.RELEASE_VERSION : "0";
String plistUrl = getPackageChildrenPath() + widgetPackage.getId() + "?designerVersion="+ targetDesignerVersion;
OnlineShareWidget[] widgets = getOnlineShareWidgets(plistUrl); OnlineShareWidget[] widgets = getOnlineShareWidgets(plistUrl);
for (OnlineShareWidget widget : widgets) { for (OnlineShareWidget widget : widgets) {
widget.setParentPackage(widgetPackage); widget.setParentPackage(widgetPackage);

20
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java

@ -7,22 +7,28 @@ import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.*; import com.fr.design.designer.creator.*;
import com.fr.design.fit.common.TemplateTool; import com.fr.design.fit.common.TemplateTool;
import com.fr.design.fit.attrpane.PcFitExpandablePane; import com.fr.design.fit.attrpane.PcFitExpandablePane;
import com.fr.design.gui.ilable.UIAutoChangeLineLabel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.style.FollowingThemePane; import com.fr.design.gui.style.FollowingThemePane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.accessibles.AccessibleElementCaseToolBarEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleElementCaseToolBarEditor;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane; import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.PaddingMargin; import com.fr.form.ui.PaddingMargin;
import com.fr.form.web.FormToolBarManager; import com.fr.form.web.FormToolBarManager;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.report.fit.FitProvider;
import com.fr.report.fit.ReportFitAttr; import com.fr.report.fit.ReportFitAttr;
import com.fr.report.fit.ReportFitConfig;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -78,11 +84,23 @@ public class ElementEditorDefinePane extends WTitleLayoutDefinePane<ElementCaseE
pcFitExpandablePane = new PcFitExpandablePane(this); pcFitExpandablePane = new PcFitExpandablePane(this);
if (TemplateTool.isCurrentEditingNewJForm()) { if (TemplateTool.isCurrentEditingNewJForm()) {
centerPane.add(pcFitExpandablePane, BorderLayout.SOUTH); centerPane.add(pcFitExpandablePane, BorderLayout.SOUTH);
} else if (isGlobalReportFitBrowser()) {
UIAutoChangeLineLabel tip = new UIAutoChangeLineLabel(Toolkit.i18nText("Fine-Design_EC_Default_Fit_Config_Tip"), 216);
tip.setForeground(Color.lightGray);
centerPane.add(tip, BorderLayout.SOUTH);
} }
return centerPane; return centerPane;
} }
private boolean isGlobalReportFitBrowser() {
FitProvider fitProvider = WidgetPropertyPane.getInstance().getEditingFormDesigner().getTarget();
ReportFitAttr fitAttr = fitProvider.getReportFitAttr();
if (fitAttr == null) {
fitAttr = ReportFitConfig.getInstance().getFrmFitAttr();
}
return fitAttr.fitStateInPC() == 0;
}
private CRPropertyDescriptor[] removeOldFitEditor(CRPropertyDescriptor[] extraTableEditor) { private CRPropertyDescriptor[] removeOldFitEditor(CRPropertyDescriptor[] extraTableEditor) {
if (!TemplateTool.isCurrentEditingNewJForm()) { if (!TemplateTool.isCurrentEditingNewJForm()) {
return extraTableEditor; return extraTableEditor;

144
designer-realize/src/main/java/com/fr/design/deeplink/DeepLinkManager.java

@ -1,153 +1,21 @@
package com.fr.design.deeplink; package com.fr.design.deeplink;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.startup.FineStartupNotificationFactory;
import com.fr.design.startup.FineStartupNotificationProvider;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.third.org.apache.http.NameValuePair;
import com.fr.web.URLUtils;
import javax.swing.SwingUtilities;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* @author Starryi * @author Starryi
* @version 1.0 * @version 1.0
* Created by Starryi on 2022/1/6 * Created by Starryi on 2022/2/10
*/ */
public class DeepLinkManager { public class DeepLinkManager {
protected DeepLinkManager(){}
private DeepLinkManager(){}
private static final DeepLinkManager instance = new DeepLinkManager(); private static final DeepLinkManager instance = new DeepLinkManager();
public static DeepLinkManager getInstance(){ public static DeepLinkManager getInstance(){
return instance; return instance;
} }
private String pendingURL; public void start(String[] args) {
DeepLinkCore.getInstance().register(new FileOpen4MacDeepLink());
private final List<DeepLink> deepLinkList = new ArrayList<>(); DeepLinkCore.getInstance().register(new TemplateThemeInstallationDeepLink());
private boolean isDesignerStartUpCompleted = false;
private void register(DeepLink deepLink) {
if (deepLink != null) {
deepLinkList.add(deepLink);
}
}
public void prepare() {
register(new FileOpen4MacDeepLink());
register(new TemplateThemeInstallationDeepLink());
FineStartupNotificationFactory.getNotification()
.registerStartupListener(new FineStartupNotificationProvider.Listener() {
@Override
public void startupPerformed(String parameters) {
if (canAcceptNewURL()) {
acceptNewURL(parameters);
if (canConsumePendingURL()) {
consumePendingURL();
}
}
}
});
EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener<Null>() {
@Override
public void on(Event event, Null param) {
isDesignerStartUpCompleted = true;
if (canConsumePendingURL()) {
consumePendingURL();
}
}
});
}
private boolean canAcceptNewURL() {
return StringUtils.isEmpty(this.pendingURL);
}
private void acceptNewURL(String url) {
this.pendingURL = url;
}
private boolean canConsumePendingURL() {
return StringUtils.isNotEmpty(this.pendingURL) && isDesignerStartUpCompleted;
}
private void consumePendingURL() {
String host = null;
String path = null;
Map<String, Object> params = new HashMap<>();
URL url = null;
try {
url = new URL(null, this.pendingURL, new URLStreamHandler() {
@Override
protected URLConnection openConnection(URL u) throws IOException {
return null;
}
});
} catch (MalformedURLException ignored) {}
if (url != null) {
host = url.getHost();
path = url.getPath();
List<NameValuePair> pairs = URLUtils.parse(url.getQuery());
for (NameValuePair pair: pairs) {
params.put(pair.getName(), pair.getValue());
}
}
FineLoggerFactory.getLogger().info("consume deep link: " + this.pendingURL);
performDeepLinks(this.pendingURL, host, path, params);
markPendingURLConsumed();
}
private void performDeepLinks(String url, String host, String path, Map<String, Object> params) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
for (DeepLink deepLink: deepLinkList) {
if (deepLink.accept(url, host, path, params)) {
deepLink.run(url, host, path, params);
}
}
}
});
}
public String[] createNewArgs(String[] args) {
String filePath = this.pendingURL;
if (OperatingSystem.isMacos() && StringUtils.isNotEmpty(filePath) && new File(filePath).exists()) {
List<String> argList = new ArrayList<>(Arrays.asList(args));
argList.add(filePath);
markPendingURLConsumed();
return argList.toArray(new String[]{});
} else {
return args;
}
}
private void markPendingURLConsumed() { DeepLinkCore.getInstance().start(args);
this.pendingURL = null;
} }
} }

171
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java

@ -12,10 +12,8 @@ import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.layout.VerticalFlowLayout;
@ -60,8 +58,6 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private static final int HEAD_HEIGTH = 24; private static final int HEAD_HEIGTH = 24;
private static final int COMBO_WIDTH = 154; private static final int COMBO_WIDTH = 154;
private static final int BUTTON_GROUP_WIDTH = 140; private static final int BUTTON_GROUP_WIDTH = 140;
private static final double f = TableLayout.FILL;
private static final double p = TableLayout.PREFERRED;
// normal // normal
private UIButtonGroup autoshrik; private UIButtonGroup autoshrik;
@ -71,20 +67,8 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private UIComboBox showContent; private UIComboBox showContent;
//内容提示
private UIButtonGroup tooltipButtonGroup;
private CardLayout tooltipLayout;
private JPanel tooltipPane;
private UITextField tooltipTextField; private UITextField tooltipTextField;
//文本超出时隐藏
private UICheckBox textOverflowCheckBox;
private UIComboBox showPartComboBox;
private CardLayout showPartLayout;
private JPanel showPartPane;
private UISpinner showCharNums;
private UIComboBox textOverflowTypeComboBox;
private UITextField fileNameTextField; private UITextField fileNameTextField;
// 分页 // 分页
@ -230,16 +214,17 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private JPanel seniorUpPane() { private JPanel seniorUpPane() {
JPanel pane = new JPanel(new BorderLayout()); JPanel pane = new JPanel(new BorderLayout());
// TODO: 方法之间的耦合还比较严重。现在必须先执行 createShowContentPane,再执行 createSeniorCheckPane。否则出现 npe。 // TODO: 方法之间的耦合还比较严重。现在必须先执行 createShowContentPane,再执行 createSeniorCheckPane。否则出现 npe。
pane.add(createTextOverflowPane(), BorderLayout.SOUTH);
pane.add(createShowContentPane(), BorderLayout.CENTER); pane.add(createShowContentPane(), BorderLayout.CENTER);
pane.add(createSeniorCheckPane(), BorderLayout.NORTH); pane.add(createSeniorCheckPane(), BorderLayout.NORTH);
return pane; return pane;
} }
private JPanel createShowContentPane() { private JPanel createShowContentPane() {
double[] rowSize = {p, p, p, p}; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p};
double[] colSize = {f, COMBO_WIDTH}; double[] colSize = {f, COMBO_WIDTH};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}};
JPanel fileNamePane = createNormal(); JPanel fileNamePane = createNormal();
fileNamePane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); fileNamePane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0));
@ -248,96 +233,21 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
UIComponentUtils.setLineWrap(showContentLabel); UIComponentUtils.setLineWrap(showContentLabel);
UILabel toolTipLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip")); UILabel toolTipLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip"));
tooltipLayout = new CardLayout(); JPanel toolTipTextFieldWrapper = new JPanel(new BorderLayout());
tooltipPane = new JPanel(tooltipLayout); toolTipTextFieldWrapper.add(tooltipTextField, BorderLayout.NORTH);
tooltipPane.add(new JPanel(), "none");
tooltipPane.add(tooltipTextField, "content");
tooltipPane.setPreferredSize(new Dimension(0, 0));
tooltipButtonGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_Custom"), Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_CellValue")});
tooltipButtonGroup.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (tooltipButtonGroup.getSelectedIndex() == 0) {
tooltipPane.setPreferredSize(new Dimension(154, 20));
tooltipLayout.show(tooltipPane, "content");
} else {
tooltipLayout.show(tooltipPane, "none");
tooltipPane.setPreferredSize(new Dimension(0, 0));
}
}
});
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{showContentLabel, UIComponentUtils.wrapWithBorderLayoutPane(showContent)}, new Component[]{showContentLabel, UIComponentUtils.wrapWithBorderLayoutPane(showContent)},
new Component[]{fileNamePane, null}, // 选择"用下载连接显示二进制内容"时,会显示这一行的面板 new Component[]{fileNamePane, null}, // 选择"用下载连接显示二进制内容"时,会显示这一行的面板
new Component[]{toolTipLabel, tooltipButtonGroup}, // “自定义”or"单元格值" new Component[]{toolTipLabel, toolTipTextFieldWrapper}
new Component[]{null, tooltipPane} // 选择“自定义”时显示这一行
}; };
JPanel showContentPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, colSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); JPanel showContentPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, colSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM);
showContentPane.setBorder(BorderFactory.createEmptyBorder(6, 0, 6, 0)); showContentPane.setBorder(BorderFactory.createEmptyBorder(6, 0, 12, 0));
return showContentPane; return showContentPane;
} }
private JPanel createTextOverflowPane() {
showPartLayout = new CardLayout();
showPartPane = new JPanel(showPartLayout);
showCharNums = new UISpinner(0, Integer.MAX_VALUE, 1, 10);
JPanel showPartNumPane = new JPanel(new BorderLayout(4, 0));
showPartNumPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Nums")), BorderLayout.WEST);
showPartNumPane.add(showCharNums, BorderLayout.CENTER);
showPartPane.add(new JPanel(), "none");
showPartPane.add(showPartNumPane, "content");
showPartComboBox = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_CharNum"), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_CellWidth")});
showPartComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (showPartComboBox.getSelectedIndex() == 0) {
showPartPane.setPreferredSize(new Dimension(70, 20));
showPartLayout.show(showPartPane, "content");
} else {
showPartLayout.show(showPartPane, "none");
showPartPane.setPreferredSize(new Dimension(0, 0));
}
}
});
textOverflowTypeComboBox = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Ellipsis"), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_NoneSymbol")});
UILabel showPartLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_ShowPart") + ":");
UILabel hideTypeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideType") + ":");
Component[][] textOverflowComponents = new Component[][]{
new Component[]{showPartLabel, showPartComboBox, showPartPane},
new Component[]{hideTypeLabel, textOverflowTypeComboBox, null}
};
JPanel textOverflowComPane = TableLayoutHelper.createTableLayoutPane(textOverflowComponents, new double[]{p, p}, new double[]{p, f, p});
textOverflowComPane.setVisible(false);
textOverflowCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideWhenOverflow"));
textOverflowCheckBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
textOverflowComPane.setVisible(e.getStateChange() == ItemEvent.SELECTED);
if (e.getStateChange() == ItemEvent.SELECTED) {
if (showPartComboBox.getSelectedIndex() == 0) {
showPartPane.setPreferredSize(new Dimension(70, 20));
showPartLayout.show(showPartPane, "content");
} else {
showPartLayout.show(showPartPane, "none");
showPartPane.setPreferredSize(new Dimension(0, 0));
}
noAutoRadioButton.setSelected(true);
}
}
});
JPanel dynamicPaneWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane();
dynamicPaneWrapper.add(textOverflowComPane);
JPanel textOverflowPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
textOverflowPane.add(textOverflowCheckBox, BorderLayout.NORTH);
textOverflowPane.add(dynamicPaneWrapper, BorderLayout.CENTER);
textOverflowPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
return textOverflowPane;
}
private JPanel createSeniorCheckPane() { private JPanel createSeniorCheckPane() {
previewCellContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); previewCellContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
printAndExportContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); printAndExportContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
@ -461,11 +371,6 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
insertRowPolicyButtonGroup.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy")); insertRowPolicyButtonGroup.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy"));
valueEditor.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy")); valueEditor.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy"));
pageFixedRowDataCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Page_Fixed_Row_Cell")); pageFixedRowDataCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Page_Fixed_Row_Cell"));
tooltipButtonGroup.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_Button_Group"));
textOverflowCheckBox.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideWhenOverflow"));
showPartComboBox.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_ShowPart"));
showCharNums.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Nums"));
textOverflowTypeComboBox.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideType"));
} }
@ -524,40 +429,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
} else { } else {
showContent.setSelectedItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default")); showContent.setSelectedItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"));
} }
if (cellGUIAttr.isCustomTooltip()) { tooltipTextField.setText(cellGUIAttr.getTooltipText());
tooltipButtonGroup.setSelectedIndex(0);
tooltipTextField.setText(cellGUIAttr.getTooltipText());
} else {
tooltipButtonGroup.setSelectedIndex(1);
}
if (tooltipButtonGroup.getSelectedIndex() == 0) {
tooltipPane.setPreferredSize(new Dimension(100, 20));
tooltipLayout.show(tooltipPane, "content");
} else {
tooltipLayout.show(tooltipPane, "none");
tooltipPane.setPreferredSize(new Dimension(0, 0));
}
tooltipPane.setVisible(true);
if (cellGUIAttr.isHideTextWhenOverflow()) {
textOverflowCheckBox.setSelected(true);
if (cellGUIAttr.isShowCharNum()) {
showPartComboBox.setSelectedIndex(0);
showCharNums.setValue(cellGUIAttr.getShowCharNums());
} else {
showPartComboBox.setSelectedIndex(1);
}
showPartPane.setVisible(true);
if (cellGUIAttr.isTextOverflowEllipsis()) {
textOverflowTypeComboBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Ellipsis"));
} else {
textOverflowTypeComboBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_NoneSymbol"));
}
} else {
showPartComboBox.setSelectedIndex(0);
showCharNums.setValue(cellGUIAttr.getShowCharNums());
textOverflowTypeComboBox.setSelectedIndex(0);
textOverflowCheckBox.setSelected(false);
}
CellPageAttr cellPageAttr = cellElement.getCellPageAttr(); // 分页 CellPageAttr cellPageAttr = cellElement.getCellPageAttr(); // 分页
if (cellPageAttr == null) { if (cellPageAttr == null) {
cellPageAttr = new CellPageAttr(); cellPageAttr = new CellPageAttr();
@ -649,18 +521,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
cellGUIAttr.setFileName(fileNameTextField.getText()); cellGUIAttr.setFileName(fileNameTextField.getText());
} }
} }
if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_Button_Group"))) {
cellGUIAttr.setCustomTooltip(tooltipButtonGroup.getSelectedIndex() == 0);
if (tooltipButtonGroup.getSelectedIndex() == 0) {
if (tooltipTextField.getText() == null || tooltipTextField.getText().trim().length() <= 0) {
cellGUIAttr.setTooltipText(fieldName);
} else {
cellGUIAttr.setTooltipText(tooltipTextField.getText());
}
} else if (tooltipButtonGroup.getSelectedIndex() == 1) {
cellGUIAttr.setTooltipText("=$$$");
}
}
if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip"))) { if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip"))) {
if (tooltipTextField.getText() == null || tooltipTextField.getText().trim().length() <= 0) { if (tooltipTextField.getText() == null || tooltipTextField.getText().trim().length() <= 0) {
cellGUIAttr.setTooltipText(fieldName); cellGUIAttr.setTooltipText(fieldName);
@ -668,18 +529,6 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
cellGUIAttr.setTooltipText(tooltipTextField.getText()); cellGUIAttr.setTooltipText(tooltipTextField.getText());
} }
} }
if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideWhenOverflow"))) {
cellGUIAttr.setHideTextWhenOverflow(textOverflowCheckBox.isSelected());
}
if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_ShowPart"))) {
cellGUIAttr.setShowCharNum(showPartComboBox.getSelectedIndex() == 0);
}
if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Nums"))) {
cellGUIAttr.setShowCharNums((int) showCharNums.getValue());
}
if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideType"))) {
cellGUIAttr.setTextOverflowEllipsis(textOverflowTypeComboBox.getSelectedIndex() == 0);
}
// 如果与默认的CellGUIAttr相同,就不用保存这个属性了 // 如果与默认的CellGUIAttr相同,就不用保存这个属性了
if (ComparatorUtils.equals(cellGUIAttr, CellGUIAttr.DEFAULT_CELLGUIATTR)) { if (ComparatorUtils.equals(cellGUIAttr, CellGUIAttr.DEFAULT_CELLGUIATTR)) {
cellElement.setCellGUIAttr(cellNullGUIAttr); cellElement.setCellGUIAttr(cellNullGUIAttr);

7
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java

@ -130,12 +130,13 @@ public class GuideCreateUtils {
return; return;
} }
FormDesigner designer = GuideCreateUtils.getFormDesigner(); FormDesigner designer = GuideCreateUtils.getFormDesigner();
designer.getSelectionModel().selectACreator(xLayoutContainer);
if (dragNewComponent) { if (dragNewComponent) {
designer.addNewWidget(xCreator, xLayoutContainer.getX(), xLayoutContainer.getY()); designer.instantiateCreator(xCreator);
} else { } else {
designer.changeWidgetPlace(xCreator, xLayoutContainer.getX(), xLayoutContainer.getY()); designer.backUpCreator(xCreator);
} }
designer.getSelectionModel().selectACreator(xLayoutContainer);
designer.addWidgetToForm(xCreator, xLayoutContainer.getX(), xLayoutContainer.getY());
designer.getSelectionModel().selectACreator(xCreator); designer.getSelectionModel().selectACreator(xCreator);
} }

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

@ -22,7 +22,6 @@ import com.fr.log.FineLoggerFactory;
import com.fr.serialization.SerializerHelper; import com.fr.serialization.SerializerHelper;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.third.apache.log4j.spi.LoggingEvent;
import com.fr.third.apache.logging.log4j.core.LogEvent; import com.fr.third.apache.logging.log4j.core.LogEvent;
import com.fr.third.org.apache.http.client.config.RequestConfig; import com.fr.third.org.apache.http.client.config.RequestConfig;
import com.fr.third.org.apache.http.client.methods.CloseableHttpResponse; import com.fr.third.org.apache.http.client.methods.CloseableHttpResponse;
@ -33,6 +32,7 @@ import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.base.WorkspaceConstants; import com.fr.workspace.base.WorkspaceConstants;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.server.socket.CustomLogEvent;
import com.fr.workspace.server.socket.LogEventConverter; import com.fr.workspace.server.socket.LogEventConverter;
import io.socket.client.IO; import io.socket.client.IO;
import io.socket.client.Socket; import io.socket.client.Socket;
@ -151,14 +151,14 @@ public class DesignerSocketIO {
if (ArrayUtils.isNotEmpty(objects)) { if (ArrayUtils.isNotEmpty(objects)) {
try { try {
Object obj = SerializerHelper.deserialize((byte[]) objects[0]); Object obj = SerializerHelper.deserialize((byte[]) objects[0]);
// 兼容下老版本服务器 // 完全去除log4j1.x
LogEvent event; LogEvent event;
if (obj instanceof LoggingEvent) { if (obj instanceof CustomLogEvent) {
event = LogEventConverter.convert((LoggingEvent) obj); event = LogEventConverter.convert((CustomLogEvent) obj);
DesignerLogger.log(event);
} else { } else {
event = (LogEvent) obj; FineLoggerFactory.getLogger().warn("Unable to display server push logs, because server and designer versions are inconsistent!");
} }
DesignerLogger.log(event);
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }

3
designer-realize/src/main/java/com/fr/start/MainDesigner.java

@ -107,7 +107,7 @@ public class MainDesigner extends BaseDesigner {
*/ */
public static void main(String[] args) { public static void main(String[] args) {
DeepLinkManager.getInstance().prepare(); DeepLinkManager.getInstance().start(args);
StopWatch watch = new StopWatch(); StopWatch watch = new StopWatch();
watch.start(); watch.start();
DesignerLifecycleMonitorContext.getMonitor().beforeStart(); DesignerLifecycleMonitorContext.getMonitor().beforeStart();
@ -122,7 +122,6 @@ public class MainDesigner extends BaseDesigner {
}); });
Module designerRoot = ModuleContext.parseRoot("designer-startup.xml"); Module designerRoot = ModuleContext.parseRoot("designer-startup.xml");
//传递启动参数 //传递启动参数
args = DeepLinkManager.getInstance().createNewArgs(args);
designerRoot.setSingleton(StartupArgs.class, new StartupArgs(args)); designerRoot.setSingleton(StartupArgs.class, new StartupArgs(args));
try { try {
designerRoot.start(); designerRoot.start();

Loading…
Cancel
Save