Browse Source

REPORT-62573 【组件可更新提醒】组件复用-应当仅有可更新组件的分组展开

【问题原因】
重新实现组件分组面板可展开的逻辑

【改动思路】
同上
feature/x
Starryi 3 years ago
parent
commit
e1748fda1b
  1. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java
  2. 22
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/GroupPane.java
  3. 8
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java
  4. 8
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoUpdater.java
  5. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/ManagePane.java

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

@ -275,7 +275,7 @@ public class LocalWidgetBlock extends PreviewWidgetBlock<DefaultSharableWidget>
if (getUpdater().isUpdating()) {
paintLoadingIndicator(g2d, getUpdater().getProcessValue());
} else if (LocalWidgetRepoUpdater.getInstance().checkUpdate(getWidget()) != null) {
} else if (LocalWidgetRepoUpdater.getInstance().checkUpdatable(getWidget())) {
paintUpdatableMarker(g2d);
}
}

22
designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/GroupPane.java

@ -53,10 +53,6 @@ public class GroupPane extends JPanel {
private SharableWidgetProvider[] elCaseBindInfoList;
private SortType sortType = WidgetSortType.INSTALL_TIME;
private GroupPane(Group group) {
this(group, DEFAULT_HEIGHT, group.isDefaultExpend());
}
private GroupPane(Group group, boolean expendStatus) {
this(group, DEFAULT_HEIGHT, expendStatus);
}
@ -90,7 +86,9 @@ public class GroupPane extends JPanel {
//按照筛选条件进行过滤
elCaseBindInfoList = LocalWidgetFilter.getInstance().filter(elCaseBindInfoList);
boolean needExpendGroup = expendStatus || (isFiltering() && elCaseBindInfoList.length > 0);
boolean needExpendGroup = expendStatus
|| (isFiltering() && elCaseBindInfoList.length > 0)
|| hasUpdatableWidget();
if (elCaseBindInfoList.length == 0 && isFiltering()) {
this.setVisible(false);
}
@ -107,6 +105,16 @@ public class GroupPane extends JPanel {
expendGroup(needExpendGroup);
}
private boolean hasUpdatableWidget() {
for (SharableWidgetProvider provider: elCaseBindInfoList) {
boolean updatable = LocalWidgetRepoUpdater.getInstance().checkUpdatable(provider);
if (updatable) {
return true;
}
}
return false;
}
public LocalWidgetSelectPane getWidgetListPane() {
return contentPanel;
}
@ -375,7 +383,7 @@ public class GroupPane extends JPanel {
DEFAULT {
@Override
public GroupPane creteGroupPane(Group group) {
return new GroupPane(group);
return new GroupPane(group, group.isDefaultExpend());
}
},
EXPANDED {
@ -384,7 +392,7 @@ public class GroupPane extends JPanel {
return new GroupPane(group, true);
}
},
CLOSURE {
COLLAPSED {
@Override
public GroupPane creteGroupPane(Group group) {
return new GroupPane(group, false);

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

@ -390,7 +390,7 @@ public class LocalWidgetRepoPane extends BasicPane {
List<SharableWidgetProvider> updatableWidgetProviders = LocalWidgetRepoUpdater.getInstance().getUpdatableWidgetProviders();
updateTipPane.setVisible(updatableWidgetProviders.size() > 0);
if (updatableWidgetProviders.size() > 0) {
refreshAllGroupPane(GroupPane.GroupCreateStrategy.EXPANDED);
refreshAllGroupPane(GroupPane.GroupCreateStrategy.DEFAULT);
}
}
}
@ -413,7 +413,7 @@ public class LocalWidgetRepoPane extends BasicPane {
toolbarPane.reset();
managePane.switchPanel(false);
switchPane(LocalPaneStatus.NORMAL);
refreshAllGroupPane(GroupPane.GroupCreateStrategy.EXPANDED);
refreshAllGroupPane(GroupPane.GroupCreateStrategy.DEFAULT);
List<LocalWidgetBlock> blockList = getUpdatableBlocks();
if (blockList.size() == 0) {
@ -428,7 +428,7 @@ public class LocalWidgetRepoPane extends BasicPane {
LocalWidgetRepoUpdater updater = LocalWidgetRepoUpdater.getInstance();
for (LocalWidgetBlock block: blockList) {
OnlineShareWidget remoteLatestWidget = updater.checkUpdate(block.getWidget());
OnlineShareWidget remoteLatestWidget = updater.findLatestRemoteWidget(block.getWidget());
block.getUpdater().updateWidget(remoteLatestWidget.getId(), new LocalWidgetUpdater.UpdateListener() {
@Override
public void onUpdated(boolean success, String group, String id) {
@ -505,7 +505,7 @@ public class LocalWidgetRepoPane extends BasicPane {
LocalWidgetBlock widgetBlock = (LocalWidgetBlock) component;
SharableWidgetProvider localProvider = widgetBlock.getWidget();
OnlineShareWidget remoteLatestWidget = updater.checkUpdate(localProvider);
OnlineShareWidget remoteLatestWidget = updater.findLatestRemoteWidget(localProvider);
if (remoteLatestWidget != null) {
blockList.add(widgetBlock);
}

8
designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoUpdater.java

@ -55,7 +55,11 @@ public class LocalWidgetRepoUpdater {
remoteLatestWidgetsBackup.clear();
}
public OnlineShareWidget checkUpdate(SharableWidgetProvider provider) {
public boolean checkUpdatable(SharableWidgetProvider provider) {
return findLatestRemoteWidget(provider) != null;
}
public OnlineShareWidget findLatestRemoteWidget(SharableWidgetProvider provider) {
OnlineShareWidget remoteLatestWidget = remoteLatestWidgetsBackup.get(provider.getId());
if (remoteLatestWidget != null && StringUtils.isNotEmpty(remoteLatestWidget.getVersion())) {
Version remoteLatestVersion = Version.create(remoteLatestWidget.getVersion());
@ -76,7 +80,7 @@ public class LocalWidgetRepoUpdater {
for (Group group: groups) {
SharableWidgetProvider[] widgetProviders = group.getAllBindInfoList();
for (SharableWidgetProvider widgetProvider: widgetProviders) {
if (checkUpdate(widgetProvider) != null) {
if (checkUpdatable(widgetProvider)) {
updatableProviders.add(widgetProvider);
}
}

2
designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/ManagePane.java

@ -135,7 +135,7 @@ class ManagePane extends JPanel implements ShareUIAspect {
String userInput = getFileName().replaceAll("[\\\\/:*?\"<>|]", StringUtils.EMPTY);
//新建分组,刷新显示
if (DefaultShareGroupManager.getInstance().createGroup(userInput)) {
LocalWidgetRepoPane.getInstance().refreshAllGroupPane(GroupPane.GroupCreateStrategy.CLOSURE);
LocalWidgetRepoPane.getInstance().refreshAllGroupPane(GroupPane.GroupCreateStrategy.COLLAPSED);
} else {
ShareUIUtils.showErrorMessageDialog(Toolkit.i18nText("Fine-Design_Basic_Make_Failure"));
}

Loading…
Cancel
Save