diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index 5339807eea..2c47e1e072 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -3,17 +3,24 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIHeadGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane; import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; +import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JPanel; import javax.swing.JScrollPane; +import javax.swing.SwingConstants; import java.awt.BorderLayout; import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; import java.util.ArrayList; import java.util.List; @@ -30,6 +37,8 @@ public class FormWidgetDetailPane extends FormDockView{ private UIHeadGroup headGroup; private List paneList; + private boolean isEmptyPane = false; + public static FormWidgetDetailPane getInstance() { if (HOLDER.singleton == null) { HOLDER.singleton = new FormWidgetDetailPane(); @@ -53,7 +62,7 @@ public class FormWidgetDetailPane extends FormDockView{ } public String getViewTitle() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Tree_And_Table"); + return Toolkit.i18nText("Fine-Design_Form_Widget_Tree_And_Table"); } @Override @@ -65,6 +74,9 @@ public class FormWidgetDetailPane extends FormDockView{ * 初始化 */ public void refreshDockingView(){ + if (isEmptyPane) { + return; + } FormDesigner designer = this.getEditingFormDesigner(); removeAll(); if (designer == null) { @@ -95,6 +107,10 @@ public class FormWidgetDetailPane extends FormDockView{ this.add(centerPane, BorderLayout.CENTER); } + public void resetEmptyPane(){ + this.isEmptyPane = false; + } + /** * 清除数据 @@ -105,6 +121,30 @@ public class FormWidgetDetailPane extends FormDockView{ this.add(psp, BorderLayout.CENTER); } + public void switch2Empty(){ + isEmptyPane = true; + this.removeAll(); + JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 5); + UILabel imagePanel = new UILabel(BaseUtils.readIcon("/com/fr/base/images/share/version_not_match.png")); + imagePanel.setPreferredSize(new Dimension(240, 96)); + imagePanel.setHorizontalAlignment(SwingConstants.CENTER); + panel.add(imagePanel); + UILabel uiLabel1 = tipLabel(Toolkit.i18nText("Fine-Design_Share_Version_Not_Match_Tip1")); + UILabel uiLabel2 = tipLabel(Toolkit.i18nText("Fine-Design_Share_Version_Not_Match_Tip2")); + panel.add(uiLabel1); + panel.add(uiLabel2); + panel.setBorder(BorderFactory.createEmptyBorder(240, 0, 0, 0)); + this.add(panel, BorderLayout.CENTER); + } + + private UILabel tipLabel(String text) { + UILabel tipLabel = new UILabel(text); + tipLabel.setHorizontalAlignment(SwingConstants.CENTER); + tipLabel.setPreferredSize(new Dimension(240, 20)); + tipLabel.setForeground(Color.decode("#8F8F92")); + return tipLabel; + } + public void enterWidgetLib() { ComponentReuseNotifyUtil.enterWidgetLibExtraAction(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java index 487a414e51..fad64627f8 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java @@ -5,6 +5,7 @@ import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.VerticalFlowLayout; +import com.fr.design.mainframe.FormWidgetDetailPane; import com.fr.design.mainframe.share.sort.WidgetSortType; import com.fr.design.mainframe.share.ui.widgetfilter.LocalWidgetFilter; import com.fr.design.mainframe.share.util.InstallComponentHelper; @@ -213,6 +214,7 @@ public class LocalWidgetRepoPane extends BasicPane { Thread.currentThread().interrupt(); } catch (ExecutionException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); + FormWidgetDetailPane.getInstance().switch2Empty(); } finally { isRefreshing.set(false); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallComponentHelper.java b/designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallComponentHelper.java index d2846d93cd..7302c7afc3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallComponentHelper.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallComponentHelper.java @@ -46,9 +46,14 @@ public class InstallComponentHelper { } private static boolean needPreInstallComponent() { - //老用户或者组件库里已有组件,不预装组件 - SnapChat snapChat = SnapChatFactory.createSnapChat(false, SnapChatKeys.COMPONENT); - return !snapChat.hasRead() && !hasComponentInstalled(); + try { + //老用户或者组件库里已有组件,不预装组件 + SnapChat snapChat = SnapChatFactory.createSnapChat(false, SnapChatKeys.COMPONENT); + return !snapChat.hasRead() && !hasComponentInstalled(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return false; } /** diff --git a/designer-realize/src/main/java/com/fr/design/share/SharableManager.java b/designer-realize/src/main/java/com/fr/design/share/SharableManager.java index 0e3a1c41e8..b84349be40 100644 --- a/designer-realize/src/main/java/com/fr/design/share/SharableManager.java +++ b/designer-realize/src/main/java/com/fr/design/share/SharableManager.java @@ -3,6 +3,7 @@ package com.fr.design.share; import com.fr.design.base.clipboard.ClipboardFilter; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.mainframe.FormWidgetDetailPane; import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.share.collect.ComponentCollector; @@ -55,6 +56,7 @@ public class SharableManager { GeneralContext.addEnvChangedListenerToLast(new EnvChangedListener() { @Override public void envChanged() { + FormWidgetDetailPane.getInstance().resetEmptyPane(); LocalWidgetRepoPane.getInstance().refreshPane(); } });