Browse Source

Merge pull request #7969 in DESIGN/design from release/11.0 to feature/x

* commit '358725b102284b70dd3a05a13201d04de5b4fa99':
  REPORT-66966 FR11决策报表-放在推荐布局占位块里的报表块组件,拖拽调整尺寸,保存模板再打开模板,再拖拽调整报表块组件尺寸,会出现和空白块重叠错乱的现象
  CHART-22936 图表切换控件标题设置公式无效
  REPORT-66274【公式报错优化】windows下从日志定位会再打开一次模板
  REPORT-66306 组件包下载面板无遮罩阴影
  REPORT-66947
  REPORT-66827&REPORT-66947&REPORT-66946
  REPORT-66886 鼠标悬浮n秒后释放,没有将组件放入tab中
  REPORT-66254 【组件商城风格优化】打开商城窗口到商城内容显示出来,期间大概有5秒空白状态,需要优化下
  REPORT-66930 【组件商城风格优化】网慢时多次点击下载出现多个弹窗
  REPORT-66884
  REPORT-66884 修正拖拽组件时候备份组件的时机
feature/x
superman 3 years ago
parent
commit
2411cfc889
  1. 3
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  2. 2
      designer-base/src/main/java/com/fr/file/FILEFactory.java
  3. 14
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java
  4. 14
      designer-form/src/main/java/com/fr/design/designer/beans/events/AddingWidgetListenerTable.java
  5. 10
      designer-form/src/main/java/com/fr/design/designer/beans/models/DraggingModel.java
  6. 10
      designer-form/src/main/java/com/fr/design/fit/NewJForm.java
  7. 2
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java
  8. 6
      designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java
  9. 38
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  10. 17
      designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java
  11. 67
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java
  12. 8
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineDownloadPackagePane.java
  13. 11
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java
  14. 5
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java
  15. 73
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java
  16. 6
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeTaskBridge.java
  17. 15
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/widgetpackage/OnlineWidgetPackagesShowPane.java
  18. 7
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java

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

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

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

@ -10,6 +10,7 @@ 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.dialog.AttrScrollPane;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
@ -238,13 +239,14 @@ 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();
Object content = switchTitle.getContent();
String result = StringUtils.EMPTY; String result = StringUtils.EMPTY;
if (switchTitle != null) { if (content != null) {
if (switchTitle instanceof BaseFormula) { if (content instanceof BaseFormula) {
result = ((BaseFormula) switchTitle).getContent(); result = ((BaseFormula) content).getContent();
} else { } else {
result = Utils.objectToString(switchTitle); result = Utils.objectToString(content);
} }
} }
TinyFormulaPane title = new TinyFormulaPane(); TinyFormulaPane title = new TinyFormulaPane();
@ -345,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));
} }
} }

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

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

@ -1252,12 +1252,12 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
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();
} }
@ -1273,12 +1273,12 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
if (currentDragEvent == null || this.getDropTarget() != null) { if (currentDragEvent == null || this.getDropTarget() != 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());
@ -1990,27 +1990,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();
} }

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

@ -256,4 +256,12 @@ public class OnlineDownloadPackagePane extends OnlineWidgetSelectPane {
} }
} }
} }
@Override
public void refreshShowPaneUI() {
if (downloadProgressPane != null && downloadProgressPane.isShowing()) {
downloadProgressPane.invalidate();
downloadProgressPane.repaint();
}
}
} }

11
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));
@ -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();
}
} }

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

@ -106,6 +106,11 @@ 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);
} }

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

@ -37,10 +37,15 @@ 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 static final Map<String, ComponentInstallationTask> createdComponentInstallationTasks = new HashMap<>();
private static final Map<String, ComponentsPackageInstallationTask> createdComponentsPackageInstallationTasks = new HashMap<>();
private static final Map<String, TemplateThemeInstallationTask> createdTemplateThemeInstallationTasks = new HashMap<>();
private static final Map<String, ComponentInstallationTask> startedComponentInstallationTasks = new HashMap<>();
private static final Map<String, ComponentsPackageInstallationTask> startedComponentsPackageInstallationTasks = new HashMap<>();
private static final Map<String, TemplateThemeInstallationTask> startedTemplateThemeInstallationTasks = new HashMap<>();
private final Object window; private final Object window;
private static final Map<String, ComponentInstallationTask> executingComponentInstallationTasks = new HashMap<>();
private static final Map<String, ComponentsPackageInstallationTask> executingComponentsPackageInstallationTasks = new HashMap<>();
private static final Map<String, TemplateThemeInstallationTask> executingTemplateThemeInstallationTasks = new HashMap<>();
private final Map<String, Set<Object>> componentDownloadTaskStartListeners = new HashMap<>(); private final Map<String, Set<Object>> componentDownloadTaskStartListeners = new HashMap<>();
private final Map<String, Set<Object>> componentsPackageDownloadTaskStartListeners = new HashMap<>(); private final Map<String, Set<Object>> componentsPackageDownloadTaskStartListeners = new HashMap<>();
@ -115,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);
@ -131,9 +136,22 @@ public class NativeProductBridge {
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(this, 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(this, 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;
}
} }
} }
@ -165,7 +183,7 @@ public class NativeProductBridge {
@JsAccessible @JsAccessible
@JSBridge @JSBridge
public Object getExecutingThemeDownloadTask(String themePath) { public Object getExecutingThemeDownloadTask(String themePath) {
NativeTaskBridge task = (NativeTaskBridge) executingTemplateThemeInstallationTasks.get(themePath); NativeTaskBridge task = startedTemplateThemeInstallationTasks.get(themePath);
if (task != null) { if (task != null) {
task.checkJSEnvChange(this.window); task.checkJSEnvChange(this.window);
} }
@ -176,7 +194,13 @@ public class NativeProductBridge {
@JsAccessible @JsAccessible
@JSBridge @JSBridge
public Object createTemplateThemeDownloadTask(String themePath) { public Object createTemplateThemeDownloadTask(String themePath) {
return new TemplateThemeInstallationTask(this, 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 static class ComponentInstallationTask extends NativeTaskBridge { public static class ComponentInstallationTask extends NativeTaskBridge {
@ -217,6 +241,9 @@ public class NativeProductBridge {
@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
@ -257,7 +284,7 @@ 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<Object> startListeners = env.componentDownloadTaskStartListeners.get(widget.getUuid()); Set<Object> startListeners = env.componentDownloadTaskStartListeners.get(widget.getUuid());
SafeJSFunctionInvoker.invoke(startListeners, env.window); SafeJSFunctionInvoker.invoke(startListeners, env.window);
super.fireStartEvent(event); super.fireStartEvent(event);
@ -265,13 +292,15 @@ public class NativeProductBridge {
@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);
} }
} }
@ -317,6 +346,9 @@ public class NativeProductBridge {
@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
@ -373,7 +405,7 @@ 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<Object> startListeners = env.componentsPackageDownloadTaskStartListeners.get(widget.getUuid()); Set<Object> startListeners = env.componentsPackageDownloadTaskStartListeners.get(widget.getUuid());
@ -382,13 +414,15 @@ public class NativeProductBridge {
@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);
} }
} }
@ -426,6 +460,9 @@ public class NativeProductBridge {
@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
@ -452,7 +489,7 @@ public class NativeProductBridge {
@Override @Override
protected void fireStartEvent(String event) { protected void fireStartEvent(String event) {
executingTemplateThemeInstallationTasks.put(themePath, this); startedTemplateThemeInstallationTasks.put(themePath, this);
Set<Object> startListeners = env.themeDownloadTaskStartListeners.get(themePath); Set<Object> startListeners = env.themeDownloadTaskStartListeners.get(themePath);
SafeJSFunctionInvoker.invoke(startListeners, env.window); SafeJSFunctionInvoker.invoke(startListeners, env.window);
super.fireStartEvent(event); super.fireStartEvent(event);
@ -460,13 +497,15 @@ public class NativeProductBridge {
@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);
} }
} }

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

@ -18,6 +18,7 @@ public class NativeTaskBridge implements MiniShopNativeTask {
private Object window; private Object window;
protected final Set<Object> statusCbs = new HashSet<>(); protected final Set<Object> statusCbs = new HashSet<>();
protected boolean isExecuting = false;
public NativeTaskBridge(Object window) { public NativeTaskBridge(Object window) {
this.window = window; this.window = window;
@ -49,6 +50,9 @@ public class NativeTaskBridge implements MiniShopNativeTask {
@JsAccessible @JsAccessible
@Override @Override
public void execute() { public void execute() {
if (!isExecuting) {
isExecuting = true;
}
} }
@JSBridge @JSBridge
@ -68,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);
} }

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

Loading…
Cancel
Save