Browse Source

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

* commit '69bb4113c600cf30cc0e8bc204c41321a531854c':
  REPORT-63311【接触点优化】轮播期间切换组件设置页面,轮播停住了
  REPORT-62672【接触点优化】部分埋点无法模拟对应埋点数据
  REPORT-63308【接触点优化】轮播期间在组件上右键的交互问题
  CHART-22038 决策报表,安装ECharts后,图表块插入图表区域不显示echarts的图标
  REPORT-63305 设计器获取父容器,需要对拓展的布局插件兼容处理下
  REPORT-63196 && REPORT-63186 1.在双击之后使搜索框消失; 2.模拟计算在计算错误的时候提示计算异常
  REPORT-62672【接触点优化】部分埋点无法模拟对应埋点数据
  REPORT-63250 组件可更新视觉验收
  REPORT-63190【接触点优化】轮播过程中切换组件包,再回来发现显示有问题
feature/x
superman 3 years ago
parent
commit
75479ae526
  1. 24
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  2. 22
      designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java
  3. 26
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  4. 11
      designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java
  5. 6
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java
  6. 3
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetPackageBlock.java
  7. 7
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java
  8. 5
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/SimpleWidgetBlock.java
  9. 4
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java
  10. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java
  11. 12
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java
  12. 10
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java
  13. 7
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/ResourceLoader.java
  14. 7
      designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java
  15. 10
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

24
designer-base/src/main/java/com/fr/design/formula/FormulaPane.java

@ -46,6 +46,7 @@ import com.fr.parser.BlockIntervalLiteral;
import com.fr.parser.ColumnRowRangeInPage; import com.fr.parser.ColumnRowRangeInPage;
import com.fr.parser.NumberLiteral; import com.fr.parser.NumberLiteral;
import com.fr.parser.SheetIntervalLiteral; import com.fr.parser.SheetIntervalLiteral;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.report.core.namespace.SimpleCellValueNameSpace; import com.fr.report.core.namespace.SimpleCellValueNameSpace;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.script.ScriptConstants; import com.fr.script.ScriptConstants;
@ -54,7 +55,6 @@ import com.fr.stable.EncodeConstants;
import com.fr.stable.EssentialUtils; import com.fr.stable.EssentialUtils;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.UtilEvalError;
import com.fr.stable.script.CRAddress; import com.fr.stable.script.CRAddress;
import com.fr.stable.script.ColumnRowRange; import com.fr.stable.script.ColumnRowRange;
import com.fr.stable.script.Expression; import com.fr.stable.script.Expression;
@ -122,6 +122,7 @@ import java.util.Set;
* @editor zhou * @editor zhou
* @since 2012-3-29下午1:50:53 * @since 2012-3-29下午1:50:53
*/ */
@EnableMetrics
public class FormulaPane extends BasicPane implements KeyListener, UIFormula { public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
public static final int DEFUAL_FOMULA_LENGTH = 103; public static final int DEFUAL_FOMULA_LENGTH = 103;
public static final String ELLIPSIS = "..."; public static final String ELLIPSIS = "...";
@ -139,6 +140,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
protected static UICheckBox autoCompletionCheck; protected static UICheckBox autoCompletionCheck;
protected static UICheckBox checkBeforeColse; protected static UICheckBox checkBeforeColse;
private JList tipsList; private JList tipsList;
private JPopupMenu popupMenu;
protected DefaultListModel listModel = new DefaultListModel(); protected DefaultListModel listModel = new DefaultListModel();
private int ifHasBeenWriten = 0; private int ifHasBeenWriten = 0;
private DefaultListModel functionTypeListModel = new DefaultListModel(); private DefaultListModel functionTypeListModel = new DefaultListModel();
@ -457,6 +459,9 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
if (ComparatorUtils.equals((String) listModel.getElementAt(index), doublePressContent)) { if (ComparatorUtils.equals((String) listModel.getElementAt(index), doublePressContent)) {
doubleClickActuator(doublePressContent); doubleClickActuator(doublePressContent);
} }
if (popupMenu != null) {
popupMenu.setVisible(false);
}
} }
} }
} }
@ -616,7 +621,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
} }
private void popTips() { private void popTips() {
JPopupMenu popupMenu = new JPopupMenu(); popupMenu = new JPopupMenu();
JScrollPane tipsScrollPane = new JScrollPane(tipsList); JScrollPane tipsScrollPane = new JScrollPane(tipsList);
popupMenu.add(tipsScrollPane); popupMenu.add(tipsScrollPane);
tipsScrollPane.setPreferredSize(new Dimension(240, 146)); tipsScrollPane.setPreferredSize(new Dimension(240, 146));
@ -792,6 +797,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
private final ActionListener calculateActionListener = new ActionListener() { private final ActionListener calculateActionListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
String formulaText = formulaTextArea.getText().trim(); String formulaText = formulaTextArea.getText().trim();
@ -819,16 +825,20 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
} }
BaseFormula baseFormula = BaseFormula.createFormulaBuilder().build(formulaText); BaseFormula baseFormula = BaseFormula.createFormulaBuilder().build(formulaText);
Object calResult;
try { try {
Object value = calculator.evalValue(baseFormula); calResult = calculator.evalValue(baseFormula);
String objectToString = EssentialUtils.objectToString(value); String objectToString = EssentialUtils.objectToString(calResult);
String result = objectToString.length() > DEFUAL_FOMULA_LENGTH ? String result = objectToString.length() > DEFUAL_FOMULA_LENGTH ?
objectToString.substring(0, DEFUAL_FOMULA_LENGTH - ELLIPSIS.length()) + ELLIPSIS : objectToString; objectToString.substring(0, DEFUAL_FOMULA_LENGTH - ELLIPSIS.length()) + ELLIPSIS : objectToString;
messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Result") + ":" + result; messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Result") + ":" + result;
FineLoggerFactory.getLogger().info("value:{}", value); } catch (Exception ce) {
} catch (UtilEvalError utilEvalError) { //模拟计算如果出现错误,则抛出错误
FineLoggerFactory.getLogger().error(utilEvalError.getMessage(), utilEvalError); calResult = ce.getMessage();
FineLoggerFactory.getLogger().error(ce.getMessage(), ce);
messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Error") + ":" + calResult;
} }
FineLoggerFactory.getLogger().info("value:{}", calResult);
} else { } else {
messageTips = checkResult.getTips(); messageTips = checkResult.getTips();
} }

22
designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java

@ -343,21 +343,12 @@ public class ComponentCollector implements XMLable {
} }
public void clickComponentSetting() { public void clickComponentSetting() {
if (!ComponentShareUtil.needShowEmbedFilterPane()) {
return;
}
boolean changed = false;
int firstShowReact = ComponentReuseNotificationInfo.getInstance().isWidgetLibHasRefreshed() ? 2 : -1; int firstShowReact = ComponentReuseNotificationInfo.getInstance().isWidgetLibHasRefreshed() ? 2 : -1;
if (this.firstShowReact != firstShowReact) { if (this.firstShowReact != firstShowReact) {
this.firstShowReact = firstShowReact; collectFirstShowReact(firstShowReact);
changed = true;
} }
if (this.embededFilterReact == 0 && ComponentReuseNotificationInfo.getInstance().isWidgetLibHasRefreshed()) { if (this.embededFilterReact == 0 && ComponentReuseNotificationInfo.getInstance().isWidgetLibHasRefreshed()) {
this.embededFilterReact = -1; collectEmbededFilterReact(-1);
changed = true;
}
if (changed) {
saveInfo();
} }
} }
@ -374,11 +365,16 @@ public class ComponentCollector implements XMLable {
return; return;
} }
if (System.currentTimeMillis() - ComponentReuseNotificationInfo.getInstance().getFirstDragEndTime() <= ONE_MINUTE) { if (System.currentTimeMillis() - ComponentReuseNotificationInfo.getInstance().getFirstDragEndTime() <= ONE_MINUTE) {
this.dynamicEffectReact = 1; collectDynamicEffectReactFlag(1);
saveInfo();
} }
} }
public void collectDynamicEffectReactFlag(int flag) {
this.dynamicEffectReact = flag;
saveInfo();
}
public void clearSortType() { public void clearSortType() {
sortType = JSONFactory.createJSON(JSON.ARRAY); sortType = JSONFactory.createJSON(JSON.ARRAY);
} }

26
designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java

@ -71,6 +71,7 @@ import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WCardTitleLayout; import com.fr.form.ui.container.cardlayout.WCardTitleLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.invoke.Reflect; import com.fr.invoke.Reflect;
@ -82,6 +83,7 @@ import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventListener;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.javax.annotation.Nonnull; import com.fr.third.javax.annotation.Nonnull;
import java.util.Set;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.Icon; import javax.swing.Icon;
@ -446,4 +448,28 @@ public class XCreatorUtils {
return xCreator; return xCreator;
} }
public static boolean isExtraContainer(XCreator creator) {
Set<FormWidgetOptionProvider> set = ExtraDesignClassManager.getInstance().getArray(FormWidgetOptionProvider.XML_TAG);
for (FormWidgetOptionProvider provider : set) {
if (provider.isContainer()
&& ComparatorUtils.equals(provider.appearanceForWidget(), provider.appearanceForWidget())
&& ComparatorUtils.equals(provider.classForWidget(), creator.toData().getClass())) {
return true;
}
}
return false;
}
public static XLayoutContainer getParent(XCreator source) {
if (source.acceptType(XWCardTagLayout.class) ) {
return (XLayoutContainer)source.getParent();
}
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source);
boolean accept = (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) && !isExtraContainer(source);
if (accept) {
container = null;
}
return container;
}
} }

11
designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java

@ -7,6 +7,7 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.gui.chart.ChartXMLTag; import com.fr.design.gui.chart.ChartXMLTag;
import com.fr.design.gui.core.FormWidgetOption; import com.fr.design.gui.core.FormWidgetOption;
@ -18,6 +19,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.UserDefinedWidgetConfig; import com.fr.form.ui.UserDefinedWidgetConfig;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
@ -98,6 +100,15 @@ public class FormParaWidgetPane extends JPanel {
synchronized (FormParaWidgetPane.class) { synchronized (FormParaWidgetPane.class) {
THIS = null; THIS = null;
} }
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null && !template.isJWorkBook()) {
DesignerContext.getDesignerFrame().resetToolkitByPlus(template);
}
}
});
} }
}, new PluginFilter() { }, new PluginFilter() {

6
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java

@ -95,6 +95,10 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock<Onlin
resetCover(image); resetCover(image);
} }
public boolean checkValid(Object key) {
return this.parentPane == key;
}
private Image getDefaultDisplayImage(){ private Image getDefaultDisplayImage(){
return ShareComponentConstants.DEFAULT_COVER; return ShareComponentConstants.DEFAULT_COVER;
} }
@ -110,7 +114,7 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock<Onlin
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
super.mouseClicked(e); super.mouseClicked(e);
if (e.getButton() == MouseEvent.BUTTON3) { if (e.getButton() == MouseEvent.BUTTON3) {
CarouselStateManger.getInstance().suspend(CarouselStateManger.MOUSE_HOVER); CarouselStateManger.getInstance().suspend(CarouselStateManger.RIGHT_CLICK);
this.parentPane.hidePreviewPane(); this.parentPane.hidePreviewPane();
JPopupMenu rightClickPopupMenu = getRightClickPopupMenu(); JPopupMenu rightClickPopupMenu = getRightClickPopupMenu();
GUICoreUtils.showPopupMenu(rightClickPopupMenu, this, e.getX(), e.getY()); GUICoreUtils.showPopupMenu(rightClickPopupMenu, this, e.getX(), e.getY());

3
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetPackageBlock.java

@ -41,6 +41,9 @@ public class OnlineWidgetPackageBlock extends AbstractOnlineWidgetBlock {
southPane.add(detailLabel, BorderLayout.EAST); southPane.add(detailLabel, BorderLayout.EAST);
return southPane; return southPane;
} }
protected boolean supportFirstDragAnimate(){
return false;
}
protected Dimension getCoverDimension() { protected Dimension getCoverDimension() {
return new Dimension(ShareComponentConstants.SHARE_PACKAGE_BLOCK_WIDTH, IMAGE_HEIGHT); return new Dimension(ShareComponentConstants.SHARE_PACKAGE_BLOCK_WIDTH, IMAGE_HEIGHT);

7
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java

@ -148,7 +148,8 @@ public abstract class PreviewWidgetBlock<T> extends JPanel implements MouseListe
@Override @Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
hover = true; hover = true;
if (ComponentShareUtil.needShowFirstDragAnimate() && !FormWidgetDetailPane.getInstance().hasTouched() && checkWidget()) { if (ComponentShareUtil.needShowFirstDragAnimate() && supportFirstDragAnimate() &&
!FormWidgetDetailPane.getInstance().hasTouched() && checkWidget()) {
schedule(ANIMATE_START_TIME); schedule(ANIMATE_START_TIME);
awtEventListener = event -> { awtEventListener = event -> {
if (!this.isShowing()) { if (!this.isShowing()) {
@ -169,6 +170,10 @@ public abstract class PreviewWidgetBlock<T> extends JPanel implements MouseListe
} }
} }
protected boolean supportFirstDragAnimate(){
return true;
}
protected boolean checkWidget() { protected boolean checkWidget() {
return true; return true;
} }

5
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/SimpleWidgetBlock.java

@ -14,4 +14,9 @@ public class SimpleWidgetBlock extends OnlineWidgetBlock {
this.removeListener(); this.removeListener();
this.setFocusable(false); this.setFocusable(false);
} }
protected boolean supportFirstDragAnimate(){
return false;
}
} }

4
designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java

@ -119,10 +119,12 @@ public class LocalWidgetRepoPane extends BasicPane {
content.add(LabelUtils.createAutoWrapLabel(Toolkit.i18nText("Fine-Design_Share_Upgrade_Tip"), new Color(0x333334)), BorderLayout.CENTER); content.add(LabelUtils.createAutoWrapLabel(Toolkit.i18nText("Fine-Design_Share_Upgrade_Tip"), new Color(0x333334)), BorderLayout.CENTER);
JPanel actionsPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 0)); JPanel actionsPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 0));
actionsPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, -5));
actionsPane.setOpaque(false); actionsPane.setOpaque(false);
actionsPane.setBackground(null); actionsPane.setBackground(null);
UIButton cancelUpgradeButton = new UIButton(Toolkit.i18nText("Fine-Design_Share_Upgrade_Cancel")); UIButton cancelUpgradeButton = new UIButton(Toolkit.i18nText("Fine-Design_Share_Upgrade_Cancel"));
cancelUpgradeButton.setRoundBorder(true);
cancelUpgradeButton.addActionListener(new ActionListener() { cancelUpgradeButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -132,6 +134,8 @@ public class LocalWidgetRepoPane extends BasicPane {
UIButton startUpgradeButton = new UIButton(Toolkit.i18nText("Fine-Design_Share_Upgrade_All")); UIButton startUpgradeButton = new UIButton(Toolkit.i18nText("Fine-Design_Share_Upgrade_All"));
startUpgradeButton.setSelected(true); startUpgradeButton.setSelected(true);
startUpgradeButton.setRoundBorder(true);
startUpgradeButton.setBorderPainted(false);
startUpgradeButton.setForeground(Color.WHITE); startUpgradeButton.setForeground(Color.WHITE);
startUpgradeButton.addActionListener(new ActionListener() { startUpgradeButton.addActionListener(new ActionListener() {
@Override @Override

2
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java

@ -170,7 +170,7 @@ public abstract class AbstractOnlineWidgetSelectPane extends AbstractWidgetSele
if (!OnlineShopUtils.testConnection()) { if (!OnlineShopUtils.testConnection()) {
return OnlineWidgetSelectPane.PaneStatue.DISCONNECTED; return OnlineWidgetSelectPane.PaneStatue.DISCONNECTED;
} }
OnlineResourceManager.getInstance().cancelLoad(); OnlineResourceManager.getInstance().cancelLoad(this);
contentPane.removeAll(); contentPane.removeAll();
scrollPane = createScrollPane(); scrollPane = createScrollPane();

12
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java

@ -40,6 +40,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
private static final String CAROUSEL_PREVIEW = "carousel_preview"; private static final String CAROUSEL_PREVIEW = "carousel_preview";
private static final int CAROUSE_IMAGE_LOAD_TIMEOUT = 2000; private static final int CAROUSE_IMAGE_LOAD_TIMEOUT = 2000;
private OnlineShareWidget[] showWidgets; private OnlineShareWidget[] showWidgets;
private static final int NOT_CAROUSE_WIDGET_NUM = 30;
private PreviewDialog previewDialog; private PreviewDialog previewDialog;
private JPanel widgetPane; private JPanel widgetPane;
@ -56,8 +57,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
Point selectPanePoint = OnlineEmbedFilterSelectPane.this.getLocationOnScreen(); Point selectPanePoint = OnlineEmbedFilterSelectPane.this.getLocationOnScreen();
Dimension selectPaneDimension = OnlineEmbedFilterSelectPane.this.getSize(); Dimension selectPaneDimension = OnlineEmbedFilterSelectPane.this.getSize();
Rectangle selectPaneRec = new Rectangle(selectPanePoint.x, selectPanePoint.y, selectPaneDimension.width, selectPaneDimension.height); Rectangle selectPaneRec = new Rectangle(selectPanePoint.x, selectPanePoint.y, selectPaneDimension.width, selectPaneDimension.height);
if (CarouselStateManger.getInstance().running() && if (!selectPaneRec.contains(((MouseEvent) event).getLocationOnScreen())) {
!selectPaneRec.contains(((MouseEvent) event).getLocationOnScreen())) {
CarouselStateManger.getInstance().stop(); CarouselStateManger.getInstance().stop();
} }
} catch (Exception e) { } catch (Exception e) {
@ -144,7 +144,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
stopCarouse(integer); stopCarouse(integer);
return; return;
} }
if (integer.get() == 0) { if (integer.get() == NOT_CAROUSE_WIDGET_NUM) {
CarouselStateManger.getInstance().stop(); CarouselStateManger.getInstance().stop();
stopCarouse(integer); stopCarouse(integer);
previewDialog.setVisible(false); previewDialog.setVisible(false);
@ -172,6 +172,12 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
} }
if (!CarouselStateManger.getInstance().isSuspend()) { if (!CarouselStateManger.getInstance().isSuspend()) {
previewDialog.setVisible(true); previewDialog.setVisible(true);
//再做一次检查,避免因并发导致的previewDialog始终展示的问题
if (CarouselStateManger.getInstance().stopped()) {
stopCarouse(integer);
service.shutdown();
return;
}
showCurrentLoadBlock(integer, widgetPane); showCurrentLoadBlock(integer, widgetPane);
service.shutdown(); service.shutdown();
} }

10
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe.share.ui.online.resource;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
import java.util.function.Predicate;
/** /**
* Created by kerry on 2020-12-10 * Created by kerry on 2020-12-10
@ -25,11 +26,16 @@ public class OnlineResourceManager {
private final BlockingQueue<ResourceLoader> loaderBlockingQueue = new ArrayBlockingQueue<ResourceLoader>(100); private final BlockingQueue<ResourceLoader> loaderBlockingQueue = new ArrayBlockingQueue<ResourceLoader>(100);
public void cancelLoad() { public void cancelLoad(Object key) {
if (swingWorker != null) { if (swingWorker != null) {
swingWorker.cancel(true); swingWorker.cancel(true);
} }
this.loaderBlockingQueue.clear(); loaderBlockingQueue.removeIf(new Predicate<ResourceLoader>() {
@Override
public boolean test(ResourceLoader resourceLoader) {
return resourceLoader.checkValid(key);
}
});
} }
public void addLoader(ResourceLoader loader) { public void addLoader(ResourceLoader loader) {

7
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/ResourceLoader.java

@ -10,4 +10,11 @@ public interface ResourceLoader {
*/ */
void load(); void load();
/**
* 检查resource是否属于某分类
* @param key 分类标识
* @return boolean
*/
boolean checkValid(Object key);
} }

7
designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java

@ -65,12 +65,9 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane {
initDefinePane(); initDefinePane();
} }
@Deprecated
public XLayoutContainer getParent(XCreator source) { public XLayoutContainer getParent(XCreator source) {
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source); return XCreatorUtils.getParent(source);
if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) {
container = null;
}
return container;
} }
public WidgetBoundPane createWidgetBoundPane(XCreator xCreator) { public WidgetBoundPane createWidgetBoundPane(XCreator xCreator) {

10
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

@ -61,15 +61,9 @@ public class WidgetBoundPane extends BasicPane {
initBoundPane(); initBoundPane();
} }
@Deprecated
public XLayoutContainer getParent(XCreator source) { public XLayoutContainer getParent(XCreator source) {
if(source.acceptType(XWCardTagLayout.class)){ return XCreatorUtils.getParent(source);
return (XLayoutContainer)source.getParent();
}
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source);
if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) {
container = null;
}
return container;
} }
public void initBoundPane() { public void initBoundPane() {

Loading…
Cancel
Save