Browse Source

Merging in latest from upstream (DESIGN/design:refs/heads/feature/x)

* commit '8f063b46482a895340ef1b0cabfd888a0ce77b43':
  REPORT-62398  && REPORT-62397【接触点优化】查看推荐组件按钮,显示不全;【接触点优化】筛选面板存在时,上下滑动鼠标显示异常
  REPORT-62653 【组件可更新提醒】组件复用-组件上“版本不兼容”提示文字不明显
  CHART-21951 第三方图表插件无法创建复用组件
  REPORT-62677 组件复用-在线组件页面数据加载失败
  REPORT-62576 【组件可更新提醒】组件复用-更新过程中取消更新失败
  REPORT-62652 【组件可更新提醒】组件复用-不兼容弹窗图标应该是红色标识
  REPORT-62647 组件更新成功后可更新标志应该消失
  CHART-21951 第三方图表插件无法创建复用组件
  REPORT-62623 && REPORT-62399 && REPORT-62547 && REPORT-62626 && REPORT-62400 && REPORT-62542 && REPORT-62544
  bug修复
  REPORT-62400 && REPORT-62399 && REPORT-62547【接触点优化】拖拽动效出现时,预览图不消失;【接触点优化】轮播的同时,鼠标悬浮在组件上,轮播图不消失,与组件预览图同时出现;【接触点优化】轮播的图片固定大小,导致预览图显示不全
feature/x
Hades 3 years ago
parent
commit
cfce6b4546
  1. 4
      designer-base/src/main/java/com/fr/design/DesignerCloudURLManager.java
  2. 2
      designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java
  3. 15
      designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java
  4. 17
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java
  5. 36
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java
  6. 7
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java
  7. 3
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java
  8. 4
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java
  9. 12
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/CarouselStateManger.java
  10. 6
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetRepoPane.java
  11. 7
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java
  12. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java
  13. 63
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java
  14. 6
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterShowPane.java
  15. 18
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/PreviewDialog.java
  16. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java
  17. 22
      designer-realize/src/main/java/com/fr/design/share/effect/EffectItemGroup.java

4
designer-base/src/main/java/com/fr/design/DesignerCloudURLManager.java

@ -63,7 +63,7 @@ public class DesignerCloudURLManager implements XMLable {
executorService.submit(() -> { executorService.submit(() -> {
updateURLXMLFile(key, latestUrl); updateURLXMLFile(key, latestUrl);
}); });
return url; return latestUrl;
} }
//本地缓存不为空时,直接返回对应 url,同时异步更新 //本地缓存不为空时,直接返回对应 url,同时异步更新
executorService.submit(() -> { executorService.submit(() -> {
@ -74,7 +74,7 @@ public class DesignerCloudURLManager implements XMLable {
} }
private synchronized void updateURLXMLFile(String key, String url) { private synchronized void updateURLXMLFile(String key, String url) {
if (!urlMap.containsKey(key) || !url.equals(urlMap.get(key))) { if (StringUtils.isNotEmpty(url) && (!urlMap.containsKey(key) || !url.equals(urlMap.get(key)))) {
urlMap.put(key, url); urlMap.put(key, url);
saveURLXMLFile(); saveURLXMLFile();
} }

2
designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java

@ -66,7 +66,7 @@ public class ComponentShareUtil {
* @return boolean * @return boolean
*/ */
public static boolean needShowFirstDragAnimate() { public static boolean needShowFirstDragAnimate() {
return ComponentReuseNotificationInfo.getInstance().isFirstDrag() && !hasTouched(); return ComponentReuseNotificationInfo.getInstance().isFirstDrag();
} }
/** /**

15
designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java

@ -13,7 +13,6 @@ import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane;
import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane;
import com.fr.general.locale.LocaleCenter; import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark; import com.fr.general.locale.LocaleMark;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -40,6 +39,8 @@ public class FormWidgetDetailPane extends FormDockView{
private UIHeadGroup headGroup; private UIHeadGroup headGroup;
private List<BasicPane> paneList; private List<BasicPane> paneList;
private CardLayout cardLayout; private CardLayout cardLayout;
//用来标记当前组件库界面是否处于已触达状态
private boolean hasTouched = false;
private boolean isEmptyPane = false; private boolean isEmptyPane = false;
@ -87,7 +88,7 @@ public class FormWidgetDetailPane extends FormDockView{
clearDockingView(); clearDockingView();
return; return;
} }
hasTouched = ComponentShareUtil.hasTouched();
initPaneList(); initPaneList();
this.setBorder(null); this.setBorder(null);
cardLayout = new CardLayout(); cardLayout = new CardLayout();
@ -113,13 +114,21 @@ public class FormWidgetDetailPane extends FormDockView{
} }
/**
* 判断是否可触达
*
* @return boolean
*/
public boolean hasTouched() {
return hasTouched;
}
public void resetEmptyPane() { public void resetEmptyPane() {
this.isEmptyPane = false; this.isEmptyPane = false;
} }
/** /**
* 清除数据 * 清除数据
*/ */

17
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.share.ui.block; package com.fr.design.mainframe.share.ui.block;
import com.fr.base.FRContext;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.iofile.attr.SharableAttrMark; import com.fr.base.iofile.attr.SharableAttrMark;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
@ -38,8 +39,10 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JPopupMenu; import javax.swing.JPopupMenu;
import javax.swing.UIManager;
import java.awt.AlphaComposite; import java.awt.AlphaComposite;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
@ -57,6 +60,7 @@ import java.awt.dnd.DnDConstants;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.font.FontRenderContext; import java.awt.font.FontRenderContext;
import java.awt.font.LineMetrics;
import java.awt.geom.Dimension2D; import java.awt.geom.Dimension2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.util.UUID; import java.util.UUID;
@ -224,7 +228,10 @@ public class LocalWidgetBlock extends PreviewWidgetBlock<DefaultSharableWidget>
} }
if (!widget.isCompatibleWithCurrentEnv()) { if (!widget.isCompatibleWithCurrentEnv()) {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Share_Drag_And_Make_Incompatible_Component_Tip") Toolkit.i18nText("Fine-Design_Share_Drag_And_Make_Incompatible_Component_Tip"),
Toolkit.i18nText("Fine-Design_Basic_Error"),
JOptionPane.ERROR_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon")
); );
return; return;
} }
@ -293,17 +300,17 @@ public class LocalWidgetBlock extends PreviewWidgetBlock<DefaultSharableWidget>
double canvasH = coverDim.getHeight(); double canvasH = coverDim.getHeight();
g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.4F)); g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.4F));
GraphHelper.fillRect(g2d, canvasX, canvasY, canvasW, canvasH - 16); GraphHelper.fillRect(g2d, canvasX, canvasY, canvasW, canvasH);
g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.5F)); g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.5F));
GraphHelper.fillRect(g2d, canvasX, canvasH - 16, canvasW, 16); GraphHelper.fillRect(g2d, canvasX, canvasH - 16, canvasW, 16);
String tipText = Toolkit.i18nText("Fine-Design_Share_Incompatible_Version_Tip"); String tipText = Toolkit.i18nText("Fine-Design_Share_Incompatible_Version_Tip");
Font tipFont = FRFont.getInstance().deriveFont(8F); Font tipFont = FRContext.getDefaultValues().getFRFont().deriveFont(8.0F);
FontRenderContext frc = g2d.getFontRenderContext(); FontRenderContext frc = g2d.getFontRenderContext();
double tipTextWidth = GraphHelper.stringWidth(tipText, tipFont, frc); double tipTextWidth = GraphHelper.stringWidth(tipText, tipFont, frc);
Dimension2D dim = GraphHelper.stringDimensionWithRotation(tipText, tipFont, 0, frc); LineMetrics metrics = tipFont.getLineMetrics(tipText, frc);
double tipTextHeight = dim.getHeight(); double tipTextHeight = metrics.getHeight();
g2d.setColor(Color.WHITE); g2d.setColor(Color.WHITE);
g2d.setFont(tipFont); g2d.setFont(tipFont);
GraphHelper.drawString(g2d, tipText, canvasX + (canvasW - tipTextWidth) / 2.0F, canvasY + canvasH - (16 - tipTextHeight) / 2.0F); GraphHelper.drawString(g2d, tipText, canvasX + (canvasW - tipTextWidth) / 2.0F, canvasY + canvasH - (16 - tipTextHeight) / 2.0F);

36
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java

@ -11,6 +11,9 @@ import com.fr.design.mainframe.share.util.ShareComponentUtils;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
import com.fr.form.share.DefaultSharableWidget; import com.fr.form.share.DefaultSharableWidget;
import com.fr.form.share.Group; import com.fr.form.share.Group;
import com.fr.form.share.GroupManege;
import com.fr.form.share.SharableWidgetProvider;
import com.fr.form.share.group.DefaultShareGroupManager;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -20,7 +23,6 @@ import java.awt.Component;
import java.awt.Container; import java.awt.Container;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.ExecutionException;
/** /**
* @author Starryi * @author Starryi
@ -103,9 +105,12 @@ public class LocalWidgetUpdater implements Process<Double> {
boolean success = false; boolean success = false;
try { try {
success = get(); success = get();
} catch (InterruptedException | ExecutionException e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
if (success) {
resetWidgetOfBlock();
}
if (updateListener != null) { if (updateListener != null) {
updateListener.onUpdated(success, getGroup().getGroupName(), widget.getId()); updateListener.onUpdated(success, getGroup().getGroupName(), widget.getId());
} }
@ -115,19 +120,38 @@ public class LocalWidgetUpdater implements Process<Double> {
worker.execute(); worker.execute();
} }
public void cancelUpdate() { private void resetWidgetOfBlock() {
if (worker.isDone() || worker.isCancelled()) { GroupManege groupManege = DefaultShareGroupManager.getInstance();
return; Group group = groupManege.getGroup(getGroup().getGroupName());
if (group != null) {
String id = widgetBlock.getWidgetUuid();
if (StringUtils.isNotEmpty(id)) {
SharableWidgetProvider localLatestWidget = group.getElCaseBindInfoById(widgetBlock.getWidgetUuid());
if (localLatestWidget instanceof DefaultSharableWidget) {
widgetBlock.widget = (DefaultSharableWidget) localLatestWidget;
repaintBlockAndOverlay();
}
}
} }
}
public void cancelUpdate() {
if (worker != null && !worker.isDone()) {
worker.cancel(true); worker.cancel(true);
worker = null;
}
process(-1.0); process(-1.0);
} }
@Override @Override
public void process(Double processValue) { public void process(Double processValue) {
this.processValue = processValue; this.processValue = processValue;
repaintBlockAndOverlay();
}
UIUtil.invokeAndWaitIfNeeded(new Runnable() { private void repaintBlockAndOverlay() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override @Override
public void run() { public void run() {
Container absoluteLayoutParent = getAbsoluteLayoutAncestor(widgetBlock); Container absoluteLayoutParent = getAbsoluteLayoutAncestor(widgetBlock);

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

@ -357,6 +357,9 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
if (isUnusable) { if (isUnusable) {
paintUnusableMask((Graphics2D) g); paintUnusableMask((Graphics2D) g);
} }
if (this.parentPane != null) {
this.parentPane.refreshShowPaneUI();
}
} }
protected void paintUnusableMask(Graphics2D g2d) { protected void paintUnusableMask(Graphics2D g2d) {
@ -393,14 +396,12 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
g2d.setColor(oldColor); g2d.setColor(oldColor);
g2d.setFont(oldFont); g2d.setFont(oldFont);
} }
@Override @Override
public void repaint() { public void repaint() {
super.repaint(); super.repaint();
if (this.parentPane != null) {
this.parentPane.refreshUI();
}
} }
class WidgetDownloadProcess implements com.fr.design.extra.Process<Double> { class WidgetDownloadProcess implements com.fr.design.extra.Process<Double> {

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

@ -5,6 +5,7 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.FormWidgetDetailPane;
import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo;
import com.fr.design.mainframe.share.ComponentShareUtil; import com.fr.design.mainframe.share.ComponentShareUtil;
import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.collect.ComponentCollector;
@ -147,7 +148,7 @@ 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() && checkWidget()) { if (ComponentShareUtil.needShowFirstDragAnimate() && !FormWidgetDetailPane.getInstance().hasTouched() && checkWidget()) {
schedule(ANIMATE_START_TIME); schedule(ANIMATE_START_TIME);
awtEventListener = event -> { awtEventListener = event -> {
if (!this.isShowing()) { if (!this.isShowing()) {

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

@ -242,7 +242,7 @@ public abstract class AbstractOnlineWidgetSelectPane extends AbstractWidgetSele
return this.getParent(); return this.getParent();
} }
public void refreshUI() { public void refreshShowPaneUI() {
OnlineWidgetRepoPane.getInstance().repaint(); OnlineWidgetRepoPane.getInstance().refreshShowPaneUI();
} }
} }

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

@ -4,14 +4,11 @@ package com.fr.design.mainframe.share.ui.online;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.util.concurrent.CountDownLatch;
/** /**
* Created by kerry on 2021/10/22 * Created by kerry on 2021/10/22
*/ */
public class CarouselStateManger { public class CarouselStateManger {
private static final String START_CAROUSEL ="START_CAROUSEL";
public static final String RIGHT_CLICK ="RIGHT_CLICK"; public static final String RIGHT_CLICK ="RIGHT_CLICK";
public static final String DOWNLOAD_COMPONENT ="DOWNLOAD_COMPONENT"; public static final String DOWNLOAD_COMPONENT ="DOWNLOAD_COMPONENT";
public static final String FIRST_DRAG_ANIMATE ="FIRST_DRAG_ANIMATE"; public static final String FIRST_DRAG_ANIMATE ="FIRST_DRAG_ANIMATE";
@ -19,7 +16,6 @@ public class CarouselStateManger {
private CarouseState state; private CarouseState state;
private final CountDownLatch countDownLatch = new CountDownLatch(1);
private String suspendEvent; private String suspendEvent;
@ -36,14 +32,6 @@ public class CarouselStateManger {
} }
public void countDown() {
countDownLatch.countDown();
}
public void countDownLatchAwait() throws InterruptedException {
countDownLatch.await();
}
public void start() { public void start() {
this.state = CarouseState.RUNNING; this.state = CarouseState.RUNNING;
} }

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

@ -228,6 +228,12 @@ public class OnlineWidgetRepoPane extends BasicPane {
} }
} }
public void refreshShowPaneUI(){
if (componentTabPane != null) {
this.componentTabPane.refreshShowPaneUI();
}
}
public void completeEmbedFilter(){ public void completeEmbedFilter(){
if (componentTabPane != null) { if (componentTabPane != null) {

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

@ -87,6 +87,13 @@ public class OnlineWidgetTabPane extends JPanel {
this.cardLayout.show(centerPane, ComponentShareUtil.needShowEmbedFilterPane() ? COMPONENT_EMBED : COMPONENT); this.cardLayout.show(centerPane, ComponentShareUtil.needShowEmbedFilterPane() ? COMPONENT_EMBED : COMPONENT);
} }
public void refreshShowPaneUI(){
if (embedFilterShowPane != null) {
this.embedFilterShowPane.refreshUI();
}
}
public void removeTabChangeListener(TabChangeListener listener) { public void removeTabChangeListener(TabChangeListener listener) {
tabChangeListeners.remove(listener); tabChangeListeners.remove(listener);
} }

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

@ -86,7 +86,7 @@ public class EmbedPane extends JPanel {
protected void paintBorder(Graphics g, UIButton b) { protected void paintBorder(Graphics g, UIButton b) {
Color oldColor = g.getColor(); Color oldColor = g.getColor();
g.setColor(SEARCH_BUTTON_COLOR); g.setColor(SEARCH_BUTTON_COLOR);
g.drawRoundRect(0, 0, b.getWidth(), b.getHeight(), 2, 2); g.drawRoundRect(0, 0, b.getWidth() - 4, b.getHeight() - 4, 2, 2);
g.setColor(oldColor); g.setColor(oldColor);
} }
}); });

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

@ -7,11 +7,9 @@ import com.fr.design.mainframe.share.ui.online.CarouselStateManger;
import com.fr.design.mainframe.share.ui.widgetfilter.FilterPane; import com.fr.design.mainframe.share.ui.widgetfilter.FilterPane;
import com.fr.form.share.base.DataLoad; import com.fr.form.share.base.DataLoad;
import com.fr.form.share.bean.OnlineShareWidget; import com.fr.form.share.bean.OnlineShareWidget;
import com.fr.form.share.constants.ShareComponentConstants; import com.fr.form.share.exception.NetWorkFailedException;
import com.fr.log.FineLoggerFactory; import com.fr.general.http.HttpClient;
import com.fr.module.ModuleContext; import com.fr.module.ModuleContext;
import com.fr.stable.EncodeConstants;
import com.fr.third.springframework.web.util.UriUtils;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -24,7 +22,8 @@ import java.awt.Rectangle;
import java.awt.event.AWTEventListener; import java.awt.event.AWTEventListener;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.HttpURLConnection;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@ -34,10 +33,12 @@ import java.util.concurrent.atomic.AtomicInteger;
*/ */
public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane { 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 OnlineShareWidget[] showWidgets; private OnlineShareWidget[] showWidgets;
private PreviewDialog previewDialog; private PreviewDialog previewDialog;
private JPanel widgetPane; private JPanel widgetPane;
private final CountDownLatch countDownLatch = new CountDownLatch(1);
private final AWTEventListener awtEventListener; private final AWTEventListener awtEventListener;
@ -46,6 +47,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
awtEventListener = event -> { awtEventListener = event -> {
if (event instanceof MouseEvent) { if (event instanceof MouseEvent) {
if (((MouseEvent) event).getClickCount() > 0) { if (((MouseEvent) event).getClickCount() > 0) {
try {
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);
@ -53,6 +55,10 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
!selectPaneRec.contains(((MouseEvent) event).getLocationOnScreen())) { !selectPaneRec.contains(((MouseEvent) event).getLocationOnScreen())) {
CarouselStateManger.getInstance().stop(); CarouselStateManger.getInstance().stop();
} }
} catch (Exception e) {
//忽略
}
} }
} }
@ -77,17 +83,34 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
protected void fireAfterDataLoad() { protected void fireAfterDataLoad() {
super.fireAfterDataLoad(); super.fireAfterDataLoad();
CarouselStateManger.getInstance().countDown(); countDownLatch.countDown();
} }
public void animate() throws InterruptedException { public void animate() throws InterruptedException {
CarouselStateManger.getInstance().countDownLatchAwait(); countDownLatch.await();
AtomicInteger integer = new AtomicInteger(showWidgets.length - 1); AtomicInteger integer = new AtomicInteger(showWidgets.length - 1);
showCurrentLoadBlock(integer, widgetPane); showCurrentLoadBlock(integer, widgetPane);
this.repaint(); this.repaint();
CarouselStateManger.getInstance().start();
previewDialog.setVisible(true); previewDialog.setVisible(true);
} }
private Image getPreviewImage(String url) throws NetWorkFailedException {
HttpClient httpClient = new HttpClient(url);
httpClient.setTimeout(CAROUSE_IMAGE_LOAD_TIMEOUT);
httpClient.asGet();
int responseCode = httpClient.getResponseCode();
if (responseCode != HttpURLConnection.HTTP_OK) {
throw new NetWorkFailedException();
}
try {
return ImageIO.read(httpClient.getResponseStream());
} catch (IOException e) {
throw new NetWorkFailedException();
}
}
private void showCurrentLoadBlock(AtomicInteger integer, JPanel widgetPane) { private void showCurrentLoadBlock(AtomicInteger integer, JPanel widgetPane) {
ScheduledExecutorService service = createToastScheduleExecutorService(); ScheduledExecutorService service = createToastScheduleExecutorService();
OnlineShareWidget shareWidget = showWidgets[integer.get()]; OnlineShareWidget shareWidget = showWidgets[integer.get()];
@ -95,7 +118,13 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
this.doLayout(); this.doLayout();
this.validate(); this.validate();
this.repaint(); this.repaint();
previewDialog.setImage(getPreviewImage(shareWidget)); try {
previewDialog.setImage(getPreviewImage(shareWidget.getPicPath()), widgetPane.getLocationOnScreen());
} catch (NetWorkFailedException e) {
this.stopCarouse(integer, false);
this.switchPane(PaneStatue.DISCONNECTED);
return;
}
//展示弹出框 //展示弹出框
service.schedule(new Runnable() { service.schedule(new Runnable() {
@Override @Override
@ -114,6 +143,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
if (!CarouselStateManger.getInstance().isSuspend()) { if (!CarouselStateManger.getInstance().isSuspend()) {
showCurrentLoadBlock(integer, widgetPane); showCurrentLoadBlock(integer, widgetPane);
} else { } else {
previewDialog.setVisible(false);
pollingCarouselState(integer, widgetPane); pollingCarouselState(integer, widgetPane);
} }
} }
@ -130,6 +160,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
return; return;
} }
if (!CarouselStateManger.getInstance().isSuspend()) { if (!CarouselStateManger.getInstance().isSuspend()) {
previewDialog.setVisible(true);
showCurrentLoadBlock(integer, widgetPane); showCurrentLoadBlock(integer, widgetPane);
service.shutdown(); service.shutdown();
} }
@ -138,11 +169,18 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
} }
private void stopCarouse(AtomicInteger integer) { private void stopCarouse(AtomicInteger integer) {
this.stopCarouse(integer, true);
}
private void stopCarouse(AtomicInteger integer, boolean showExtra) {
previewDialog.setVisible(false); previewDialog.setVisible(false);
if (showExtra) {
loadRestShowWidgets(integer.get() - 1); loadRestShowWidgets(integer.get() - 1);
}
java.awt.Toolkit.getDefaultToolkit().removeAWTEventListener(awtEventListener); java.awt.Toolkit.getDefaultToolkit().removeAWTEventListener(awtEventListener);
} }
private void loadRestShowWidgets(int startIndex) { private void loadRestShowWidgets(int startIndex) {
for (int i = startIndex; i >= 0; i--) { for (int i = startIndex; i >= 0; i--) {
OnlineShareWidget shareWidget = showWidgets[i]; OnlineShareWidget shareWidget = showWidgets[i];
@ -153,15 +191,6 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
this.repaint(); this.repaint();
} }
public Image getPreviewImage(OnlineShareWidget widget) {
try {
return ImageIO.read(new URL(UriUtils.encodePath(widget.getPicPath(), EncodeConstants.ENCODING_UTF_8)));
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return ShareComponentConstants.DEFAULT_COVER;
}
}
private ScheduledExecutorService createToastScheduleExecutorService() { private ScheduledExecutorService createToastScheduleExecutorService() {
return ModuleContext.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory(CAROUSEL_PREVIEW)); return ModuleContext.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory(CAROUSEL_PREVIEW));
} }

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

@ -36,6 +36,12 @@ public class OnlineEmbedFilterShowPane extends JPanel {
selectPane.animate(); selectPane.animate();
} }
public void refreshUI(){
if (embedPane != null) {
this.repaint();
}
}
public void completeEmbedFilter(){ public void completeEmbedFilter(){
if (embedPane!= null && embedPane.isShowing()){ if (embedPane!= null && embedPane.isShowing()){
this.remove(embedPane); this.remove(embedPane);

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

@ -6,35 +6,33 @@ import com.fr.design.mainframe.EastRegionContainerPane;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.JDialog; import javax.swing.JDialog;
import java.awt.Dimension;
import java.awt.Image; import java.awt.Image;
import java.awt.Point;
/** /**
* Created by kerry on 2021/10/22 * Created by kerry on 2021/10/22
*/ */
public class PreviewDialog extends JDialog { public class PreviewDialog extends JDialog {
private static final int OFFSET_Y = 9;
public PreviewDialog() { public PreviewDialog() {
super(DesignerContext.getDesignerFrame()); super(DesignerContext.getDesignerFrame());
setUndecorated(true); setUndecorated(true);
setSize(300, 300);
adjustLocation();
this.setVisible(false); this.setVisible(false);
} }
public void setImage(Image image) { public void setImage(Image image, Point point) {
this.getContentPane().removeAll(); this.getContentPane().removeAll();
this.getContentPane().add(new UILabel(new ImageIcon(image))); this.getContentPane().add(new UILabel(new ImageIcon(image)));
int width = image.getWidth(null);
this.setSize(width, image.getHeight(null));
this.setLocation(point.x - width, point.y + OFFSET_Y);
this.doLayout(); this.doLayout();
this.validate(); this.validate();
this.repaint(); this.repaint();
} }
public void adjustLocation() {
this.setLocation(
EastRegionContainerPane.getInstance().getX() - 300,
20
);
}
} }

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

@ -46,7 +46,7 @@ public class OnlineShopUtils {
} }
private static String getWidgetReusePath() { private static String getWidgetReusePath() {
return getReuInfoPath(); return StableUtils.pathJoin(getReuInfoPath(), "all/detail/");
} }
private static String getPackageChildrenPath() { private static String getPackageChildrenPath() {

22
designer-realize/src/main/java/com/fr/design/share/effect/EffectItemGroup.java

@ -109,34 +109,30 @@ public class EffectItemGroup {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value instanceof ChartCollection) { if (value instanceof ChartCollection) {
ChartCollection chartCollection = (ChartCollection) value; ChartCollection chartCollection = (ChartCollection) value;
for (int index = 0; index < chartCollection.getChartCount(); index++) { initChartEditorByChartCollection(chartCollection, cellSourceNode);
Chart chart= (Chart) chartCollection.getChart(index, ChartProvider.class);
Plot plot = chart.getPlot();
if (plot == null) {
continue;
}
SourceNode chartSourceNode = SourceNodeUtils.createSourceNode(plot, chartCollection.getChartName(index), cellSourceNode);
initChartPlot(plot, chartSourceNode, false);
} }
} }
} }
}
private void initChartEditor() { private void initChartEditor() {
ChartEditor editor = (ChartEditor) this.widget; ChartEditor editor = (ChartEditor) this.widget;
ChartCollection chartCollection = (ChartCollection) editor.getChartCollection(); ChartCollection chartCollection = (ChartCollection) editor.getChartCollection();
initChartEditorByChartCollection(chartCollection, null);
}
private void initChartEditorByChartCollection(ChartCollection chartCollection, SourceNode sourceNode) {
for (int index = 0; index < chartCollection.getChartCount(); index++) { for (int index = 0; index < chartCollection.getChartCount(); index++) {
ChartProvider chartProvider = chartCollection.getChart(index, ChartProvider.class);
if (chartProvider instanceof Chart) {
Chart chart= (Chart) chartCollection.getChart(index, ChartProvider.class); Chart chart= (Chart) chartCollection.getChart(index, ChartProvider.class);
Plot plot = chart.getPlot(); Plot plot = chart.getPlot();
if (plot == null) { if (plot == null) {
continue; continue;
} }
SourceNode plotSourceNode = SourceNodeUtils.createSourceNode(plot, chartCollection.getChartName(index), null); SourceNode plotSourceNode = SourceNodeUtils.createSourceNode(plot, chartCollection.getChartName(index), sourceNode);
initChartPlot(plot, plotSourceNode, false); initChartPlot(plot, plotSourceNode, false);
} }
}
} }
private void initChartPlot(Plot plot, SourceNode sourceNode, boolean isSubChart) { private void initChartPlot(Plot plot, SourceNode sourceNode, boolean isSubChart) {

Loading…
Cancel
Save