Browse Source

Merge branch 'release/10.0' of https://code.fineres.com/scm/~lucian.chen/design.git into release/10.0

security/10.0
lucian 4 years ago
parent
commit
94a3c1f620
  1. 39
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 11
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  3. 8
      designer-base/src/main/java/com/fr/design/actions/community/TemplateStoreAction.java
  4. 12
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  5. 28
      designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java
  6. 3
      designer-base/src/main/java/com/fr/design/dialog/NotificationDialogAction.java
  7. 2
      designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java
  8. 68
      designer-base/src/main/java/com/fr/design/login/message/DesignerMessageHelper.java
  9. 19
      designer-base/src/main/java/com/fr/design/login/message/NotificationActionType.java
  10. 6
      designer-base/src/main/java/com/fr/design/login/utils/DesignerLoginUtils.java
  11. 4
      designer-base/src/main/java/com/fr/design/mainframe/ComponentReuseNotifyUtil.java
  12. 2
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  13. 23
      designer-base/src/main/java/com/fr/design/mainframe/toast/DesignerToastMsgUtil.java
  14. 16
      designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java
  15. 21
      designer-base/src/main/java/com/fr/design/notification/Notification.java
  16. 6
      designer-base/src/main/java/com/fr/design/notification/NotificationCenter.java
  17. 148
      designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java
  18. 2
      designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java
  19. 148
      designer-base/src/main/java/com/fr/design/notification/ui/NotificationPane.java
  20. 2
      designer-base/src/main/java/com/fr/design/upm/UpmFinder.java
  21. 6
      designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java
  22. 2
      designer-base/src/main/resources/com/fr/design/login/login.js
  23. 44
      designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java
  24. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java
  25. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java
  26. 11
      designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallComponentHelper.java
  27. 5
      designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java
  28. 2
      designer-realize/src/main/java/com/fr/design/share/SharableManager.java

39
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -199,6 +199,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private DesignerLoginConfigManager designerLoginConfigManager = DesignerLoginConfigManager.getInstance(); private DesignerLoginConfigManager designerLoginConfigManager = DesignerLoginConfigManager.getInstance();
private boolean showTemplateMissingPlugin = true;
/** /**
* DesignerEnvManager. * DesignerEnvManager.
*/ */
@ -315,8 +317,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
} }
LogHandler handler = new LogHandler<FileAppender>() { LogHandler handler = new LogHandler<FileAppender>() {
final FileAppender appender = new FileAppender( final FileAppender appender = new FileAppender(
new com.fr.third.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n"), new com.fr.third.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n"),
fileName fileName
); );
@Override @Override
@ -621,6 +623,24 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.templateTreePaneExpanded = templateTreePaneExpanded; this.templateTreePaneExpanded = templateTreePaneExpanded;
} }
/**
* 是否提示模板缺少插件
*
* @return 提示返回true
*/
public boolean isShowTemplateMissingPlugin() {
return showTemplateMissingPlugin;
}
/**
* 设置是否提示模板缺少插件
*
* @param showTemplateMissingPlugin 是否提示
*/
public void setShowTemplateMissingPlugin(boolean showTemplateMissingPlugin) {
this.showTemplateMissingPlugin = showTemplateMissingPlugin;
}
/** /**
* 知否自动备份 * 知否自动备份
* *
@ -1698,7 +1718,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
} }
} }
private void readComponentReuseNotificationInfo(XMLableReader reader){ private void readComponentReuseNotificationInfo(XMLableReader reader) {
reader.readXMLObject(this.notificationInfo); reader.readXMLObject(this.notificationInfo);
} }
@ -1792,6 +1812,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.setRecentSelectedConnection(tmpVal); this.setRecentSelectedConnection(tmpVal);
} }
this.setEmbedServerLazyStartup(reader.getAttrAsBoolean("embedServerLazyStartup", false)); this.setEmbedServerLazyStartup(reader.getAttrAsBoolean("embedServerLazyStartup", false));
this.setShowTemplateMissingPlugin(reader.getAttrAsBoolean("showTemplateMissingPlugin", true));
} }
private void readReportPaneAttributions(XMLableReader reader) { private void readReportPaneAttributions(XMLableReader reader) {
@ -2060,6 +2081,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (this.isEmbedServerLazyStartup()) { if (this.isEmbedServerLazyStartup()) {
writer.attr("embedServerLazyStartup", this.isEmbedServerLazyStartup()); writer.attr("embedServerLazyStartup", this.isEmbedServerLazyStartup());
} }
if (!this.isShowTemplateMissingPlugin()) {
writer.attr("showTemplateMissingPlugin", this.isShowTemplateMissingPlugin());
}
writer.end(); writer.end();
} }
@ -2212,11 +2236,12 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
enum XmlHandler { enum XmlHandler {
Self; Self;
public void handle(Throwable throwable) { public void handle(Throwable throwable) {
ErrorDialog dialog = new ErrorDialog(null, ErrorDialog dialog = new ErrorDialog(null,
Toolkit.i18nText("Fine-Design_Error_Start_Apology_Message"), Toolkit.i18nText("Fine-Design_Error_Start_Apology_Message"),
Toolkit.i18nText("Fine-Design_Error_Start_Report"), Toolkit.i18nText("Fine-Design_Error_Start_Report"),
throwable.getMessage()) { throwable.getMessage()) {
@Override @Override
protected void okEvent() { protected void okEvent() {
dispose(); dispose();
@ -2232,5 +2257,5 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
dialog.setVisible(true); dialog.setVisible(true);
DesignerExiter.getInstance().execute(); DesignerExiter.getInstance().execute();
} }
}; }
} }

11
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -96,8 +96,9 @@ public class EnvChangeEntrance {
* @param envName 目标工作目录名称 * @param envName 目标工作目录名称
*/ */
public void switch2Env(final String envName) { public void switch2Env(final String envName) {
switch2Env(envName, PopTipStrategy.LATER); if (switch2Env(envName, PopTipStrategy.LATER)) {
VersionCheckUtils.showVersionCheckDialog(envName); VersionCheckUtils.showVersionCheckDialog(envName);
}
} }
/** /**
@ -445,9 +446,12 @@ public class EnvChangeEntrance {
@Override @Override
public void doOk() { public void doOk() {
envListOkAction(envListPane, PopTipStrategy.LATER); boolean changeResult = envListOkAction(envListPane, PopTipStrategy.LATER);
// 切换完成后清理密码 // 切换完成后清理密码
updateNotRememberPwdEnv(); updateNotRememberPwdEnv();
if (changeResult) {
VersionCheckUtils.showVersionCheckDialog(envListPane.updateEnvManager());
}
} }
@Override @Override
@ -479,6 +483,7 @@ public class EnvChangeEntrance {
DesignerExiter.getInstance().execute(); DesignerExiter.getInstance().execute();
} else { } else {
updateNotRememberPwdEnv(); updateNotRememberPwdEnv();
VersionCheckUtils.showVersionCheckDialog(envListPane.updateEnvManager());
} }
} }

8
designer-base/src/main/java/com/fr/design/actions/community/TemplateStoreAction.java

@ -2,6 +2,7 @@ package com.fr.design.actions.community;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.login.AbstractDesignerSSO;
import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.BrowseUtils;
@ -13,7 +14,7 @@ import java.awt.event.ActionEvent;
/** /**
* created by Harrison on 2020/03/24 * created by Harrison on 2020/03/24
**/ **/
public class TemplateStoreAction extends UpdateAction { public class TemplateStoreAction extends AbstractDesignerSSO {
public TemplateStoreAction() { public TemplateStoreAction() {
@ -44,9 +45,8 @@ public class TemplateStoreAction extends UpdateAction {
}; };
@Override @Override
public void actionPerformed(ActionEvent e) { public String getJumpUrl() {
ComponentCollector.getInstance().collectTepMenuEnterClick(); ComponentCollector.getInstance().collectTepMenuEnterClick();
String url = CloudCenter.getInstance().acquireUrlByKind("design.market.template", "https://market.fanruan.com/template"); return CloudCenter.getInstance().acquireUrlByKind("design.market.template", "https://market.fanruan.com/template");
BrowseUtils.browser(url);
} }
} }

12
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -40,7 +40,6 @@ import com.fr.general.log.Log4jConfig;
import com.fr.locale.InterProviderFactory; import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StableUtils;
import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.OperatingSystem;
import com.fr.third.apache.log4j.Level; import com.fr.third.apache.log4j.Level;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
@ -141,6 +140,8 @@ public class PreferencePane extends BasicPane {
private UIComboBox maxUndoLimit; private UIComboBox maxUndoLimit;
//是非支持自动计算父格 //是非支持自动计算父格
private UICheckBox supportDefaultParentCalculateCheckBox; private UICheckBox supportDefaultParentCalculateCheckBox;
//打开模板是否提示缺少插件
private UICheckBox showTemplateMissingPlugin;
//是否自动转化为公式 //是否自动转化为公式
private UICheckBox supportStringToFormulaBox; private UICheckBox supportStringToFormulaBox;
@ -361,6 +362,11 @@ public class PreferencePane extends BasicPane {
supportDefaultParentCalculateCheckBox = new UICheckBox( supportDefaultParentCalculateCheckBox = new UICheckBox(
i18nText("Fine-Design_Basic_Preference_Support_Default_Parent_Calculate")); i18nText("Fine-Design_Basic_Preference_Support_Default_Parent_Calculate"));
functionPane.add(supportDefaultParentCalculateCheckBox); functionPane.add(supportDefaultParentCalculateCheckBox);
//添加是否展示打开模板提示缺少插件选择项
showTemplateMissingPlugin = new UICheckBox(
i18nText("Fine-Design_Basic_Preference_Show-Template-Missing-Plugin"));
functionPane.add(showTemplateMissingPlugin);
} }
private void createEditPane(JPanel generalPane) { private void createEditPane(JPanel generalPane) {
@ -644,6 +650,8 @@ public class PreferencePane extends BasicPane {
supportDefaultParentCalculateCheckBox.setSelected(designerEnvManager.isSupportDefaultParentCalculate()); supportDefaultParentCalculateCheckBox.setSelected(designerEnvManager.isSupportDefaultParentCalculate());
showTemplateMissingPlugin.setSelected(designerEnvManager.isShowTemplateMissingPlugin());
supportStringToFormulaBox.setSelected(designerEnvManager.isSupportStringToFormula()); supportStringToFormulaBox.setSelected(designerEnvManager.isSupportStringToFormula());
shortCutLabel.setText(getDisplayShortCut(designerEnvManager.getAutoCompleteShortcuts())); shortCutLabel.setText(getDisplayShortCut(designerEnvManager.getAutoCompleteShortcuts()));
@ -744,6 +752,8 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setSupportDefaultParentCalculate(supportDefaultParentCalculateCheckBox.isSelected()); designerEnvManager.setSupportDefaultParentCalculate(supportDefaultParentCalculateCheckBox.isSelected());
designerEnvManager.setShowTemplateMissingPlugin(showTemplateMissingPlugin.isSelected());
designerEnvManager.setSupportStringToFormula(supportStringToFormulaBox.isSelected()); designerEnvManager.setSupportStringToFormula(supportStringToFormulaBox.isSelected());
designerEnvManager.setDefaultStringToFormula(defaultStringToFormulaBox.isSelected()); designerEnvManager.setDefaultStringToFormula(defaultStringToFormulaBox.isSelected());

28
designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java

@ -9,6 +9,7 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.notification.Notification; import com.fr.design.notification.Notification;
import com.fr.design.notification.NotificationCenter; import com.fr.design.notification.NotificationCenter;
import com.fr.module.ModuleContext; import com.fr.module.ModuleContext;
import com.fr.stable.StringUtils;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
@ -43,17 +44,17 @@ public class NotificationDialog extends JDialog {
public NotificationDialog(Frame owner, String title, boolean isModal, int messageType, String message, NotificationDialogAction action) { public NotificationDialog(Frame owner, String title, boolean isModal, int messageType, String message, NotificationDialogAction action) {
super(owner); super(owner);
setTitle(title); setTitle(title);
initComponents(messageType, message, isModal, action); initComponents(StringUtils.EMPTY, messageType, message, isModal, action);
} }
public NotificationDialog(Builder builder) { public NotificationDialog(Builder builder) {
super(builder.owner); super(builder.owner);
setTitle(builder.title); setTitle(builder.title);
initComponents(builder.messageType, builder.message, builder.modal, builder.action); initComponents(builder.messageId, builder.messageType, builder.message, builder.modal, builder.action);
} }
public void initComponents(int messageType, String message, boolean isModal, NotificationDialogAction action) { public void initComponents(String messageId, int messageType, String message, boolean isModal, NotificationDialogAction action) {
NotificationCenter.getInstance().addNotification(new Notification(messageType, message, action)); NotificationCenter.getInstance().addNotification(new Notification(messageId, messageType, message, action));
notificationDialogAction = action; notificationDialogAction = action;
setModal(isModal); setModal(isModal);
setFocusable(false); setFocusable(false);
@ -173,6 +174,7 @@ public class NotificationDialog extends JDialog {
public static final class Builder { public static final class Builder {
public int messageType = WARNING_MESSAGE; public int messageType = WARNING_MESSAGE;
public String messageId;
public String message; public String message;
public boolean modal = true; public boolean modal = true;
public Frame owner = null; public Frame owner = null;
@ -187,6 +189,11 @@ public class NotificationDialog extends JDialog {
return new NotificationDialog(this); return new NotificationDialog(this);
} }
public Builder messageId(String messageId) {
this.messageId = messageId;
return this;
}
public Builder owner(Frame owner) { public Builder owner(Frame owner) {
this.owner = owner; this.owner = owner;
return this; return this;
@ -217,4 +224,17 @@ public class NotificationDialog extends JDialog {
return this; return this;
} }
} }
public static void defaultPopup(String messageId, String title, String body, NotificationDialogAction action) {
NotificationDialog.Builder()
.messageId(messageId)
.owner(DesignerContext.getDesignerFrame())
.title(title)
.modal(false)
.messageType(NotificationDialog.NEW_MESSAGE)
.message(body)
.notificationDialogAction(action)
.build()
.setVisible(true);
}
} }

3
designer-base/src/main/java/com/fr/design/dialog/NotificationDialogAction.java

@ -1,5 +1,8 @@
package com.fr.design.dialog; package com.fr.design.dialog;
public interface NotificationDialogAction { public interface NotificationDialogAction {
String name();
void doClick(); void doClick();
} }

2
designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java

@ -207,7 +207,7 @@ public class WebViewDlgHelper {
UIDialog dlg = new ShopDialog(DesignerContext.getDesignerFrame(), managerPane); UIDialog dlg = new ShopDialog(DesignerContext.getDesignerFrame(), managerPane);
PluginWebBridge.getHelper().setDialogHandle(dlg); PluginWebBridge.getHelper().setDialogHandle(dlg);
dlg.setVisible(true); dlg.setVisible(true);
DesignerLoginUtils.showPluginRemindOnFirstLaunch(); DesignerLoginUtils.showPluginRemindOnFirstLaunch(dlg);
} catch (Exception e) { } catch (Exception e) {
// ignored // ignored
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);

68
designer-base/src/main/java/com/fr/design/login/message/DesignerMessageHelper.java

@ -59,7 +59,7 @@ public class DesignerMessageHelper {
@Override @Override
public void run() { public void run() {
try { try {
pullLatestMessageAndShow(); pullLatestMessage();
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
@ -70,7 +70,7 @@ public class DesignerMessageHelper {
}); });
} }
private void pullLatestMessageAndShow() throws Exception { private void pullLatestMessage() throws Exception {
String url = CloudCenter.getInstance().acquireUrlByKind("designer.message.push", "https://market.fanruan.com/api/v1/message/designer"); String url = CloudCenter.getInstance().acquireUrlByKind("designer.message.push", "https://market.fanruan.com/api/v1/message/designer");
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
params.put("designerId", DesignerEnvManager.getEnvManager().getUUID()); params.put("designerId", DesignerEnvManager.getEnvManager().getUUID());
@ -78,42 +78,34 @@ public class DesignerMessageHelper {
JSONObject response = JSONFactory.createJSON(JSON.OBJECT, result); JSONObject response = JSONFactory.createJSON(JSON.OBJECT, result);
String status = response.optString(STATUS); String status = response.optString(STATUS);
if (SUCCESS.equals(status)) { if (SUCCESS.equals(status)) {
JSONObject data = response.optJSONObject(DATA); parseLatestMessage(response.optJSONObject(DATA));
String messageId = data.optString(MESSAGE_ID); }
String title = data.optString(TITLE); }
String body = data.optString(BODY);
int jumpType = data.optInt(JUMP_TYPE); private void parseLatestMessage(JSONObject data) {
String jumpTo = data.optString(JUMP_TO); String messageId = data.optString(MESSAGE_ID);
if (StringUtils.isNotEmpty(messageId) && StringUtils.isNotEmpty(title) && StringUtils.isNotEmpty(body) && jumpType > 0 && StringUtils.isNotEmpty(jumpTo)) { String title = data.optString(TITLE);
NotificationJumpType notificationJumpType = NotificationJumpType.valueOf(jumpType); String body = data.optString(BODY);
if (notificationJumpType == NotificationJumpType.WEB_URL) { int jumpType = data.optInt(JUMP_TYPE);
NotificationDialog.Builder() String jumpTo = data.optString(JUMP_TO);
.owner(DesignerContext.getDesignerFrame()) if (StringUtils.isNotEmpty(messageId) && StringUtils.isNotEmpty(title) && StringUtils.isNotEmpty(body) && jumpType > 0 && StringUtils.isNotEmpty(jumpTo)) {
.title(title) NotificationJumpType notificationJumpType = NotificationJumpType.valueOf(jumpType);
.modal(false) if (notificationJumpType == NotificationJumpType.WEB_URL) {
.messageType(NotificationDialog.NEW_MESSAGE) NotificationDialog.defaultPopup(messageId, title, body, new NotificationDialogAction() {
.message(body) @Override
.notificationDialogAction(new NotificationDialogAction() { public String name() {
@Override return jumpTo;
public void doClick() { }
String ssoUrl = DesignerLoginUtils.generateDesignerSSOUrl(jumpTo);
BrowseUtils.browser(ssoUrl); @Override
} public void doClick() {
}) String ssoUrl = DesignerLoginUtils.generateDesignerSSOUrl(jumpTo);
.build() BrowseUtils.browser(ssoUrl);
.setVisible(true); }
} else if (notificationJumpType == NotificationJumpType.DESIGNER_MODULE) { });
DesignerModuleClickType designerModuleClickType = DesignerModuleClickType.valueOf(jumpTo); } else if (notificationJumpType == NotificationJumpType.DESIGNER_MODULE) {
NotificationDialog.Builder() NotificationActionType notificationActionType = NotificationActionType.valueOf(jumpTo);
.owner(DesignerContext.getDesignerFrame()) NotificationDialog.defaultPopup(messageId, title, body, notificationActionType.getAction());
.title(title)
.modal(false)
.messageType(NotificationDialog.NEW_MESSAGE)
.message(body)
.notificationDialogAction(designerModuleClickType.getAction())
.build()
.setVisible(true);
}
} }
} }
} }

19
designer-base/src/main/java/com/fr/design/login/message/DesignerModuleClickType.java → designer-base/src/main/java/com/fr/design/login/message/NotificationActionType.java

@ -21,8 +21,13 @@ import com.fr.stable.os.OperatingSystem;
* @version 10.0 * @version 10.0
* Created by Lanlan on 2021/6/11 * Created by Lanlan on 2021/6/11
*/ */
public enum DesignerModuleClickType { public enum NotificationActionType {
PLUGIN("PLUGIN", new NotificationDialogAction() { PLUGIN("PLUGIN", new NotificationDialogAction() {
@Override
public String name() {
return "PLUGIN";
}
@Override @Override
public void doClick() { public void doClick() {
try { try {
@ -41,6 +46,11 @@ public enum DesignerModuleClickType {
} }
}), }),
REUSE("REUSE", new NotificationDialogAction() { REUSE("REUSE", new NotificationDialogAction() {
@Override
public String name() {
return "REUSE";
}
@Override @Override
public void doClick() { public void doClick() {
try { try {
@ -54,6 +64,11 @@ public enum DesignerModuleClickType {
} }
}), }),
UNKNOWN(StringUtils.EMPTY, new NotificationDialogAction() { UNKNOWN(StringUtils.EMPTY, new NotificationDialogAction() {
@Override
public String name() {
return "UNKNOWN";
}
@Override @Override
public void doClick() { public void doClick() {
} }
@ -62,7 +77,7 @@ public enum DesignerModuleClickType {
private String jumpTo; private String jumpTo;
private NotificationDialogAction action; private NotificationDialogAction action;
DesignerModuleClickType(String jumpTo, NotificationDialogAction action) { NotificationActionType(String jumpTo, NotificationDialogAction action) {
this.jumpTo = jumpTo; this.jumpTo = jumpTo;
this.action = action; this.action = action;
} }

6
designer-base/src/main/java/com/fr/design/login/utils/DesignerLoginUtils.java

@ -8,6 +8,7 @@ import com.fr.general.log.MessageFormatter;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.third.org.bouncycastle.util.encoders.Hex; import com.fr.third.org.bouncycastle.util.encoders.Hex;
import java.awt.Window;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -32,14 +33,15 @@ public class DesignerLoginUtils {
return map4Tpl; return map4Tpl;
} }
public static void showPluginRemindOnFirstLaunch() { public static void showPluginRemindOnFirstLaunch(Window parent) {
DesignerEnvManager manager = DesignerEnvManager.getEnvManager(); DesignerEnvManager manager = DesignerEnvManager.getEnvManager();
int uid = manager.getDesignerLoginUid(); int uid = manager.getDesignerLoginUid();
if (uid > 0) { if (uid > 0) {
boolean pluginRemindOnFirstLaunch = manager.isPluginRemindOnFirstLaunch(); boolean pluginRemindOnFirstLaunch = manager.isPluginRemindOnFirstLaunch();
if (pluginRemindOnFirstLaunch) { if (pluginRemindOnFirstLaunch) {
DesignerToastMsgUtil.toastWarning( DesignerToastMsgUtil.toastWarning(
com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Plugin_Tip") com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Plugin_Tip"),
parent
); );
manager.setPluginRemindOnFirstLaunch(false); manager.setPluginRemindOnFirstLaunch(false);
} }

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

@ -18,7 +18,7 @@ public class ComponentReuseNotifyUtil {
} }
public static void enterWidgetLibExtraAction(boolean needValidRead) { public static void enterWidgetLibExtraAction() {
if (ComponentReuseNotificationInfo.getInstance().isClickedWidgetLib()) { if (ComponentReuseNotificationInfo.getInstance().isClickedWidgetLib()) {
return; return;
} }
@ -28,7 +28,7 @@ public class ComponentReuseNotifyUtil {
return COMPONENT_SNAP_CHAT_KEY; return COMPONENT_SNAP_CHAT_KEY;
} }
}); });
if (snapChat.hasRead() && needValidRead) { if (snapChat.hasRead()) {
DesignerToastMsgUtil.toastPrompt(Toolkit.i18nText("Fine-Design_Component_Reuse_Merge_Prompt")); DesignerToastMsgUtil.toastPrompt(Toolkit.i18nText("Fine-Design_Component_Reuse_Merge_Prompt"));
} }
ComponentReuseNotificationInfo.getInstance().setClickedWidgetLib(true); ComponentReuseNotificationInfo.getInstance().setClickedWidgetLib(true);

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

@ -315,7 +315,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
ComponentCollector.getInstance().collectCmpBoardClick(); ComponentCollector.getInstance().collectCmpBoardClick();
ComponentReuseNotifyUtil.enterWidgetLibExtraAction(true); ComponentReuseNotifyUtil.enterWidgetLibExtraAction();
} }
}); });
// 权限编辑 // 权限编辑

23
designer-base/src/main/java/com/fr/design/mainframe/toast/DesignerToastMsgUtil.java

@ -6,6 +6,9 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.Window;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JEditorPane; import javax.swing.JEditorPane;
@ -30,12 +33,15 @@ public class DesignerToastMsgUtil {
public static void toastPrompt(JPanel contendPane) { public static void toastPrompt(JPanel contendPane) {
toastPane(PROMPT_ICON, contendPane); toastPane(PROMPT_ICON, contendPane, DesignerContext.getDesignerFrame());
} }
public static void toastWarning(JPanel contendPane) { public static void toastWarning(JPanel contendPane) {
toastPane(WARNING_ICON, contendPane); toastPane(WARNING_ICON, contendPane, DesignerContext.getDesignerFrame());
}
public static void toastWarning(JPanel contendPane, Window parent) {
toastPane(WARNING_ICON, contendPane, parent);
} }
public static void toastPrompt(String promptInfo) { public static void toastPrompt(String promptInfo) {
@ -46,6 +52,10 @@ public class DesignerToastMsgUtil {
toastWarning(toastPane(warningInfo)); toastWarning(toastPane(warningInfo));
} }
public static void toastWarning(String warningInfo, Window parent) {
toastWarning(toastPane(warningInfo), parent);
}
private static JPanel toastPane(String text) { private static JPanel toastPane(String text) {
UILabel promptLabel = new UILabel("<html>" + text + "</html>"); UILabel promptLabel = new UILabel("<html>" + text + "</html>");
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -58,7 +68,7 @@ public class DesignerToastMsgUtil {
return jPanel; return jPanel;
} }
private static void toastPane(Icon icon, JPanel contendPane) { private static void toastPane(Icon icon, JPanel contendPane, Window parent) {
JPanel pane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel pane = FRGUIPaneFactory.createBorderLayout_S_Pane();
UILabel uiLabel = new UILabel(icon); UILabel uiLabel = new UILabel(icon);
uiLabel.setVerticalAlignment(SwingConstants.TOP); uiLabel.setVerticalAlignment(SwingConstants.TOP);
@ -67,7 +77,12 @@ public class DesignerToastMsgUtil {
pane.add(contendPane, BorderLayout.CENTER); pane.add(contendPane, BorderLayout.CENTER);
pane.setBorder(BorderFactory.createEmptyBorder(8, 15, 8, 15)); pane.setBorder(BorderFactory.createEmptyBorder(8, 15, 8, 15));
contendPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); contendPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
ToastMsgDialog dialog = new ToastMsgDialog(DesignerContext.getDesignerFrame(), pane); ToastMsgDialog dialog;
if (parent instanceof Dialog) {
dialog = new ToastMsgDialog((Dialog) parent, pane);
} else {
dialog = new ToastMsgDialog((Frame) parent, pane);
}
dialog.setVisible(true); dialog.setVisible(true);
} }

16
designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java

@ -5,6 +5,7 @@ import com.fr.design.dialog.UIDialog;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.module.ModuleContext; import com.fr.module.ModuleContext;
import java.awt.Dialog;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Frame; import java.awt.Frame;
@ -26,14 +27,23 @@ public class ToastMsgDialog extends UIDialog {
public ToastMsgDialog(Frame parent, JPanel panel) { public ToastMsgDialog(Frame parent, JPanel panel) {
super(parent); super(parent);
init(panel);
}
public ToastMsgDialog(Dialog parent, JPanel panel) {
super(parent);
init(panel);
}
private void init(JPanel panel) {
setFocusable(false); setFocusable(false);
setAutoRequestFocus(false); setAutoRequestFocus(false);
setUndecorated(true); setUndecorated(true);
contentPane = panel; contentPane = panel;
initComponent(parent); initComponent();
} }
private void initComponent(Frame parent) { private void initComponent() {
this.getContentPane().setLayout(null); this.getContentPane().setLayout(null);
this.getContentPane().add(contentPane); this.getContentPane().add(contentPane);
Dimension dimension = calculatePreferSize(); Dimension dimension = calculatePreferSize();
@ -42,7 +52,7 @@ public class ToastMsgDialog extends UIDialog {
contentPane.setSize(dimension); contentPane.setSize(dimension);
setLocationRelativeTo(DesignerContext.getDesignerFrame().getContentFrame()); setLocationRelativeTo(DesignerContext.getDesignerFrame().getContentFrame());
int positionY = DesignerContext.getDesignerFrame().getContentFrame().getLocationOnScreen().y + 10; int positionY = DesignerContext.getDesignerFrame().getContentFrame().getLocationOnScreen().y + 10;
setLocation((parent.getWidth() - dimension.width) / 2, positionY); setLocation((DesignerContext.getDesignerFrame().getWidth() - dimension.width) / 2, positionY);
addMouseEvent(contentPane); addMouseEvent(contentPane);
} }

21
designer-base/src/main/java/com/fr/design/notification/Notification.java

@ -1,24 +1,33 @@
package com.fr.design.notification; package com.fr.design.notification;
import com.fr.design.dialog.NotificationDialogAction; import com.fr.design.dialog.NotificationDialogAction;
import com.fr.stable.StringUtils;
public class Notification { public class Notification {
private String messageId;
private int type; private int type;
private String message; private String message;
private NotificationDialogAction notificationDialogAction; private NotificationDialogAction notificationDialogAction;
public static final int ERROR_MESSAGE = 0; public static final int ERROR_MESSAGE = 0;
public static final int NEW_MESSAGE = 1; public static final int NEW_MESSAGE = 1;
public static final int WARNING_MESSAGE = 2; public static final int WARNING_MESSAGE = 2;
public Notification(int type,String message,NotificationDialogAction notificationDialogAction){
public Notification(String messageId, int type, String message, NotificationDialogAction notificationDialogAction) {
this.messageId = messageId;
this.type = type; this.type = type;
this.message = message; this.message = message;
this.notificationDialogAction = notificationDialogAction; this.notificationDialogAction = notificationDialogAction;
} }
public Notification(String message){ public Notification(String message) {
this.type = WARNING_MESSAGE; this.type = WARNING_MESSAGE;
this.message = message; this.message = message;
this.notificationDialogAction = new NotificationDialogAction() { this.notificationDialogAction = new NotificationDialogAction() {
@Override
public String name() {
return StringUtils.EMPTY;
}
@Override @Override
public void doClick() { public void doClick() {
//do nothing //do nothing
@ -30,11 +39,15 @@ public class Notification {
return notificationDialogAction; return notificationDialogAction;
} }
public int getType(){ public int getType() {
return type; return type;
} }
public String getMessage(){ public String getMessage() {
return message; return message;
} }
public String getMessageId() {
return messageId;
}
} }

6
designer-base/src/main/java/com/fr/design/notification/NotificationCenter.java

@ -26,12 +26,12 @@ public class NotificationCenter {
} }
public void removeNotification(int index){ public void removeNotification(int index){
notifications.remove(index); notifications.remove(index);
NotificationCenterPane.getNotificationCenterPane().refreshButton(); NotificationCenterPane.getNotificationCenterPane().refreshButton();
} }
public Notification getNotification(int index){ public Notification getNotification(int index){
return notifications.get(index); return notifications.get(index);
} }
public void clearAllNotifications(){ public void clearAllNotifications(){

148
designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java

@ -1,30 +1,23 @@
package com.fr.design.notification.ui; package com.fr.design.notification.ui;
import com.fr.design.dialog.NotificationDialogAction;
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.notification.Notification; import com.fr.design.notification.Notification;
import com.fr.design.notification.NotificationCenter; import com.fr.design.notification.NotificationCenter;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Frame; import java.awt.Frame;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.Window; import java.awt.Window;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.util.ArrayList; import java.util.ArrayList;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.UIManager;
public class NotificationCenterDialog extends JDialog { public class NotificationCenterDialog extends JDialog {
private ArrayList<NotificationPane> notificationNeedShow; private ArrayList<NotificationPane> notificationNeedShow;
@ -32,6 +25,7 @@ public class NotificationCenterDialog extends JDialog {
private UILabel deleteLabel; private UILabel deleteLabel;
private static final int NOTIFICATIONCOUNT = 5; private static final int NOTIFICATIONCOUNT = 5;
public NotificationCenterDialog(Frame parent) { public NotificationCenterDialog(Frame parent) {
super(parent); super(parent);
setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Notification")); setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Notification"));
@ -46,7 +40,7 @@ public class NotificationCenterDialog extends JDialog {
initComponents(); initComponents();
} }
public void initComponents() { private void initComponents() {
centerPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); centerPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1);
addNotification(); addNotification();
deleteLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Clear_Notifications") + "(" + NotificationCenter.getInstance().getNotificationsCount() + ")"); deleteLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Clear_Notifications") + "(" + NotificationCenter.getInstance().getNotificationsCount() + ")");
@ -74,11 +68,28 @@ public class NotificationCenterDialog extends JDialog {
centerWindow(); centerWindow();
} }
private void hideDialog() { public ArrayList<NotificationPane> getNotificationNeedShow() {
return notificationNeedShow;
}
public JPanel getCenterPanel() {
return centerPanel;
}
public UILabel getDeleteLabel() {
return deleteLabel;
}
public void hideDialog() {
this.dispose(); this.dispose();
} }
private void addNotification() { public void showDialog() {
this.setVisible(true);
}
public void addNotification() {
notificationNeedShow.clear(); notificationNeedShow.clear();
int size = NotificationCenter.getInstance().getNotificationsCount(); int size = NotificationCenter.getInstance().getNotificationsCount();
@ -86,7 +97,7 @@ public class NotificationCenterDialog extends JDialog {
int j = size - i; int j = size - i;
if (j >= 0) { if (j >= 0) {
Notification notification = NotificationCenter.getInstance().getNotification(j); Notification notification = NotificationCenter.getInstance().getNotification(j);
NotificationPane notificationPane = new NotificationPane(notification.getType(), notification.getMessage(), i, notification.getNotificationDialogAction()); NotificationPane notificationPane = new NotificationPane(this, notification.getMessageId(), notification.getType(), notification.getMessage(), i, notification.getNotificationDialogAction());
notificationNeedShow.add(notificationPane); notificationNeedShow.add(notificationPane);
} }
} }
@ -111,119 +122,4 @@ public class NotificationCenterDialog extends JDialog {
//这里设置位置:水平居中,竖直偏上 //这里设置位置:水平居中,竖直偏上
win.setLocation(screenSize.width - winSize.width - 90, 50); win.setLocation(screenSize.width - winSize.width - 90, 50);
} }
/**
* 一条消息面板
*/
class NotificationPane extends JPanel {
private int index;
private UILabel messageLabel;
private UILabel messageIcon;
private NotificationDialogAction notificationDialogAction;
public NotificationPane(int type, String message, int index, NotificationDialogAction notificationDialogAction) {
this.index = index;
this.notificationDialogAction = notificationDialogAction;
this.setLayout(FRGUIPaneFactory.createBorderLayout());
setTypeIcon(getIconForType(type));
setNotification(message);
setDeleteIcon();
}
public void setTypeIcon(Icon icon) {
messageIcon = new UILabel(icon);
messageIcon.addMouseListener(messageAndIconListener);
JPanel messageIconPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
messageIconPanel.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8));
messageIconPanel.add(messageIcon);
add(messageIconPanel, BorderLayout.WEST);
}
public void setDeleteIcon() {
UILabel deleteIcon = new UILabel(UIManager.getIcon("OptionPane.deleteIcon"));
JPanel deleteIconPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
deleteIconPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 7));
deleteIconPane.add(deleteIcon);
deleteIconPane.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
NotificationCenter.getInstance().removeNotification(NotificationCenter.getInstance().getNotificationsCount() - index);
centerPanel.removeAll();
addNotification();
deleteLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Clear_Notifications") + "(" + NotificationCenter.getInstance().getNotificationsCount() + ")");
pack();
if (notificationNeedShow.size() == 0) {
hideDialog();
}
NotificationCenterPane.getNotificationCenterPane().refreshButton();
}
@Override
public void mouseEntered(MouseEvent e) {
deleteIcon.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
@Override
public void mouseExited(MouseEvent e) {
deleteIcon.setCursor(Cursor.getDefaultCursor());
}
});
add(deleteIconPane, BorderLayout.EAST);
}
public int getIndex() {
return index;
}
public void setNotification(String message) {
messageLabel = new UILabel("<html>" + message + "</html>");
messageLabel.addMouseListener(messageAndIconListener);
JPanel labelPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
labelPanel.add(messageLabel);
this.add(labelPanel, BorderLayout.CENTER);
}
protected Icon getIconForType(int messageType) {
String propertyName;
switch (messageType) {
case 0:
propertyName = "OptionPane.circularErrorIcon";
break;
case 1:
propertyName = "OptionPane.newMessageIcon";
break;
case 2:
propertyName = "OptionPane.circularWarningIcon";
break;
default:
return null;
}
return UIManager.getIcon(propertyName);
}
private MouseListener messageAndIconListener = new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
hideDialog();
notificationDialogAction.doClick();
}
@Override
public void mouseEntered(MouseEvent e) {
messageLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
messageIcon.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
messageLabel.setForeground(new Color(250, 170, 57));
}
@Override
public void mouseExited(MouseEvent e) {
messageLabel.setCursor(Cursor.getDefaultCursor());
messageIcon.setCursor(Cursor.getDefaultCursor());
messageLabel.setForeground(Color.BLACK);
}
};
}
} }

2
designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java

@ -29,7 +29,7 @@ public class NotificationCenterPane extends BasicPane {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
NotificationCenterDialog notificationCenterDialog = new NotificationCenterDialog(DesignerContext.getDesignerFrame()); NotificationCenterDialog notificationCenterDialog = new NotificationCenterDialog(DesignerContext.getDesignerFrame());
notificationCenterDialog.setVisible(true); notificationCenterDialog.showDialog();
} }
}); });
this.setBackground(UIConstants.TEMPLATE_TAB_PANE_BACKGROUND); this.setBackground(UIConstants.TEMPLATE_TAB_PANE_BACKGROUND);

148
designer-base/src/main/java/com/fr/design/notification/ui/NotificationPane.java

@ -0,0 +1,148 @@
package com.fr.design.notification.ui;
import com.fr.design.dialog.NotificationDialogAction;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.notification.NotificationCenter;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.UIManager;
/**
* @author Lanlan
* @version 10.0
* Created by Lanlan on 2021/6/21
*/
public class NotificationPane extends JPanel {
private NotificationCenterDialog parent;
private String messageId;
private int index;
private UILabel messageLabel;
private UILabel messageIcon;
private NotificationDialogAction notificationDialogAction;
public NotificationPane(NotificationCenterDialog parent, String messageId, int type, String message, int index, NotificationDialogAction notificationDialogAction) {
this.parent = parent;
this.index = index;
this.messageId = messageId;
this.notificationDialogAction = notificationDialogAction;
this.setLayout(FRGUIPaneFactory.createBorderLayout());
setTypeIcon(getIconForType(type));
setNotification(message);
setDeleteIcon();
}
public void setTypeIcon(Icon icon) {
messageIcon = new UILabel(icon);
messageIcon.addMouseListener(messageAndIconListener);
JPanel messageIconPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
messageIconPanel.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8));
messageIconPanel.add(messageIcon);
add(messageIconPanel, BorderLayout.WEST);
}
public void setDeleteIcon() {
UILabel deleteIcon = new UILabel(UIManager.getIcon("OptionPane.deleteIcon"));
JPanel deleteIconPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
deleteIconPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 7));
deleteIconPane.add(deleteIcon);
deleteIconPane.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
NotificationCenter.getInstance().removeNotification(NotificationCenter.getInstance().getNotificationsCount() - index);
parent.getCenterPanel().removeAll();
parent.addNotification();
parent.getDeleteLabel().setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Clear_Notifications") + "(" + NotificationCenter.getInstance().getNotificationsCount() + ")");
parent.pack();
if (parent.getNotificationNeedShow().size() == 0) {
parent.hideDialog();
}
NotificationCenterPane.getNotificationCenterPane().refreshButton();
}
@Override
public void mouseEntered(MouseEvent e) {
deleteIcon.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
@Override
public void mouseExited(MouseEvent e) {
deleteIcon.setCursor(Cursor.getDefaultCursor());
}
});
add(deleteIconPane, BorderLayout.EAST);
}
public int getIndex() {
return index;
}
public String getMessageId() {
return messageId;
}
public NotificationDialogAction getNotificationDialogAction() {
return notificationDialogAction;
}
public void setNotification(String message) {
messageLabel = new UILabel("<html>" + message + "</html>");
messageLabel.addMouseListener(messageAndIconListener);
JPanel labelPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
labelPanel.add(messageLabel);
this.add(labelPanel, BorderLayout.CENTER);
}
protected Icon getIconForType(int messageType) {
String propertyName;
switch (messageType) {
case 0:
propertyName = "OptionPane.circularErrorIcon";
break;
case 1:
propertyName = "OptionPane.newMessageIcon";
break;
case 2:
propertyName = "OptionPane.circularWarningIcon";
break;
default:
return null;
}
return UIManager.getIcon(propertyName);
}
private void performTargetAction() {
parent.hideDialog();
notificationDialogAction.doClick();
}
private MouseListener messageAndIconListener = new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
performTargetAction();
}
@Override
public void mouseEntered(MouseEvent e) {
messageLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
messageIcon.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
messageLabel.setForeground(new Color(250, 170, 57));
}
@Override
public void mouseExited(MouseEvent e) {
messageLabel.setCursor(Cursor.getDefaultCursor());
messageIcon.setCursor(Cursor.getDefaultCursor());
messageLabel.setForeground(Color.BLACK);
}
};
}

2
designer-base/src/main/java/com/fr/design/upm/UpmFinder.java

@ -98,7 +98,7 @@ public class UpmFinder {
dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane); dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane);
} }
dialog.setVisible(true); dialog.setVisible(true);
DesignerLoginUtils.showPluginRemindOnFirstLaunch(); DesignerLoginUtils.showPluginRemindOnFirstLaunch(dialog);
} }
} }

6
designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java

@ -10,7 +10,6 @@ import com.fr.design.env.RemoteWorkspace;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.env.CheckServiceDialog; import com.fr.env.CheckServiceDialog;
import com.fr.env.VersionCheckMessageDialog;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.invoke.Reflect; import com.fr.invoke.Reflect;
@ -74,6 +73,11 @@ public class VersionCheckUtils {
if (!VersionCheckUtils.versionCheck(envName)) { if (!VersionCheckUtils.versionCheck(envName)) {
NotificationDialog notificationDialog = new NotificationDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Sync_Prompt"), NotificationDialog notificationDialog = new NotificationDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Sync_Prompt"),
false, NotificationDialog.WARNING_MESSAGE, Toolkit.i18nText("Fine-Design_Basic_Sync_Check_Brief_Info"), new NotificationDialogAction() { false, NotificationDialog.WARNING_MESSAGE, Toolkit.i18nText("Fine-Design_Basic_Sync_Check_Brief_Info"), new NotificationDialogAction() {
@Override
public String name() {
return "VERSION_CHECK";
}
@Override @Override
public void doClick() { public void doClick() {
CheckServiceDialog checkServiceDialog = new CheckServiceDialog(DesignerContext.getDesignerFrame(), GeneralUtils.readFullBuildNO(), getRemoteBranch(envName),getNoExistServiceDescription(envName)); CheckServiceDialog checkServiceDialog = new CheckServiceDialog(DesignerContext.getDesignerFrame(), GeneralUtils.readFullBuildNO(), getRemoteBranch(envName),getNoExistServiceDescription(envName));

2
designer-base/src/main/resources/com/fr/design/login/login.js

File diff suppressed because one or more lines are too long

44
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.base.BaseUtils;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIHeadGroup; 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.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; 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.ui.local.LocalWidgetRepoPane; 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 javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.SwingConstants;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -30,6 +37,8 @@ public class FormWidgetDetailPane extends FormDockView{
private UIHeadGroup headGroup; private UIHeadGroup headGroup;
private List<BasicPane> paneList; private List<BasicPane> paneList;
private boolean isEmptyPane = false;
public static FormWidgetDetailPane getInstance() { public static FormWidgetDetailPane getInstance() {
if (HOLDER.singleton == null) { if (HOLDER.singleton == null) {
HOLDER.singleton = new FormWidgetDetailPane(); HOLDER.singleton = new FormWidgetDetailPane();
@ -53,7 +62,7 @@ public class FormWidgetDetailPane extends FormDockView{
} }
public String getViewTitle() { 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 @Override
@ -65,6 +74,9 @@ public class FormWidgetDetailPane extends FormDockView{
* 初始化 * 初始化
*/ */
public void refreshDockingView(){ public void refreshDockingView(){
if (isEmptyPane) {
return;
}
FormDesigner designer = this.getEditingFormDesigner(); FormDesigner designer = this.getEditingFormDesigner();
removeAll(); removeAll();
if (designer == null) { if (designer == null) {
@ -95,6 +107,10 @@ public class FormWidgetDetailPane extends FormDockView{
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
} }
public void resetEmptyPane(){
this.isEmptyPane = false;
}
/** /**
* 清除数据 * 清除数据
@ -105,10 +121,34 @@ public class FormWidgetDetailPane extends FormDockView{
this.add(psp, BorderLayout.CENTER); 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() { public void enterWidgetLib() {
ComponentReuseNotifyUtil.enterWidgetLibExtraAction();
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_LIB); EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_LIB);
ComponentReuseNotifyUtil.enterWidgetLibExtraAction(false);
} }
/** /**

2
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.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.VerticalFlowLayout; 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.sort.WidgetSortType;
import com.fr.design.mainframe.share.ui.widgetfilter.LocalWidgetFilter; import com.fr.design.mainframe.share.ui.widgetfilter.LocalWidgetFilter;
import com.fr.design.mainframe.share.util.InstallComponentHelper; import com.fr.design.mainframe.share.util.InstallComponentHelper;
@ -213,6 +214,7 @@ public class LocalWidgetRepoPane extends BasicPane {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} catch (ExecutionException e) { } catch (ExecutionException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
FormWidgetDetailPane.getInstance().switch2Empty();
} finally { } finally {
isRefreshing.set(false); isRefreshing.set(false);
} }

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

@ -35,7 +35,7 @@ import java.security.spec.X509EncodedKeySpec;
* created by Harrison on 2020/05/27 * created by Harrison on 2020/05/27
**/ **/
public class DownloadUtils { public class DownloadUtils {
private static final String REUSES_URL = CloudCenter.getInstance().acquireUrlByKind("af.reuseInfo") + "file/"; private static final String REUSES_URL = CloudCenter.getInstance().acquireUrlByKind("af.reuseInfo") + "file/download";
private static final String PACKAGE_REUSES_URL = CloudCenter.getInstance().acquireUrlByKind("af.reuseInfo") + "package/download/"; private static final String PACKAGE_REUSES_URL = CloudCenter.getInstance().acquireUrlByKind("af.reuseInfo") + "package/download/";
private static final String CERTIFICATE_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCtsz62CPSWXZE/IYZRiAuTSZkw\n" + private static final String CERTIFICATE_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCtsz62CPSWXZE/IYZRiAuTSZkw\n" +
"1WOwer8+JFktK0uKLAUuQoBr+UjAMFtRA8W7JgKMDwZy/2liEAiXEOSPU/hrdV8D\n" + "1WOwer8+JFktK0uKLAUuQoBr+UjAMFtRA8W7JgKMDwZy/2liEAiXEOSPU/hrdV8D\n" +

11
designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallComponentHelper.java

@ -46,9 +46,14 @@ public class InstallComponentHelper {
} }
private static boolean needPreInstallComponent() { private static boolean needPreInstallComponent() {
//老用户或者组件库里已有组件,不预装组件 try {
SnapChat snapChat = SnapChatFactory.createSnapChat(false, SnapChatKeys.COMPONENT); //老用户或者组件库里已有组件,不预装组件
return !snapChat.hasRead() && !hasComponentInstalled(); SnapChat snapChat = SnapChatFactory.createSnapChat(false, SnapChatKeys.COMPONENT);
return !snapChat.hasRead() && !hasComponentInstalled();
} catch (Throwable e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return false;
} }
/** /**

5
designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java

@ -77,6 +77,11 @@ public class DesignerAppUtils {
* @return 格式化后的多行插件错误信息详情 * @return 格式化后的多行插件错误信息详情
*/ */
public static String dealWithErrorDetailMultiLineAndCache(String key) { public static String dealWithErrorDetailMultiLineAndCache(String key) {
if (!DesignerEnvManager.getEnvManager().isShowTemplateMissingPlugin()) {
// 直接清空不提示
TemplateIOErrorContextHolder.reset();
return StringUtils.EMPTY;
}
Multimap<String, PluginMarkerAdapter> pendingPlugins = TemplateIOErrorContextHolder.getPendingPlugin(); Multimap<String, PluginMarkerAdapter> pendingPlugins = TemplateIOErrorContextHolder.getPendingPlugin();
if (pendingPlugins.isEmpty()) { if (pendingPlugins.isEmpty()) {
return StringUtils.EMPTY; return StringUtils.EMPTY;

2
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.base.clipboard.ClipboardFilter;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.mainframe.FormWidgetDetailPane;
import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.collect.ComponentCollector;
@ -55,6 +56,7 @@ public class SharableManager {
GeneralContext.addEnvChangedListenerToLast(new EnvChangedListener() { GeneralContext.addEnvChangedListenerToLast(new EnvChangedListener() {
@Override @Override
public void envChanged() { public void envChanged() {
FormWidgetDetailPane.getInstance().resetEmptyPane();
LocalWidgetRepoPane.getInstance().refreshPane(); LocalWidgetRepoPane.getInstance().refreshPane();
} }
}); });

Loading…
Cancel
Save