diff --git a/designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java b/designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java index 5011ef2bd..46ccef099 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java +++ b/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 completeFirstShowComponentLib = false; + public boolean isClickedWidgetLib() { return clickedWidgetLib; } @@ -68,6 +70,14 @@ public class ComponentReuseNotificationInfo implements XMLable { this.widgetLibHasRefreshed = widgetLibHasRefreshed; } + public boolean isCompleteFirstShowComponentLib() { + return completeFirstShowComponentLib; + } + + public void setCompleteFirstShowComponentLib(boolean completeFirstShowComponentLib) { + this.completeFirstShowComponentLib = completeFirstShowComponentLib; + } + public String getHistoryCreatedReuses() { return historyCreatedReuses; } @@ -79,7 +89,8 @@ public class ComponentReuseNotificationInfo implements XMLable { @Override public void readXML(XMLableReader reader) { 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.setFirstDrag(reader.getAttrAsBoolean("firstDrag", true)); this.setHistoryCreatedReuses(reader.getAttrAsString("historyCreatedReuses", "[]")); @@ -90,7 +101,8 @@ public class ComponentReuseNotificationInfo implements XMLable { public void writeXML(XMLPrintWriter writer) { writer.startTAG("ComponentReuseNotificationInfo"); writer.attr("clickedWidgetLib", this.clickedWidgetLib) - .attr("hasCompleteEmbedFilter", this.completeEmbedFilter) + .attr("completeEmbedFilter", this.completeEmbedFilter) + .attr("completeFirstShowComponentLib", this.completeFirstShowComponentLib) .attr("firstDrag", this.firstDrag) .attr("widgetLibHasRefreshed", this.widgetLibHasRefreshed) .attr("firstDragEndTime", this.firstDragEndTime) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java b/designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java index 8940b6c89..db53be726 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java @@ -48,7 +48,7 @@ public class ComponentShareUtil { } /** - * 判断是否需要展示嵌入式筛选面板 + * 判断是否在需要展示组件库界面 * * @return boolean */ @@ -56,6 +56,10 @@ public class ComponentShareUtil { return !ComponentReuseNotificationInfo.getInstance().isCompleteEmbedFilter() && !hasTouched() && isCurrentTplNewCreate(); } + public static boolean needShowComponentLib() { + return !ComponentReuseNotificationInfo.getInstance().isCompleteFirstShowComponentLib() && !hasTouched() && isCurrentTplNewCreate(); + } + /** * 判断是否需要展示首次拖拽动效 * diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 6d0147b60..6e16472df 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/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.design.DesignModelAdapter; import com.fr.design.DesignState; +import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.FormMobileAttrAction; 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.mainframe.form.FormECCompositeProvider; 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.ComponentShareUtil; import com.fr.design.mainframe.template.info.JFormProcessInfo; @@ -894,8 +896,10 @@ public class JForm extends JTemplate implements BaseJForm implements ResourceLoader { - private final AbstractOnlineWidgetSelectPane parentPane; + protected final AbstractOnlineWidgetSelectPane parentPane; private UILabel coverLabel; + private Image coverImage; public AbstractOnlineWidgetBlock(OnlineShareWidget widget, AbstractOnlineWidgetSelectPane parentPane) { super(widget); @@ -61,8 +63,12 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock { @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java index d55228b19..949719b85 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java @@ -48,7 +48,6 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe private static final int ANIMATE_START_TIME = 1000; private static final int ANIMATE_TIME = 2000; private AnimatePopupDialog animatePopupDialog; - private AWTEventListener awtEventListener; private static final double[] ANIMATE_CONTROL_VALUE = {0.23, 1, 0.32, 1}; @@ -104,7 +103,7 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe private void showPreviewPane() { synchronized (this) { - CarouselStateManger.getInstance().suspend(); + CarouselStateManger.getInstance().suspend(CarouselStateManger.MOUSE_HOVER); if (!showing) { showPreview(widget); showing = true; @@ -119,7 +118,6 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe protected abstract void hidePreview(); private void hidePreviewPane() { - CarouselStateManger.getInstance().start(); if (showing) { hidePreview(); showing = false; @@ -176,7 +174,7 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe private void animate(ScheduledExecutorService service) { - CarouselStateManger.getInstance().suspend(); + CarouselStateManger.getInstance().suspend(CarouselStateManger.FIRST_DRAG_ANIMATE); 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]); Point startPoint = new Point(this.getLocationOnScreen().x - 5, this.getLocationOnScreen().y - 5); @@ -193,7 +191,7 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe ComponentReuseNotificationInfo.getInstance().setFirstDragEndTime(System.currentTimeMillis()); DesignerEnvManager.getEnvManager().saveXMLFile(); java.awt.Toolkit.getDefaultToolkit().removeAWTEventListener(awtEventListener); - CarouselStateManger.getInstance().start(); + CarouselStateManger.getInstance().start(CarouselStateManger.FIRST_DRAG_ANIMATE); return; } double progress = calXProgress(atomicInteger.getAndIncrement() * 20, cubic); @@ -220,7 +218,9 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe public void mouseExited(MouseEvent e) { hover = false; this.hidePreviewPane(); - + if(!FirstDragAnimateStateManager.getInstance().animating()){ + CarouselStateManger.getInstance().start(CarouselStateManger.MOUSE_HOVER); + } } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java index f85f30b62..4221e4b96 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java +++ b/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() { return this.getParent(); } + + public void refreshUI() { + OnlineWidgetRepoPane.getInstance().repaint(); + } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/CarouselStateManger.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/CarouselStateManger.java index cd818f42e..a0265d536 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/CarouselStateManger.java +++ b/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; +import com.fr.general.ComparatorUtils; +import com.fr.stable.StringUtils; + import java.util.concurrent.CountDownLatch; /** @@ -8,10 +11,18 @@ import java.util.concurrent.CountDownLatch; */ 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 final CountDownLatch countDownLatch = new CountDownLatch(1); + private String suspendEvent; + public static CarouselStateManger getInstance() { return CarouselStateManger.HOLDER.singleton; @@ -37,12 +48,22 @@ public class CarouselStateManger { 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() { return this.state == CarouseState.RUNNING; } - public void suspend() { - this.state = CarouseState.SUSPEND; + public void suspend(String externalSuspendEvent) { + if (!this.stopped()) { + this.state = CarouseState.SUSPEND; + this.suspendEvent = externalSuspendEvent; + } } public boolean isSuspend() { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java index f1069ba3f..b7f62e564 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java +++ b/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 { CarouselStateManger.getInstance().countDownLatchAwait(); - AtomicInteger integer = new AtomicInteger(0); + AtomicInteger integer = new AtomicInteger(showWidgets.length-1); showCurrentLoadBlock(integer, widgetPane); this.repaint(); previewDialog.setVisible(true); - CarouselStateManger.getInstance().start(); } private void showCurrentLoadBlock(AtomicInteger integer, JPanel widgetPane) { @@ -105,12 +104,13 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane stopCarouse(integer); return; } - if (integer.get() == showWidgets.length - 1) { + if (integer.get() == 0) { CarouselStateManger.getInstance().stop(); + stopCarouse(integer); previewDialog.setVisible(false); return; } - integer.incrementAndGet(); + integer.decrementAndGet(); if (!CarouselStateManger.getInstance().isSuspend()) { showCurrentLoadBlock(integer, widgetPane); } else { @@ -139,12 +139,12 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane private void stopCarouse(AtomicInteger integer) { previewDialog.setVisible(false); - loadRestShowWidgets(integer.get() + 1); + loadRestShowWidgets(integer.get() - 1); java.awt.Toolkit.getDefaultToolkit().removeAWTEventListener(awtEventListener); } private void loadRestShowWidgets(int startIndex) { - for (int i = startIndex; i < showWidgets.length; i++) { + for (int i = startIndex; i >= 0; i--) { OnlineShareWidget shareWidget = showWidgets[i]; widgetPane.add(createWidgetBlock(shareWidget)); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java index 3915a84dd..4e10ff25b 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java @@ -49,7 +49,7 @@ public class OnlineResourceManager { try { loader = loaderBlockingQueue.take(); } catch (InterruptedException e) { - e.printStackTrace(); + } loader.load(); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterConfigPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterConfigPane.java index 31df72f99..8808a5d75 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterConfigPane.java +++ b/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.general.ComparatorUtils; import com.fr.stable.StringUtils; +import com.fr.third.javax.annotation.Nullable; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -152,7 +153,7 @@ public abstract class FilterConfigPane extends JPanel { checkBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { - if (checkBox.isSelected() && !checkBox.getFilterInfo().hasChildFilter()) { + if (checkBox.isSelected() && (!checkBox.getFilterInfo().hasChildFilter() || !showChildNode)) { filterList.add(filterInfo); } else if (filterList.contains(filterInfo)) { filterList.remove(filterInfo); @@ -222,16 +223,35 @@ public abstract class FilterConfigPane extends JPanel { public abstract String assembleFilter(); - public void setFilters(List selectedFilterNames) { + public void setFilters(List selectedFilters) { reset = true; filterList.clear(); + setFilterList(selectedFilters); + reset = false; + } + + private void setFilterList(List selectedFilters){ for (FilterCheckBox checkBox : checkBoxList) { - if (selectedFilterNames.contains(checkBox.getFilterInfo().getName())) { - checkBox.setSelected(true); - filterList.add(checkBox.getFilterInfo()); + String filterName = checkBox.getFilterInfo().getName(); + WidgetFilterInfo selectFilterInfo = getSelectFilterInfoByName(selectedFilters, filterName); + if (selectFilterInfo == null) { + continue; + } + checkBox.setSelected(true); + if (selectFilterInfo.hasChildFilter()) { + setFilterList(selectFilterInfo.getInnerFilterInfo()); } } - reset = false; + } + + @Nullable + private WidgetFilterInfo getSelectFilterInfoByName(List selectedFilters, String name) { + for (WidgetFilterInfo filterInfo : selectedFilters) { + if (ComparatorUtils.equals(filterInfo.getName(), name)) { + return filterInfo; + } + } + return null; } public void reset() { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java index 77e863177..6713d94e2 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java +++ b/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 selectedFilters){ - List selectedFilterNames = new ArrayList<>(); - for(WidgetFilterInfo filterInfo : selectedFilters){ - selectedFilterNames.add(filterInfo.getName()); - } - filterPopupPane.setFilters(selectedFilterNames); + filterPopupPane.setFilters(selectedFilters); } private void switchToNoFilter() { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java index 94a96b4b1..e0ec375bc 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java +++ b/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; import com.fr.design.mainframe.share.Bean.FilterTypeInfo; +import com.fr.design.mainframe.share.Bean.WidgetFilterInfo; import javax.swing.event.ChangeEvent; import java.util.List; @@ -19,8 +20,8 @@ public abstract class FilterPopupPane extends FilterConfigPane { this.filterPane = filterPane; } - public void setFilters(List selectedFilterNames) { - super.setFilters(selectedFilterNames); + public void setFilters(List selectedFilters) { + super.setFilters(selectedFilters); filterPane.changeFilterButtonStatus(hasFilter()); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java index 9405ace59..7db6608c5 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java +++ b/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 filterInfos) { + List allFilterInfos = getAllFilterInfoList(filterInfos); List cidList = new ArrayList<>(); Map queryParaMap = new HashMap<>(); - for (WidgetFilterInfo filterInfo : filterInfos) { + for (WidgetFilterInfo filterInfo : allFilterInfos) { if (ComparatorUtils.equals(CHART, filterInfo.getType()) || ComparatorUtils.equals(REPORT, filterInfo.getType())) { cidList.add(filterInfo.getType() + "-" + filterInfo.getId()); @@ -206,6 +207,18 @@ public class OnlineShopUtils { return StringUtils.join("&", queryCondition.toArray(new String[queryCondition.size()])); } + private static List getAllFilterInfoList(List filterInfos) { + List allFilterList = new ArrayList<>(); + for (WidgetFilterInfo filterInfo : filterInfos) { + if (filterInfo.hasChildFilter()) { + allFilterList.addAll(filterInfo.getInnerFilterInfo()); + } else { + allFilterList.add(filterInfo); + } + } + return allFilterList; + } + public static boolean testConnection() { HttpClient httpClient = new HttpClient(getTestConnectionUrl()); httpClient.asGet();