Browse Source

Pull request #6491: REPORT-60153 复用组件接触点优化二期

Merge in DESIGN/design from ~KERRY/design_10.0:feature/x to feature/x

* commit '3084eef79d91008e5455ff8f1e9927ed48fad5dc':
  REPORT-60153 复用组件接触点优化二期
feature/x
kerry 3 years ago
parent
commit
c44b8328cf
  1. 16
      designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java
  2. 6
      designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java
  3. 6
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  4. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java
  5. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/Jump2DetailAction.java
  6. 17
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java
  7. 15
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java
  8. 12
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java
  9. 4
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java
  10. 23
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/CarouselStateManger.java
  11. 12
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java
  12. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java
  13. 30
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterConfigPane.java
  14. 6
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java
  15. 5
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java
  16. 15
      designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java

16
designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java

@ -28,6 +28,8 @@ public class ComponentReuseNotificationInfo implements XMLable {
private boolean widgetLibHasRefreshed = false; private boolean widgetLibHasRefreshed = false;
private boolean completeFirstShowComponentLib = false;
public boolean isClickedWidgetLib() { public boolean isClickedWidgetLib() {
return clickedWidgetLib; return clickedWidgetLib;
} }
@ -68,6 +70,14 @@ public class ComponentReuseNotificationInfo implements XMLable {
this.widgetLibHasRefreshed = widgetLibHasRefreshed; this.widgetLibHasRefreshed = widgetLibHasRefreshed;
} }
public boolean isCompleteFirstShowComponentLib() {
return completeFirstShowComponentLib;
}
public void setCompleteFirstShowComponentLib(boolean completeFirstShowComponentLib) {
this.completeFirstShowComponentLib = completeFirstShowComponentLib;
}
public String getHistoryCreatedReuses() { public String getHistoryCreatedReuses() {
return historyCreatedReuses; return historyCreatedReuses;
} }
@ -79,7 +89,8 @@ public class ComponentReuseNotificationInfo implements XMLable {
@Override @Override
public void readXML(XMLableReader reader) { public void readXML(XMLableReader reader) {
this.setClickedWidgetLib(reader.getAttrAsBoolean("clickedWidgetLib", false)); this.setClickedWidgetLib(reader.getAttrAsBoolean("clickedWidgetLib", false));
this.setCompleteEmbedFilter(reader.getAttrAsBoolean("hasCompleteEmbedFilter", false)); this.setCompleteEmbedFilter(reader.getAttrAsBoolean("completeEmbedFilter", false));
this.setCompleteFirstShowComponentLib(reader.getAttrAsBoolean("completeFirstShowComponentLib", false));
this.setWidgetLibHasRefreshed(reader.getAttrAsBoolean("widgetLibHasRefreshed", false)); this.setWidgetLibHasRefreshed(reader.getAttrAsBoolean("widgetLibHasRefreshed", false));
this.setFirstDrag(reader.getAttrAsBoolean("firstDrag", true)); this.setFirstDrag(reader.getAttrAsBoolean("firstDrag", true));
this.setHistoryCreatedReuses(reader.getAttrAsString("historyCreatedReuses", "[]")); this.setHistoryCreatedReuses(reader.getAttrAsString("historyCreatedReuses", "[]"));
@ -90,7 +101,8 @@ public class ComponentReuseNotificationInfo implements XMLable {
public void writeXML(XMLPrintWriter writer) { public void writeXML(XMLPrintWriter writer) {
writer.startTAG("ComponentReuseNotificationInfo"); writer.startTAG("ComponentReuseNotificationInfo");
writer.attr("clickedWidgetLib", this.clickedWidgetLib) writer.attr("clickedWidgetLib", this.clickedWidgetLib)
.attr("hasCompleteEmbedFilter", this.completeEmbedFilter) .attr("completeEmbedFilter", this.completeEmbedFilter)
.attr("completeFirstShowComponentLib", this.completeFirstShowComponentLib)
.attr("firstDrag", this.firstDrag) .attr("firstDrag", this.firstDrag)
.attr("widgetLibHasRefreshed", this.widgetLibHasRefreshed) .attr("widgetLibHasRefreshed", this.widgetLibHasRefreshed)
.attr("firstDragEndTime", this.firstDragEndTime) .attr("firstDragEndTime", this.firstDragEndTime)

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

@ -48,7 +48,7 @@ public class ComponentShareUtil {
} }
/** /**
* 判断是否需要展示嵌入式筛选面板 * 判断是否在需要展示组件库界面
* *
* @return boolean * @return boolean
*/ */
@ -56,6 +56,10 @@ public class ComponentShareUtil {
return !ComponentReuseNotificationInfo.getInstance().isCompleteEmbedFilter() && !hasTouched() && isCurrentTplNewCreate(); return !ComponentReuseNotificationInfo.getInstance().isCompleteEmbedFilter() && !hasTouched() && isCurrentTplNewCreate();
} }
public static boolean needShowComponentLib() {
return !ComponentReuseNotificationInfo.getInstance().isCompleteFirstShowComponentLib() && !hasTouched() && isCurrentTplNewCreate();
}
/** /**
* 判断是否需要展示首次拖拽动效 * 判断是否需要展示首次拖拽动效
* *

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

@ -13,6 +13,7 @@ import com.fr.base.theme.TemplateThemeConfig;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.FormMobileAttrAction; import com.fr.design.actions.FormMobileAttrAction;
import com.fr.design.actions.TemplateParameterAction; import com.fr.design.actions.TemplateParameterAction;
@ -49,6 +50,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.form.FormECCompositeProvider; import com.fr.design.mainframe.form.FormECCompositeProvider;
import com.fr.design.mainframe.form.FormECDesignerProvider; import com.fr.design.mainframe.form.FormECDesignerProvider;
import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo;
import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.ComponentShareUtil; import com.fr.design.mainframe.share.ComponentShareUtil;
import com.fr.design.mainframe.template.info.JFormProcessInfo; import com.fr.design.mainframe.template.info.JFormProcessInfo;
@ -894,8 +896,10 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
pane.setLayout(new BorderLayout()); pane.setLayout(new BorderLayout());
pane.add(FormWidgetDetailPane.getInstance(formDesign), BorderLayout.CENTER); pane.add(FormWidgetDetailPane.getInstance(formDesign), BorderLayout.CENTER);
EastRegionContainerPane.getInstance().replaceWidgetLibPane(pane); EastRegionContainerPane.getInstance().replaceWidgetLibPane(pane);
if (!ComponentShareUtil.hasTouched() && this.isNewCreateTpl()) { if (ComponentShareUtil.needShowComponentLib()) {
ComponentCollector.getInstance().collectFirstShowReact(1); ComponentCollector.getInstance().collectFirstShowReact(1);
ComponentReuseNotificationInfo.getInstance().setCompleteFirstShowComponentLib(true);
DesignerEnvManager.getEnvManager().saveXMLFile();
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_LIB); EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_LIB);
} }
} }

2
designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java

@ -17,6 +17,7 @@ import com.fr.design.login.DesignerLoginSource;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.share.ui.constants.ColorConstants; import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.design.mainframe.share.ui.online.CarouselStateManger;
import com.fr.design.mainframe.share.util.DownloadUtils; import com.fr.design.mainframe.share.util.DownloadUtils;
import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog; import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -75,6 +76,7 @@ public class DownloadSuitableThemeAction extends SharedComponentPopupAction {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
fetchTheme(); fetchTheme();
CarouselStateManger.getInstance().start(CarouselStateManger.RIGHT_CLICK);
} }
private boolean checkAuthority() { private boolean checkAuthority() {

2
designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/Jump2DetailAction.java

@ -5,6 +5,7 @@ import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIMenuItemUI; import com.fr.design.gui.imenu.UIMenuItemUI;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.share.ui.constants.ColorConstants; import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.design.mainframe.share.ui.online.CarouselStateManger;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.Action; import javax.swing.Action;
@ -41,6 +42,7 @@ public class Jump2DetailAction extends SharedComponentPopupAction {
} catch (IOException | URISyntaxException ioException) { } catch (IOException | URISyntaxException ioException) {
ioException.printStackTrace(); ioException.printStackTrace();
} }
CarouselStateManger.getInstance().start(CarouselStateManger.RIGHT_CLICK);
} }
} }
} }

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

@ -5,6 +5,7 @@ import com.fr.design.mainframe.share.ui.actions.DownloadSuitableThemeAction;
import com.fr.design.mainframe.share.ui.actions.Jump2DetailAction; import com.fr.design.mainframe.share.ui.actions.Jump2DetailAction;
import com.fr.design.mainframe.share.ui.actions.SharedComponentPopupMenu; import com.fr.design.mainframe.share.ui.actions.SharedComponentPopupMenu;
import com.fr.design.mainframe.share.ui.online.AbstractOnlineWidgetSelectPane; import com.fr.design.mainframe.share.ui.online.AbstractOnlineWidgetSelectPane;
import com.fr.design.mainframe.share.ui.online.CarouselStateManger;
import com.fr.design.mainframe.share.ui.online.resource.OnlineResourceManager; import com.fr.design.mainframe.share.ui.online.resource.OnlineResourceManager;
import com.fr.design.mainframe.share.ui.online.resource.ResourceLoader; import com.fr.design.mainframe.share.ui.online.resource.ResourceLoader;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
@ -30,8 +31,9 @@ import java.net.URL;
*/ */
public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock<OnlineShareWidget> implements ResourceLoader { public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock<OnlineShareWidget> implements ResourceLoader {
private final AbstractOnlineWidgetSelectPane parentPane; protected final AbstractOnlineWidgetSelectPane parentPane;
private UILabel coverLabel; private UILabel coverLabel;
private Image coverImage;
public AbstractOnlineWidgetBlock(OnlineShareWidget widget, AbstractOnlineWidgetSelectPane parentPane) { public AbstractOnlineWidgetBlock(OnlineShareWidget widget, AbstractOnlineWidgetSelectPane parentPane) {
super(widget); super(widget);
@ -61,8 +63,12 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock<Onlin
@Override @Override
@NotNull @NotNull
protected Image getCoverImage() { protected Image getCoverImage() {
if (coverImage != null) {
return coverImage;
}
OnlineResourceManager.getInstance().addLoader(this); OnlineResourceManager.getInstance().addLoader(this);
return getDefaultDisplayImage(); coverImage = getDefaultDisplayImage();
return coverImage;
} }
@Override @Override
@ -95,15 +101,16 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock<Onlin
public void resetCover(Image image) { public void resetCover(Image image) {
coverLabel.setIcon(new ImageIcon(image)); coverImage = image;
this.parentPane.validate(); coverLabel.setIcon(new ImageIcon(coverImage));
this.parentPane.repaint(); this.repaint();
} }
@Override @Override
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);
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());

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

@ -13,6 +13,7 @@ import com.fr.design.login.DesignerLoginSource;
import com.fr.design.mainframe.WidgetToolBarPane; import com.fr.design.mainframe.WidgetToolBarPane;
import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.ui.online.AbstractOnlineWidgetSelectPane; import com.fr.design.mainframe.share.ui.online.AbstractOnlineWidgetSelectPane;
import com.fr.design.mainframe.share.ui.online.CarouselStateManger;
import com.fr.form.share.DefaultSharableWidget; import com.fr.form.share.DefaultSharableWidget;
import com.fr.form.share.group.DefaultShareGroup; import com.fr.form.share.group.DefaultShareGroup;
import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane; import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane;
@ -185,6 +186,7 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
} }
private void downLoadWidget() { private void downLoadWidget() {
CarouselStateManger.getInstance().suspend(CarouselStateManger.DOWNLOAD_COMPONENT);
if (OnlineWidgetRepoPane.getInstance().isShowPackagePanel()) { if (OnlineWidgetRepoPane.getInstance().isShowPackagePanel()) {
ComponentCollector.getInstance().collectDownloadPktNum(); ComponentCollector.getInstance().collectDownloadPktNum();
} }
@ -234,6 +236,7 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
try { try {
if (get()) { if (get()) {
LocalWidgetRepoPane.getInstance().refreshShowPanel(); LocalWidgetRepoPane.getInstance().refreshShowPanel();
CarouselStateManger.getInstance().start(CarouselStateManger.DOWNLOAD_COMPONENT);
} else { } else {
ShareUIUtils.showErrorMessageDialog(Toolkit.i18nText("Fine-Design_Share_Download_Failed")); ShareUIUtils.showErrorMessageDialog(Toolkit.i18nText("Fine-Design_Share_Download_Failed"));
} }
@ -245,8 +248,6 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
} }
} }
}.execute(); }.execute();
} }
@ -270,7 +271,7 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
return ShareUtils.getElCaseBindInfoById(widget.getUuid()) != null; return ShareUtils.getElCaseBindInfoById(widget.getUuid()) != null;
} }
protected boolean checkWidget(){ protected boolean checkWidget() {
return checkWidgetInstalled(); return checkWidgetInstalled();
} }
@ -330,6 +331,14 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
} }
} }
@Override
public void 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> {
@Override @Override

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

@ -48,7 +48,6 @@ public abstract class PreviewWidgetBlock<T> extends JPanel implements MouseListe
private static final int ANIMATE_START_TIME = 1000; private static final int ANIMATE_START_TIME = 1000;
private static final int ANIMATE_TIME = 2000; private static final int ANIMATE_TIME = 2000;
private AnimatePopupDialog animatePopupDialog; private AnimatePopupDialog animatePopupDialog;
private AWTEventListener awtEventListener; private AWTEventListener awtEventListener;
private static final double[] ANIMATE_CONTROL_VALUE = {0.23, 1, 0.32, 1}; private static final double[] ANIMATE_CONTROL_VALUE = {0.23, 1, 0.32, 1};
@ -104,7 +103,7 @@ public abstract class PreviewWidgetBlock<T> extends JPanel implements MouseListe
private void showPreviewPane() { private void showPreviewPane() {
synchronized (this) { synchronized (this) {
CarouselStateManger.getInstance().suspend(); CarouselStateManger.getInstance().suspend(CarouselStateManger.MOUSE_HOVER);
if (!showing) { if (!showing) {
showPreview(widget); showPreview(widget);
showing = true; showing = true;
@ -119,7 +118,6 @@ public abstract class PreviewWidgetBlock<T> extends JPanel implements MouseListe
protected abstract void hidePreview(); protected abstract void hidePreview();
private void hidePreviewPane() { private void hidePreviewPane() {
CarouselStateManger.getInstance().start();
if (showing) { if (showing) {
hidePreview(); hidePreview();
showing = false; showing = false;
@ -176,7 +174,7 @@ public abstract class PreviewWidgetBlock<T> extends JPanel implements MouseListe
private void animate(ScheduledExecutorService service) { private void animate(ScheduledExecutorService service) {
CarouselStateManger.getInstance().suspend(); CarouselStateManger.getInstance().suspend(CarouselStateManger.FIRST_DRAG_ANIMATE);
AtomicInteger atomicInteger = new AtomicInteger(0); AtomicInteger atomicInteger = new AtomicInteger(0);
BezierCubic cubic = new BezierCubic(ANIMATE_CONTROL_VALUE[0], ANIMATE_CONTROL_VALUE[1], ANIMATE_CONTROL_VALUE[2], ANIMATE_CONTROL_VALUE[3]); BezierCubic cubic = new BezierCubic(ANIMATE_CONTROL_VALUE[0], ANIMATE_CONTROL_VALUE[1], ANIMATE_CONTROL_VALUE[2], ANIMATE_CONTROL_VALUE[3]);
Point startPoint = new Point(this.getLocationOnScreen().x - 5, this.getLocationOnScreen().y - 5); Point startPoint = new Point(this.getLocationOnScreen().x - 5, this.getLocationOnScreen().y - 5);
@ -193,7 +191,7 @@ public abstract class PreviewWidgetBlock<T> extends JPanel implements MouseListe
ComponentReuseNotificationInfo.getInstance().setFirstDragEndTime(System.currentTimeMillis()); ComponentReuseNotificationInfo.getInstance().setFirstDragEndTime(System.currentTimeMillis());
DesignerEnvManager.getEnvManager().saveXMLFile(); DesignerEnvManager.getEnvManager().saveXMLFile();
java.awt.Toolkit.getDefaultToolkit().removeAWTEventListener(awtEventListener); java.awt.Toolkit.getDefaultToolkit().removeAWTEventListener(awtEventListener);
CarouselStateManger.getInstance().start(); CarouselStateManger.getInstance().start(CarouselStateManger.FIRST_DRAG_ANIMATE);
return; return;
} }
double progress = calXProgress(atomicInteger.getAndIncrement() * 20, cubic); double progress = calXProgress(atomicInteger.getAndIncrement() * 20, cubic);
@ -220,7 +218,9 @@ public abstract class PreviewWidgetBlock<T> extends JPanel implements MouseListe
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
hover = false; hover = false;
this.hidePreviewPane(); this.hidePreviewPane();
if(!FirstDragAnimateStateManager.getInstance().animating()){
CarouselStateManger.getInstance().start(CarouselStateManger.MOUSE_HOVER);
}
} }
@Override @Override

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

@ -241,4 +241,8 @@ public abstract class AbstractOnlineWidgetSelectPane extends AbstractWidgetSele
protected Container getParentContainer() { protected Container getParentContainer() {
return this.getParent(); return this.getParent();
} }
public void refreshUI() {
OnlineWidgetRepoPane.getInstance().repaint();
}
} }

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

@ -1,6 +1,9 @@
package com.fr.design.mainframe.share.ui.online; package com.fr.design.mainframe.share.ui.online;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
/** /**
@ -8,10 +11,18 @@ import java.util.concurrent.CountDownLatch;
*/ */
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 DOWNLOAD_COMPONENT ="DOWNLOAD_COMPONENT";
public static final String FIRST_DRAG_ANIMATE ="FIRST_DRAG_ANIMATE";
public static final String MOUSE_HOVER ="MOUSE_HOVER";
private CarouseState state; private CarouseState state;
private final CountDownLatch countDownLatch = new CountDownLatch(1); private final CountDownLatch countDownLatch = new CountDownLatch(1);
private String suspendEvent;
public static CarouselStateManger getInstance() { public static CarouselStateManger getInstance() {
return CarouselStateManger.HOLDER.singleton; return CarouselStateManger.HOLDER.singleton;
@ -37,12 +48,22 @@ public class CarouselStateManger {
this.state = CarouseState.RUNNING; this.state = CarouseState.RUNNING;
} }
public void start(String startEvent) {
if (!this.stopped() && ComparatorUtils.equals(this.suspendEvent, startEvent)){
this.state = CarouseState.RUNNING;
this.suspendEvent = StringUtils.EMPTY;
}
}
public boolean running() { public boolean running() {
return this.state == CarouseState.RUNNING; return this.state == CarouseState.RUNNING;
} }
public void suspend() { public void suspend(String externalSuspendEvent) {
if (!this.stopped()) {
this.state = CarouseState.SUSPEND; this.state = CarouseState.SUSPEND;
this.suspendEvent = externalSuspendEvent;
}
} }
public boolean isSuspend() { public boolean isSuspend() {

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

@ -82,11 +82,10 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
public void animate() throws InterruptedException { public void animate() throws InterruptedException {
CarouselStateManger.getInstance().countDownLatchAwait(); CarouselStateManger.getInstance().countDownLatchAwait();
AtomicInteger integer = new AtomicInteger(0); AtomicInteger integer = new AtomicInteger(showWidgets.length-1);
showCurrentLoadBlock(integer, widgetPane); showCurrentLoadBlock(integer, widgetPane);
this.repaint(); this.repaint();
previewDialog.setVisible(true); previewDialog.setVisible(true);
CarouselStateManger.getInstance().start();
} }
private void showCurrentLoadBlock(AtomicInteger integer, JPanel widgetPane) { private void showCurrentLoadBlock(AtomicInteger integer, JPanel widgetPane) {
@ -105,12 +104,13 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
stopCarouse(integer); stopCarouse(integer);
return; return;
} }
if (integer.get() == showWidgets.length - 1) { if (integer.get() == 0) {
CarouselStateManger.getInstance().stop(); CarouselStateManger.getInstance().stop();
stopCarouse(integer);
previewDialog.setVisible(false); previewDialog.setVisible(false);
return; return;
} }
integer.incrementAndGet(); integer.decrementAndGet();
if (!CarouselStateManger.getInstance().isSuspend()) { if (!CarouselStateManger.getInstance().isSuspend()) {
showCurrentLoadBlock(integer, widgetPane); showCurrentLoadBlock(integer, widgetPane);
} else { } else {
@ -139,12 +139,12 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
private void stopCarouse(AtomicInteger integer) { private void stopCarouse(AtomicInteger integer) {
previewDialog.setVisible(false); previewDialog.setVisible(false);
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 < showWidgets.length; i++) { for (int i = startIndex; i >= 0; i--) {
OnlineShareWidget shareWidget = showWidgets[i]; OnlineShareWidget shareWidget = showWidgets[i];
widgetPane.add(createWidgetBlock(shareWidget)); widgetPane.add(createWidgetBlock(shareWidget));
} }

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

@ -49,7 +49,7 @@ public class OnlineResourceManager {
try { try {
loader = loaderBlockingQueue.take(); loader = loaderBlockingQueue.take();
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace();
} }
loader.load(); loader.load();
} }

30
designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterConfigPane.java

@ -9,6 +9,7 @@ import com.fr.design.mainframe.share.Bean.WidgetFilterInfo;
import com.fr.design.mainframe.share.Bean.WidgetFilterTypeInfo; import com.fr.design.mainframe.share.Bean.WidgetFilterTypeInfo;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.javax.annotation.Nullable;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -152,7 +153,7 @@ public abstract class FilterConfigPane extends JPanel {
checkBox.addItemListener(new ItemListener() { checkBox.addItemListener(new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
if (checkBox.isSelected() && !checkBox.getFilterInfo().hasChildFilter()) { if (checkBox.isSelected() && (!checkBox.getFilterInfo().hasChildFilter() || !showChildNode)) {
filterList.add(filterInfo); filterList.add(filterInfo);
} else if (filterList.contains(filterInfo)) { } else if (filterList.contains(filterInfo)) {
filterList.remove(filterInfo); filterList.remove(filterInfo);
@ -222,16 +223,35 @@ public abstract class FilterConfigPane extends JPanel {
public abstract String assembleFilter(); public abstract String assembleFilter();
public void setFilters(List<String> selectedFilterNames) { public void setFilters(List<WidgetFilterInfo> selectedFilters) {
reset = true; reset = true;
filterList.clear(); filterList.clear();
setFilterList(selectedFilters);
reset = false;
}
private void setFilterList(List<WidgetFilterInfo> selectedFilters){
for (FilterCheckBox checkBox : checkBoxList) { for (FilterCheckBox checkBox : checkBoxList) {
if (selectedFilterNames.contains(checkBox.getFilterInfo().getName())) { String filterName = checkBox.getFilterInfo().getName();
WidgetFilterInfo selectFilterInfo = getSelectFilterInfoByName(selectedFilters, filterName);
if (selectFilterInfo == null) {
continue;
}
checkBox.setSelected(true); checkBox.setSelected(true);
filterList.add(checkBox.getFilterInfo()); if (selectFilterInfo.hasChildFilter()) {
setFilterList(selectFilterInfo.getInnerFilterInfo());
} }
} }
reset = false; }
@Nullable
private WidgetFilterInfo getSelectFilterInfoByName(List<WidgetFilterInfo> selectedFilters, String name) {
for (WidgetFilterInfo filterInfo : selectedFilters) {
if (ComparatorUtils.equals(filterInfo.getName(), name)) {
return filterInfo;
}
}
return null;
} }
public void reset() { public void reset() {

6
designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java

@ -206,11 +206,7 @@ public class FilterPane extends JPanel {
} }
public void setFilter(List<WidgetFilterInfo> selectedFilters){ public void setFilter(List<WidgetFilterInfo> selectedFilters){
List<String> selectedFilterNames = new ArrayList<>(); filterPopupPane.setFilters(selectedFilters);
for(WidgetFilterInfo filterInfo : selectedFilters){
selectedFilterNames.add(filterInfo.getName());
}
filterPopupPane.setFilters(selectedFilterNames);
} }
private void switchToNoFilter() { private void switchToNoFilter() {

5
designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.share.ui.widgetfilter; package com.fr.design.mainframe.share.ui.widgetfilter;
import com.fr.design.mainframe.share.Bean.FilterTypeInfo; import com.fr.design.mainframe.share.Bean.FilterTypeInfo;
import com.fr.design.mainframe.share.Bean.WidgetFilterInfo;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import java.util.List; import java.util.List;
@ -19,8 +20,8 @@ public abstract class FilterPopupPane extends FilterConfigPane {
this.filterPane = filterPane; this.filterPane = filterPane;
} }
public void setFilters(List<String> selectedFilterNames) { public void setFilters(List<WidgetFilterInfo> selectedFilters) {
super.setFilters(selectedFilterNames); super.setFilters(selectedFilters);
filterPane.changeFilterButtonStatus(hasFilter()); filterPane.changeFilterButtonStatus(hasFilter());
} }

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

@ -172,9 +172,10 @@ public class OnlineShopUtils {
} }
public static String assembleFilter(List<WidgetFilterInfo> filterInfos) { public static String assembleFilter(List<WidgetFilterInfo> filterInfos) {
List<WidgetFilterInfo> allFilterInfos = getAllFilterInfoList(filterInfos);
List<String> cidList = new ArrayList<>(); List<String> cidList = new ArrayList<>();
Map<String, String> queryParaMap = new HashMap<>(); Map<String, String> queryParaMap = new HashMap<>();
for (WidgetFilterInfo filterInfo : filterInfos) { for (WidgetFilterInfo filterInfo : allFilterInfos) {
if (ComparatorUtils.equals(CHART, filterInfo.getType()) if (ComparatorUtils.equals(CHART, filterInfo.getType())
|| ComparatorUtils.equals(REPORT, filterInfo.getType())) { || ComparatorUtils.equals(REPORT, filterInfo.getType())) {
cidList.add(filterInfo.getType() + "-" + filterInfo.getId()); cidList.add(filterInfo.getType() + "-" + filterInfo.getId());
@ -206,6 +207,18 @@ public class OnlineShopUtils {
return StringUtils.join("&", queryCondition.toArray(new String[queryCondition.size()])); return StringUtils.join("&", queryCondition.toArray(new String[queryCondition.size()]));
} }
private static List<WidgetFilterInfo> getAllFilterInfoList(List<WidgetFilterInfo> filterInfos) {
List<WidgetFilterInfo> allFilterList = new ArrayList<>();
for (WidgetFilterInfo filterInfo : filterInfos) {
if (filterInfo.hasChildFilter()) {
allFilterList.addAll(filterInfo.getInnerFilterInfo());
} else {
allFilterList.add(filterInfo);
}
}
return allFilterList;
}
public static boolean testConnection() { public static boolean testConnection() {
HttpClient httpClient = new HttpClient(getTestConnectionUrl()); HttpClient httpClient = new HttpClient(getTestConnectionUrl());
httpClient.asGet(); httpClient.asGet();

Loading…
Cancel
Save